ProcessConfig.jsx 3.29 KB
Newer Older
邓超's avatar
邓超 committed
1
import React, { useEffect } from 'react';
邓超's avatar
邓超 committed
2
import { CMFlowGet, CMFlowPost } from '@/services/flow/flow';
邓超's avatar
邓超 committed
3 4 5 6 7 8 9 10
import { Form, Modal, Input, Radio, Select, notification } from 'antd';
const { Option } = Select;
const { TextArea } = Input;

const ProcessConfig = props => {
  const { onSubumit, handleCancel, visible, processMsg } = props;
  const [form] = Form.useForm();
  useEffect(() => {
邓超's avatar
邓超 committed
11
    form.resetFields();
邓超's avatar
邓超 committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    if (visible) {
      getFormData();
    }
  }, [visible]);
  // 获取表单回显
  const getFormData = () => {
    CMFlowGet({ flowId: processMsg.ID }).then(res => {
      if (res.code === 0) {
        form.setFieldsValue(res.data);
      }
    });
  };
  // 提交表单
  const onFinish = () => {
    form.validateFields().then(validate => {
      if (validate) {
        console.log(validate);
        CMFlowPost({ ...validate, flowId: processMsg.ID })
          .then(res => {
            if (res.code === 0) {
              notification.success({
                message: '提示',
                duration: 3,
                description: '编辑成功',
              });
              onSubumit();
            } else {
              notification.error({
                message: '提示',
                duration: 3,
                description: res.msg,
              });
            }
          })
          .catch(() => {
            notification.error({
              message: '提示',
              duration: 3,
              description: '网络异常',
            });
          });
      }
    });
  };
  return (
    <Modal
      title="流程配置"
      visible={visible}
      onOk={onFinish}
      onCancel={handleCancel}
      maskClosable={false}
    >
      <Form
        form={form}
        labelCol={{ span: 5 }}
        wrapperCol={{ span: 18 }}
        initialValues={{ remember: true }}
      >
        <Form.Item label="流程名称" name="name">
          <Input disabled />
        </Form.Item>
        <Form.Item label="流程结束" name="flowEndBehavior">
          <Radio.Group>
            <Radio value={0}>不做任何事情</Radio>
            <Radio value={1}>直接关闭事件</Radio>
            <Radio value={2}>事件转为待审核</Radio>
            <Radio value={3}>重新处理事件</Radio>
          </Radio.Group>
        </Form.Item>
81 82 83 84 85 86 87
        <Form.Item
          label="前端样式"
          name="webPage"
          initialValue="多表显示"
          rules={[{ required: true, message: '请选择前端样式' }]}
        >
          <Select placeholder="请选择前端样式">
邓超's avatar
邓超 committed
88 89 90 91 92 93 94 95 96 97 98 99 100
            <Option value="多表显示">多表显示</Option>
            <Option value="多表在办显示">多表在办显示</Option>
            <Option value="表堆叠显示">表堆叠显示</Option>
            <Option value="分派节点显示">分派节点显示</Option>
          </Select>
        </Form.Item>
        <Form.Item label="编码样式" name="coding12Checked">
          <Radio.Group>
            <Radio value={false}>GIS-2021-0000001 (前缀长度 + 13 位)</Radio>
            <Radio value>GIS000000001 (始终 12 位)</Radio>
          </Radio.Group>
        </Form.Item>
        <Form.Item label="接口配置" name="interfaceConfig">
邓超's avatar
邓超 committed
101
          <TextArea placeholder="请填写接口配置" />
邓超's avatar
邓超 committed
102 103 104 105 106 107
        </Form.Item>
      </Form>
    </Modal>
  );
};
export default ProcessConfig;