Bladeren bron

添加合同管理导出功能

Renxy 2 jaren geleden
bovenliggende
commit
32d734543b
1 gewijzigde bestanden met toevoegingen van 14 en 2 verwijderingen
  1. 14 2
      src/pages/ContractManager/index.jsx

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

@@ -28,6 +28,7 @@ import FileViewerModal from '@/components/FileViewerNew';
 import { getToken } from '@/utils/utils';
 import PageContent from '@/components/PageContent';
 import EllipsisText from './component/EllipsisText';
+import { stringify } from 'qs';
 
 const ConteactManager = (props) => {
   const { dispatch } = props;
@@ -304,7 +305,7 @@ const ConteactManager = (props) => {
     setFileViewerData(attach);
     setFileViewerVisible(true);
   };
-
+  //单个合同下载
   const handleUpload = (record) => {
     const token = getToken();
     window.downloadFile(
@@ -316,7 +317,18 @@ const ConteactManager = (props) => {
   const handleSearch = () => {
     run(searchData);
   };
-  const handleExport = () => {};
+  //合同列表导出列表下载
+  const handleExport = async () => {
+    const token = getToken();
+    const params = { ...searchData, current_user: user.ID };
+    window.downloadFile(
+      `/api/contract/v1/contract-list/download?${stringify(
+        params,
+      )}&JWT-TOKEN=${token}`,
+      '合同列表.xlsx',
+      false,
+    );
+  };
 
   const handleQueryChildren = async (req) => {
     const res = await queryGetContractList(req);