From 3165c9b9f6cae0b4f3b355136904c046d2807761 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Thu, 17 Jul 2025 11:13:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9License=E8=A1=A8?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web-antd/src/api/license/license/index.ts | 10 +-- .../src/locales/langs/en-US/license.json | 8 +-- .../src/locales/langs/zh-CN/license.json | 8 +-- apps/web-antd/src/utils/dict.ts | 2 +- .../src/views/license/license/data.ts | 70 ++++++++++--------- .../views/license/license/modules/form.vue | 20 +++--- 6 files changed, 61 insertions(+), 57 deletions(-) diff --git a/apps/web-antd/src/api/license/license/index.ts b/apps/web-antd/src/api/license/license/index.ts index 6500f7a..3017399 100644 --- a/apps/web-antd/src/api/license/license/index.ts +++ b/apps/web-antd/src/api/license/license/index.ts @@ -10,11 +10,11 @@ export namespace LicenseApi { id: number; // 主键 customerId?: number; // 客户ID projectId?: number; // 项目ID - sn?: string; // sn - expirationTime: Dayjs | string; // 到期时间 - neSwitch: number[]; // 网元开关 - userNum: number; // 用户数 - baseStationNum: number; // 基站数 + serialNo?: string; // sn + expiryDate: Dayjs | string; // 到期时间 + neList: number[]; // 网元开关 + userNumber: number; // 用户数 + ranNumber: number; // 基站数 activationCode: string; // 激活码 licenseContent: string; // License内容 applicant: number; // 申请人 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 f925910..38551a0 100644 --- a/apps/web-antd/src/locales/langs/en-US/license.json +++ b/apps/web-antd/src/locales/langs/en-US/license.json @@ -1,10 +1,10 @@ { "customer": "Customer", "project": "Project", - "expirationTime": "Expiration Time", - "neSwitch": "NE Switch", - "userNum": "User Count", - "baseStationNum": "Base Station", + "expiryDate": "Expiry Date", + "neList": "Network Elements", + "userNumber": "User Count", + "ranNumber": "Base Station Count", "activationCode": "Activation Code", "licenseContent": "License Content", "applicant": "Applicant", 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 da41bb9..67d006f 100644 --- a/apps/web-antd/src/locales/langs/zh-CN/license.json +++ b/apps/web-antd/src/locales/langs/zh-CN/license.json @@ -1,10 +1,10 @@ { "customer": "客户", "project": "项目", - "expirationTime": "有效期", - "neSwitch": "网元开关", - "userNum": "用户数", - "baseStationNum": "基站", + "expiryDate": "到期时间", + "neList": "网元", + "userNumber": "用户数", + "ranNumber": "基站数", "activationCode": "激活码", "licenseContent": "License内容", "applicant": "申请人", diff --git a/apps/web-antd/src/utils/dict.ts b/apps/web-antd/src/utils/dict.ts index 9488414..2e070d9 100644 --- a/apps/web-antd/src/utils/dict.ts +++ b/apps/web-antd/src/utils/dict.ts @@ -263,7 +263,7 @@ enum DICT_TYPE { LIC_BUSINESS_STATUS = 'lic_business_status', // 商务状态 LIC_CUSTOMER_TYPE = 'lic_customer_type', // 客户类型 LIC_LICENSE_STATUS = 'lic_license_status', // License 状态 - LIC_NE_SWITCH = 'lic_ne_switch', // NE 开关 + LIC_NE_LIST = 'lic_ne_list', // NE 列表 LIC_PROJECT_STATUS = 'lic_project_status', // 项目状态 MEMBER_EXPERIENCE_BIZ_TYPE = 'member_experience_biz_type', // 会员经验业务类型 // ========== Member 会员模块 ========== diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts index b76e56e..e3368cb 100644 --- a/apps/web-antd/src/views/license/license/data.ts +++ b/apps/web-antd/src/views/license/license/data.ts @@ -74,7 +74,7 @@ export function useFormSchema(): VbenFormSchema[] { }, }, { - fieldName: 'sn', + fieldName: 'serialNo', label: 'SN', component: 'Input', componentProps: { @@ -88,7 +88,10 @@ export function useFormSchema(): VbenFormSchema[] { const customerCode = customerList.find((customer) => { return customer.id === values.customerId; })?.code; - form.setFieldValue('sn', `${customerCode || ''}${projectCode || ''}`); + form.setFieldValue( + 'serialNo', + `${customerCode || ''}${projectCode || ''}`, + ); }, // 只有指定的字段改变时,才会触发 triggerFields: ['customerId', 'projectId'], @@ -103,8 +106,8 @@ export function useFormSchema(): VbenFormSchema[] { ), }, { - fieldName: 'expirationTime', - label: $t('license.expirationTime'), + fieldName: 'expiryDate', + label: $t('license.expiryDate'), rules: 'required', component: 'DatePicker', componentProps: { @@ -114,8 +117,8 @@ export function useFormSchema(): VbenFormSchema[] { }, }, { - fieldName: 'neSwitch', - label: $t('license.neSwitch'), + fieldName: 'neList', + label: $t('license.neList'), component: 'CheckboxGroup', formItemClass: 'col-span-2', modelPropName: 'modelValue', @@ -140,17 +143,20 @@ export function useFormSchema(): VbenFormSchema[] { // }, // }, { - fieldName: 'userNum', - label: $t('license.userNum'), + fieldName: 'userNumber', + label: $t('license.userNumber'), component: 'InputNumber', componentProps: { min: 0, }, }, { - fieldName: 'baseStationNum', - label: $t('license.baseStationNum'), - component: 'Input', + fieldName: 'ranNumber', + label: $t('license.ranNumber'), + component: 'InputNumber', + componentProps: { + min: 0, + }, }, // { // fieldName: 'status', @@ -215,7 +221,7 @@ export function useGridFormSchema(): VbenFormSchema[] { }, }, { - fieldName: 'sn', + fieldName: 'serialNo', label: 'SN', component: 'Input', componentProps: { @@ -223,8 +229,8 @@ export function useGridFormSchema(): VbenFormSchema[] { }, }, { - fieldName: 'expirationTime', - label: $t('license.expirationTime'), + fieldName: 'expiryDate', + label: $t('license.expiryDate'), component: 'RangePicker', componentProps: { ...getRangePickerDefaultProps(), @@ -232,29 +238,29 @@ export function useGridFormSchema(): VbenFormSchema[] { }, }, { - fieldName: 'neSwitch', - label: $t('license.neSwitch'), + fieldName: 'neList', + label: $t('license.neList'), component: 'Select', componentProps: { allowClear: true, mode: 'multiple', - options: getDictOptions(DICT_TYPE.LIC_NE_SWITCH, 'number'), + options: getDictOptions(DICT_TYPE.LIC_NE_LIST, 'number'), showSearch: true, filterOption: (input: string, option: any) => option.label.toLowerCase().includes(input.toLowerCase()), }, }, // { - // fieldName: 'userNum', - // label: $t('license.userNum'), + // fieldName: 'userNumber', + // label: $t('license.userNumber'), // component: 'Input', // componentProps: { // allowClear: true, // }, // }, // { - // fieldName: 'baseStationNum', - // label: $t('license.baseStationNum'), + // fieldName: 'ranNumber', + // label: $t('license.ranNumber'), // component: 'Input', // componentProps: { // allowClear: true, @@ -366,33 +372,33 @@ export function useGridColumns( minWidth: 120, }, { - field: 'sn', + field: 'serialNo', title: 'SN', minWidth: 120, }, { - field: 'expirationTime', - title: $t('license.expirationTime'), + field: 'expiryDate', + title: $t('license.expiryDate'), minWidth: 120, formatter: 'formatDateTime', }, { - field: 'neSwitch', - title: $t('license.neSwitch'), + field: 'neList', + title: $t('license.neList'), minWidth: 120, cellRender: { name: 'CellDictGroup', - props: { type: DICT_TYPE.LIC_NE_SWITCH }, + props: { type: DICT_TYPE.LIC_NE_LIST }, }, }, { - field: 'userNum', - title: $t('license.userNum'), + field: 'userNumber', + title: $t('license.userNumber'), minWidth: 120, }, { - field: 'baseStationNum', - title: $t('license.baseStationNum'), + field: 'ranNumber', + title: $t('license.ranNumber'), minWidth: 120, }, { @@ -455,7 +461,7 @@ export function useGridColumns( showOverflow: false, cellRender: { attrs: { - nameField: 'sn', + nameField: 'serialNo', nameTitle: 'License', onClick: onActionClick, }, diff --git a/apps/web-antd/src/views/license/license/modules/form.vue b/apps/web-antd/src/views/license/license/modules/form.vue index 32d8cdf..8f4b263 100644 --- a/apps/web-antd/src/views/license/license/modules/form.vue +++ b/apps/web-antd/src/views/license/license/modules/form.vue @@ -20,7 +20,7 @@ import { DICT_TYPE, getDictOptions } from '#/utils'; import { formData, useFormSchema } from '../data'; const emit = defineEmits(['success']); -const neSwitchOptions = getDictOptions(DICT_TYPE.LIC_NE_SWITCH, 'number'); +const neListOptions = getDictOptions(DICT_TYPE.LIC_NE_LIST, 'number'); const state = reactive({ indeterminate: false, @@ -63,7 +63,7 @@ const [Form, formApi] = useVbenForm({ const onCheckAllChange = (e: any) => { Object.assign(state, { checkedList: e.target.checked - ? neSwitchOptions.map((option) => option.value) + ? neListOptions.map((option) => option.value) : [], indeterminate: false, }); @@ -72,8 +72,8 @@ const onCheckAllChange = (e: any) => { watch( () => state.checkedList, (val) => { - state.indeterminate = val.length > 0 && val.length < neSwitchOptions.length; - state.checkAll = val.length === neSwitchOptions.length; + state.indeterminate = val.length > 0 && val.length < neListOptions.length; + state.checkAll = val.length === neListOptions.length; }, ); @@ -86,7 +86,7 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(); // 提交表单 const data = (await formApi.getValues()) as LicenseApi.License; - data.neSwitch = state.checkedList; + data.neList = state.checkedList; try { if (formData.value?.id) { await (formData.value?.action === 1 @@ -125,12 +125,10 @@ const [Modal, modalApi] = useVbenModal({ } } // 处理数据 - data.expirationTime = data.expirationTime - ? data.expirationTime.toString() - : ''; + data.expiryDate = data.expiryDate ? data.expiryDate.toString() : ''; // 设置到 values formData.value = data; - state.checkedList = data.neSwitch || []; + state.checkedList = data.neList || []; await formApi.setValues(formData.value); }, }); @@ -139,7 +137,7 @@ const [Modal, modalApi] = useVbenModal({