浏览代码

展示个人中心页面列表

Renxy 2 年之前
父节点
当前提交
71af5aa602
共有 4 个文件被更改,包括 140 次插入54 次删除
  1. 3 3
      .umirc.ts
  2. 1 1
      src/pages/ContractManager/component/Modal.jsx
  3. 2 1
      src/pages/ContractManager/index.jsx
  4. 134 49
      src/pages/Profile/index.js

+ 3 - 3
.umirc.ts

@@ -14,7 +14,7 @@ export default defineConfig({
   proxy: {
     '/api': {
       // target: 'http://47.96.12.136:8788/',
-      target: 'http://47.96.12.136:8896/',
+      target: 'http://47.96.12.136:8888/',
       // target: 'http://120.55.44.4:8900/',
       changeOrigin: true,
     },
@@ -119,13 +119,13 @@ export default defineConfig({
       name: '个人中心',
       path: '/profile',
       component: './Profile/index',
-      hideInMenu: true
+      hideInMenu: true,
     },
     {
       name: '审批详情',
       path: '/profile/:id',
       component: './Flow/OaAuditDetail',
-      hideInMenu: true
+      hideInMenu: true,
     },
     {
       name: '供应商管理',

+ 1 - 1
src/pages/ContractManager/component/Modal.jsx

@@ -352,7 +352,7 @@ const ContractModal = (props) => {
             <Form.Item
               name="party_c"
               label="丙方(及其他):"
-              initialValue={data?.party_c ? JSON.parse(data?.party_c) : []}
+              initialValue={data?.party_c ? data?.party_c.split(',') : []}
               rules={[
                 {
                   required: true,

+ 2 - 1
src/pages/ContractManager/index.jsx

@@ -51,6 +51,7 @@ const ConteactManager = (props) => {
       dataIndex: 'code',
       key: 'code',
       align: 'center',
+      width: '12%',
     },
     {
       title: '合同生效时间',
@@ -351,7 +352,7 @@ const ConteactManager = (props) => {
         loading={loading}
         columns={columns}
         dataSource={data}
-        // indentSize={30}
+        indentSize={70}
         onExpand={(expanded, record) => {
           console.log(expanded, record);
           if (expanded) handleQueryChildren({ is_parent: record.id });

+ 134 - 49
src/pages/Profile/index.js

@@ -39,7 +39,12 @@ function profile(props) {
     OA: 2,
   };
 
-  const { data: OAData, loading: OALoading } = useRequest(queryProfileList, {
+  //OA我的申请列表
+  const {
+    data: OAApplyData,
+    run: OAApplyRun,
+    loading: OAApplyLoading,
+  } = useRequest(queryProfileList, {
     // manual: true,
     formatResult: (res) => {
       return res.data?.list?.map((item) => {
@@ -47,21 +52,47 @@ function profile(props) {
           ...item,
           CName: item.AuthorInfo.CName,
           table_desc: [item.table_desc],
-          statusText: item.status,
+          statusText: (() => {
+            switch (item.audit_status) {
+              case 0:
+                return '审核中';
+              case 1:
+                return '通过';
+              case 2:
+                return '拒绝';
+              case 3:
+                return '终审通过';
+            }
+          })(),
+          key: `${TYPE.Contract}_${item.id}`,
           type: TYPE.OA,
         };
       });
     },
-    onSuccess: (data) => {
-      console.log(data);
-    },
-  });
-  const queryProfileListRequest = useRequest(queryProfileList, {
-    manual: true,
   });
-  const queryApplyListRequest = useRequest(queryApplyList, {
+  //OA我的审批和待审批列表
+  const {
+    data: OAAuditData,
+    run: OAAuditRun,
+    loading: OAAuditLoading,
+  } = useRequest(queryProfileList, {
     manual: true,
+    formatResult: (res) => {
+      return res.data?.list?.map((item) => {
+        return {
+          ...item,
+          CName: item.AuthorInfo.CName,
+          table_desc: [item.table_desc],
+          statusText: item.status,
+          // key: `${TYPE.Contract}_${item.id}`,
+          showBtn: true,
+          type: TYPE.OA,
+        };
+      });
+    },
   });
+
+  //合同管理返回处理函数
   const contractResult = (res) => {
     let data = res.data?.list;
     return data?.map((item) => {
@@ -77,6 +108,9 @@ function profile(props) {
         create_time: item.cancel_on || item.created_on,
         type: TYPE.Contract,
         statusText: StatusText[item.status],
+        showBtn:
+          item.status == Status.Checking || item.status == Status.CalChecking,
+        // key: `${TYPE.Contract}_${item.id}`,
       };
     });
   };
@@ -84,23 +118,31 @@ function profile(props) {
   //合同管理相关数据
   //请求我的申请列表
   const {
-    data: ApplyData,
-    run: applyRun,
-    loading: applyLoading,
+    data: conApplyData,
+    run: conApplyRun,
+    loading: conApplyLoading,
   } = useRequest(queryGetContractList, {
     defaultParams: [{ created_by: user?.ID }],
     formatResult: contractResult,
   });
-  //我的审批列表
+  //我的待审批列表
+  const {
+    data: conAuditData,
+    run: conAuditRun,
+    loading: conAduitLoading,
+  } = useRequest((data) => queryGetContractList(data), {
+    manual: true,
+    formatResult: contractResult,
+  });
+  //我审批过的列表
   const {
-    data: AuditData,
-    run,
-    loading: aduitLoading,
+    data: conAuditedData,
+    run: conAuditedRun,
+    loading: conAduitedLoading,
   } = useRequest((data) => queryGetContractList(data), {
     manual: true,
     formatResult: contractResult,
   });
-  console.log('================', ApplyData, AuditData, OAData);
 
   //审核合同
   const { run: runCheck, loading: checkLoading } = useRequest(
@@ -108,6 +150,8 @@ function profile(props) {
     {
       manual: true,
       onSuccess: () => {
+        conAuditRun({ status: 1 });
+        conAuditedRun({ check_by: user.CName });
         setConVisible(false);
         message.success('审核成功');
       },
@@ -117,12 +161,50 @@ function profile(props) {
     },
   );
 
-  useEffect(() => {
-    if (user?.Permission['menu-001-audit']) run({ status: 1 });
-  }, [user]);
+  //拼接审核数据和申请数据  审核loading和申请loading
+  const auditData = useMemo(() => {
+    let result = [];
+    if (OAAuditData && OAAuditData.length > 0) result = [...OAAuditData];
+    if (conAuditData && conAuditData.length > 0)
+      result = [...result, ...conAuditData];
+    if (conAuditedData && conAuditedData.length > 0)
+      result = [...result, ...conAuditedData];
+    return result;
+  }, [OAAuditData, conAuditData, conAuditedData]);
+
+  const auditLoading = useMemo(() => {
+    let loading = false;
+    if (OAAuditLoading || conAduitLoading || conAduitedLoading) loading = true;
+    return loading;
+  }, [OAAuditLoading, conAduitLoading, conAduitedLoading]);
+
+  const applyData = useMemo(() => {
+    let result = [];
+    if (OAApplyData && OAApplyData.length > 0) result = [...OAApplyData];
+    if (conApplyData && conApplyData.length > 0)
+      result = [...result, ...conApplyData];
+    return result;
+  }, [OAApplyData, conApplyData]);
+
+  const applyLoading = useMemo(() => {
+    let loading = false;
+    if (OAApplyLoading || conApplyLoading) loading = true;
+    return loading;
+  }, [OAApplyLoading, conApplyLoading]);
+
+  // useEffect(() => {
+  //   if (user?.Permission['menu-001-audit']) run({ status: 1 });
+  // }, [user]);
 
   const onTabChange = (activeKey) => {
-    applyRun();
+    if (activeKey == '1') {
+      OAApplyRun();
+      conApplyRun();
+    } else {
+      OAAuditRun();
+      if (user?.Permission['menu-001-audit']) conAuditRun({ status: 1 });
+      conAuditedRun({ check_by: user.CName });
+    }
     setTabActive(activeKey);
   };
   const columns = [
@@ -222,21 +304,26 @@ function profile(props) {
     },
     {
       title: '操作',
-      render: (record) => (
+      dataIndex: 'showBtn',
+      render: (text, record) => (
         <>
-          <a
-            style={{ color: '#4096ff' }}
-            onClick={() => {
-              if (record.type == TYPE.Contract) {
-                setDetail(record);
-                setConVisible(true);
-              } else {
-                navigate(`/oa/detail/${record.flow_id}/${record.id}`);
-              }
-            }}
-          >
-            审批
-          </a>
+          {text ? (
+            <a
+              style={{ color: '#4096ff' }}
+              onClick={() => {
+                if (record.type == TYPE.Contract) {
+                  setDetail(record);
+                  setConVisible(true);
+                } else {
+                  navigate(`/oa/detail/${record.flow_id}/${record.id}`);
+                }
+              }}
+            >
+              审批
+            </a>
+          ) : (
+            <div>已审批</div>
+          )}
         </>
       ),
     },
@@ -286,16 +373,17 @@ function profile(props) {
                 </Button>
               </Form.Item>
             </div>
-            <Table
-              columns={columns}
-              dataSource={ApplyData}
-              // columns={columns}
-              // loading={queryApplyListRequest.loading}
-              // dataSource={queryApplyListRequest?.data?.list}
-              // pagination={queryApplyListRequest?.data?.pagination}
-              // onChange={handleApplyPaginationChange}
-            />
           </Form>
+          <Table
+            columns={columns}
+            dataSource={applyData}
+            loading={applyLoading}
+            // columns={columns}
+            // loading={queryApplyListRequest.loading}
+            // dataSource={queryApplyListRequest?.data?.list}
+            // pagination={queryApplyListRequest?.data?.pagination}
+            // onChange={handleApplyPaginationChange}
+          />
         </>
       );
     else if (activeKey == '2')
@@ -337,12 +425,9 @@ function profile(props) {
             </div>
           </Form>
           <Table
-            rowKey="id"
             columns={approveColumns}
-            dataSource={[...OAData, ...AuditData].sort(
-              (a, b) => a.create_time > b.create_time,
-            )}
-
+            dataSource={auditData}
+            loading={auditLoading}
             // loading={queryProfileListRequest.loading}
             // columns={approveColumns}
             // dataSource={queryProfileListRequest?.data?.list}