From 4fb2986c62f1aa068b5a4bb333b05b08310ea78b Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Tue, 29 Jul 2025 15:16:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9A=E6=97=B6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=8A=B6=E6=80=81=E5=92=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/locales/langs/en-US/license.json | 3 +- .../src/locales/langs/zh-CN/license.json | 3 +- .../license/license/components/detail.vue | 76 ++++++++++++-- .../license/license/components/ne-code.vue | 2 +- .../src/views/license/license/data.ts | 4 +- .../views/license/license/generate/index.vue | 99 ++++++++++++++----- .../src/views/license/license/index.vue | 2 +- 7 files changed, 151 insertions(+), 38 deletions(-) diff --git a/apps/web-antd/src/locales/langs/en-US/license.json b/apps/web-antd/src/locales/langs/en-US/license.json index d2273e0..6e91da6 100644 --- a/apps/web-antd/src/locales/langs/en-US/license.json +++ b/apps/web-antd/src/locales/langs/en-US/license.json @@ -30,5 +30,6 @@ "addNe": "Add Network Elements", "enterCode": "Please enter Activation Code", "selectNe": "Please select Network Element", - "detail": "detail" + "detail": "detail", + "downloadAll": "Download All" } diff --git a/apps/web-antd/src/locales/langs/zh-CN/license.json b/apps/web-antd/src/locales/langs/zh-CN/license.json index 43e4a81..ef402d1 100644 --- a/apps/web-antd/src/locales/langs/zh-CN/license.json +++ b/apps/web-antd/src/locales/langs/zh-CN/license.json @@ -30,5 +30,6 @@ "addNe": "添加网元", "enterCode": "请输入激活码", "selectNe": "请选择网元", - "detail": "详情" + "detail": "详情", + "downloadAll": "全部下载" } diff --git a/apps/web-antd/src/views/license/license/components/detail.vue b/apps/web-antd/src/views/license/license/components/detail.vue index a104b0a..3ff45f9 100644 --- a/apps/web-antd/src/views/license/license/components/detail.vue +++ b/apps/web-antd/src/views/license/license/components/detail.vue @@ -43,15 +43,18 @@ const columns = [ }, { title: 'License文件', - dataIndex: 'fileUrl', - key: 'fileUrl', + dataIndex: 'fileUrlList', + key: 'fileUrlList', customRender: (data: any) => { if (!data.value) { return; } - const fileName = `${data.value?.slice( - Math.max(0, data.value.lastIndexOf('/') + 1), - data.value.lastIndexOf('_'), + if (!data.value[0]) { + return; + } + const fileName = `${data.value[0]?.slice( + Math.max(0, data.value[0].lastIndexOf('/') + 1), + data.value[0].lastIndexOf('_'), )}.ini`; // 创建下载链接 const link = h( @@ -69,7 +72,7 @@ const columns = [ Button, { onClick: async () => { - const res = await fetch(data.value); + const res = await fetch(data.value[0]); if (!res.ok) { message.error($t('license.downloadFailed')); return; @@ -83,8 +86,7 @@ const columns = [ $t('license.download'), ); - // 包裹容器 - return h( + const file = h( 'div', { style: { @@ -94,6 +96,64 @@ const columns = [ }, [link, button], ); + + let file1; + if (data.value[1]) { + const fileName1 = `${data.value[1]?.slice( + Math.max(0, data.value[1].lastIndexOf('/') + 1), + data.value[1].lastIndexOf('_'), + )}.ini`; + // 创建下载链接 + const link1 = h( + 'span', + { + style: { + marginRight: '15px', + }, + }, + fileName1, + ); + + // 创建下载按钮 + const button1 = h( + Button, + { + onClick: async () => { + const res = await fetch(data.value[1]); + if (!res.ok) { + message.error($t('license.downloadFailed')); + return; + } + const blob1 = await res.blob(); + + downloadFileFromBlobPart({ fileName: fileName1, source: blob1 }); + }, + type: 'primary', + }, + $t('license.download'), + ); + + file1 = h( + 'div', + { + style: { + display: 'flex', + alignItems: 'center', + margin: '8px 0 0 0', + }, + }, + [link1, button1], + ); + } + + // 包裹容器 + return h( + 'div', + { + style: {}, + }, + [file, file1], + ); }, }, ]; diff --git a/apps/web-antd/src/views/license/license/components/ne-code.vue b/apps/web-antd/src/views/license/license/components/ne-code.vue index 0697881..8032e19 100644 --- a/apps/web-antd/src/views/license/license/components/ne-code.vue +++ b/apps/web-antd/src/views/license/license/components/ne-code.vue @@ -60,7 +60,7 @@ defineExpose({ mode="multiple" allow-clear show-search - style="width: 220px" + style="width: 100px" :options="props.availableOptions(index)" :filter-option="filterOption" :placeholder="$t('license.selectNe')" diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts index 96b3cb5..08d978f 100644 --- a/apps/web-antd/src/views/license/license/data.ts +++ b/apps/web-antd/src/views/license/license/data.ts @@ -143,7 +143,7 @@ export function useFormSchema(): VbenFormSchema[] { fieldName: 'neCodeList', label: $t('license.neList'), component: '', - formItemClass: 'col-span-2', + formItemClass: 'col-span-2 items-baseline', modelPropName: 'modelValue', rules: z.array(z.object({})), }, @@ -533,7 +533,7 @@ export function useGridColumns( code: 'download', text: $t('license.download'), show: (values: LicenseApi.License) => { - return values.status === 2; + return values.status === 3; }, }, { diff --git a/apps/web-antd/src/views/license/license/generate/index.vue b/apps/web-antd/src/views/license/license/generate/index.vue index 9c8eb33..deafccd 100644 --- a/apps/web-antd/src/views/license/license/generate/index.vue +++ b/apps/web-antd/src/views/license/license/generate/index.vue @@ -1,12 +1,13 @@ @@ -101,6 +144,14 @@ getDetail(route.query.id); > {{ $t('license.generate') }} + diff --git a/apps/web-antd/src/views/license/license/index.vue b/apps/web-antd/src/views/license/license/index.vue index b49cf37..4ba66df 100644 --- a/apps/web-antd/src/views/license/license/index.vue +++ b/apps/web-antd/src/views/license/license/index.vue @@ -66,7 +66,7 @@ async function onDownload(row: LicenseApi.License) { const fileName = `${row.fileUrl?.slice( Math.max(0, row.fileUrl.lastIndexOf('/') + 1), row.fileUrl.lastIndexOf('_'), - )}.ini`; + )}.zip`; const res = await fetch(row.fileUrl); if (!res.ok) { message.error($t('license.downloadFailed'));