refactor:优化 date 范围查找的函数

This commit is contained in:
YunaiV
2025-04-04 18:42:57 +08:00
parent 72dd0bcbde
commit cf434f0ed1
12 changed files with 35 additions and 28 deletions

View File

@@ -4,6 +4,7 @@ import type { SystemMailLogApi } from '#/api/system/mail/log';
import { getSimpleMailAccountList } from '#/api/system/mail/account';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
@@ -13,6 +14,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '发送时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},

View File

@@ -6,6 +6,7 @@ import { z } from '#/adapter/form';
import { getSimpleMailAccountList } from '#/api/system/mail/account';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -179,6 +180,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},

View File

@@ -3,6 +3,7 @@ import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
@@ -40,11 +41,11 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '模版类型',
component: 'Select',
componentProps: {
allowClear: true,
options: getDictOptions(
DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
'number',
),
allowClear: true,
placeholder: '请选择模版类型',
},
},
@@ -53,6 +54,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},

View File

@@ -5,7 +5,7 @@ import type { SystemNotifyTemplateApi } from '#/api/system/notify/template';
import { z } from '#/adapter/form';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { rangePickerExtend } from '#/utils/TimeUtils';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -139,8 +139,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
...rangePickerExtend(),
},
},
];

View File

@@ -5,7 +5,7 @@ import type { SystemRoleApi } from '#/api/system/role';
import { z } from '#/adapter/form';
import { CommonStatusEnum, SystemDataScopeEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { rangePickerExtend } from '#/utils/TimeUtils';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -175,8 +175,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
...rangePickerExtend(),
},
},
];

View File

@@ -5,7 +5,7 @@ import type { SystemSmsChannelApi } from '#/api/system/sms/channel';
import { z } from '#/adapter/form';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { rangePickerExtend } from '#/utils/TimeUtils';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -121,8 +121,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
...rangePickerExtend(),
},
},
];

View File

@@ -4,7 +4,7 @@ import type { SystemSmsLogApi } from '#/api/system/sms/log';
import { getSimpleSmsChannelList } from '#/api/system/sms/channel';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { rangePickerExtend } from '#/utils/TimeUtils';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
@@ -54,8 +54,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '发送时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
...rangePickerExtend(),
},
},
{
@@ -73,8 +73,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '接收时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
...rangePickerExtend(),
},
},
];

View File

@@ -6,6 +6,7 @@ import { z } from '#/adapter/form';
import { getSimpleSmsChannelList } from '#/api/system/sms/channel';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -153,12 +154,12 @@ export function useGridFormSchema(): VbenFormSchema[] {
placeholder: '请选择短信渠道',
},
},
// TODO @芋艿:范围检索的处理
{
fieldName: 'createTime',
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},

View File

@@ -6,6 +6,7 @@ import { z } from '#/adapter/form';
import { getTenantPackageList } from '#/api/system/tenant-package';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -169,6 +170,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},

View File

@@ -5,6 +5,7 @@ import type { SystemTenantPackageApi } from '#/api/system/tenant-package';
import { z } from '#/adapter/form';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -81,6 +82,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
},
},

View File

@@ -9,6 +9,7 @@ import { getDeptList } from '#/api/system/dept';
import { getSimplePostList } from '#/api/system/post';
import { getSimpleRoleList } from '#/api/system/role';
import { handleTree } from '#/utils/tree';
import { getRangePickerDefaultProps } from '#/utils/date';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -245,10 +246,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '创建时间',
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
allowClear: true,
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
placeholder: ['开始日期', '结束日期'],
},
},
];