From 5c8aaba66c16b1a143fdec27e29ad36eaefd1e3a Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期二, 31 十二月 2024 14:33:25 +0800 Subject: [PATCH] 无源器件检验开发 --- src/components/do/a6-personnel/training-record.vue | 43 ++++++++++++++++++++++++++++++++----------- 1 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/components/do/a6-personnel/training-record.vue b/src/components/do/a6-personnel/training-record.vue index 21ad553..cfc5c2f 100644 --- a/src/components/do/a6-personnel/training-record.vue +++ b/src/components/do/a6-personnel/training-record.vue @@ -164,10 +164,12 @@ }, { label: '鍩硅鍐呭', prop: 'trainingContent' - }, { - label: '鍩硅璇炬椂', - prop: 'educationBackground' - }, { + }, + // { + // label: '鍩硅璇炬椂', + // prop: 'educationBackground' + // }, + { label: '璇炬椂', prop: 'classHour' }, { @@ -197,13 +199,32 @@ const name = this.isDepartment ? 'departmentId' : 'userId'; this.$axios.get(this.$api.personnel.personTrackRecordExport + `&${name}=` + this.departId, { responseType: 'blob' }).then(res => { this.outLoading = false; - this.$message.success('瀵煎嚭鎴愬姛'); - const blob = new Blob([res], { type: 'application/octet-stream' }); - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '鍩硅璁板綍.xlsx'; - 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('瀵煎嚭鎴愬姛') + } + } }).catch(err => { this.outLoading = false; }) -- Gitblit v1.9.3