|
|
@@ -52,9 +52,9 @@ import type { DisabledPersonData } from '@d8d/allin-disability-person-management
|
|
|
// 人员信息Schema - 与后端BatchAddPersonItemSchema保持一致
|
|
|
const personInfoSchema = z.object({
|
|
|
personId: z.number().int().positive('请选择人员'),
|
|
|
- joinDate: z.string().datetime('请选择有效的入职日期'),
|
|
|
+ joinDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, '请选择有效的入职日期格式(YYYY-MM-DD)'),
|
|
|
salaryDetail: z.coerce.number<number>().positive('薪资必须为正数'),
|
|
|
- leaveDate: z.string().datetime().optional(),
|
|
|
+ leaveDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, '请选择有效的离职日期格式(YYYY-MM-DD)').optional(),
|
|
|
workStatus: z.nativeEnum(WorkStatus).optional(),
|
|
|
});
|
|
|
|
|
|
@@ -64,7 +64,7 @@ const orderFormSchema = z.object({
|
|
|
platformId: z.number().int().positive('请选择平台'),
|
|
|
companyId: z.number().int().positive('请选择公司'),
|
|
|
channelId: z.number().int().positive('请选择渠道').optional(),
|
|
|
- expectedStartDate: z.string().datetime('请选择有效的开始日期').optional(),
|
|
|
+ expectedStartDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, '请选择有效的日期格式(YYYY-MM-DD)').optional(),
|
|
|
orderStatus: z.nativeEnum(OrderStatus),
|
|
|
workStatus: z.nativeEnum(WorkStatus),
|
|
|
orderPersons: z.array(personInfoSchema).min(1, '至少选择一名人员'),
|
|
|
@@ -128,12 +128,17 @@ export const OrderForm: React.FC<OrderFormProps> = ({
|
|
|
if (order && open) {
|
|
|
// 使用类型断言,因为OrderDetail可能不包含所有表单字段
|
|
|
const orderData = order as any;
|
|
|
+ // 转换日期格式:如果后端返回ISO格式,转换为YYYY-MM-DD
|
|
|
+ const expectedStartDate = orderData.expectedStartDate
|
|
|
+ ? orderData.expectedStartDate.slice(0, 10)
|
|
|
+ : undefined;
|
|
|
+
|
|
|
form.reset({
|
|
|
orderName: orderData.orderName || '',
|
|
|
platformId: orderData.platformId || 0,
|
|
|
companyId: orderData.companyId || 0,
|
|
|
channelId: orderData.channelId || undefined,
|
|
|
- expectedStartDate: orderData.expectedStartDate || undefined,
|
|
|
+ expectedStartDate,
|
|
|
orderStatus: orderData.orderStatus || OrderStatus.DRAFT,
|
|
|
workStatus: orderData.workStatus || WorkStatus.NOT_WORKING,
|
|
|
orderPersons: [],
|