feat: 修改License表字段
This commit is contained in:
@@ -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; // 申请人
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"customer": "客户",
|
||||
"project": "项目",
|
||||
"expirationTime": "有效期",
|
||||
"neSwitch": "网元开关",
|
||||
"userNum": "用户数",
|
||||
"baseStationNum": "基站",
|
||||
"expiryDate": "到期时间",
|
||||
"neList": "网元",
|
||||
"userNumber": "用户数",
|
||||
"ranNumber": "基站数",
|
||||
"activationCode": "激活码",
|
||||
"licenseContent": "License内容",
|
||||
"applicant": "申请人",
|
||||
|
||||
@@ -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 会员模块 ==========
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -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({
|
||||
<template>
|
||||
<Modal :title="getTitle" class="w-[800px]" :confirm-text="getConfirmText">
|
||||
<Form class="mx-4">
|
||||
<template #neSwitch="slotProps">
|
||||
<template #neList="slotProps">
|
||||
<a-row>
|
||||
<div>
|
||||
<a-checkbox
|
||||
@@ -154,7 +152,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<a-checkbox-group
|
||||
v-bind="slotProps"
|
||||
v-model:value="state.checkedList"
|
||||
:options="neSwitchOptions"
|
||||
:options="neListOptions"
|
||||
/>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user