fix: 修复保洁订单结束时间能早于开始时间bug

This commit is contained in:
fyy 2025-07-15 10:58:17 +08:00
parent f0f0cc6746
commit 8dee11802e

View File

@ -4,7 +4,7 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
import { resident_unitList } from '#/api/property/resident/unit'; import { resident_unitList } from '#/api/property/resident/unit';
import { useCleanStore } from '#/store'; import { useCleanStore } from '#/store';
import type { FormSchema } from '../../../../../../../packages/@core/ui-kit/form-ui/src/types'; import type { FormSchema } from '../../../../../../../packages/@core/ui-kit/form-ui/src/types';
import dayjs from 'dayjs';
const cleanStore = useCleanStore(); const cleanStore = useCleanStore();
export const querySchema: (areaList: any[]) => FormSchema[] = (areaList) => [ export const querySchema: (areaList: any[]) => FormSchema[] = (areaList) => [
@ -163,12 +163,21 @@ export const modalSchema: FormSchemaGetter = () => [
label: '结束时间', label: '结束时间',
fieldName: 'endTime', fieldName: 'endTime',
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: (values) => ({
showTime: true, showTime: true,
format: 'YYYY-MM-DD HH:mm:ss', format: 'YYYY-MM-DD HH:mm:ss',
placeholder: '请选择结束时间', placeholder: !values.starTime?'请先选择开始时间':`请选择结束时间(结束时间不能早于开始时间)`,
disabled: !values.starTime, // 没选开始时间时禁用
disabledDate: (current:any) => {
if (!values.starTime) return false;
// 只允许选择大于等于开始时间的日期
return current && current < dayjs(values.starTime).startOf('second');
}, },
}),
rules: 'required', rules: 'required',
dependencies: {
triggerFields: ['starTime'],
},
}, },
{ {
label: '申请人', label: '申请人',