Bläddra i källkod

个人中心优化

hanxin 2 år sedan
förälder
incheckning
ee5e25ef9b
1 ändrade filer med 41 tillägg och 16 borttagningar
  1. 41 16
      src/pages/Profile/index.js

+ 41 - 16
src/pages/Profile/index.js

@@ -19,27 +19,34 @@ function profile(props) {
   const approveFormRef = useRef();
   const applyFormRef = useRef();
   let navigate = useNavigate();
-  const queryProfileListRequest = useRequest(queryProfileList, {});
-  const queryApplyListRequest = useRequest(queryApplyList, {});
+  const queryProfileListRequest = useRequest(queryProfileList, {
+    manual: true
+  });
+  const queryApplyListRequest = useRequest(queryApplyList, {
+    manual: true
+  });
   const onTabChange = activeKey => {
     setTabActive(activeKey)
   }
   const columns = [
     {
       title: '标题',
-      dataIndex: 'name'
+      dataIndex: 'name',
+      width: '30%'
     },
     {
 
       title: '发起人',
-      render: (record) => record.AuthorInfo.CName
+      render: (record) => record.AuthorInfo.CName,
+      width: '20%'
     },
     {
 
       title: '发起时间',
       render: (record) => {
         return dayjs(record.create_time).format('YYYY-MM-DD HH:mm:ss')
-      }
+      },
+      width: '20%'
     },
     {
 
@@ -51,7 +58,8 @@ function profile(props) {
           case 2: return '拒绝'
           case 3: return '终审通过'
         }
-      }
+      },
+      width: '20%'
     },
     {
       title: '操作',
@@ -59,39 +67,45 @@ function profile(props) {
         <Fragment>
           <>
             <a style={{ color: "#4096ff" }} onClick={() => {
-              navigate(`/oa/detail/${record.flow_id}/${record.id}`)
+              navigate(`/oa/audit/${record.flow_id}/${record.id}`)
             }}>申请</a>
           </>
         </Fragment>
       ),
-    }
+      width: '10%'
+    },
   ]
   const approveColumns = [
     {
       title: '标题',
-      dataIndex: 'table_name'
+      dataIndex: 'table_name',
+      width: '30%'
     },
     {
 
       title: '摘要',
-      dataIndex: 'table_desc'
+      dataIndex: 'table_desc',
+      width: '30%'
     },
     {
 
       title: '发起人',
-      dataIndex: 'AuthorInfo.CName'
+      render: (record) => record.AuthorInfo.CName,
+      width: '10%'
     },
     {
 
       title: '发起时间',
       render: (record) => {
         return dayjs(record.create_time).format('YYYY-MM-DD HH:mm:ss')
-      }
+      },
+      width: '10%'
     },
     {
 
       title: '流程状态',
-      dataIndex: 'status'
+      dataIndex: 'status',
+      width: '10%'
     },
     {
       title: '操作',
@@ -104,6 +118,7 @@ function profile(props) {
           </>
         </Fragment>
       ),
+      width: '10%'
     }
   ]
   const handleApplySubmit = (values) => {
@@ -123,10 +138,9 @@ function profile(props) {
         ref={applyFormRef}
       >
         <div style={{ display: 'flex' }}>
-          <Form.Item name="audit_status" label="状态:">
+          <Form.Item name="audit_status" label="状态:" initialValue=''>
             <Select
               style={{ width: 120 }}
-              defaultValue=''
               options={[
                 { value: '', label: '全部' },
                 { value: '0', label: '审核中' },
@@ -137,13 +151,15 @@ function profile(props) {
             />
           </Form.Item>
           <Form.Item>
-            <Button type="primary" htmlType="submit" style={{ marginLeft: 10 }}>
+            <Button loading={queryApplyListRequest.loading} type="primary" htmlType="submit" style={{ marginLeft: 10 }}>
               查询
             </Button>
           </Form.Item>
         </div>
         <Table
+          rowKey='id'
           columns={columns}
+          loading={queryApplyListRequest.loading}
           dataSource={queryApplyListRequest?.data?.list}
           pagination={queryApplyListRequest?.data?.pagination}
         />
@@ -178,6 +194,15 @@ function profile(props) {
         />
       </>
   }
+  useEffect(() => {
+    queryApplyListRequest.run({});
+  }, []);
+  useEffect(() => {
+    if (tabActive == '1')
+      queryApplyListRequest.run({});
+    else if (tabActive == '2')
+      queryProfileListRequest.run({});
+  }, [tabActive]);
   return (
     <PageContainer
       header={{