From dd929871969c4275eeb3246d7c5c0d6f35060b10 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期二, 31 十二月 2024 14:52:47 +0800 Subject: [PATCH] 接口文件冲突 --- src/components/do/a6-facilities-environment/three-wastes-treatment.vue | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/components/do/a6-facilities-environment/three-wastes-treatment.vue b/src/components/do/a6-facilities-environment/three-wastes-treatment.vue index 9728652..f3471dc 100644 --- a/src/components/do/a6-facilities-environment/three-wastes-treatment.vue +++ b/src/components/do/a6-facilities-environment/three-wastes-treatment.vue @@ -171,13 +171,33 @@ handleDown (row) { this.$axios.get(this.$api.internalWastes.exportInternalWastes + '?wastesId=' + row.wastesId,{responseType: "blob"}).then(res => { this.outLoading = false - this.$message.success('瀵煎嚭鎴愬姛') const blob = new Blob([res],{ type: 'application/msword' }); - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '涓夊簾澶勭悊瀵煎嚭' + '.docx'; - link.click(); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '涓夊簾澶勭悊瀵煎嚭' + '.docx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '涓夊簾澶勭悊瀵煎嚭' + '.docx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } }) }, closeThreeWastesDia () { -- Gitblit v1.9.3