소스 검색

tab页数量,翻页信息

hanxin 2 년 전
부모
커밋
64e5c785b5
4개의 변경된 파일28개의 추가작업 그리고 22개의 파일을 삭제
  1. 3 3
      src/pages/Profile/apply.js
  2. 16 10
      src/pages/Profile/approve.js
  3. 7 7
      src/pages/Profile/approved.js
  4. 2 2
      src/services/boom.js

+ 3 - 3
src/pages/Profile/apply.js

@@ -85,7 +85,7 @@ function Apply(props) {
     run: conApplyRun,
     loading: conApplyLoading,
   } = useRequest(queryGetContractList, {
-    manual: true,
+    // manual: true,
     defaultParams: [{ created_by: user?.ID, pageSize: 10 }],
     formatResult: contractResult,
   });
@@ -351,11 +351,11 @@ function Apply(props) {
       }}
       tabList={[
         {
-          tab: 'OA审批',
+          tab: `OA审批(${OAApplyData?.pagination?.total || 0})`,
           key: '1',
         },
         {
-          tab: '合同管理',
+          tab: `合同管理(${conApplyData?.pagination?.total || 0})`,
           key: '2',
         },
       ]}

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

@@ -96,9 +96,9 @@ function Approve(props) {
   }, [OAAuditData]);
   const onTabChange = (activeKey) => {
     if (activeKey == '1') {
-      OAAuditRun();
+      OAAuditRun({ current: 1, page_size: 10 });
     } else {
-      if (user?.Permission['menu-001-audit']) conAuditRun({ status: 1 });
+      if (user?.Permission['menu-001-audit']) conAuditRun({ status: 1, currentPage: 1, page_size: 10 });
     }
     setTabActive(activeKey);
   };
@@ -107,10 +107,16 @@ function Approve(props) {
     OAApplyRun(values);
   };
   const handleProfilePaginationChange = (pagination) => {
-    conApplyRun({
+    conAuditRun({
+      status: user?.Permission['menu-001-audit'] ? 1 : undefined,
       currentPage: pagination.current,
-      pageSize: 10,
-
+      page_size: 10,
+    });
+  };
+  const handleApplyPaginationChange = (pagination) => {
+    OAAuditRun({
+      currentPage: pagination.current,
+      pageSize: pagination.pageSize,
     });
   };
   const columns = [
@@ -266,8 +272,8 @@ function Approve(props) {
             columns={columns}
             dataSource={applyData}
             loading={OAAuditLoading}
-          // pagination={queryApplyListRequest?.data?.pagination}
-          // onChange={handleApplyPaginationChange}
+            pagination={OAAuditData.pagination}
+            onChange={handleApplyPaginationChange}
           />
         </>
       );
@@ -314,7 +320,7 @@ function Approve(props) {
             dataSource={conAuditData?.data}
             loading={conAduitLoading}
             pagination={conAuditData?.pagination}
-          // onChange={handleProfilePaginationChange}
+            onChange={handleProfilePaginationChange}
           />
         </>
       );
@@ -326,11 +332,11 @@ function Approve(props) {
       }}
       tabList={[
         {
-          tab: 'OA审批',
+          tab: `OA审批(${OAAuditData?.pagination?.total || 0})`,
           key: '1',
         },
         {
-          tab: '合同管理',
+          tab: `合同管理(${conAuditData?.pagination?.total || 0})`,
           key: '2',
         },
       ]}

+ 7 - 7
src/pages/Profile/approved.js

@@ -58,6 +58,7 @@ function Approved(props) {
     run: conAuditedRun,
     loading: conAduitedLoading,
   } = useRequest((data) => queryApprovedList(data), {
+    defaultParams: [{ currentPage: 1, pageSize: 10 }]
     // formatResult: contractResult,
   });
   // //合同 我审批过的列表
@@ -68,7 +69,7 @@ function Approved(props) {
   // } = useRequest((data) => queryGetContractList(data), {
   //   manual: true,
   //   formatResult: contractResult,
-  // });
+  // });0
   // const applyData = useMemo(() => {
   //   let result = [];
   //   if (conAuditedData?.data && conAuditedData?.data.length > 0) result = [...conAuditedData?.data];
@@ -86,11 +87,10 @@ function Approved(props) {
     console.log(values);
     OAApplyRun(values);
   };
-  const handleProfilePaginationChange = (pagination) => {
-    conApplyRun({
+  const handleApplyPaginationChange = (pagination) => {
+    conAuditedRun({
       currentPage: pagination.current,
       pageSize: 10,
-
     });
   };
   const columns = [
@@ -178,8 +178,8 @@ function Approved(props) {
           columns={columns}
           dataSource={conAuditedData?.list}
           loading={conAduitedLoading}
-        // pagination={queryApplyListRequest?.data?.pagination}
-        // onChange={handleApplyPaginationChange}
+          pagination={conAuditedData?.pagination}
+          onChange={handleApplyPaginationChange}
         />
       </>
     );
@@ -234,7 +234,7 @@ function Approved(props) {
   return (
     <PageContainer
       header={{
-        title: '已审批',
+        title: `已审批(${conAuditedData?.pagination?.total || 0})`,
       }}
     // tabList={[
     //   {

+ 2 - 2
src/services/boom.js

@@ -205,8 +205,8 @@ export async function advanceSubmitNextNode(params) {
   });
 }
 
-export async function queryProfileList() {
-  let profileList = await request(`/api/v1/oa/audit/list`, { method: 'GET' });
+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(