feat: 修改License表字段
This commit is contained in:
@@ -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