feat: 到期时间调整;用户数校验;警告处理;
This commit is contained in:
@@ -57,7 +57,9 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
label: $t('customer.customerSn'),
|
label: $t('customer.customerSn'),
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
rules: z
|
rules: z
|
||||||
.number()
|
.number({
|
||||||
|
message: $t('ui.formRules.required', [$t('customer.customerSn')]),
|
||||||
|
})
|
||||||
.min(
|
.min(
|
||||||
2000,
|
2000,
|
||||||
$t('ui.formRules.range', [$t('customer.customerSn'), 2000, 9999]),
|
$t('ui.formRules.range', [$t('customer.customerSn'), 2000, 9999]),
|
||||||
@@ -77,7 +79,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.nullable()
|
// .nullable()
|
||||||
.refine(
|
.refine(
|
||||||
(value: null | number) => {
|
(value: null | number) => {
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ const columns = [
|
|||||||
},
|
},
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
$t('license.download'),
|
() => $t('license.download'),
|
||||||
);
|
);
|
||||||
|
|
||||||
const file = h(
|
const file = h(
|
||||||
@@ -130,7 +130,7 @@ const columns = [
|
|||||||
},
|
},
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
$t('license.download'),
|
() => $t('license.download'),
|
||||||
);
|
);
|
||||||
|
|
||||||
file1 = h(
|
file1 = h(
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ import type { DescriptionItemSchema } from '#/components/description';
|
|||||||
import { h, ref } from 'vue';
|
import { h, ref } from 'vue';
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
import { useAccess } from '@vben/access';
|
||||||
import { formatDateTime } from '@vben/utils';
|
import { formatDate, formatDateTime } from '@vben/utils';
|
||||||
|
|
||||||
|
import dayjs, { Dayjs } from 'dayjs';
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
import { getCustomerList } from '#/api/license/customer';
|
import { getCustomerList } from '#/api/license/customer';
|
||||||
@@ -121,9 +123,22 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
rules: 'required',
|
rules: 'required',
|
||||||
component: 'DatePicker',
|
component: 'DatePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
showTime: true,
|
// showTime: true,
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
format: 'YYYY-MM-DD',
|
||||||
valueFormat: 'x',
|
valueFormat: 'x',
|
||||||
|
disabledDate: (current: Dayjs) => {
|
||||||
|
// Can not select days before today and today
|
||||||
|
return current && current < dayjs().startOf('day');
|
||||||
|
},
|
||||||
|
presets: [
|
||||||
|
{ label: '七天', value: dayjs().add(+7, 'd') },
|
||||||
|
{ label: '一个月', value: dayjs().add(+1, 'month') },
|
||||||
|
{ label: '三个月', value: dayjs().add(+3, 'month') },
|
||||||
|
{ label: '半年', value: dayjs().add(+6, 'month') },
|
||||||
|
{ label: '一年', value: dayjs().add(+1, 'year') },
|
||||||
|
{ label: '三年', value: dayjs().add(+3, 'year') },
|
||||||
|
{ label: '永久', value: dayjs('2099-12-31') },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
@@ -165,8 +180,13 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
label: $t('license.userNumber'),
|
label: $t('license.userNumber'),
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
min: 0,
|
min: 10,
|
||||||
},
|
},
|
||||||
|
rules: z
|
||||||
|
.number()
|
||||||
|
.multipleOf(10, '用户数必须是10的倍数')
|
||||||
|
.nullable()
|
||||||
|
.optional(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'ranNumber',
|
fieldName: 'ranNumber',
|
||||||
@@ -305,6 +325,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
...getRangePickerDefaultProps(),
|
...getRangePickerDefaultProps(),
|
||||||
|
showTime: false,
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -406,7 +427,7 @@ export function useGridColumns(
|
|||||||
field: 'expiryDate',
|
field: 'expiryDate',
|
||||||
title: $t('license.expiryDate'),
|
title: $t('license.expiryDate'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
formatter: 'formatDateTime',
|
formatter: 'formatDate',
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// field: 'neList',
|
// field: 'neList',
|
||||||
@@ -565,7 +586,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
|
|||||||
field: 'expiryDate',
|
field: 'expiryDate',
|
||||||
label: $t('license.expiryDate'),
|
label: $t('license.expiryDate'),
|
||||||
content: (data) => {
|
content: (data) => {
|
||||||
return formatDateTime(data?.expiryDate) as string;
|
return formatDate(data?.expiryDate) as string;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
label: $t('project.code'),
|
label: $t('project.code'),
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
rules: z
|
rules: z
|
||||||
.number()
|
.number({ message: $t('ui.formRules.required', [$t('project.code')]) })
|
||||||
.min(2000, $t('ui.formRules.range', [$t('project.code'), 2000, 9999]))
|
.min(2000, $t('ui.formRules.range', [$t('project.code'), 2000, 9999]))
|
||||||
.max(9999, $t('ui.formRules.range', [$t('project.code'), 2000, 9999]))
|
.max(9999, $t('ui.formRules.range', [$t('project.code'), 2000, 9999]))
|
||||||
.refine(
|
.refine(
|
||||||
@@ -71,7 +71,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
]),
|
]),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.nullable()
|
|
||||||
.refine(
|
.refine(
|
||||||
(value: null | number) => {
|
(value: null | number) => {
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
modalApi.unlock();
|
modalApi.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data.startTime = data.startTime ? data.startTime.toString() : '';
|
||||||
|
data.endTime = data.endTime ? data.endTime.toString() : '';
|
||||||
// 设置到 values
|
// 设置到 values
|
||||||
formData.value = data;
|
formData.value = data;
|
||||||
await formApi.setValues(formData.value);
|
await formApi.setValues(formData.value);
|
||||||
|
|||||||
Reference in New Issue
Block a user