From ee2882cff02d3545b66c7591f88ed4800f730a9a Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 21 五月 2025 10:00:17 +0800 Subject: [PATCH] 消息通知数据自动筛选 --- src/components/do/a6-personnel-training/index.vue | 70 ++++++++++++++++++++++++++++------- 1 files changed, 56 insertions(+), 14 deletions(-) diff --git a/src/components/do/a6-personnel-training/index.vue b/src/components/do/a6-personnel-training/index.vue index 5a4f796..1d81a9f 100644 --- a/src/components/do/a6-personnel-training/index.vue +++ b/src/components/do/a6-personnel-training/index.vue @@ -401,11 +401,13 @@ label: '璇炬椂', prop: 'classHour', width: '100px', - }, { + }, + { label: '澶囨敞', prop: 'remarks', width: '100px', - }, { + }, + { dataType: 'action', width: '180', label: '鎿嶄綔', @@ -619,13 +621,33 @@ downLoadPost(row) { this.$axios.get(this.$api.personnel.exportPersonTraining + '?id=' + row.id,{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 = row.fileName + '.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 = row.fileName + '.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 = row.fileName + '.docx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } }) }, // 骞村害璁″垝-瀵煎叆 @@ -703,13 +725,33 @@ downLoadInDetail(row) { this.$axios.get(this.$api.personnel.exportPersonTrainingRecord + '?id=' + row.id,{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 = row.courseCode + '浜哄憳鍩硅涓庤�冩牳璁板綍' + '.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 = row.courseCode + '浜哄憳鍩硅涓庤�冩牳璁板綍' + '.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 = row.courseCode + '浜哄憳鍩硅涓庤�冩牳璁板綍' + '.docx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } }) }, // 骞村害璁″垝鏄庣粏琛�-澶氶�� -- Gitblit v1.9.3