|  | @@ -1,9 +1,12 @@
 | 
	
		
			
				|  |  |  import { queryMandate } from '@/services/SmartOps';
 | 
	
		
			
				|  |  | -import { useRequest } from '@umijs/max';
 | 
	
		
			
				|  |  | +import { UnityAction } from '@/utils/utils';
 | 
	
		
			
				|  |  | +import { connect, useRequest } from '@umijs/max';
 | 
	
		
			
				|  |  |  import {
 | 
	
		
			
				|  |  |    Button,
 | 
	
		
			
				|  |  | +  Checkbox,
 | 
	
		
			
				|  |  |    Col,
 | 
	
		
			
				|  |  |    ConfigProvider,
 | 
	
		
			
				|  |  | +  DatePicker,
 | 
	
		
			
				|  |  |    Divider,
 | 
	
		
			
				|  |  |    Form,
 | 
	
		
			
				|  |  |    Input,
 | 
	
	
		
			
				|  | @@ -15,7 +18,6 @@ import {
 | 
	
		
			
				|  |  |  } from 'antd';
 | 
	
		
			
				|  |  |  import dayjs from 'dayjs';
 | 
	
		
			
				|  |  |  import { useEffect, useState } from 'react';
 | 
	
		
			
				|  |  | -import styles from '../Popup/index.less';
 | 
	
		
			
				|  |  |  import {
 | 
	
		
			
				|  |  |    MandateClass,
 | 
	
		
			
				|  |  |    MandateStatus,
 | 
	
	
		
			
				|  | @@ -24,17 +26,38 @@ import {
 | 
	
		
			
				|  |  |    OrderType,
 | 
	
		
			
				|  |  |    ignoreReason,
 | 
	
		
			
				|  |  |  } from '../constent';
 | 
	
		
			
				|  |  | +import styles from './MandateDetail.less';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import zhCN from 'antd/es/locale/zh_CN';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const MandateDetail = (props) => {
 | 
	
		
			
				|  |  | -  const { projectID, mandateID, userList } = props;
 | 
	
		
			
				|  |  | +  const {
 | 
	
		
			
				|  |  | +    projectID,
 | 
	
		
			
				|  |  | +    mandateID,
 | 
	
		
			
				|  |  | +    userList,
 | 
	
		
			
				|  |  | +    ignoreTask,
 | 
	
		
			
				|  |  | +    dispatchTask,
 | 
	
		
			
				|  |  | +    autoHandleTask,
 | 
	
		
			
				|  |  | +    dispatch,
 | 
	
		
			
				|  |  | +  } = props;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  useEffect(() => {
 | 
	
		
			
				|  |  | +    if (userList.length === 0) {
 | 
	
		
			
				|  |  | +      dispatch({
 | 
	
		
			
				|  |  | +        type: 'taskUser/fetchUserList',
 | 
	
		
			
				|  |  | +        payload: { project_id: projectID },
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }, []);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    const [mandateDetail, setMandateDetail] = useState();
 | 
	
		
			
				|  |  |    const [mandateChild, setMandateChild] = useState([]);
 | 
	
		
			
				|  |  |    const [handledWorkOrder, setHandledWorkOrder] = useState([]);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    const [ignoreModalOpen, setIgnoreModalOpen] = useState(false);
 | 
	
		
			
				|  |  |    const [autoHandleModalOpen, setAutoHandleModalOpen] = useState(false);
 | 
	
		
			
				|  |  | +  const [mandateSelectModalOpen, setMandateSelectModalOpen] = useState(false);
 | 
	
		
			
				|  |  | +  const [selectedTask, setSelectedTask] = useState([]);
 | 
	
		
			
				|  |  |    const [dispatchModalOpen, setDispatchModalOpen] = useState(false);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    const columns = [
 | 
	
	
		
			
				|  | @@ -86,40 +109,84 @@ const MandateDetail = (props) => {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const onIgnoreClick = () => {
 | 
	
		
			
				|  |  | -    setIgnoreModalOpen(true);
 | 
	
		
			
				|  |  | -  };
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  const onDispatchClick = () => {
 | 
	
		
			
				|  |  | -    setDispatchModalOpen(true);
 | 
	
		
			
				|  |  | +  // 打开指定弹窗
 | 
	
		
			
				|  |  | +  const openSpecifiedModal = (type) => {
 | 
	
		
			
				|  |  | +    switch (type) {
 | 
	
		
			
				|  |  | +      case 'ignore':
 | 
	
		
			
				|  |  | +        setIgnoreModalOpen(true);
 | 
	
		
			
				|  |  | +        break;
 | 
	
		
			
				|  |  | +      case 'manual':
 | 
	
		
			
				|  |  | +        console.log('manual');
 | 
	
		
			
				|  |  | +        break;
 | 
	
		
			
				|  |  | +      case 'auto':
 | 
	
		
			
				|  |  | +        setAutoHandleModalOpen(true);
 | 
	
		
			
				|  |  | +        break;
 | 
	
		
			
				|  |  | +      case 'dispatch':
 | 
	
		
			
				|  |  | +        setMandateSelectModalOpen(true);
 | 
	
		
			
				|  |  | +        break;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const onAutoHandleClick = () => {
 | 
	
		
			
				|  |  | -    setAutoHandleModalOpen(true);
 | 
	
		
			
				|  |  | +  // 忽略
 | 
	
		
			
				|  |  | +  const onIgnoreConfirm = async (reason) => {
 | 
	
		
			
				|  |  | +    const result = await ignoreTask(mandateID, reason);
 | 
	
		
			
				|  |  | +    if (result) {
 | 
	
		
			
				|  |  | +      setIgnoreModalOpen(false);
 | 
	
		
			
				|  |  | +      getMandateInfo({ mandate_id: mandateID });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const onManualHandleClick = () => {
 | 
	
		
			
				|  |  | -    console.log('manual handle click');
 | 
	
		
			
				|  |  | +  const onAutoHandleConfirm = async (pw) => {
 | 
	
		
			
				|  |  | +    const result = await autoHandleTask(pw, mandateDetail);
 | 
	
		
			
				|  |  | +    if (result) {
 | 
	
		
			
				|  |  | +      setAutoHandleModalOpen(false);
 | 
	
		
			
				|  |  | +      getMandateInfo({ mandate_id: mandateID });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const onIgnoreConfirm = (text) => {
 | 
	
		
			
				|  |  | -    console.log(text);
 | 
	
		
			
				|  |  | -    // 调用ignore
 | 
	
		
			
				|  |  | -    setIgnoreModalOpen(false);
 | 
	
		
			
				|  |  | +  const onManualHandleConfirm = () => {
 | 
	
		
			
				|  |  | +    console.log('manual handle Confirm');
 | 
	
		
			
				|  |  |    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const onAutoHandleConfirm = (text) => {
 | 
	
		
			
				|  |  | -    console.log(text);
 | 
	
		
			
				|  |  | -    setAutoHandleModalOpen(false);
 | 
	
		
			
				|  |  | +  const onMandateSelected = (records) => {
 | 
	
		
			
				|  |  | +    // 打开派单Form弹窗将选中的任务进行派遣
 | 
	
		
			
				|  |  | +    if (records?.length === 0) {
 | 
	
		
			
				|  |  | +      message.warning('请先选择要派遣的任务');
 | 
	
		
			
				|  |  | +      return;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    setSelectedTask(records);
 | 
	
		
			
				|  |  | +    setDispatchModalOpen(true);
 | 
	
		
			
				|  |  |    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const onManualHandleConfirm = () => {
 | 
	
		
			
				|  |  | -    console.log('manual handle Confirm');
 | 
	
		
			
				|  |  | +  const onDispatchConfirm = async (value) => {
 | 
	
		
			
				|  |  | +    const params = {
 | 
	
		
			
				|  |  | +      ...value,
 | 
	
		
			
				|  |  | +      m_id: Number(mandateID),
 | 
	
		
			
				|  |  | +      mc_id: selectedTask.join(),
 | 
	
		
			
				|  |  | +      plan_end_time: dayjs(value.plan_end_time).format('YYYY-MM-DD HH:mm:ss'),
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +    if (params.type === 5) {
 | 
	
		
			
				|  |  | +      if (params.mc_id.split(',').length > 1) {
 | 
	
		
			
				|  |  | +        message.warning('加药工单不可批量派遣');
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      params.note = `${
 | 
	
		
			
				|  |  | +        mandateChild.find((mandate) => mandate.Id === Number(params.mc_id))
 | 
	
		
			
				|  |  | +          ?.Content
 | 
	
		
			
				|  |  | +      } ${params?.note || ''}`;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    const result = await dispatchTask(params);
 | 
	
		
			
				|  |  | +    if (result) {
 | 
	
		
			
				|  |  | +      setDispatchModalOpen(false);
 | 
	
		
			
				|  |  | +      getMandateInfo({ mandate_id: mandateID });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const onDispatchConfirm = () => {
 | 
	
		
			
				|  |  | -    console.log('ignore Confirm');
 | 
	
		
			
				|  |  | -    setDispatchModalOpen(false);
 | 
	
		
			
				|  |  | +  const openWorkOrderModal = (record) => {
 | 
	
		
			
				|  |  | +    UnityAction.sendMsg(
 | 
	
		
			
				|  |  | +      'OpenWorkOrderModal',
 | 
	
		
			
				|  |  | +      `/task-manage/pop/work-order/${projectID}?order_id=${record.Id}&order_type=${record.RecordType.value}`,
 | 
	
		
			
				|  |  | +    );
 | 
	
		
			
				|  |  |    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    useEffect(() => {
 | 
	
	
		
			
				|  | @@ -146,7 +213,7 @@ const MandateDetail = (props) => {
 | 
	
		
			
				|  |  |              任务时间:{mandateDetail?.CreateTime || '-'}
 | 
	
		
			
				|  |  |            </Col>
 | 
	
		
			
				|  |  |            <Col className={styles.fontS24}>
 | 
	
		
			
				|  |  | -            任务类别:{mandateDetail?.MandateClass.label || '-'}
 | 
	
		
			
				|  |  | +            任务类别:{mandateDetail?.MandateClass?.label || '-'}
 | 
	
		
			
				|  |  |            </Col>
 | 
	
		
			
				|  |  |          </Row>
 | 
	
		
			
				|  |  |          <Row>
 | 
	
	
		
			
				|  | @@ -185,7 +252,12 @@ const MandateDetail = (props) => {
 | 
	
		
			
				|  |  |                </Row>
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |              <Divider type="vertical" style={{ height: '40px' }} />
 | 
	
		
			
				|  |  | -            <div className={styles.rightButton}>查看工单</div>
 | 
	
		
			
				|  |  | +            <div
 | 
	
		
			
				|  |  | +              className={styles.rightButton}
 | 
	
		
			
				|  |  | +              onClick={() => openWorkOrderModal(item)}
 | 
	
		
			
				|  |  | +            >
 | 
	
		
			
				|  |  | +              查看工单
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  |          );
 | 
	
		
			
				|  |  |        })}
 | 
	
	
		
			
				|  | @@ -195,33 +267,42 @@ const MandateDetail = (props) => {
 | 
	
		
			
				|  |  |            <Button
 | 
	
		
			
				|  |  |              className={styles.footerBtn}
 | 
	
		
			
				|  |  |              shape="round"
 | 
	
		
			
				|  |  | -            onClick={onIgnoreClick}
 | 
	
		
			
				|  |  | +            onClick={() => {
 | 
	
		
			
				|  |  | +              openSpecifiedModal('ignore');
 | 
	
		
			
				|  |  | +            }}
 | 
	
		
			
				|  |  |            >
 | 
	
		
			
				|  |  |              忽略
 | 
	
		
			
				|  |  |            </Button>
 | 
	
		
			
				|  |  |            <Button
 | 
	
		
			
				|  |  |              className={styles.footerBtn}
 | 
	
		
			
				|  |  |              shape="round"
 | 
	
		
			
				|  |  | -            onClick={onManualHandleClick}
 | 
	
		
			
				|  |  | +            onClick={() => {
 | 
	
		
			
				|  |  | +              openSpecifiedModal('manual');
 | 
	
		
			
				|  |  | +            }}
 | 
	
		
			
				|  |  |            >
 | 
	
		
			
				|  |  |              手动处理
 | 
	
		
			
				|  |  |            </Button>
 | 
	
		
			
				|  |  |            <Button
 | 
	
		
			
				|  |  |              className={styles.footerBtn}
 | 
	
		
			
				|  |  |              shape="round"
 | 
	
		
			
				|  |  | -            onClick={onAutoHandleClick}
 | 
	
		
			
				|  |  | +            onClick={() => {
 | 
	
		
			
				|  |  | +              openSpecifiedModal('auto');
 | 
	
		
			
				|  |  | +            }}
 | 
	
		
			
				|  |  |            >
 | 
	
		
			
				|  |  |              自动处理
 | 
	
		
			
				|  |  |            </Button>
 | 
	
		
			
				|  |  |            <Button
 | 
	
		
			
				|  |  |              className={styles.footerBtn}
 | 
	
		
			
				|  |  |              shape="round"
 | 
	
		
			
				|  |  | -            onClick={onDispatchClick}
 | 
	
		
			
				|  |  | +            onClick={() => {
 | 
	
		
			
				|  |  | +              openSpecifiedModal('dispatch');
 | 
	
		
			
				|  |  | +            }}
 | 
	
		
			
				|  |  |            >
 | 
	
		
			
				|  |  |              派单
 | 
	
		
			
				|  |  |            </Button>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |        )}
 | 
	
		
			
				|  |  | +      {/* 弹窗 */}
 | 
	
		
			
				|  |  |        <ConfigProvider locale={zhCN}>
 | 
	
		
			
				|  |  |          <IgnoreTaskModal
 | 
	
		
			
				|  |  |            open={ignoreModalOpen}
 | 
	
	
		
			
				|  | @@ -233,17 +314,32 @@ const MandateDetail = (props) => {
 | 
	
		
			
				|  |  |            onCancel={() => setAutoHandleModalOpen(false)}
 | 
	
		
			
				|  |  |            onOk={onAutoHandleConfirm}
 | 
	
		
			
				|  |  |          />
 | 
	
		
			
				|  |  | -        <DispatchModa
 | 
	
		
			
				|  |  | +        <MandateSelectModal
 | 
	
		
			
				|  |  | +          open={mandateSelectModalOpen}
 | 
	
		
			
				|  |  | +          onCancel={() => setMandateSelectModalOpen(false)}
 | 
	
		
			
				|  |  | +          selectedTask={selectedTask}
 | 
	
		
			
				|  |  | +          setSelectedTask={setSelectedTask}
 | 
	
		
			
				|  |  | +          onOk={onMandateSelected}
 | 
	
		
			
				|  |  | +          list={mandateChild}
 | 
	
		
			
				|  |  | +        />
 | 
	
		
			
				|  |  | +        <DispatchTaskModal
 | 
	
		
			
				|  |  |            open={dispatchModalOpen}
 | 
	
		
			
				|  |  | -          onCancel={() => setDispatchModalOpen(false)}
 | 
	
		
			
				|  |  | -          onOk={onDispatchConfirm}
 | 
	
		
			
				|  |  | +          userList={userList}
 | 
	
		
			
				|  |  | +          onCancel={() => {
 | 
	
		
			
				|  |  | +            setDispatchModalOpen(false);
 | 
	
		
			
				|  |  | +          }}
 | 
	
		
			
				|  |  | +          onOK={onDispatchConfirm}
 | 
	
		
			
				|  |  |          />
 | 
	
		
			
				|  |  |        </ConfigProvider>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |    );
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -export default MandateDetail;
 | 
	
		
			
				|  |  | +export default connect(({ taskUser }) => {
 | 
	
		
			
				|  |  | +  return {
 | 
	
		
			
				|  |  | +    userList: taskUser.userList,
 | 
	
		
			
				|  |  | +  };
 | 
	
		
			
				|  |  | +})(MandateDetail);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const IgnoreTaskModal = (params) => {
 | 
	
		
			
				|  |  |    const { open, onCancel, onOk } = params;
 | 
	
	
		
			
				|  | @@ -313,7 +409,7 @@ const IgnoreTaskModal = (params) => {
 | 
	
		
			
				|  |  |  const AutoHandleModal = (props) => {
 | 
	
		
			
				|  |  |    const { open, onCancel, onOk } = props;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const [automation, setAutomation] = useState('');
 | 
	
		
			
				|  |  | +  const [automation, setAutomation] = useState();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    const confirmAutoHandle = () => {
 | 
	
		
			
				|  |  |      if (automation.length) {
 | 
	
	
		
			
				|  | @@ -336,6 +432,8 @@ const AutoHandleModal = (props) => {
 | 
	
		
			
				|  |  |            <Form.Item label="口令:">
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  |                <Input
 | 
	
		
			
				|  |  | +                autoFocus
 | 
	
		
			
				|  |  | +                style={{ width: '100%' }}
 | 
	
		
			
				|  |  |                  placeholder="请输入口令"
 | 
	
		
			
				|  |  |                  onChange={(e) => {
 | 
	
		
			
				|  |  |                    setAutomation(e.target.value);
 | 
	
	
		
			
				|  | @@ -349,11 +447,139 @@ const AutoHandleModal = (props) => {
 | 
	
		
			
				|  |  |    );
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const DispatchModa = (props) => {
 | 
	
		
			
				|  |  | -  const { open, onCancel } = props;
 | 
	
		
			
				|  |  | +const MandateSelectModal = (props) => {
 | 
	
		
			
				|  |  | +  const { open, onCancel, list, onOk, selectedTask, setSelectedTask } = props;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  const [checkOptions, setCheckOptions] = useState([]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  useEffect(() => {
 | 
	
		
			
				|  |  | +    setCheckOptions(
 | 
	
		
			
				|  |  | +      list.map((mandate, index) => {
 | 
	
		
			
				|  |  | +        return {
 | 
	
		
			
				|  |  | +          label: (
 | 
	
		
			
				|  |  | +            <Row className={styles.taskCheckItem}>
 | 
	
		
			
				|  |  | +              <span
 | 
	
		
			
				|  |  | +                style={{
 | 
	
		
			
				|  |  | +                  textDecoration: `${
 | 
	
		
			
				|  |  | +                    mandate.Status === 0 ? '' : 'line-through'
 | 
	
		
			
				|  |  | +                  }`,
 | 
	
		
			
				|  |  | +                }}
 | 
	
		
			
				|  |  | +              >
 | 
	
		
			
				|  |  | +                {`${index + 1}. ${mandate.Title}为${mandate.Content}`}
 | 
	
		
			
				|  |  | +              </span>
 | 
	
		
			
				|  |  | +            </Row>
 | 
	
		
			
				|  |  | +          ),
 | 
	
		
			
				|  |  | +          value: mandate.Id,
 | 
	
		
			
				|  |  | +          disabled: mandate.Status !== 0,
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  | +    );
 | 
	
		
			
				|  |  | +  }, [list]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  const onDispatchClick = () => {
 | 
	
		
			
				|  |  | +    onOk(selectedTask);
 | 
	
		
			
				|  |  | +  };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  const handleCheckChange = (checkedValue) => {
 | 
	
		
			
				|  |  | +    setSelectedTask(checkedValue);
 | 
	
		
			
				|  |  | +  };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    return (
 | 
	
		
			
				|  |  | -    <Modal title="工单派遣" open={open} onCancel={onCancel}>
 | 
	
		
			
				|  |  | -      派单
 | 
	
		
			
				|  |  | +    <Modal
 | 
	
		
			
				|  |  | +      title={<span className={styles.fontS24}>选择任务</span>}
 | 
	
		
			
				|  |  | +      open={open}
 | 
	
		
			
				|  |  | +      onCancel={onCancel}
 | 
	
		
			
				|  |  | +      width={'95%'}
 | 
	
		
			
				|  |  | +      destroyOnClose
 | 
	
		
			
				|  |  | +      footer={[
 | 
	
		
			
				|  |  | +        <Button key="back" onClick={onCancel}>
 | 
	
		
			
				|  |  | +          取消
 | 
	
		
			
				|  |  | +        </Button>,
 | 
	
		
			
				|  |  | +        <Button key="dispatch" type="primary" onClick={onDispatchClick}>
 | 
	
		
			
				|  |  | +          派单
 | 
	
		
			
				|  |  | +        </Button>,
 | 
	
		
			
				|  |  | +      ]}
 | 
	
		
			
				|  |  | +    >
 | 
	
		
			
				|  |  | +      <Checkbox.Group
 | 
	
		
			
				|  |  | +        className={styles.taskCheckBox}
 | 
	
		
			
				|  |  | +        options={checkOptions}
 | 
	
		
			
				|  |  | +        onChange={handleCheckChange}
 | 
	
		
			
				|  |  | +      />
 | 
	
		
			
				|  |  | +    </Modal>
 | 
	
		
			
				|  |  | +  );
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const DispatchTaskModal = (props) => {
 | 
	
		
			
				|  |  | +  const { open, onCancel, onOK, userList } = props;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  const [form] = Form.useForm();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  useEffect(() => {
 | 
	
		
			
				|  |  | +    if (!open) {
 | 
	
		
			
				|  |  | +      form.resetFields();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }, [open]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  const handleDispatchConfirm = async () => {
 | 
	
		
			
				|  |  | +    const value = await form.validateFields().catch((err) =>
 | 
	
		
			
				|  |  | +      err.errorFields.forEach((item) => {
 | 
	
		
			
				|  |  | +        message.error(item.errors);
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  | +    );
 | 
	
		
			
				|  |  | +    if (!value) {
 | 
	
		
			
				|  |  | +      return;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    onOK(value);
 | 
	
		
			
				|  |  | +  };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  return (
 | 
	
		
			
				|  |  | +    <Modal
 | 
	
		
			
				|  |  | +      title={<span className={styles.fontS24}>派遣任务</span>}
 | 
	
		
			
				|  |  | +      onCancel={onCancel}
 | 
	
		
			
				|  |  | +      open={open}
 | 
	
		
			
				|  |  | +      destroyOnClose
 | 
	
		
			
				|  |  | +      style={{ padding: '20px 0' }}
 | 
	
		
			
				|  |  | +      onOk={handleDispatchConfirm}
 | 
	
		
			
				|  |  | +    >
 | 
	
		
			
				|  |  | +      <Form
 | 
	
		
			
				|  |  | +        form={form}
 | 
	
		
			
				|  |  | +        layout="horizontal"
 | 
	
		
			
				|  |  | +        labelCol={{ span: 6 }}
 | 
	
		
			
				|  |  | +        wrapperCol={{ span: 18 }}
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  | +        <Form.Item
 | 
	
		
			
				|  |  | +          label="工单类型"
 | 
	
		
			
				|  |  | +          name="type"
 | 
	
		
			
				|  |  | +          rules={[{ required: true, message: '请选择工单类型' }]}
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  | +          <Select options={OrderType} placeholder="请选择工单类型" />
 | 
	
		
			
				|  |  | +        </Form.Item>
 | 
	
		
			
				|  |  | +        <Form.Item
 | 
	
		
			
				|  |  | +          label="操作人"
 | 
	
		
			
				|  |  | +          name="operator_id"
 | 
	
		
			
				|  |  | +          rules={[{ required: true, message: '请选择操作人' }]}
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  | +          <Select
 | 
	
		
			
				|  |  | +            options={userList.map((item) => {
 | 
	
		
			
				|  |  | +              return {
 | 
	
		
			
				|  |  | +                label: item.CName,
 | 
	
		
			
				|  |  | +                value: item.ID,
 | 
	
		
			
				|  |  | +              };
 | 
	
		
			
				|  |  | +            })}
 | 
	
		
			
				|  |  | +            placeholder="请选择操作人"
 | 
	
		
			
				|  |  | +          />
 | 
	
		
			
				|  |  | +        </Form.Item>
 | 
	
		
			
				|  |  | +        <Form.Item
 | 
	
		
			
				|  |  | +          label="计划完成时间"
 | 
	
		
			
				|  |  | +          name="plan_end_time"
 | 
	
		
			
				|  |  | +          rules={[{ required: true, message: '请选择完成时间' }]}
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  | +          <DatePicker style={{ width: '100%' }} placeholder="请选择完成时间" />
 | 
	
		
			
				|  |  | +        </Form.Item>
 | 
	
		
			
				|  |  | +        <Form.Item label="备注" name="note">
 | 
	
		
			
				|  |  | +          <Input.TextArea placeholder="备注" />
 | 
	
		
			
				|  |  | +        </Form.Item>
 | 
	
		
			
				|  |  | +      </Form>
 | 
	
		
			
				|  |  |      </Modal>
 | 
	
		
			
				|  |  |    );
 | 
	
		
			
				|  |  |  };
 |