From c70e37453d06f8eb6eddeddb3085548541cd34b5 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期四, 26 十二月 2024 14:33:10 +0800 Subject: [PATCH] 修改人员 --- src/components/do/a6-facilities-environment/facilities-environmental-conditions/power-supply-stability.vue | 34 +++++++++++++++++++++++++++------- 1 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/components/do/a6-facilities-environment/facilities-environmental-conditions/power-supply-stability.vue b/src/components/do/a6-facilities-environment/facilities-environmental-conditions/power-supply-stability.vue index 4cbed1f..857a47c 100644 --- a/src/components/do/a6-facilities-environment/facilities-environmental-conditions/power-supply-stability.vue +++ b/src/components/do/a6-facilities-environment/facilities-environmental-conditions/power-supply-stability.vue @@ -255,7 +255,7 @@ // 鐢垫簮绋冲畾鎬�-鎵撳紑寮规璋冪敤璁惧鎺ュ彛锛屾煡璇娇鐢ㄧ殑璁惧 openDialog() { this.$axios.get(this.$api.deviceScope.treeDevice).then(res => { - this.cascaderList = res.data; + this.cascaderList = res.data }); this.$nextTick(() => { this.$refs['form'].clearValidate() @@ -321,13 +321,33 @@ downLoadPost(row) { this.$axios.get(this.$api.facilitiesAndEnvironment.exportFePowerStable + '?powerStableId=' + row.powerStableId,{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('瀵煎嚭鎴愬姛') + } + } }) }, // 鐢垫簮绋冲畾鎬� 鐐瑰嚮琛岀紪杈戣Е鍙� -- Gitblit v1.9.3