diff --git a/src/components/DetailForm/index.js b/src/components/DetailForm/index.js index 80d30fb..cd54d05 100644 --- a/src/components/DetailForm/index.js +++ b/src/components/DetailForm/index.js @@ -14,13 +14,14 @@ import "./index.css" import {addTask} from "../../utils"; import {useNavigate, useOutletContext} from "react-router-dom"; export default () => { + // 设置标题栏 const {setTitle} = useOutletContext(); setTitle("添加任务") + // 路由 + const navigate = useNavigate(); + // 获取form引用 const [form] = Form.useForm(); const onFinish = (values) => { - // Dialog.alert({ - // content:
{JSON.stringify(values, null, 2)}, - // }) console.log("提交:",values) if (values.pidArray===undefined){ values.pid='0' @@ -28,9 +29,29 @@ export default () => { values.pid=values.pidArray[values.pidArray.length-1]; } addTask(values).then(values=>{ - Dialog.alert({ - content: '添加任务成功' + values.data, - onConfirm:()=>{} + Dialog.show({ + content: `添加任务${values.name}成功`, + closeOnAction:true, + actions: [ + [ + { + key: 'back', + text: '回到列表', + onClick:()=>{ + navigate("/home/listTask") + } + }, + { + key: 'create', + text: '创建下一条', + onClick:()=>{ + // 清空值 + form.resetFields(); + form.setFieldValue("pidArray",values.pidArray); + } + }, + ], + ], }) }) } @@ -65,11 +86,10 @@ export default () => {