|
|
@@ -89,9 +89,17 @@ export const XunlianCodePage = () => {
|
|
|
// 处理表单提交
|
|
|
const handleSubmit = async (values: Partial<XunlianCode>) => {
|
|
|
try {
|
|
|
+ // 转换交易日期格式为ISO格式,确保不为null
|
|
|
+ const submitValues = {
|
|
|
+ ...values,
|
|
|
+ ...(values.trade_date && {
|
|
|
+ trade_date: dayjs(values.trade_date).format('YYYY-MM-DD')
|
|
|
+ })
|
|
|
+ };
|
|
|
+
|
|
|
const response = formMode === 'create'
|
|
|
- ? await XunlianCodeAPI.createXunlianCode(values)
|
|
|
- : await XunlianCodeAPI.updateXunlianCode(editingId!, values);
|
|
|
+ ? await XunlianCodeAPI.createXunlianCode(submitValues)
|
|
|
+ : await XunlianCodeAPI.updateXunlianCode(editingId!, submitValues);
|
|
|
|
|
|
message.success(formMode === 'create' ? '创建训练代码成功' : '更新训练代码成功');
|
|
|
setModalVisible(false);
|
|
|
@@ -108,7 +116,11 @@ export const XunlianCodePage = () => {
|
|
|
if (code) {
|
|
|
setFormMode('edit');
|
|
|
setEditingId(id);
|
|
|
- form.setFieldsValue(code);
|
|
|
+ // 转换交易日期格式为dayjs对象
|
|
|
+ form.setFieldsValue({
|
|
|
+ ...code,
|
|
|
+ trade_date: code.trade_date ? dayjs(code.trade_date) : null
|
|
|
+ });
|
|
|
setModalVisible(true);
|
|
|
}
|
|
|
};
|