Browse Source

财务报表导出

XuZinan 2 năm trước cách đây
mục cha
commit
0fbd48407d

+ 24 - 8
src/pages/PurchaseAdmin/PurchaseList/Report/Department.js

@@ -119,14 +119,25 @@ function Department(props) {
       callback: list => handleChangeCurrent(list[0]),
     });
   };
-  const handleDownload = () => {
+  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;
-    downloadFile(
-      `/api/v2/workload/rpt/dep/export2excel?JWT-TOKEN=${token}&s_time=${s_time}&e_time=${e_time}`,
-      `项目报表${moment().format('YYYYMMDDHHMMSS')}.xlsx`
-    );
+
+    console.log(s_time, e_time);
+
+    if (finance) {
+      console.log(1);
+      downloadFile(
+        `/api/v2/workload/finance/people/export?JWT-TOKEN=${token}&s_time=${s_time}&e_time=${e_time}`,
+        `财务报表_部门${moment().format('YYYYMMDDHHMMSS')}.xlsx`
+      );
+      console.log(2);
+    } else
+      downloadFile(
+        `/api/v2/workload/rpt/dep/export2excel?JWT-TOKEN=${token}&s_time=${s_time}&e_time=${e_time}`,
+        `部门报表${moment().format('YYYYMMDDHHMMSS')}.xlsx`
+      );
   };
   const renderSearch = () => {
     return (
@@ -285,9 +296,14 @@ function Department(props) {
     <div>
       <div className={styles.topPart}>
         {renderSearch()}
-        <Button type="primary" onClick={handleDownload}>
-          导出
-        </Button>
+        <div>
+          <Button type="primary" onClick={() => handleDownload(1)} style={{ marginRight: '10px' }}>
+            财务报表导出
+          </Button>
+          <Button type="primary" onClick={() => handleDownload(0)}>
+            导出
+          </Button>
+        </div>
       </div>
       <div style={{ marginTop: 20, display: 'flex' }}>
         <Table

+ 18 - 1
src/pages/PurchaseAdmin/PurchaseList/Report/Finance/Project.js

@@ -140,6 +140,18 @@ function FinanceProject(props) {
       </Form>
     );
   };
+
+  const handleDownload = () => {
+    const token = getToken();
+    let s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : null;
+    let e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : null;
+
+    downloadFile(
+      `/api/v2/workload/finance/exe/export?JWT-TOKEN=${token}&s_time=${s_time}&e_time=${e_time}`,
+      `财务报表_项目${moment().format('YYYYMMDDHHMMSS')}.xlsx`
+    );
+  };
+
   useEffect(() => {
     handleSearch();
     dispatch({
@@ -149,7 +161,12 @@ function FinanceProject(props) {
 
   return (
     <div>
-      <div className={styles.topPart}>{renderSearch()}</div>
+      <div className={styles.topPart}>
+        {renderSearch()}
+        <Button type="primary" onClick={handleDownload}>
+          导出
+        </Button>
+      </div>
       <Table
         loading={loading}
         style={{ marginTop: 20 }}

+ 18 - 1
src/pages/PurchaseAdmin/PurchaseList/Report/Finance/Resources.js

@@ -72,13 +72,30 @@ function FinanceResource(props) {
       </Form>
     );
   };
+
+  const handleDownload = () => {
+    const token = getToken();
+    let s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : null;
+    let e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : null;
+    
+    downloadFile(
+      `/api/v2/workload/finance/resource/export?JWT-TOKEN=${token}&s_time=${s_time}&e_time=${e_time}`,
+      `财务报表_资源${moment().format('YYYYMMDDHHMMSS')}.xlsx`
+    );
+  };
+
   useEffect(() => {
     handleSearch();
   }, []);
 
   return (
     <div>
-      <div className={styles.topPart}>{renderSearch()}</div>
+      <div className={styles.topPart}>
+        {renderSearch()}
+        <Button type="primary" onClick={handleDownload}>
+          导出
+        </Button>
+      </div>
       <Table
         loading={loading}
         style={{ marginTop: 20 }}