fix: getRangePickerDefaultProps

This commit is contained in:
xingyu4j
2025-10-17 15:10:23 +08:00
parent 22cf883cc4
commit a65a5d2aab
4 changed files with 53 additions and 50 deletions

View File

@@ -236,7 +236,7 @@ async function initComponentAdapter() {
'select',
{
component: ElTreeSelect,
// TODO @xingyu这里要加 props: { label: 'label', children: 'children' }, vben 官方是有的
props: { label: 'label', children: 'children' },
nodeKey: 'value',
loadingSlot: 'loading',
optionsPropName: 'data',
@@ -265,8 +265,8 @@ async function initComponentAdapter() {
},
// 自定义默认按钮
DefaultButton: (props, { attrs, slots }) => {
// TODO @xingyu, type: 'info' 要加么vben5 是有的;
return h(ElButton, { ...props, attrs }, slots);
// 调整 type 为 default info 有点丑
return h(ElButton, { ...props, attrs, type: 'default' }, slots);
},
// 自定义主要按钮
PrimaryButton: (props, { attrs, slots }) => {

View File

@@ -5,8 +5,15 @@ import { $t } from '#/locales';
/** 时间段选择器拓展 */
export function getRangePickerDefaultProps() {
return {
// 显示在输入框中的格式
format: 'YYYY-MM-DD HH:mm:ss',
// 绑定值的格式。 不指定则绑定值为 Date 对象
valueFormat: 'YYYY-MM-DD HH:mm:ss',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')],
// 输入框提示文字
startPlaceholder: $t('utils.rangePicker.beginTime'),
endPlaceholder: $t('utils.rangePicker.endTime'),
// 快捷时间范围
shortcuts: [
{
text: $t('utils.rangePicker.today'),
@@ -63,16 +70,5 @@ export function getRangePickerDefaultProps() {
},
},
],
transformDateFunc: (dates: any) => {
// TODO puhui999: 没起作用后面调试再看看
if (dates && dates.length === 2) {
// 格式化为后台支持的时间格式
return [dates.createTime[0], dates.createTime[1]].join(',');
}
return {};
},
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')],
};
}