ソースを参照

修改个人中心分页bug

Renxy 1 年間 前
コミット
752eea2ee0
3 ファイル変更38 行追加52 行削除
  1. 6 3
      src/pages/ContractManager/index.jsx
  2. 31 27
      src/pages/Profile/index.js
  3. 1 22
      src/services/boom.js

+ 6 - 3
src/pages/ContractManager/index.jsx

@@ -59,6 +59,7 @@ const ConteactManager = (props) => {
   const [modal, contextHolder] = Modal.useModal();
 
   const [draftOpen, setDraftOpen] = useState(false);
+  const oaParamsRef = useRef();
 
   const showBtn = (record, type) => {
     let bool = false;
@@ -265,6 +266,8 @@ const ConteactManager = (props) => {
     manual: true,
     onSuccess: () => {
       // message.success('添加成功');
+      createRun(oaParamsRef.current);
+      oaParamsRef.current = null;
       setVisible(false);
       run(searchData);
       modal.info(config);
@@ -413,13 +416,13 @@ const ConteactManager = (props) => {
 
   const handleOk = (data, type, formData = [], audit_list = []) => {
     if (type == Type.add) {
-      editRun(data);
-      createRun({
+      oaParamsRef.current = {
         form: JSON.stringify(formData),
         audit_list,
         extend_code: data.code,
         extend_type: 0, //归档提交
-      });
+      };
+      editRun(data);
     } else if (type == Type.cancel) {
       calRun(data);
       createRun({

+ 31 - 27
src/pages/Profile/index.js

@@ -26,14 +26,17 @@ function profile(props) {
   const columnsApplay = [
     {
       title: '标题',
-      dataIndex: 'table_name',
+      dataIndex: 'name',
       width: '30%',
     },
 
     {
       title: '发起人',
-      dataIndex: 'CName',
+      // dataIndex: 'CName',
       width: '20%',
+      render: (record) => (
+        <div>{record.CName ? record.CName : record.AuthorInfo?.CName}</div>
+      ),
     },
     {
       title: '发起时间',
@@ -112,24 +115,6 @@ function profile(props) {
       dataIndex: 'name',
       width: '30%',
     },
-    // {
-    //   title: '摘要',
-    //   dataIndex: 'table_desc',
-    //   render: (descList) => {
-    //     return (
-    //       <ul>
-    //         {descList?.map((item) => (
-    //           <li>{item}</li>
-    //         ))}
-    //       </ul>
-    //     );
-    //   },
-    // },
-    // {
-    //   title: '发起人',
-    //   dataIndex: 'CName',
-    //   width: '20%',
-    // },
     {
       title: '发起时间',
       render: (record) => {
@@ -164,22 +149,22 @@ function profile(props) {
   ];
 
   //我的申请
-  const queryApplay = async () => {
-    const data = await queryApplyList();
+  const queryApplay = async (params) => {
+    const data = await queryApplyList(params);
     console.log(data);
     setData(data);
     setLoading(false);
   };
   //我的待审批
-  const queryApprove = async () => {
-    const data = await queryProfileList();
+  const queryApprove = async (params) => {
+    const data = await queryProfileList(params);
     console.log(data);
     setData(data);
     setLoading(false);
   };
   //我的已审批
-  const queryApproved = async () => {
-    const data = await queryApprovedList();
+  const queryApproved = async (params) => {
+    const data = await queryApprovedList(params);
     console.log(data);
     setData(data);
     setLoading(false);
@@ -234,6 +219,19 @@ function profile(props) {
       },
     });
   };
+  const handleProfilePaginationChange = (pagination) => {
+    switch (tabActive) {
+      case '1':
+        queryApplay({ currentPage: pagination.current, pageSize: 10 });
+        break;
+      case '2':
+        queryApprove({ currentPage: pagination.current, pageSize: 10 });
+        break;
+      case '3':
+        queryApproved({ currentPage: pagination.current, pageSize: 10 });
+        break;
+    }
+  };
 
   return (
     <PageContent
@@ -253,7 +251,13 @@ function profile(props) {
       ]}
       onTabChange={setTabActive}
     >
-      <Table columns={columns} dataSource={data?.list} loading={loading} />
+      <Table
+        columns={columns}
+        dataSource={data?.list}
+        loading={loading}
+        pagination={{ ...data?.pagination, showSizeChanger: false }}
+        onChange={handleProfilePaginationChange}
+      />
     </PageContent>
   );
 }

+ 1 - 22
src/services/boom.js

@@ -217,33 +217,12 @@ export async function advanceSubmitNextNode(params) {
 
 export async function queryProfileList(params) {
   let profileList = await request(`/api/v1/oa/audit/list`, { params });
-  let auditList = await request(`/api/v1/purchase/flow/info?flow_type=1`);
-  profileList?.data?.list.map((item) => {
-    var audit = auditList?.data?.find(
-      (child) => item.flow_id === child?.list.id,
-    );
-    if (audit) {
-      item.CName = item.AuthorInfo.CName;
-      item.table_name = item.name;
-      item.table_desc = audit.list.desc;
-      item.status = '待审批';
-    }
-  });
-  console.log(profileList);
   return profileList?.data;
 }
 export async function queryApplyList(params) {
   const res = await request(`/api/v1/oa/audit/my/list`, { params });
   if (res?.data) {
-    const list = res.data?.list?.map((item) => {
-      return {
-        ...item,
-        CName: item.AuthorInfo.CName,
-        table_desc: item.table_desc,
-        table_name: item.name,
-      };
-    });
-    return { list, pagination: res.data?.pagination };
+    return { list: res.data?.list, pagination: res.data?.pagination };
   } else {
     return { list: [], pagination: {} };
   }