Sfoglia il codice sorgente

fix:导出质检报表报错

weieryang 3 anni fa
parent
commit
d03ac37f1a

+ 1 - 1
CallCenterWeb.UI/RMYY/src/api/telCall/report.js

@@ -16,4 +16,4 @@ export function getListExpt(params) {
16 16
     responseType: 'blob',
17 17
     params
18 18
   })
19
-}
19
+}

+ 3 - 2
CallCenterWeb.UI/RMYY/src/api/testing/reportTesting.js

@@ -32,7 +32,8 @@ export function GetDataList(params) {
32 32
 export function exportToExcelHeBing(params) {
33 33
   return request({
34 34
     url: 'QCManage/ExportToExcelHeBing',
35
-    method: 'post',
36
-    data: params
35
+    method: 'get',
36
+    responseType: 'blob',
37
+    params
37 38
   })
38 39
 }

+ 3 - 2
CallCenterWeb.UI/RMYY/src/utils/index.js

@@ -370,11 +370,12 @@ export function firstToUpper(str) {
370 370
 export function exportExcel(exporParams, getListExpt) {
371 371
   return new Promise(resolve => {
372 372
     getListExpt(exporParams).then(response => {
373
-      if (response.headers['content-disposition']) {
373
+      const headerDispostion = response.headers['content-disposition'] || response.headers['Content-Disposition'] || ''
374
+      if (headerDispostion) {
374 375
         const content = response.data
375 376
         const blob = new Blob([content])
376 377
         // let fileName = '报表数据.xls'
377
-        let fileName = response.headers['content-disposition'].split(';')[1].split('=')[1]
378
+        let fileName = headerDispostion.split(';')[1].split('=')[1]
378 379
         var explorer = navigator.userAgent
379 380
         if (explorer.indexOf('MSIE') >= 0 || explorer.indexOf('Chrome') >= 0) { // IE和google浏览器
380 381
           fileName = decodeURIComponent(fileName)

+ 21 - 13
CallCenterWeb.UI/RMYY/src/views/testing/reportTesting/index.vue

@@ -70,6 +70,9 @@ import {
70 70
   exportToExcelHeBing
71 71
 } from '@/api/testing/reportTesting'
72 72
 import Pagination from '@/components/context/Pagination' // 对el-pagination 二次封装
73
+import {
74
+  exportExcel
75
+} from '@/utils'
73 76
 export default {
74 77
   name: 'CallRecord',
75 78
   components: {
@@ -174,20 +177,25 @@ export default {
174 177
     },
175 178
     btn_export() {
176 179
       this.loading = true
177
-      return new Promise((resolve) => {
178
-        const params = {
179
-          stime: this.ruleForm.searchDate[0],
180
-          endtime: this.ruleForm.searchDate[1]
181
-        }
182
-        this.dataLists = []
183
-        exportToExcelHeBing(params).then((response) => {
184
-          this.loading = false
185
-          // if (response.rows && response.rows.length) {
180
+      // return new Promise((resolve) => {
181
+      //   const params = {
182
+      //     stime: this.ruleForm.searchDate[0],
183
+      //     endtime: this.ruleForm.searchDate[1]
184
+      //   }
185
+      //   exportToExcelHeBing(params).then((response) => {
186
+      //     this.loading = false
187
+      //     // if (response.rows && response.rows.length) {
186 188
 
187
-          // }
188
-        })
189
-        resolve()
190
-      })
189
+      //     // }
190
+      //   })
191
+      //   resolve()
192
+      // })
193
+
194
+      const params = {
195
+        stime: this.ruleForm.searchDate[0],
196
+        endtime: this.ruleForm.searchDate[1]
197
+      }
198
+      exportExcel(params, exportToExcelHeBing)
191 199
     }
192 200
   }
193 201
 }