From 964a281175bbbbb0c5161c25f0e8a613cdfe75f8 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Mon, 4 Aug 2025 15:38:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20license=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web-antd/src/api/license/license/index.ts | 7 +++ .../src/locales/langs/en-US/license.json | 3 +- .../src/locales/langs/zh-CN/license.json | 3 +- .../src/views/license/license/data.ts | 16 ++++-- .../src/views/license/license/index.vue | 16 ++++++ .../views/license/license/modules/history.vue | 55 +++++++++++++++++++ 6 files changed, 92 insertions(+), 8 deletions(-) create mode 100644 apps/web-antd/src/views/license/license/modules/history.vue diff --git a/apps/web-antd/src/api/license/license/index.ts b/apps/web-antd/src/api/license/license/index.ts index f831383..f0a94e2 100644 --- a/apps/web-antd/src/api/license/license/index.ts +++ b/apps/web-antd/src/api/license/license/index.ts @@ -47,6 +47,13 @@ export function getLicense(id: number) { return requestClient.get(`/license/license/get?id=${id}`); } +/** 查询License历史 */ +export function getLicenseHistory(id: number) { + return requestClient.get( + `/license/license/history?id=${id}`, + ); +} + /** 新增License */ export function createLicense(data: LicenseApi.License) { return requestClient.post('/license/license/create', data); 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 4c8872e..15a254c 100644 --- a/apps/web-antd/src/locales/langs/en-US/license.json +++ b/apps/web-antd/src/locales/langs/en-US/license.json @@ -33,5 +33,6 @@ "detail": "detail", "downloadAll": "Download All", "reapply": "Reapply", - "reapplyAction": "Reapply For {0}" + "reapplyAction": "Reapply For {0}", + "history": "History" } 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 c1fd20f..26154fa 100644 --- a/apps/web-antd/src/locales/langs/zh-CN/license.json +++ b/apps/web-antd/src/locales/langs/zh-CN/license.json @@ -33,5 +33,6 @@ "detail": "详情", "downloadAll": "全部下载", "reapply": "重新申请", - "reapplyAction": "重新申请{0}" + "reapplyAction": "重新申请{0}", + "history": "历史" } diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts index 01385aa..ac8687c 100644 --- a/apps/web-antd/src/views/license/license/data.ts +++ b/apps/web-antd/src/views/license/license/data.ts @@ -385,6 +385,10 @@ export function useGridColumns( code: 'detail', text: $t('license.detail'), }, + { + code: 'history', + text: $t('license.history'), + }, { code: 'reapply', text: $t('license.reapply'), @@ -441,7 +445,7 @@ export function useDetailSchema(): DescriptionItemSchema[] { field: 'expiryDate', label: $t('license.expiryDate'), content: (data) => { - if (data.oldLicense) { + if (data.oldLicense && data.oldLicense.expiryDate !== data.expiryDate) { const after = h( 'span', { @@ -449,7 +453,7 @@ export function useDetailSchema(): DescriptionItemSchema[] { color: 'red', }, }, - ` → ${formatDate(data?.expiryDate)}`, + ` → ${formatDate(data.expiryDate)}`, ); return h('div', {}, [ formatDate(data.oldLicense.expiryDate) as string, @@ -463,7 +467,7 @@ export function useDetailSchema(): DescriptionItemSchema[] { field: 'userNumber', label: $t('license.userNumber'), content: (data) => { - if (data.oldLicense) { + if (data.oldLicense && data.oldLicense.userNumber !== data.userNumber) { const after = h( 'span', { @@ -471,7 +475,7 @@ export function useDetailSchema(): DescriptionItemSchema[] { color: 'red', }, }, - ` → ${data.userNumber}`, + ` → ${data.userNumber ?? ''}`, ); return h('div', {}, [data.oldLicense.userNumber, after]); } @@ -482,7 +486,7 @@ export function useDetailSchema(): DescriptionItemSchema[] { field: 'ranNumber', label: $t('license.ranNumber'), content: (data) => { - if (data.oldLicense) { + if (data.oldLicense && data.oldLicense.ranNumber !== data.ranNumber) { const after = h( 'span', { @@ -490,7 +494,7 @@ export function useDetailSchema(): DescriptionItemSchema[] { color: 'red', }, }, - ` → ${data.ranNumber}`, + ` → ${data.ranNumber ?? ''}`, ); return h('div', {}, [data.oldLicense.ranNumber, after]); } diff --git a/apps/web-antd/src/views/license/license/index.vue b/apps/web-antd/src/views/license/license/index.vue index 570c32e..1853caa 100644 --- a/apps/web-antd/src/views/license/license/index.vue +++ b/apps/web-antd/src/views/license/license/index.vue @@ -23,6 +23,7 @@ import { $t } from '#/locales'; import { useGridColumns, useGridFormSchema } from './data'; import Detail from './modules/detail.vue'; import Form from './modules/form.vue'; +import History from './modules/history.vue'; const router = useRouter(); @@ -31,6 +32,11 @@ const [FormModal, formModalApi] = useVbenModal({ destroyOnClose: true, }); +const [HistoryModal, historyModalApi] = useVbenModal({ + connectedComponent: History, + destroyOnClose: true, +}); + const [DetailModal, detailModalApi] = useVbenModal({ connectedComponent: Detail, destroyOnClose: true, @@ -56,6 +62,11 @@ function onDetail(row: LicenseApi.License) { detailModalApi.setData(row).open(); } +/** 历史License */ +function onHistory(row: LicenseApi.License) { + historyModalApi.setData(row).open(); +} + /** 下载License */ async function onDownload(row: LicenseApi.License) { const fileName = `${row.fileUrl?.slice( @@ -119,6 +130,10 @@ function onActionClick({ code, row }: OnActionClickParams) { onGenerate(row); break; } + case 'history': { + onHistory(row); + break; + } case 'reapply': { onReapply(row); break; @@ -169,6 +184,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ +