Pārlūkot izejas kodu

bug修复 导出报错时提示信息

chenrui 3 gadi atpakaļ
vecāks
revīzija
164e7975ce

+ 14 - 1
src/views/bulkManagement/bulkWarehousingOrder/list.vue

@@ -284,11 +284,24 @@ export default {
     },
     //  导出
     handleExport () {
+      const _this = this
       const params = this.queryParam
       this.exportLoading = true
       sparePartsPurExport(params).then(res => {
         this.exportLoading = false
-        this.download(res)
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.download(res)
+        }
       })
     },
     download (data) {

+ 14 - 1
src/views/inventoryManagement/inventoryQuery/list.vue

@@ -241,11 +241,24 @@ export default {
     },
     //  导出
     handleExport () {
+      const _this = this
       const params = this.queryParam
       this.exportLoading = true
       stockExport(params).then(res => {
         this.exportLoading = false
-        this.download(res)
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.download(res)
+        }
       })
     },
     download (data) {