CalcCheckModal.jsx 2.3 KB
Newer Older
DarkForst's avatar
DarkForst committed
1 2 3 4 5 6 7 8 9 10 11 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 81 82 83 84 85 86 87 88 89 90 91
import React, { useEffect } from 'react';
import { connect } from 'dva';
import {
  Row,
  Col,
  Form,
  Input,
  Button,
  Select,
  Switch,
  TreeSelect,
  message,
  Modal,
  Table,
  Alert,
} from 'antd';
import { dispatchHandle } from '@/utils/publicHandle';
import useUpdateEffect from '@/useHooks/useUpdateEffect';
import { render } from 'enzyme';

const CalcCheckModal = (props) => {
  const [form] = Form.useForm();
  const { dispatch } = props;
  const { TextArea } = Input;
  useUpdateEffect(() => {
    // dispatchHandle(dispatch, 'groupList/setModelsState', { userDetail: {} });
  }, [props.addVisible]);

  const validateConfirmPassword = (rule, value) => {
    const ruleName = rule.field;
    const name = 'password';
    const compareName = ruleName === name ? 'confirmPassword' : name;

    if (!value || form.getFieldValue(compareName) === value) {
      ruleName === 'confirmPassword' && form.validateFields([compareName]);
      return Promise.resolve();
    }
    return Promise.reject('密码两次输入不一致!');
  };

  const handleClose = () => {
    form.resetFields();
    props.handleClose();
  };
  const handleSubmit = (e) => {
    e.preventDefault();
  };

  const formItemLayout = {
    labelCol: { span: 4 },
    wrapperCol: { span: 18 },
  };
  const formTailLayout = {
    labelCol: { span: 8 },
    wrapperCol: { span: 12 },
  };
  const { addType, addVisible, currentModalType } = props;
  return (
    <Modal
      centered={true}
      width={800}
      title={currentModalType === 'pass' ? `通过` : `驳回`}
      visible={addVisible}
      onCancel={handleClose}
      closable={false}
    >
      <Form layout="vertical">
        <div span={24}>
          <div style={{ padding: 10, fontSize: 16, flex: 1 }}>
            <Alert
              message={
                currentModalType === 'pass'
                  ? '你确定要通过该单据的验收吗?'
                  : '你确定要驳回该单据的验收吗?'
              }
              type="info"
              showIcon
            />
          </div>
          <Form>
            <Form.Item name="a" label={currentModalType === 'pass' ? '备注' : '驳回意见'}>
              <TextArea rows="6" max={50} />
            </Form.Item>
          </Form>
        </div>
      </Form>
    </Modal>
  );
};

export default CalcCheckModal;