Explorar o código

定时报表优化——下载

wyh hai 5 meses
pai
achega
eef12998b8

+ 6 - 2
src/api/api.js

@@ -1,4 +1,4 @@
-import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage'
+import { getAction, deleteAction, putAction, postAction, httpAction, downFile } from '@/api/manage'
 import Vue from 'vue'
 import {UI_CACHE_DB_DICT_DATA } from "@/store/mutation-types"
 
@@ -73,6 +73,9 @@ function getDictItemsFromCache(dictCode) {
   }
 }
 
+// 定时报表下载
+const downFiles_info= (params)=>downFile("/report/interlockDataReport/download",params);
+
 //系统通告
 const doReleaseData = (params)=>getAction("/sys/annountCement/doReleaseData",params);
 const doReovkeData = (params)=>getAction("/sys/annountCement/doReovkeData",params);
@@ -154,7 +157,8 @@ export {
   saveDeptRolePermission,
   queryMyDepartTreeList,
   getUserNoticeInfo,
-  getDictItemsFromCache
+  getDictItemsFromCache,
+  downFiles_info
 }
 
 

+ 19 - 6
src/views/module_interLock/interlockHistoryData/InterlockReport/InterlockDataReportList.vue

@@ -102,7 +102,7 @@
         <span slot="action" slot-scope="text, record">
           <!-- <a @click="handleEdit(record)">编辑</a> -->
           <!-- <a @click="downloadFile(text)">下载</a> -->
-          <a @click="downloadFile(record.reportUrl)">下载</a>
+          <a @click="downloadFiles(record)">下载</a>
 
           <!-- <a-divider type="vertical" />
           <a-dropdown>
@@ -135,6 +135,7 @@
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import InterlockDataReportModal from './modules/InterlockDataReportModal'
   import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
+  import { downFiles_info } from '@api/api'
 
   export default {
     name: 'InterlockDataReportList',
@@ -162,11 +163,11 @@
             align:"center",
             dataIndex: 'reportName'
           },
-          {
-            title:'报表地址',
-            align:"center",
-            dataIndex: 'reportUrl'
-          },
+          // {
+          //   title:'报表地址',
+          //   align:"center",
+          //   dataIndex: 'reportUrl'
+          // },
           {
             title:'报表类型',
             align:"center",
@@ -214,6 +215,18 @@
     methods: {
       initDictConfig(){
       },
+      // 下载
+      downloadFiles(record){
+        downFiles_info({ reportUrl: record.reportUrl }).then(response => {
+          console.log(response)
+          const blob = new Blob([response])
+          const url = window.URL.createObjectURL(blob)
+          let a = document.createElement('a')
+          a.setAttribute('href', url)
+          a.setAttribute('download', `${record.reportName}`)
+          a.click()
+        })
+      },
       getSuperFieldList(){
         let fieldList=[];
         fieldList.push({type:'string',value:'reportName',text:'报表名称',dictCode:''})