diff --git a/apps/web-antd/src/utils/TimeUtils.ts b/apps/web-antd/src/utils/date.ts similarity index 67% rename from apps/web-antd/src/utils/TimeUtils.ts rename to apps/web-antd/src/utils/date.ts index 3d3ab4554..c2704e1dd 100644 --- a/apps/web-antd/src/utils/TimeUtils.ts +++ b/apps/web-antd/src/utils/date.ts @@ -1,7 +1,10 @@ import dayjs from 'dayjs'; +// TODO @芋艿:后续整理下 + +// TODO @puhui999:转成 function 方式哈 /** 时间段选择器拓展 */ -export const rangePickerExtend = () => { +export const getRangePickerDefaultProps = () => { return { showTime: { format: 'HH:mm:ss', @@ -10,28 +13,22 @@ export const rangePickerExtend = () => { dayjs('23:59:59', 'HH:mm:ss'), ], }, - // 如果需要10位时间戳(秒级)可以使用 valueFormat: 'X' valueFormat: 'YYYY-MM-DD HH:mm:ss', - format: 'YYYY-MM-DD HH:mm:ss', // 显示格式 + format: 'YYYY-MM-DD HH:mm:ss', placeholder: ['开始时间', '结束时间'], ranges: { - 今天: [dayjs().startOf('day'), dayjs().endOf('day')], - - 昨天: [ + '今天': [dayjs().startOf('day'), dayjs().endOf('day')], + '昨天': [ dayjs().subtract(1, 'day').startOf('day'), dayjs().subtract(1, 'day').endOf('day'), ], - - 本周: [dayjs().startOf('week'), dayjs().endOf('day')], - - 本月: [dayjs().startOf('month'), dayjs().endOf('day')], - - 最近7天: [ + '本周': [dayjs().startOf('week'), dayjs().endOf('day')], + '本月': [dayjs().startOf('month'), dayjs().endOf('day')], + '最近 7 天': [ dayjs().subtract(7, 'day').startOf('day'), dayjs().endOf('day'), ], - - 最近30天: [ + '最近 30 天': [ dayjs().subtract(30, 'day').startOf('day'), dayjs().endOf('day'), ], diff --git a/apps/web-antd/src/views/system/mail/log/data.ts b/apps/web-antd/src/views/system/mail/log/data.ts index 8a0bcafa3..100fd894d 100644 --- a/apps/web-antd/src/views/system/mail/log/data.ts +++ b/apps/web-antd/src/views/system/mail/log/data.ts @@ -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, }, }, diff --git a/apps/web-antd/src/views/system/mail/template/data.ts b/apps/web-antd/src/views/system/mail/template/data.ts index 88145e4a8..c16224b91 100644 --- a/apps/web-antd/src/views/system/mail/template/data.ts +++ b/apps/web-antd/src/views/system/mail/template/data.ts @@ -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, }, }, diff --git a/apps/web-antd/src/views/system/notify/message/data.ts b/apps/web-antd/src/views/system/notify/message/data.ts index 2938ac140..3249e23e7 100644 --- a/apps/web-antd/src/views/system/notify/message/data.ts +++ b/apps/web-antd/src/views/system/notify/message/data.ts @@ -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, }, }, diff --git a/apps/web-antd/src/views/system/notify/template/data.ts b/apps/web-antd/src/views/system/notify/template/data.ts index 6dfa55299..a64123cc6 100644 --- a/apps/web-antd/src/views/system/notify/template/data.ts +++ b/apps/web-antd/src/views/system/notify/template/data.ts @@ -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(), }, }, ]; diff --git a/apps/web-antd/src/views/system/role/data.ts b/apps/web-antd/src/views/system/role/data.ts index a7c73e29f..9ab94d72b 100644 --- a/apps/web-antd/src/views/system/role/data.ts +++ b/apps/web-antd/src/views/system/role/data.ts @@ -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(), }, }, ]; diff --git a/apps/web-antd/src/views/system/sms/channel/data.ts b/apps/web-antd/src/views/system/sms/channel/data.ts index cb9e28306..206659903 100644 --- a/apps/web-antd/src/views/system/sms/channel/data.ts +++ b/apps/web-antd/src/views/system/sms/channel/data.ts @@ -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(), }, }, ]; diff --git a/apps/web-antd/src/views/system/sms/log/data.ts b/apps/web-antd/src/views/system/sms/log/data.ts index ee7ec4d1b..a71fba710 100644 --- a/apps/web-antd/src/views/system/sms/log/data.ts +++ b/apps/web-antd/src/views/system/sms/log/data.ts @@ -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(), }, }, ]; diff --git a/apps/web-antd/src/views/system/sms/template/data.ts b/apps/web-antd/src/views/system/sms/template/data.ts index 7cda7098e..f8c41c9f2 100644 --- a/apps/web-antd/src/views/system/sms/template/data.ts +++ b/apps/web-antd/src/views/system/sms/template/data.ts @@ -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, }, }, diff --git a/apps/web-antd/src/views/system/tenant/data.ts b/apps/web-antd/src/views/system/tenant/data.ts index 30d691ccf..1b1f98707 100644 --- a/apps/web-antd/src/views/system/tenant/data.ts +++ b/apps/web-antd/src/views/system/tenant/data.ts @@ -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, }, }, diff --git a/apps/web-antd/src/views/system/tenantPackage/data.ts b/apps/web-antd/src/views/system/tenantPackage/data.ts index 8b4bcce43..b79891102 100644 --- a/apps/web-antd/src/views/system/tenantPackage/data.ts +++ b/apps/web-antd/src/views/system/tenantPackage/data.ts @@ -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, }, }, diff --git a/apps/web-antd/src/views/system/user/data.ts b/apps/web-antd/src/views/system/user/data.ts index ffae08ef4..4ec431372 100644 --- a/apps/web-antd/src/views/system/user/data.ts +++ b/apps/web-antd/src/views/system/user/data.ts @@ -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: ['开始日期', '结束日期'], }, }, ];