import { PlusOutlined } from '@ant-design/icons'; import { ModalForm, ProForm, ProFormDateRangePicker, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, } from '@ant-design/pro-components'; import { Button, Form, message } from 'antd'; import React from "react"; import {getTaskTreeResult, OPERATION_BUTTON_TYPE, taskPriorityList, taskStateList} from "@/app/lib/task/project/data"; import {DataType} from "@/app/lib/definitions"; import {string} from "prop-types"; const waitTime = (time: number = 100) => { return new Promise((resolve) => { setTimeout(() => { resolve(true); }, time); }); }; export type DetailModelFormProps={ itemId?: number, pPid?:number, operationId: number, description:string, handleCancel?: () => void } export type PidSelectTree= { label: string; value: number; children?: PidSelectTree[] } export const DetailModelForm: React.FC = (props) => { const [form] = Form.useForm(); function childReduce(child:DataType[]):PidSelectTree[]{ const result:PidSelectTree[] = []; child.map(data=> { const resultData:PidSelectTree = {label:data.name,value:data.id}; if (data.children){ resultData.children=childReduce(data.children); } result.push(resultData); }) return result; } return ( title={ props.operationId === OPERATION_BUTTON_TYPE.DETAIL ? "任务详情": props.operationId === OPERATION_BUTTON_TYPE.ADD?"添加任务": props.operationId === OPERATION_BUTTON_TYPE.ADD?"修改任务":'' } trigger={ } form={form} autoFocusFirstInput modalProps={{ destroyOnClose: true, onCancel: () => console.log('run'), }} // submitTimeout={2000} onFinish={async (values) => { await waitTime(2000); console.log(values.name); message.success('提交成功'); return true; }} >