perf: utils 统一导出

pull/91/MERGE
xingyu4j 2025-05-06 23:24:14 +08:00
parent 6ff4c3b99d
commit a5bef7d279
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,4 @@
export * from './constants';
export * from './dict';
export * from './rangePickerProps';
export * from './validator';

View File

@ -0,0 +1,41 @@
import dayjs from 'dayjs';
/** 时间段选择器拓展 */
export function getRangePickerDefaultProps() {
return {
format: 'YYYY-MM-DD HH:mm:ss',
placeholder: ['开始时间', '结束时间'],
ranges: {
: [dayjs().startOf('day'), dayjs().endOf('day')],
'最近 7 天': [
dayjs().subtract(7, 'day').startOf('day'),
dayjs().endOf('day'),
],
'最近 30 天': [
dayjs().subtract(30, 'day').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')],
},
showTime: {
defaultValue: [
dayjs('00:00:00', 'HH:mm:ss'),
dayjs('23:59:59', 'HH:mm:ss'),
],
format: 'HH:mm:ss',
},
transformDateFunc: (dates: any) => {
if (dates && dates.length === 2) {
// 格式化为后台支持的时间格式
return [dates.createTime[0], dates.createTime[1]].join(',');
}
return {};
},
valueFormat: 'YYYY-MM-DD HH:mm:ss',
};
}