Kaynağa Gözat

更新下载功能

sophieChenyx 6 yıl önce
ebeveyn
işleme
5f21066435

+ 3 - 6
src/models/accounts.js

@@ -2,7 +2,6 @@
 
 import {
   queryCampusList,
-  downloadCampusExcel,
   queryTerminalsList,
   downloadTerminalsExcel,
   queryCampusAmount,
@@ -38,10 +37,7 @@ export default {
       }
     },
     *fetchCampusExcel({ payload }, { call }) {
-      //window.open('http://47.95.197.36:8500/stmt/campus/export');
-      const res =  yield call(downloadCampusExcel, payload);
-      console.log('res download',res);
-      
+      window.open('/api/stmt/campus/export');
     },
     *fetchTerminalsList({ payload }, { call, put }) {
       const response = yield call(queryTerminalsList, payload);
@@ -58,8 +54,9 @@ export default {
       }
     },
     *fetchTerminalsExcel({ payload }, { call }) {
-      yield call(downloadTerminalsExcel, payload);
+      window.open(`/api/stmt/campus/export?${stringify(payload)}`);
     },
+    
     *fetchCampusAmount({ payload }, { call, put }) {
       const response = yield call(queryCampusAmount, payload);
       if (response.success) {

+ 5 - 4
src/routes/Dashboard/Accounts/AccountsCampus.js

@@ -27,10 +27,11 @@ export default class CampusAccountsPage extends Component {
   }
 
   handleDownloadOperation = () => {
-    this.props.dispatch({
-      type: 'accounts/fetchCampusExcel',
-      payload: 'download',
-    })
+    window.open('/api/stmt/campus/export');
+    // this.props.dispatch({
+    //   type: 'accounts/fetchCampusExcel',
+    //   payload: 'download',
+    // })
   };
   handleFilterOperation = (params, states) => {
     this.setState({

+ 5 - 2
src/routes/Dashboard/Accounts/AccountsTerminals.js

@@ -28,9 +28,12 @@ export default class TerminalsAccountsPage extends Component {
     })
   }
   // 下载
-  handleDownloadOperation = () => {
+  handleDownloadOperation = (params) => {
     this.props.dispatch({
-      type: 'accounts/fetchTerminalsExcel'
+      type: 'accounts/fetchTerminalsExcel',
+      payload: {
+        ...params,
+      }
     })
   };
 

+ 0 - 13
src/services/accounts.js

@@ -9,15 +9,6 @@ export async function queryCampusList(params) {
   };
   return request(`${api.accountsCampusList}?${stringify(newParams)}`);
 }
-
-export async function downloadCampusExcel() {
-  console.log('service download')
-  return request(`${api.accountsCampusDownload}`, {
-    DOWNLOAD: true,
-  });
-  // return request(`${api.accountsCampusDownload}`);
-}
-
 export async function queryTerminalsList(params) {
   const newParams = {
     pageSize: Hotax.PAGE_SIZE,
@@ -25,10 +16,6 @@ export async function queryTerminalsList(params) {
   };
   return request(`${api.accountsTerminalsList}?${stringify(newParams)}`);
 }
-
-export async function downloadTerminalsExcel() {
-  return request(`${api.accountsTerminalsDownload}`);
-}
 export async function queryTotalList(params) {
   const newParams = {
     pageSize: Hotax.PAGE_SIZE,