Kaynağa Gözat

修改合同管理

Renxy 2 yıl önce
ebeveyn
işleme
33d8ec186d

+ 131 - 58
src/pages/ContractManager/component/Modal.jsx

@@ -102,6 +102,11 @@ const ContractModal = (props) => {
     },
   });
 
+  const isSuper = useMemo(() => {
+    if (user?.Permission['menu-001-audit']) return true;
+    return false;
+  }, [user]);
+
   console.log('======================', data);
 
   useEffect(() => {
@@ -189,7 +194,7 @@ const ContractModal = (props) => {
           cancel_desc: values.cancel_desc,
         };
         handleOk(result);
-      } else if (type == Type.check && data?.status == Status.Checking) {
+      } else if (data?.status == Status.Checking) {
         let result = {
           id: data?.id,
           check_by: user?.CName,
@@ -198,6 +203,15 @@ const ContractModal = (props) => {
           check_desc: values?.check_desc,
         };
         handleOk(result);
+      } else if (data?.status == Status.CalChecking) {
+        let result = {
+          id: data?.id,
+          cancel_check_by: user?.CName,
+          cancel_check_result: values.cancel_check_result,
+          is_pass: values.is_pass,
+          // check_desc: values?.check_desc,
+        };
+        handleOk(result);
       }
     });
   };
@@ -226,7 +240,7 @@ const ContractModal = (props) => {
       cancelText="返回"
       onOk={handleSubmit}
       onCancel={handleCancel}
-      okButtonProps={type == Type.detail ? { disabled: true } : null}
+      // okButtonProps={type == Type.detail ? { disabled: true } : null}
       destroyOnClose
     >
       <Divider />
@@ -256,6 +270,7 @@ const ContractModal = (props) => {
                 placeholder="请选择"
                 showSearch
                 allowClear
+                treeDefaultExpandAll
                 fieldNames={{
                   label: 'Name',
                   value: 'ID',
@@ -414,6 +429,7 @@ const ContractModal = (props) => {
                 placeholder="请选择"
                 showSearch
                 allowClear
+                treeDefaultExpandAll
                 fieldNames={{
                   label: 'Name',
                   value: 'ID',
@@ -494,9 +510,15 @@ const ContractModal = (props) => {
               ]}
             >
               <Select
+                showSearch
                 style={{ width: '100%' }}
                 placeholder="请选择"
                 disabled={dealDisable || disableds.contract}
+                filterOption={(input, option) =>
+                  (option?.label ?? '')
+                    .toLowerCase()
+                    .includes(input.toLowerCase())
+                }
                 options={userList?.map((item) => {
                   return {
                     value: item.CName,
@@ -553,60 +575,7 @@ const ContractModal = (props) => {
             </Form.Item>
           </Col>
         </Row>
-        {type == Type.check &&
-          (data.status == Status.Checking ||
-            data.status == Status.CalChecking) && (
-            <>
-              <ModuleTitle title="审核情况" />
-              <Row>
-                <Col span={10} offset={1}>
-                  <Form.Item
-                    name="check_by"
-                    initialValue={user?.CName}
-                    label="审核人:"
-                  >
-                    <Input disabled />
-                  </Form.Item>
-                  <Form.Item name="is_pass" initialValue={1} label="审核意见:">
-                    <Select
-                      onChange={(e) => {
-                        setIsPass(e);
-                      }}
-                      style={{ width: '100%' }}
-                      options={[
-                        {
-                          value: 1,
-                          label: '同意',
-                        },
-                        {
-                          value: 0,
-                          label: '拒绝',
-                        },
-                      ]}
-                    />
-                  </Form.Item>
-                </Col>
-                <Col span={10}>
-                  <Form.Item
-                    name="check_date"
-                    initialValue={dayjs().format(FORMAT)}
-                    label="审核时间:"
-                  >
-                    <Input disabled />
-                  </Form.Item>
-                </Col>
-              </Row>
-              {!isPass && (
-                <Form.Item
-                  name="check_desc"
-                  label="拒绝原因:"
-                  labelCol={{ span: 4 }}
-                >
-                  <Input.TextArea />
-                </Form.Item>
-              )}
-            </>
-          )}
+
         {type != Type.add && (
           <>
             <ModuleTitle title="归档流程" />
@@ -662,6 +631,58 @@ const ContractModal = (props) => {
             </div>
           </>
         )}
+        {isSuper && data.status == Status.Checking && (
+          <>
+            <ModuleTitle title="审核情况" />
+            <Row>
+              <Col span={10} offset={1}>
+                <Form.Item
+                  name="check_by"
+                  initialValue={user?.CName}
+                  label="审核人:"
+                >
+                  <Input disabled />
+                </Form.Item>
+                <Form.Item name="is_pass" initialValue={1} label="审核意见:">
+                  <Select
+                    onChange={(e) => {
+                      setIsPass(e);
+                    }}
+                    style={{ width: '100%' }}
+                    options={[
+                      {
+                        value: 1,
+                        label: '同意',
+                      },
+                      {
+                        value: 0,
+                        label: '拒绝',
+                      },
+                    ]}
+                  />
+                </Form.Item>
+              </Col>
+              <Col span={10}>
+                <Form.Item
+                  name="check_date"
+                  initialValue={dayjs().format(FORMAT)}
+                  label="审核时间:"
+                >
+                  <Input disabled />
+                </Form.Item>
+              </Col>
+            </Row>
+            {!isPass && (
+              <Form.Item
+                name="check_desc"
+                label="拒绝原因:"
+                labelCol={{ span: 4 }}
+              >
+                <Input.TextArea />
+              </Form.Item>
+            )}
+          </>
+        )}
         {(type == Type.cancel || data?.status >= Status.CalChecking) && (
           <>
             <ModuleTitle title="作废信息" />
@@ -671,7 +692,7 @@ const ContractModal = (props) => {
               initialValue={data?.cancel_desc}
               labelCol={{ span: 4 }}
             >
-              <Input />
+              <Input disabled={type != Type.cancel} />
             </Form.Item>
           </>
         )}
@@ -694,7 +715,7 @@ const ContractModal = (props) => {
             </span>
           </Form.Item>
         )}
-        {type == Type.detail && data?.status >= Status.CalChecking && (
+        {data?.status >= Status.CalChecking && (
           <>
             <ModuleTitle title="作废流程" />
             <div className={styles.modelItem}>
@@ -738,6 +759,58 @@ const ContractModal = (props) => {
             </div>
           </>
         )}
+        {isSuper && data.status == Status.CalChecking && (
+          <>
+            <ModuleTitle title="审核情况" />
+            <Row>
+              <Col span={10} offset={1}>
+                <Form.Item
+                  name="cancel_check_by"
+                  initialValue={user?.CName}
+                  label="审核人:"
+                >
+                  <Input disabled />
+                </Form.Item>
+                <Form.Item name="is_pass" initialValue={1} label="审核意见:">
+                  <Select
+                    onChange={(e) => {
+                      setIsPass(e);
+                    }}
+                    style={{ width: '100%' }}
+                    options={[
+                      {
+                        value: 1,
+                        label: '同意',
+                      },
+                      {
+                        value: 0,
+                        label: '拒绝',
+                      },
+                    ]}
+                  />
+                </Form.Item>
+              </Col>
+              <Col span={10}>
+                <Form.Item
+                  name="check_date"
+                  initialValue={dayjs().format(FORMAT)}
+                  label="审核时间:"
+                >
+                  <Input disabled />
+                </Form.Item>
+              </Col>
+            </Row>
+            {!isPass && (
+              <Form.Item
+                name="cancel_check_result"
+                label="拒绝原因:"
+                labelCol={{ span: 4 }}
+              >
+                <Input.TextArea />
+              </Form.Item>
+            )}
+          </>
+        )}
       </Form>
       <Divider />
     </Modal>

+ 19 - 0
src/pages/ContractManager/index.jsx

@@ -9,6 +9,7 @@ import {
   queryApproval,
   queryContract,
   queryContractCancel,
+  queryContractCancelCheck,
   queryContractDownload,
   queryGetContractList,
 } from '../../services/contract';
@@ -231,6 +232,22 @@ const ConteactManager = (props) => {
     },
   });
 
+  //作废审核
+  const { run: calCheckRun } = useRequest(
+    (data) => queryContractCancelCheck(data),
+    {
+      manual: true,
+      onSuccess: () => {
+        message.success('审核成功');
+        setVisible(false);
+        run(searchData);
+      },
+      onError: () => {
+        message.success('审核失败');
+      },
+    },
+  );
+
   //请求项目列表
   const { data: projectData } = useRequest(queryApproval, {
     defaultParams: [{ pageSize: 99999 }],
@@ -275,6 +292,8 @@ const ConteactManager = (props) => {
       editRun(data);
     } else if (typeRef.current == Type.cancel) {
       calRun(data);
+    } else {
+      calCheckRun(data);
     }
   };
   const onPageChange = (page) => {

+ 53 - 10
src/pages/Profile/approve.js

@@ -18,7 +18,11 @@ const { RangePicker } = DatePicker;
 import { useRequest, useModel } from '@umijs/max';
 import { queryProfileList, queryApplyList } from '@/services/boom';
 import dayjs from 'dayjs';
-import { queryContractCheck, queryGetContractList } from '@/services/contract';
+import {
+  queryContractCancelCheck,
+  queryContractCheck,
+  queryGetContractList,
+} from '@/services/contract';
 import ContractModal, {
   Status,
   StatusText,
@@ -55,7 +59,7 @@ function Approve(props) {
         // key: `${TYPE.Contract}_${item.id}`,
       };
     });
-    return { data, pagination: res.data?.pagination }
+    return { data, pagination: res.data?.pagination };
   };
   //OA我的审批和待审批列表
   const {
@@ -76,8 +80,8 @@ function Approve(props) {
             type: TYPE.OA,
           };
         }),
-        pagination: res.data?.pagination
-      }
+        pagination: res.data?.pagination,
+      };
     },
   });
   //合同 我的待审批列表
@@ -89,16 +93,51 @@ function Approve(props) {
     // manual: true,
     formatResult: contractResult,
   });
+
+  //审核合同
+  const { run: runCheck, loading: checkLoading } = useRequest(
+    (data) => queryContractCheck(data),
+    {
+      manual: true,
+      onSuccess: () => {
+        conAuditRun({ multi_status: '1,4', currentPage: 1, page_size: 10 });
+        // conAuditedRun({ check_by: user.CName });
+        setConVisible(false);
+        message.success('审核成功');
+      },
+      onErroe: () => {
+        message.error('审核失败');
+      },
+    },
+  );
+  //作废审核
+  const { run: calCheckRun } = useRequest(
+    (data) => queryContractCancelCheck(data),
+    {
+      manual: true,
+      onSuccess: () => {
+        message.success('审核成功');
+        setConVisible(false);
+        conAuditRun({ multi_status: '1,4', currentPage: 1, page_size: 10 });
+      },
+      onError: () => {
+        message.success('审核失败');
+      },
+    },
+  );
+
   const applyData = useMemo(() => {
     let result = [];
-    if (OAAuditData?.data && OAAuditData?.data.length > 0) result = [...OAAuditData?.data];
+    if (OAAuditData?.data && OAAuditData?.data.length > 0)
+      result = [...OAAuditData?.data];
     return result;
   }, [OAAuditData]);
   const onTabChange = (activeKey) => {
     if (activeKey == '1') {
       OAAuditRun({ current: 1, page_size: 10 });
     } else {
-      if (user?.Permission['menu-001-audit']) conAuditRun({ status: 1, currentPage: 1, page_size: 10 });
+      if (user?.Permission['menu-001-audit'])
+        conAuditRun({ multi_status: '1,4', currentPage: 1, page_size: 10 });
     }
     setTabActive(activeKey);
   };
@@ -108,7 +147,7 @@ function Approve(props) {
   };
   const handleProfilePaginationChange = (pagination) => {
     conAuditRun({
-      status: user?.Permission['menu-001-audit'] ? 1 : undefined,
+      multi_status: user?.Permission['menu-001-audit'] ? '1,4' : undefined,
       currentPage: pagination.current,
       page_size: 10,
     });
@@ -268,7 +307,7 @@ function Approve(props) {
             </div> */}
           </Form>
           <Table
-            rowKey='id'
+            rowKey="id"
             columns={columns}
             dataSource={applyData}
             loading={OAAuditLoading}
@@ -349,11 +388,15 @@ function Approve(props) {
         // projectList={projectData?.list}
         visible={conVisible}
         handleOk={(data) =>
-          detail.status == Status.Checking ? runCheck(data) : null
+          detail.status == Status.Checking
+            ? runCheck(data)
+            : detail.status == Status.CalChecking
+            ? calCheckRun(data)
+            : null
         }
         handleCancel={() => setConVisible(false)}
       />
     </PageContainer>
   );
 }
-export default Approve;
+export default Approve;

+ 31 - 20
src/pages/Profile/approved.js

@@ -50,7 +50,7 @@ function Approved(props) {
         // key: `${TYPE.Contract}_${item.id}`,
       };
     });
-    return { data, pagination: res.data?.pagination }
+    return { data, pagination: res.data?.pagination };
   };
   //OA我审批过的列表
   const {
@@ -58,7 +58,13 @@ function Approved(props) {
     run: conAuditedRun,
     loading: conAduitedLoading,
   } = useRequest((data) => queryApprovedList(data), {
-    defaultParams: [{ currentPage: 1, pageSize: 10 }]
+    defaultParams: [
+      {
+        check_by: user.CName,
+        // currentPage: 1,
+        // pageSize: 10,
+      },
+    ],
     // formatResult: contractResult,
   });
   // //合同 我审批过的列表
@@ -89,6 +95,7 @@ function Approved(props) {
   };
   const handleApplyPaginationChange = (pagination) => {
     conAuditedRun({
+      check_by: user.CName,
       currentPage: pagination.current,
       pageSize: 10,
     });
@@ -136,13 +143,17 @@ function Approved(props) {
       // dataIndex: 'status',
       render: (record) => {
         switch (record.audit_status) {
-          case 0: return '审核中'
-          case 1: return '通过'
-          case 2: return '拒绝'
-          case 3: return '终审通过'
+          case 0:
+            return '审核中';
+          case 1:
+            return '通过';
+          case 2:
+            return '拒绝';
+          case 3:
+            return '终审通过';
         }
       },
-      width: '20%'
+      width: '20%',
     },
   ];
 
@@ -174,7 +185,7 @@ function Approved(props) {
           </div> */}
         </Form>
         <Table
-          rowKey='id'
+          rowKey="id"
           columns={columns}
           dataSource={conAuditedData?.list}
           loading={conAduitedLoading}
@@ -236,20 +247,20 @@ function Approved(props) {
       header={{
         title: `已审批(${conAuditedData?.pagination?.total || 0})`,
       }}
-    // tabList={[
-    //   {
-    //     tab: 'OA审批',
-    //     key: '1',
-    //   },
-    //   {
-    //     tab: '合同管理',
-    //     key: '2',
-    //   },
-    // ]}
-    // onTabChange={onTabChange}
+      // tabList={[
+      //   {
+      //     tab: 'OA审批',
+      //     key: '1',
+      //   },
+      //   {
+      //     tab: '合同管理',
+      //     key: '2',
+      //   },
+      // ]}
+      // onTabChange={onTabChange}
     >
       <div>{renderPage()}</div>
     </PageContainer>
   );
 }
-export default Approved;
+export default Approved;

+ 8 - 0
src/services/contract.js

@@ -53,6 +53,14 @@ export const queryContractCancel = async (data) => {
   });
 };
 
+//作废审核
+export const queryContractCancelCheck = async (data) => {
+  return await request('/api/contract/v1/contract-cancel-check', {
+    method: 'POST',
+    data,
+  });
+};
+
 //OA已审核过的
 export const queryApprovedList = async (data) => {
   return await request('/api/v1/oa/audited/my/list', {