Browse Source

react升级 项目列表审核列表

XuZinan 2 years ago
parent
commit
fb098d5c67

+ 108 - 106
src/pages/PurchaseAdmin/PurchaseList/Approval/ApprovalModal.js

@@ -13,7 +13,6 @@ function AddModal(props) {
     visible,
     onClose,
     onOk,
-    form,
     data,
     currentUser,
     depUserTree,
@@ -23,6 +22,7 @@ function AddModal(props) {
     disabled,
     loading,
   } = props;
+  const [form] = Form.useForm();
   const [codes, setCodes] = useState({
     type: '',
     industry: '',
@@ -33,8 +33,7 @@ function AddModal(props) {
   const [type, setType] = useState({});
 
   const handleOk = () => {
-    form.validateFields((err, fieldsValue) => {
-      if (err) return;
+    form.validateFields().then(fieldsValue => {
       let values = { ...fieldsValue, id: data.id };
       values.project_name = fieldsValue.project_name;
       values.flow_id = Number(fieldsValue.flow_id);
@@ -50,8 +49,8 @@ function AddModal(props) {
         values.project_full_code = `${codes.type}${codes.industry}${codes.location}${codes.name}${codes.version}`;
       }
       if (fieldsValue.author) {
-        values.author = Number(fieldsValue.author.split("||")[0]);
-        values.author_dep_id = Number(fieldsValue.author.split("||")[1]);
+        values.author = Number(fieldsValue.author.split('||')[0]);
+        values.author_dep_id = Number(fieldsValue.author.split('||')[1]);
       } else {
         values.author = null;
       }
@@ -146,68 +145,67 @@ function AddModal(props) {
     });
   };
 
-  const onChangeManager = (e) => {
+  const onChangeManager = e => {
     console.log(e);
   };
 
   const renderDetail = () => {
     return (
       <>
-        <Form.Item label="行业名称">
-          {form.getFieldDecorator('industry_id', {
-            initialValue: String(data.industry_id || ''),
-            rules: [{ required: true, message: '请选择行业名称' }],
-          })(
-            <Select style={{ width: '100%' }} onChange={changeIndustry}>
-              {industryList.map(item => (
-                <Option key={item.id}>
-                  {item.name}({item.code})
-                </Option>
-              ))}
-            </Select>
-          )}
+        <Form.Item
+          label="行业名称"
+          name="industry_id"
+          initialValue={String(data.industry_id || '')}
+          rules={[{ required: true, message: '请选择行业名称' }]}
+        >
+          <Select style={{ width: '100%' }} onChange={changeIndustry}>
+            {industryList.map(item => (
+              <Option key={item.id}>
+                {item.name}({item.code})
+              </Option>
+            ))}
+          </Select>
         </Form.Item>
-        <Form.Item label="项目地区">
-          {form.getFieldDecorator('location', {
-            initialValue: data.location,
-            rules: [{ required: true, message: '请选择项目地区' }],
-          })(
-            <TreeSelect
-              dropdownStyle={{ maxHeight: 300, overflow: 'auto' }}
-              onChange={changeLocation}
-            >
-              {renderTreeNodes(provinces)}
-            </TreeSelect>
-          )}
+        <Form.Item
+          label="项目地区"
+          name="location"
+          initialValue={data.location}
+          rules={[{ required: true, message: '请选择项目地区' }]}
+        >
+          <TreeSelect
+            dropdownStyle={{ maxHeight: 300, overflow: 'auto' }}
+            onChange={changeLocation}
+          >
+            {renderTreeNodes(provinces)}
+          </TreeSelect>
         </Form.Item>
-        <Form.Item label="项目简称">
-          {form.getFieldDecorator('name', {
-            initialValue: data.name,
-            rules: [
-              { required: true, message: '请输入项目简称' },
-              {
-                validator: (rule, value, callback) => {
-                  if (value.match(/[^A-Za-z]/g)) {
-                    callback('项目简称只能是英文字符');
-                  } else {
-                    callback();
-                  }
-                },
+        <Form.Item
+          label="项目简称"
+          name="name"
+          initialValue={data.name}
+          rules={[
+            { required: true, message: '请输入项目简称' },
+            {
+              validator: (rule, value, callback) => {
+                if (value.match(/[^A-Za-z]/g)) callback('项目简称只能是英文字符');
+                else callback();
               },
-            ],
-          })(<Input maxLength={3} onBlur={onBlurName} />)}
+            },
+          ]}
+        >
+          <Input maxLength={3} onBlur={onBlurName} />
         </Form.Item>
-        <Form.Item label="项目期数">
-          {form.getFieldDecorator('version', {
-            initialValue: data.version,
-            rules: [{ required: true, message: '请选择项目期数' }],
-          })(
-            <Select style={{ width: '100%' }} onChange={changeVersion}>
-              {['一期', '二期', '三期', '四期', '五期'].map((item, index) => (
-                <Option key={index + 1}>{item}</Option>
-              ))}
-            </Select>
-          )}
+        <Form.Item
+          label="项目期数"
+          name="version"
+          initialValue={data.version}
+          rules={[{ required: true, message: '请选择项目期数' }]}
+        >
+          <Select style={{ width: '100%' }} onChange={changeVersion}>
+            {['一期', '二期', '三期', '四期', '五期'].map((item, index) => (
+              <Option key={index + 1}>{item}</Option>
+            ))}
+          </Select>
         </Form.Item>
         <Form.Item label="项目编号">
           {codes.type || '***'}-{codes.industry || '***'}-{codes.location || '***'}-
@@ -261,59 +259,63 @@ function AddModal(props) {
       onCancel={onClose}
       onOk={handleOk}
     >
-      <Form labelCol={{ span: 5 }} wrapperCol={{ span: 15 }}>
-        <Form.Item label="项目名称">
-          {form.getFieldDecorator('project_name', {
-            initialValue: String(data.project_name || ''),
-            rules: [{ required: true, message: '请输入项目名称' }],
-          })(<Input style={{ width: '100%' }} />)}
+      <Form labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} form={form}>
+        <Form.Item
+          label="项目名称"
+          name="project_name"
+          initialValue={String(data.project_name || '')}
+          rules={[{ required: true, message: '请输入项目名称' }]}
+        >
+          <Input style={{ width: '100%' }} />
         </Form.Item>
-        <Form.Item label="项目类别">
-          {form.getFieldDecorator('type_id', {
-            initialValue: String(data.type_id || ''),
-            rules: [{ required: true, message: '请选择项目类别' }],
-          })(
-            <Select style={{ width: '100%' }} onChange={changeType}>
-              {typeList.map(item => (
-                <Option key={item.id}>
-                  {item.name}({item.code})
-                </Option>
-              ))}
-            </Select>
-          )}
+        <Form.Item
+          label="项目类别"
+          name="type_id"
+          initialValue={String(data.type_id || '')}
+          rules={[{ required: true, message: '请选择项目类别' }]}
+        >
+          <Select style={{ width: '100%' }} onChange={changeType}>
+            {typeList.map(item => (
+              <Option key={item.id}>
+                {item.name}({item.code})
+              </Option>
+            ))}
+          </Select>
         </Form.Item>
-        <Form.Item label="流程">
-          {form.getFieldDecorator('flow_id', {
-            initialValue: String(data.flow_id || ''),
-            rules: [{ required: true, message: '请选择流程' }],
-          })(
-            <Select style={{ width: '100%' }} disabled>
-              {flowList
-                .filter(item => item && item.id != 2 && item.id != 3)
-                .map(item => (
-                  <Option key={item.id}>{item.name}</Option>
-                ))}
-            </Select>
-          )}
+        <Form.Item
+          label="流程"
+          name="flow_id"
+          initialValue={String(data.flow_id || '')}
+          rules={[{ required: true, message: '请选择流程' }]}
+        >
+          <Select style={{ width: '100%' }} disabled>
+            {flowList
+              .filter(item => item && item.id != 2 && item.id != 3)
+              .map(item => (
+                <Option key={item.id}>{item.name}</Option>
+              ))}
+          </Select>
         </Form.Item>
         {currentUser.IsSuper && (
-          <Form.Item label="售前经理">
-            {form.getFieldDecorator('author', {
-              initialValue: String((data.author && data.author_dep_id) ? `${data.author}||${data.author_dep_id}` : '')
-            })(
-              <TreeSelect
-                showSearch
-                allowClear
-                style={{ width: '100%' }}
-                multiple={false}
-                filterTreeNode={(input, option) => {
-                  return option.props.title === input;
-                }}
-                onChange={onChangeManager}
-              >
-                {renderUserSelectTreeNodes(depUserTree)}
-              </TreeSelect>
+          <Form.Item
+            label="售前经理"
+            name="author"
+            initialValue={String(
+              data.author && data.author_dep_id ? `${data.author}||${data.author_dep_id}` : ''
             )}
+          >
+            <TreeSelect
+              showSearch
+              allowClear
+              style={{ width: '100%' }}
+              multiple={false}
+              filterTreeNode={(input, option) => {
+                return option.props.title === input;
+              }}
+              onChange={onChangeManager}
+            >
+              {renderUserSelectTreeNodes(depUserTree)}
+            </TreeSelect>
           </Form.Item>
         )}
         {type?.id != 7 && renderDetail()}
@@ -321,4 +323,4 @@ function AddModal(props) {
     </Modal>
   );
 }
-export default Form.create()(AddModal);
+export default AddModal;

+ 37 - 50
src/pages/PurchaseAdmin/PurchaseList/Approval/Auth.js

@@ -30,17 +30,8 @@ const STATUS = [
 ];
 
 function Auth(props) {
-  const {
-    industryList,
-    typeList,
-    data,
-    flowList,
-    currentUser,
-    depRole,
-    dispatch,
-    loading,
-    form,
-  } = props;
+  const { industryList, typeList, data, flowList, currentUser, depRole, dispatch, loading } = props;
+  const [form] = Form.useForm();
   const [visible, setVisible] = useState(false);
   const [detailVisible, setDetailVisible] = useState(false);
   const [rejectVisible, setRejectVisible] = useState(false);
@@ -90,7 +81,7 @@ function Auth(props) {
       render: project_status => {
         // return project_status === 0 ? <>售前</> : <>转执行</>;
         //若添加其他状态则启用以下switch case:
-        switch (project_status){
+        switch (project_status) {
           case 0:
             return <>售前</>;
           case 1:
@@ -98,7 +89,7 @@ function Auth(props) {
           case 2:
             return <>转运营</>;
           case 3:
-            return <>转质保</>
+            return <>转质保</>;
         }
       },
     },
@@ -243,50 +234,46 @@ function Auth(props) {
   };
 
   const handleSearch = () => {
-    form.validateFields((error, { projectName, projectCode, projectStatus }) => {
-      // console.log(error,values);
-      let params = {};
-      params.project_name = projectName;
-      params.project_code = projectCode?.toUpperCase();
-      params.project_status = projectStatus;
+    const { projectName, projectCode, projectStatus } = form.getFieldsValue();
+    // console.log(error,values);
+    let params = {};
+    params.project_name = projectName;
+    params.project_code = projectCode?.toUpperCase();
+    params.project_status = projectStatus;
 
-      dispatch({
-        type: 'approval/queryAuth',
-        payload: params,
-      });
+    dispatch({
+      type: 'approval/queryAuth',
+      payload: params,
     });
   };
 
   const renderSearch = () => {
     return (
-      <Form style={{ marginBottom: 20 }} layout="inline">
-        <Form.Item label="项目名称">
-          {form.getFieldDecorator('projectName', {
-            initialValue: null,
-          })(<Input style={{ width: 200 }}></Input>)}
+      <Form
+        style={{ marginBottom: 20 }}
+        layout="inline"
+        initialValues={{ projectName: null, projectCode: null, projectStatus: null }}
+        form={form}
+      >
+        <Form.Item label="项目名称" name="projectName">
+          <Input style={{ width: 200 }} />
         </Form.Item>
-        <Form.Item label="项目编号">
-          {form.getFieldDecorator('projectCode', {
-            initialValue: null,
-          })(<Input style={{ width: 200 }}></Input>)}
+        <Form.Item label="项目编号" name="projectCode">
+          <Input style={{ width: 200 }} />
         </Form.Item>
-        <Form.Item label="状态">
-          {form.getFieldDecorator('projectStatus', {
-            initialValue: null,
-          })(
-            <Select
-              showSearch
-              style={{ width: 120 }}
-              filterOption={(input, option) =>
-                option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
-              }
-            >
-              <Option value={null}>全部</Option>
-              {STATUS.map(item => (
-                <Option key={item.value}>{item.label}</Option>
-              ))}
-            </Select>
-          )}
+        <Form.Item label="状态" name="projectStatus">
+          <Select
+            showSearch
+            style={{ width: 120 }}
+            filterOption={(input, option) =>
+              option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
+            }
+          >
+            <Option value={null}>全部</Option>
+            {STATUS.map(item => (
+              <Option key={item.value}>{item.label}</Option>
+            ))}
+          </Select>
         </Form.Item>
         <Form.Item>
           <Button type="primary" loading={loading} onClick={handleSearch}>
@@ -356,4 +343,4 @@ export default connect(({ approval, user, loading }) => ({
   currentUser: user.currentUser,
   depRole: user.depRole,
   loading: loading.models.approval,
-}))(Form.create()(Auth));
+}))(Auth);

+ 38 - 43
src/pages/PurchaseAdmin/PurchaseList/Approval/ExecutionModal.js

@@ -1,16 +1,16 @@
 import React, { useState, useEffect } from 'react';
 import { Form, Select, Modal, Input, TreeSelect } from 'antd';
-import { connect } from 'dva'
+import { connect } from 'dva';
 const { Option } = Select;
 const { TreeNode } = TreeSelect;
 
 function ExecutionModal(props) {
-  const { visible, onOk, onClose, form, currentItem, loading, depUserTree, dispatch } = props;
+  const { visible, onOk, onClose, currentItem, loading, depUserTree, dispatch } = props;
+  const [form] = Form.useForm();
 
   const handleOk = () => {
-    form.validateFields((err, {managerID, contractStatus}) => {
-      if (err) return;
-      const [exe_manager_id,dep_id] = managerID.split("||")
+    form.validateFields().then(({ managerID, contractStatus }) => {
+      const [exe_manager_id, dep_id] = managerID.split('||');
       dispatch({
         type: 'approval/startExecution',
         payload: {
@@ -20,13 +20,13 @@ function ExecutionModal(props) {
           exe_manager_id: Number(exe_manager_id),
         },
         callback: () => onOk(),
-      })
+      });
     });
   };
 
-  const onChangeManager = (id,e) => {
-    console.log(id)
-  }
+  const onChangeManager = (id, e) => {
+    console.log(id);
+  };
 
   const renderUserSelectTreeNodes = data => {
     return data.map(item => {
@@ -64,44 +64,39 @@ function ExecutionModal(props) {
       onCancel={onClose}
       onOk={handleOk}
     >
-      <Form labelCol={{ span: 5 }} wrapperCol={{ span: 15 }}>
-        <Form.Item label="项目经理">
-          {form.getFieldDecorator('managerID', {
-            rules: [
-              {
-                required: true,
-                message: '请选择项目经理',
-              },
-            ],
-          })(
-            <TreeSelect
-              showSearch
-              allowClear
-              style={{ width: '100%' }}
-              placeholder="请选择项目经理"
-              multiple={false}
-              filterTreeNode={(input, option) => {
-                return option.props.title === input;
-              }}
-              onChange={onChangeManager}
-            >
-              {renderUserSelectTreeNodes(depUserTree)}
-            </TreeSelect>
-          )}
+      <Form labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} form={form}>
+        <Form.Item
+          label="项目经理"
+          name="managerID"
+          rules={[{ required: true, message: '请选择项目经理' }]}
+        >
+          <TreeSelect
+            showSearch
+            allowClear
+            style={{ width: '100%' }}
+            placeholder="请选择项目经理"
+            multiple={false}
+            filterTreeNode={(input, option) => {
+              return option.props.title === input;
+            }}
+            onChange={onChangeManager}
+          >
+            {renderUserSelectTreeNodes(depUserTree)}
+          </TreeSelect>
         </Form.Item>
 
-        <Form.Item label="合同状态">
-          {form.getFieldDecorator('contractStatus', {
-            rules: [{ required: true, message: '请选择合同状态' }],
-          })(
-            <Select style={{ width: '100%' }}>
-              <Option key={0}>无合同</Option>
-              <Option key={1}>有合同</Option>
-            </Select>
-          )}
+        <Form.Item
+          label="合同状态"
+          name="contractStatus"
+          rules={[{ required: true, message: '请选择合同状态' }]}
+        >
+          <Select style={{ width: '100%' }}>
+            <Option key={0}>无合同</Option>
+            <Option key={1}>有合同</Option>
+          </Select>
         </Form.Item>
       </Form>
     </Modal>
   );
 }
-export default connect()(Form.create()(ExecutionModal));
+export default connect()(ExecutionModal);

+ 33 - 39
src/pages/PurchaseAdmin/PurchaseList/Approval/List.js

@@ -40,10 +40,10 @@ function List(props) {
     currentUser,
     dispatch,
     loading,
-    form,
     depUserTree,
     member,
   } = props;
+  const [form] = Form.useForm();
   const [addVisible, setAddVisible] = useState(false);
   const [detailVisible, setDetailVisible] = useState(false);
   const [executionVisible, setExecutionVisible] = useState(false);
@@ -161,18 +161,16 @@ function List(props) {
   ];
 
   const handleSearch = () => {
-    form.validateFields((error, { projectName, projectCode, projectStatus }) => {
-      // console.log(error,values);
-      let params = {};
-      params.project_name = projectName;
-      params.project_code = projectCode?.toUpperCase();
-      params.project_status = projectStatus;
-      params.currentPage = 1;
+    const { projectName, projectCode, projectStatus } = form.getFieldsValue();
+    let params = {};
+    params.project_name = projectName;
+    params.project_code = projectCode?.toUpperCase();
+    params.project_status = projectStatus;
+    params.currentPage = 1;
 
-      dispatch({
-        type: 'approval/queryApproval',
-        payload: params,
-      });
+    dispatch({
+      type: 'approval/queryApproval',
+      payload: params,
     });
   };
 
@@ -191,34 +189,30 @@ function List(props) {
 
   const renderSearch = () => {
     return (
-      <Form layout="inline">
-        <Form.Item label="项目名称">
-          {form.getFieldDecorator('projectName', {
-            initialValue: null,
-          })(<Input style={{ width: 200 }}></Input>)}
+      <Form
+        form={form}
+        layout="inline"
+        initialValues={{ projectName: null, projectCode: null, projectStatus: null }}
+      >
+        <Form.Item label="项目名称" name="projectName">
+          <Input style={{ width: 200 }} />
         </Form.Item>
-        <Form.Item label="项目编号">
-          {form.getFieldDecorator('projectCode', {
-            initialValue: null,
-          })(<Input style={{ width: 200 }}></Input>)}
+        <Form.Item label="项目编号" name="projectCode">
+          <Input style={{ width: 200 }} />
         </Form.Item>
-        <Form.Item label="状态">
-          {form.getFieldDecorator('projectStatus', {
-            initialValue: null,
-          })(
-            <Select
-              showSearch
-              style={{ width: 120 }}
-              filterOption={(input, option) =>
-                option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
-              }
-            >
-              <Option value={null}>全部</Option>
-              {STATUS.map(item => (
-                <Option key={item.value}>{item.label}</Option>
-              ))}
-            </Select>
-          )}
+        <Form.Item label="状态" name="projectStatus">
+          <Select
+            showSearch
+            style={{ width: 120 }}
+            filterOption={(input, option) =>
+              option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
+            }
+          >
+            <Option value={null}>全部</Option>
+            {STATUS.map(item => (
+              <Option key={item.value}>{item.label}</Option>
+            ))}
+          </Select>
         </Form.Item>
         <Form.Item>
           <Button type="primary" loading={loading} onClick={handleSearch}>
@@ -556,4 +550,4 @@ export default connect(({ approval, user, loading }) => ({
   loading: loading.models.approval,
   depUserTree: approval.depUserTree,
   member: approval.member,
-}))(Form.create()(List));
+}))(List);

+ 18 - 21
src/pages/PurchaseAdmin/PurchaseList/Approval/MemberModal.js

@@ -23,7 +23,8 @@ const tempData = [
 ];
 
 function MemberModal(props) {
-  const { visible, onClose, form, currentItem, loading, depUserTree, dataSource, dispatch } = props;
+  const { visible, onClose, currentItem, loading, depUserTree, dataSource, dispatch } = props;
+  const [form] = Form.useForm();
   const [currentMember, setCurrentMember] = useState({});
 
   const columns = [
@@ -93,8 +94,7 @@ function MemberModal(props) {
   };
 
   const handleAddMember = () => {
-    form.validateFields((error, { memberID }) => {
-      if (error) return;
+    form.validateFields().then(({ memberID }) => {
       dispatch({
         type: 'approval/addMember',
         payload: {
@@ -123,24 +123,21 @@ function MemberModal(props) {
         width="100%"
         style={{ marginBottom: 20 }}
         layout="inline"
+        form={form}
       >
-        <Form.Item label="添加成员">
-          {form.getFieldDecorator('memberID', {
-            initialValue: null,
-          })(
-            <TreeSelect
-              showSearch
-              allowClear
-              style={{ width: 240 }}
-              placeholder="请选择项目成员"
-              multiple={false}
-              filterTreeNode={(input, option) => {
-                return option.props.title === input;
-              }}
-            >
-              {renderUserSelectTreeNodes(depUserTree)}
-            </TreeSelect>
-          )}
+        <Form.Item label="添加成员" name="memberID" initialValue={null}>
+          <TreeSelect
+            showSearch
+            allowClear
+            style={{ width: 240 }}
+            placeholder="请选择项目成员"
+            multiple={false}
+            filterTreeNode={(input, option) => {
+              return option.props.title === input;
+            }}
+          >
+            {renderUserSelectTreeNodes(depUserTree)}
+          </TreeSelect>
         </Form.Item>
         <Form.Item>
           <Button type="primary" loading={loading} onClick={handleAddMember}>
@@ -153,4 +150,4 @@ function MemberModal(props) {
   );
 }
 
-export default connect()(Form.create()(MemberModal));
+export default connect()(MemberModal);

+ 25 - 29
src/pages/PurchaseAdmin/PurchaseList/Approval/QualityOperateModal.js

@@ -9,17 +9,16 @@ function QualityOperateModal(props) {
     visible,
     onOk,
     onClose,
-    form,
     currentItem,
     loading,
     depUserTree,
     dispatch,
     qualityOperate,
   } = props;
+  const [form] = Form.useForm();
 
   const handleOk = () => {
-    form.validateFields((err, { managerID }) => {
-      if (err) return;
+    form.validateFields().then(({ managerID }) => {
       const [manager_id, dep_id] = managerID.split('||');
       let params = {};
       params.type = qualityOperate ? 'approval/startOperate' : 'approval/startQuality';
@@ -28,7 +27,7 @@ function QualityOperateModal(props) {
         dep_id: Number(dep_id),
       };
       qualityOperate
-        ? (params.payload.opt_manager_id= Number(manager_id))
+        ? (params.payload.opt_manager_id = Number(manager_id))
         : (params.payload.wty_manager_id = Number(manager_id));
       dispatch({
         ...params,
@@ -77,33 +76,30 @@ function QualityOperateModal(props) {
       onCancel={onClose}
       onOk={handleOk}
     >
-      <Form labelCol={{ span: 5 }} wrapperCol={{ span: 15 }}>
-        <Form.Item label={qualityOperate ? '运营经理' : '质保经理'}>
-          {form.getFieldDecorator('managerID', {
-            rules: [
-              {
-                required: true,
-                message: qualityOperate ? '请选择运营经理' : '请选择质保经理',
-              },
-            ],
-          })(
-            <TreeSelect
-              showSearch
-              allowClear
-              style={{ width: '100%' }}
-              placeholder={qualityOperate ? '请选择运营经理' : '请选择质保经理'}
-              multiple={false}
-              filterTreeNode={(input, option) => {
-                return option.props.title === input;
-              }}
-              onChange={onChangeManager}
-            >
-              {renderUserSelectTreeNodes(depUserTree)}
-            </TreeSelect>
-          )}
+      <Form labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} form={form}>
+        <Form.Item
+          label={qualityOperate ? '运营经理' : '质保经理'}
+          name="managerID"
+          rules={[
+            { required: true, message: qualityOperate ? '请选择运营经理' : '请选择质保经理' },
+          ]}
+        >
+          <TreeSelect
+            showSearch
+            allowClear
+            style={{ width: '100%' }}
+            placeholder={qualityOperate ? '请选择运营经理' : '请选择质保经理'}
+            multiple={false}
+            filterTreeNode={(input, option) => {
+              return option.props.title === input;
+            }}
+            onChange={onChangeManager}
+          >
+            {renderUserSelectTreeNodes(depUserTree)}
+          </TreeSelect>
         </Form.Item>
       </Form>
     </Modal>
   );
 }
-export default connect()(Form.create()(QualityOperateModal));
+export default connect()(QualityOperateModal);

+ 8 - 7
src/pages/PurchaseAdmin/PurchaseList/WorkingHours/RejectModal.js

@@ -2,12 +2,11 @@ import React, { useState } from 'react';
 import { Input, message, Form, Modal } from 'antd';
 
 function RejectModal(props) {
-  const { visible, onOk, onCancel, form, loading } = props;
+  const { visible, onOk, onCancel, loading } = props;
+  const [form] = Form.useForm();
   const [type, setType] = useState({});
   const handleOk = () => {
-    form.validateFields((error, values) => {
-      if (error) return;
-
+    form.validateFields().then(values => {
       onOk(values);
     });
   };
@@ -22,11 +21,13 @@ function RejectModal(props) {
       onOk={handleOk}
       destroyOnClose
     >
-      <Form labelCol={{ span: 4 }} wrapperCol={{ span: 16 }}>
-        <Form.Item label="拒绝理由">{form.getFieldDecorator('desc')(<Input.TextArea />)}</Form.Item>
+      <Form labelCol={{ span: 4 }} wrapperCol={{ span: 16 }} form={form}>
+        <Form.Item label="拒绝理由" name="desc">
+          <Input.TextArea />
+        </Form.Item>
       </Form>
     </Modal>
   );
 }
 
-export default Form.create()(RejectModal);
+export default RejectModal;