feat: 修改License表字段

This commit is contained in:
caiyuchao
2025-07-17 11:13:41 +08:00
parent d938a59d2b
commit 3165c9b9f6
6 changed files with 61 additions and 57 deletions

View File

@@ -10,11 +10,11 @@ export namespace LicenseApi {
id: number; // 主键 id: number; // 主键
customerId?: number; // 客户ID customerId?: number; // 客户ID
projectId?: number; // 项目ID projectId?: number; // 项目ID
sn?: string; // sn serialNo?: string; // sn
expirationTime: Dayjs | string; // 到期时间 expiryDate: Dayjs | string; // 到期时间
neSwitch: number[]; // 网元开关 neList: number[]; // 网元开关
userNum: number; // 用户数 userNumber: number; // 用户数
baseStationNum: number; // 基站数 ranNumber: number; // 基站数
activationCode: string; // 激活码 activationCode: string; // 激活码
licenseContent: string; // License内容 licenseContent: string; // License内容
applicant: number; // 申请人 applicant: number; // 申请人

View File

@@ -1,10 +1,10 @@
{ {
"customer": "Customer", "customer": "Customer",
"project": "Project", "project": "Project",
"expirationTime": "Expiration Time", "expiryDate": "Expiry Date",
"neSwitch": "NE Switch", "neList": "Network Elements",
"userNum": "User Count", "userNumber": "User Count",
"baseStationNum": "Base Station", "ranNumber": "Base Station Count",
"activationCode": "Activation Code", "activationCode": "Activation Code",
"licenseContent": "License Content", "licenseContent": "License Content",
"applicant": "Applicant", "applicant": "Applicant",

View File

@@ -1,10 +1,10 @@
{ {
"customer": "客户", "customer": "客户",
"project": "项目", "project": "项目",
"expirationTime": "有效期", "expiryDate": "到期时间",
"neSwitch": "网元开关", "neList": "网元",
"userNum": "用户数", "userNumber": "用户数",
"baseStationNum": "基站", "ranNumber": "基站",
"activationCode": "激活码", "activationCode": "激活码",
"licenseContent": "License内容", "licenseContent": "License内容",
"applicant": "申请人", "applicant": "申请人",

View File

@@ -263,7 +263,7 @@ enum DICT_TYPE {
LIC_BUSINESS_STATUS = 'lic_business_status', // 商务状态 LIC_BUSINESS_STATUS = 'lic_business_status', // 商务状态
LIC_CUSTOMER_TYPE = 'lic_customer_type', // 客户类型 LIC_CUSTOMER_TYPE = 'lic_customer_type', // 客户类型
LIC_LICENSE_STATUS = 'lic_license_status', // License 状态 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', // 项目状态 LIC_PROJECT_STATUS = 'lic_project_status', // 项目状态
MEMBER_EXPERIENCE_BIZ_TYPE = 'member_experience_biz_type', // 会员经验业务类型 MEMBER_EXPERIENCE_BIZ_TYPE = 'member_experience_biz_type', // 会员经验业务类型
// ========== Member 会员模块 ========== // ========== Member 会员模块 ==========

View File

@@ -74,7 +74,7 @@ export function useFormSchema(): VbenFormSchema[] {
}, },
}, },
{ {
fieldName: 'sn', fieldName: 'serialNo',
label: 'SN', label: 'SN',
component: 'Input', component: 'Input',
componentProps: { componentProps: {
@@ -88,7 +88,10 @@ export function useFormSchema(): VbenFormSchema[] {
const customerCode = customerList.find((customer) => { const customerCode = customerList.find((customer) => {
return customer.id === values.customerId; return customer.id === values.customerId;
})?.code; })?.code;
form.setFieldValue('sn', `${customerCode || ''}${projectCode || ''}`); form.setFieldValue(
'serialNo',
`${customerCode || ''}${projectCode || ''}`,
);
}, },
// 只有指定的字段改变时,才会触发 // 只有指定的字段改变时,才会触发
triggerFields: ['customerId', 'projectId'], triggerFields: ['customerId', 'projectId'],
@@ -103,8 +106,8 @@ export function useFormSchema(): VbenFormSchema[] {
), ),
}, },
{ {
fieldName: 'expirationTime', fieldName: 'expiryDate',
label: $t('license.expirationTime'), label: $t('license.expiryDate'),
rules: 'required', rules: 'required',
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@@ -114,8 +117,8 @@ export function useFormSchema(): VbenFormSchema[] {
}, },
}, },
{ {
fieldName: 'neSwitch', fieldName: 'neList',
label: $t('license.neSwitch'), label: $t('license.neList'),
component: 'CheckboxGroup', component: 'CheckboxGroup',
formItemClass: 'col-span-2', formItemClass: 'col-span-2',
modelPropName: 'modelValue', modelPropName: 'modelValue',
@@ -140,17 +143,20 @@ export function useFormSchema(): VbenFormSchema[] {
// }, // },
// }, // },
{ {
fieldName: 'userNum', fieldName: 'userNumber',
label: $t('license.userNum'), label: $t('license.userNumber'),
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min: 0, min: 0,
}, },
}, },
{ {
fieldName: 'baseStationNum', fieldName: 'ranNumber',
label: $t('license.baseStationNum'), label: $t('license.ranNumber'),
component: 'Input', component: 'InputNumber',
componentProps: {
min: 0,
},
}, },
// { // {
// fieldName: 'status', // fieldName: 'status',
@@ -215,7 +221,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
}, },
}, },
{ {
fieldName: 'sn', fieldName: 'serialNo',
label: 'SN', label: 'SN',
component: 'Input', component: 'Input',
componentProps: { componentProps: {
@@ -223,8 +229,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
}, },
}, },
{ {
fieldName: 'expirationTime', fieldName: 'expiryDate',
label: $t('license.expirationTime'), label: $t('license.expiryDate'),
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: {
...getRangePickerDefaultProps(), ...getRangePickerDefaultProps(),
@@ -232,29 +238,29 @@ export function useGridFormSchema(): VbenFormSchema[] {
}, },
}, },
{ {
fieldName: 'neSwitch', fieldName: 'neList',
label: $t('license.neSwitch'), label: $t('license.neList'),
component: 'Select', component: 'Select',
componentProps: { componentProps: {
allowClear: true, allowClear: true,
mode: 'multiple', mode: 'multiple',
options: getDictOptions(DICT_TYPE.LIC_NE_SWITCH, 'number'), options: getDictOptions(DICT_TYPE.LIC_NE_LIST, 'number'),
showSearch: true, showSearch: true,
filterOption: (input: string, option: any) => filterOption: (input: string, option: any) =>
option.label.toLowerCase().includes(input.toLowerCase()), option.label.toLowerCase().includes(input.toLowerCase()),
}, },
}, },
// { // {
// fieldName: 'userNum', // fieldName: 'userNumber',
// label: $t('license.userNum'), // label: $t('license.userNumber'),
// component: 'Input', // component: 'Input',
// componentProps: { // componentProps: {
// allowClear: true, // allowClear: true,
// }, // },
// }, // },
// { // {
// fieldName: 'baseStationNum', // fieldName: 'ranNumber',
// label: $t('license.baseStationNum'), // label: $t('license.ranNumber'),
// component: 'Input', // component: 'Input',
// componentProps: { // componentProps: {
// allowClear: true, // allowClear: true,
@@ -366,33 +372,33 @@ export function useGridColumns(
minWidth: 120, minWidth: 120,
}, },
{ {
field: 'sn', field: 'serialNo',
title: 'SN', title: 'SN',
minWidth: 120, minWidth: 120,
}, },
{ {
field: 'expirationTime', field: 'expiryDate',
title: $t('license.expirationTime'), title: $t('license.expiryDate'),
minWidth: 120, minWidth: 120,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {
field: 'neSwitch', field: 'neList',
title: $t('license.neSwitch'), title: $t('license.neList'),
minWidth: 120, minWidth: 120,
cellRender: { cellRender: {
name: 'CellDictGroup', name: 'CellDictGroup',
props: { type: DICT_TYPE.LIC_NE_SWITCH }, props: { type: DICT_TYPE.LIC_NE_LIST },
}, },
}, },
{ {
field: 'userNum', field: 'userNumber',
title: $t('license.userNum'), title: $t('license.userNumber'),
minWidth: 120, minWidth: 120,
}, },
{ {
field: 'baseStationNum', field: 'ranNumber',
title: $t('license.baseStationNum'), title: $t('license.ranNumber'),
minWidth: 120, minWidth: 120,
}, },
{ {
@@ -455,7 +461,7 @@ export function useGridColumns(
showOverflow: false, showOverflow: false,
cellRender: { cellRender: {
attrs: { attrs: {
nameField: 'sn', nameField: 'serialNo',
nameTitle: 'License', nameTitle: 'License',
onClick: onActionClick, onClick: onActionClick,
}, },

View File

@@ -20,7 +20,7 @@ import { DICT_TYPE, getDictOptions } from '#/utils';
import { formData, useFormSchema } from '../data'; import { formData, useFormSchema } from '../data';
const emit = defineEmits(['success']); 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({ const state = reactive({
indeterminate: false, indeterminate: false,
@@ -63,7 +63,7 @@ const [Form, formApi] = useVbenForm({
const onCheckAllChange = (e: any) => { const onCheckAllChange = (e: any) => {
Object.assign(state, { Object.assign(state, {
checkedList: e.target.checked checkedList: e.target.checked
? neSwitchOptions.map((option) => option.value) ? neListOptions.map((option) => option.value)
: [], : [],
indeterminate: false, indeterminate: false,
}); });
@@ -72,8 +72,8 @@ const onCheckAllChange = (e: any) => {
watch( watch(
() => state.checkedList, () => state.checkedList,
(val) => { (val) => {
state.indeterminate = val.length > 0 && val.length < neSwitchOptions.length; state.indeterminate = val.length > 0 && val.length < neListOptions.length;
state.checkAll = val.length === neSwitchOptions.length; state.checkAll = val.length === neListOptions.length;
}, },
); );
@@ -86,7 +86,7 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock(); modalApi.lock();
// 提交表单 // 提交表单
const data = (await formApi.getValues()) as LicenseApi.License; const data = (await formApi.getValues()) as LicenseApi.License;
data.neSwitch = state.checkedList; data.neList = state.checkedList;
try { try {
if (formData.value?.id) { if (formData.value?.id) {
await (formData.value?.action === 1 await (formData.value?.action === 1
@@ -125,12 +125,10 @@ const [Modal, modalApi] = useVbenModal({
} }
} }
// 处理数据 // 处理数据
data.expirationTime = data.expirationTime data.expiryDate = data.expiryDate ? data.expiryDate.toString() : '';
? data.expirationTime.toString()
: '';
// 设置到 values // 设置到 values
formData.value = data; formData.value = data;
state.checkedList = data.neSwitch || []; state.checkedList = data.neList || [];
await formApi.setValues(formData.value); await formApi.setValues(formData.value);
}, },
}); });
@@ -139,7 +137,7 @@ const [Modal, modalApi] = useVbenModal({
<template> <template>
<Modal :title="getTitle" class="w-[800px]" :confirm-text="getConfirmText"> <Modal :title="getTitle" class="w-[800px]" :confirm-text="getConfirmText">
<Form class="mx-4"> <Form class="mx-4">
<template #neSwitch="slotProps"> <template #neList="slotProps">
<a-row> <a-row>
<div> <div>
<a-checkbox <a-checkbox
@@ -154,7 +152,7 @@ const [Modal, modalApi] = useVbenModal({
<a-checkbox-group <a-checkbox-group
v-bind="slotProps" v-bind="slotProps"
v-model:value="state.checkedList" v-model:value="state.checkedList"
:options="neSwitchOptions" :options="neListOptions"
/> />
</a-row> </a-row>
</template> </template>