From ede917ad9f8b1a5fa2b37d9b770f01b4ea9fc0e8 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Wed, 17 Sep 2025 17:59:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BD=91=E8=B7=AF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web-antd/src/api/license/project/index.ts | 2 + .../src/locales/langs/en-US/project.json | 5 +- .../src/locales/langs/zh-CN/project.json | 5 +- .../src/views/license/project/data.ts | 29 +++++++ .../src/views/license/project/index.vue | 21 +++++- .../views/license/project/modules/form.vue | 75 +++++++++++++++++-- 6 files changed, 128 insertions(+), 9 deletions(-) diff --git a/apps/web-antd/src/api/license/project/index.ts b/apps/web-antd/src/api/license/project/index.ts index 5f2fbf6..b6d189f 100644 --- a/apps/web-antd/src/api/license/project/index.ts +++ b/apps/web-antd/src/api/license/project/index.ts @@ -26,6 +26,8 @@ export namespace ProjectApi { softwareVersion: number; // 软件版本信息 remark: string; // 备注 serialNo?: string; // 序列号 + file?: any; // 上传的文件 + fileUrl?: string; // 文件访问地址 } } diff --git a/apps/web-antd/src/locales/langs/en-US/project.json b/apps/web-antd/src/locales/langs/en-US/project.json index 3627b65..116800f 100644 --- a/apps/web-antd/src/locales/langs/en-US/project.json +++ b/apps/web-antd/src/locales/langs/en-US/project.json @@ -24,5 +24,8 @@ "updateTime": "Last Modified Time", "commentNum": "Comment Count", "softwareVersion": "Software Version", - "operatingSystem": "Operating System Platform" + "operatingSystem": "Operating System Platform", + "networkChart": "Network Chart", + "uploadFile": "Click to Upload File", + "uploadRule": "Please upload {0}" } diff --git a/apps/web-antd/src/locales/langs/zh-CN/project.json b/apps/web-antd/src/locales/langs/zh-CN/project.json index 4e00cec..4fa3dc1 100644 --- a/apps/web-antd/src/locales/langs/zh-CN/project.json +++ b/apps/web-antd/src/locales/langs/zh-CN/project.json @@ -24,5 +24,8 @@ "updateTime": "最后修改时间", "commentNum": "进展记录数", "softwareVersion": "软件版本", - "operatingSystem": "操作系统平台" + "operatingSystem": "操作系统平台", + "networkChart": "网路图", + "uploadFile": "点击上传文件", + "uploadRule": "请上传{0}" } diff --git a/apps/web-antd/src/views/license/project/data.ts b/apps/web-antd/src/views/license/project/data.ts index d022345..2f4842b 100644 --- a/apps/web-antd/src/views/license/project/data.ts +++ b/apps/web-antd/src/views/license/project/data.ts @@ -247,6 +247,29 @@ export function useFormSchema(): VbenFormSchema[] { options: getDictOptions(DICT_TYPE.LIC_SOFTWARE_VERSION, 'number'), }, }, + { + component: 'Upload', + fieldName: 'file', + label: $t('project.networkChart'), + help: '提供对应项目的组网图,且不超过 5MB', + dependencies: { + triggerFields: ['customerId'], + rules: (values) => { + return z.any().refine( + (file) => { + if (values.customerId === 13) { + // 编辑状态且没有更改图片时,不校验 + return true; + } + return file instanceof File; + }, + { + message: $t('project.uploadRule', [$t('project.networkChart')]), + }, + ); + }, + }, + }, { fieldName: 'remark', label: $t('project.remarks'), @@ -520,6 +543,12 @@ export function useGridColumns( props: { type: DICT_TYPE.LIC_SOFTWARE_VERSION }, }, }, + { + field: 'file-content', + title: $t('project.networkChart'), + minWidth: 120, + slots: { default: 'file-content' }, + }, { field: 'remark', title: $t('project.remarks'), diff --git a/apps/web-antd/src/views/license/project/index.vue b/apps/web-antd/src/views/license/project/index.vue index 1b5c61b..7a07890 100644 --- a/apps/web-antd/src/views/license/project/index.vue +++ b/apps/web-antd/src/views/license/project/index.vue @@ -6,9 +6,9 @@ import type { import type { ProjectApi } from '#/api/license/project'; import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui'; -import { downloadFileFromBlobPart } from '@vben/utils'; +import { downloadFileFromBlobPart, openWindow } from '@vben/utils'; -import { message } from 'ant-design-vue'; +import { Button, Image, message } from 'ant-design-vue'; import dayjs from 'dayjs'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; @@ -213,6 +213,23 @@ const [Grid, gridApi] = useVbenVxeGrid({ ]" /> + diff --git a/apps/web-antd/src/views/license/project/modules/form.vue b/apps/web-antd/src/views/license/project/modules/form.vue index 0e2ce56..f2ac01d 100644 --- a/apps/web-antd/src/views/license/project/modules/form.vue +++ b/apps/web-antd/src/views/license/project/modules/form.vue @@ -1,11 +1,14 @@