Procházet zdrojové kódy

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

chenrui před 3 roky
rodič
revize
e8a0e2b2e6

+ 14 - 1
src/views/dealerManagement/merchantInfoManagement/list.vue

@@ -224,11 +224,24 @@ export default {
     },
     //  导出
     handleExport () {
+      const _this = this
       const params = this.queryParam
       this.exportLoading = true
       dealerExport(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) {

+ 4 - 0
src/views/inventoryManagement/intelligentReplenishment/import.vue

@@ -17,6 +17,7 @@
           :columns="columns"
           :data="loadData"
           :scroll="{ x: 1440 }"
+          :rowClassName="(record, index) => record.cost ? 'redBg-row':''"
           :showPagination="false"
           bordered>
         </s-table>
@@ -137,5 +138,8 @@ export default {
         }
       }
     }
+    .redBg-row{
+      background-color: #f5cdc8;
+    }
   }
 </style>

+ 14 - 2
src/views/inventoryManagement/intelligentReplenishment/set.vue

@@ -96,14 +96,26 @@ export default {
     },
     // 上传文件  change
     changeImport (file) {
-      console.log(file, '----上传')
       this.paramsData = file
       VueCookies.set('REPLENISHMENT_PATH', JSON.stringify(file))
     },
     //  导出
     handleExport () {
+      const _this = this
       predictProductInfoExport({}).then(res => {
-        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

@@ -243,11 +243,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) {

+ 14 - 1
src/views/productManagement/priceChangeRecord/list.vue

@@ -280,11 +280,24 @@ export default {
     },
     //  导出
     handleExport () {
+      const _this = this
       const params = this.queryParam
       this.exportLoading = true
       productPriceChangeExport(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/productManagement/productInfo/list.vue

@@ -477,11 +477,24 @@ export default {
     },
     //  导出
     handleExport () {
+      const _this = this
       const params = this.queryParam
       this.exportLoading = true
       productExport(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 - 8
src/views/salesManagement/shortageStatisticsC/list.vue

@@ -224,18 +224,24 @@ export default {
     },
     //  导出
     handleExport () {
+      const _this = this
       const params = this.queryParam
-      if (this.time && this.time.length) {
-        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
-        params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
-      } else {
-        params.beginDate = ''
-        params.endDate = ''
-      }
       this.exportLoading = true
       oosDetailExport(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) {