FlowModal.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React, { useEffect } from 'react';
  2. import { Modal, Input, Table, Select, Form, Radio } from 'antd';
  3. import FlowDetail from './FlowDetail.json';
  4. const { Option } = Select;
  5. function FlowModal(props) {
  6. const { visible, onCancel, onOk, projectList, loading } = props;
  7. const [form] = Form.useForm();
  8. const formLayout = { labelCol: { span: 4 }, wrapperCol: { span: 14 } };
  9. const handleOk = async () => {
  10. let fieldsValue = await form.validateFields();
  11. onOk({
  12. ...fieldsValue,
  13. ...FlowDetail,
  14. project_id: Number(fieldsValue.project_id)
  15. });
  16. };
  17. useEffect(() => {
  18. if (visible) form.resetFields();
  19. }, [visible]);
  20. return (
  21. <Modal
  22. confirmLoading={loading}
  23. destroyOnClose
  24. title="流程"
  25. visible={visible}
  26. onCancel={onCancel}
  27. onOk={handleOk}
  28. >
  29. <Form {...formLayout} form={form}>
  30. <Form.Item label="流程名称" name="name">
  31. <Input />
  32. </Form.Item>
  33. <Form.Item label="所属项目" name="project_id">
  34. <Select
  35. showSearch
  36. filterOption={(input, option) => option.children.join("").toLowerCase().includes(input.toLowerCase())}
  37. >
  38. {projectList.map(item => (
  39. <Option key={item.id}>{item.project_full_code}({item.project_name})</Option>
  40. ))}
  41. </Select>
  42. </Form.Item>
  43. </Form>
  44. </Modal>
  45. );
  46. }
  47. export default FlowModal;