Sfoglia il codice sorgente

修复报表导出失效

xjj 2 anni fa
parent
commit
37c1158763

+ 3 - 2
src/pages/PurchaseAdmin/PurchaseList/Report/Department.js

@@ -121,8 +121,9 @@ function Department(props) {
   };
   const handleDownload = finance => {
     const token = getToken();
-    const s_time = !filterRef.current.s_time ? '' : filterRef.current.s_time;
-    const e_time = !filterRef.current.e_time ? '' : filterRef.current.e_time;
+    const { time } = form.getFieldsValue();
+    let s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : '';
+    let e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : '';
 
     if (finance)
       downloadFile(

+ 5 - 4
src/pages/PurchaseAdmin/PurchaseList/Report/Finance/Project.js

@@ -145,12 +145,13 @@ function FinanceProject(props) {
 
   const handleDownload = () => {
     const token = getToken();
-    const s_time = !filterRef.current.s_time ? '' : filterRef.current.s_time;
-    const e_time = !filterRef.current.e_time ? '' : filterRef.current.e_time;
-    const { user_id } = form.getFieldsValue();
+    const { user_id, time } = form.getFieldsValue();
+    let s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : '';
+    let e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : '';
 
     downloadFile(
-      `/api/v2/workload/finance/exe/export?JWT-TOKEN=${token}&s_time=${s_time}&e_time=${e_time}&user_id=${user_id}`,
+      `/api/v2/workload/finance/exe/export?JWT-TOKEN=${token}&s_time=${s_time}&e_time=${e_time}&user_id=${user_id ||
+        ''}`,
       `财务报表_项目${moment().format('YYYYMMDDHHMMSS')}.xlsx`
     );
   };

+ 2 - 0
src/pages/PurchaseAdmin/PurchaseList/Report/Finance/Resources.js

@@ -74,9 +74,11 @@ function FinanceResource(props) {
   };
 
   const handleDownload = () => {
+    const { time } = form.getFieldsValue();
     const token = getToken();
     let s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : '';
     let e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : '';
+    console.log(`/api/v2/workload/finance/resource/export?JWT-TOKEN=${token}&s_time=${s_time}&e_time=${e_time}`)
     
     downloadFile(
       `/api/v2/workload/finance/resource/export?JWT-TOKEN=${token}&s_time=${s_time}&e_time=${e_time}`,