71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
|
|
import { PlusOutlined } from '@ant-design/icons';
|
||
|
|
import {
|
||
|
|
ModalForm,
|
||
|
|
ProForm,
|
||
|
|
ProFormDateRangePicker,
|
||
|
|
ProFormSelect,
|
||
|
|
ProFormText,
|
||
|
|
} from '@ant-design/pro-components';
|
||
|
|
import { Button, Form, message } from 'antd';
|
||
|
|
import {DictOptionType, DictValueEnumObj} from "@/components/DictTag";
|
||
|
|
|
||
|
|
export type ListFormProps = {
|
||
|
|
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
||
|
|
onSubmit: (values: API.AreaSubWay.Line) => Promise<void>;
|
||
|
|
open: boolean;
|
||
|
|
values?: Partial<API.AreaSubWay.Line>;
|
||
|
|
jobGroupOptions?: DictOptionType[];
|
||
|
|
statusOptions?: DictValueEnumObj;
|
||
|
|
};
|
||
|
|
|
||
|
|
const waitTime = (time: number = 100) => {
|
||
|
|
return new Promise((resolve) => {
|
||
|
|
setTimeout(() => {
|
||
|
|
resolve(true);
|
||
|
|
}, time);
|
||
|
|
});
|
||
|
|
};
|
||
|
|
|
||
|
|
const SubWayEdit: React.FC<ListFormProps> = (props) => {
|
||
|
|
const [form] = Form.useForm<{ name: string; company: string }>();
|
||
|
|
|
||
|
|
const handleCancel = () => {
|
||
|
|
props.onCancel();
|
||
|
|
form.resetFields();
|
||
|
|
};
|
||
|
|
|
||
|
|
const handleFinish = async (values: Record<string, any>) => {
|
||
|
|
props.onSubmit(values as API.AreaSubWay.Line);
|
||
|
|
};
|
||
|
|
|
||
|
|
return (
|
||
|
|
<ModalForm<{
|
||
|
|
name: string;
|
||
|
|
company: string;
|
||
|
|
}>
|
||
|
|
title="新增线路"
|
||
|
|
form={form}
|
||
|
|
// layout="inline"
|
||
|
|
autoFocusFirstInput
|
||
|
|
open={props.open}
|
||
|
|
modalProps={{
|
||
|
|
destroyOnClose: true,
|
||
|
|
onCancel: () => handleCancel(),
|
||
|
|
}}
|
||
|
|
submitTimeout={2000}
|
||
|
|
onFinish={handleFinish}
|
||
|
|
>
|
||
|
|
<ProForm.Group>
|
||
|
|
<ProFormText
|
||
|
|
width="xl"
|
||
|
|
name="lineName"
|
||
|
|
label="线路名称:"
|
||
|
|
placeholder="请输入名称"
|
||
|
|
/>
|
||
|
|
</ProForm.Group>
|
||
|
|
</ModalForm>
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default SubWayEdit
|