From c92c44b3c6071cb21759b50f05406f777b48bc0e Mon Sep 17 00:00:00 2001 From: 18154758993 <605281283@qq.com> Date: Tue, 21 Oct 2025 10:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/comprehensive/knzzGlApply/XgAll.vue | 36 +++++++++++++++++-- src/views/comprehensive/knzzGlApply/XwAll.vue | 32 +++++++++++++++++ src/views/comprehensive/knzzGlApply/xg.vue | 35 +++++++++++++++++- src/views/comprehensive/knzzGlApply/xw.vue | 35 +++++++++++++++++- .../comprehensive/knzzZzqApply/XgAll.vue | 33 +++++++++++++++++ .../comprehensive/knzzZzqApply/XwAll.vue | 33 +++++++++++++++++ src/views/comprehensive/knzzZzqApply/xg.vue | 35 +++++++++++++++++- src/views/comprehensive/knzzZzqApply/xw.vue | 35 +++++++++++++++++- 8 files changed, 268 insertions(+), 6 deletions(-) diff --git a/src/views/comprehensive/knzzGlApply/XgAll.vue b/src/views/comprehensive/knzzGlApply/XgAll.vue index 5aba6c7..5aa4923 100644 --- a/src/views/comprehensive/knzzGlApply/XgAll.vue +++ b/src/views/comprehensive/knzzGlApply/XgAll.vue @@ -60,6 +60,12 @@ + + + 下载文件 + + + 打印
@@ -207,11 +213,37 @@ export default { async lookVClick(row) { this.lookForm = {} this.lookForm = { ...row } -const res = await listView(this.queryParams) -console.log('API 返回的数据:', res.rows) + const res = await listView(this.queryParams) + console.log('API 返回的数据:', res.rows) this.lookV = true }, + downloadDiploma() { + const raw = this.lookForm.hardFile + if (!raw) return + // 支持逗号分隔的多个文件 + const files = String(raw) + .split(',') + .map((s) => s.trim()) + .filter(Boolean) + const triggerDownload = (href, filename) => { + const link = document.createElement('a') + link.href = href + // 设置下载文件名(跨域时可能被浏览器忽略,但不影响触发下载/打开) + link.download = filename || '' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } + + files.forEach((file, idx) => { + const isAbsoluteUrl = /^https?:\/\//i.test(file) + const url = isAbsoluteUrl ? file : `${this.baseurl}${file}` + const name = this.getFileName(file) + // 轻微延时,避免浏览器对一次事件同时触发多个下载的限制 + setTimeout(() => triggerDownload(url, name), idx * 200) + }) + }, } } diff --git a/src/views/comprehensive/knzzGlApply/XwAll.vue b/src/views/comprehensive/knzzGlApply/XwAll.vue index 1231a60..01fc829 100644 --- a/src/views/comprehensive/knzzGlApply/XwAll.vue +++ b/src/views/comprehensive/knzzGlApply/XwAll.vue @@ -65,6 +65,12 @@
+ + + 下载文件 + + + 打印
@@ -215,7 +221,33 @@ export default { this.lookV = true console.log('打印了' + lookForm.xwCmt) }, + downloadDiploma() { + const raw = this.lookForm.hardFile + if (!raw) return + // 支持逗号分隔的多个文件 + const files = String(raw) + .split(',') + .map((s) => s.trim()) + .filter(Boolean) + const triggerDownload = (href, filename) => { + const link = document.createElement('a') + link.href = href + // 设置下载文件名(跨域时可能被浏览器忽略,但不影响触发下载/打开) + link.download = filename || '' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } + + files.forEach((file, idx) => { + const isAbsoluteUrl = /^https?:\/\//i.test(file) + const url = isAbsoluteUrl ? file : `${this.baseurl}${file}` + const name = this.getFileName(file) + // 轻微延时,避免浏览器对一次事件同时触发多个下载的限制 + setTimeout(() => triggerDownload(url, name), idx * 200) + }) + }, } } diff --git a/src/views/comprehensive/knzzGlApply/xg.vue b/src/views/comprehensive/knzzGlApply/xg.vue index e30541d..6e37bbe 100644 --- a/src/views/comprehensive/knzzGlApply/xg.vue +++ b/src/views/comprehensive/knzzGlApply/xg.vue @@ -66,6 +66,12 @@
+ + + 下载文件 + + + @@ -408,7 +414,34 @@ export default { this.auditForm.xgCmt = '' break } - } + }, + downloadDiploma() { + const raw = this.lookForm.hardFile + if (!raw) return + // 支持逗号分隔的多个文件 + const files = String(raw) + .split(',') + .map((s) => s.trim()) + .filter(Boolean) + + const triggerDownload = (href, filename) => { + const link = document.createElement('a') + link.href = href + // 设置下载文件名(跨域时可能被浏览器忽略,但不影响触发下载/打开) + link.download = filename || '' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } + + files.forEach((file, idx) => { + const isAbsoluteUrl = /^https?:\/\//i.test(file) + const url = isAbsoluteUrl ? file : `${this.baseurl}${file}` + const name = this.getFileName(file) + // 轻微延时,避免浏览器对一次事件同时触发多个下载的限制 + setTimeout(() => triggerDownload(url, name), idx * 200) + }) + }, } } diff --git a/src/views/comprehensive/knzzGlApply/xw.vue b/src/views/comprehensive/knzzGlApply/xw.vue index 87c0343..a283154 100644 --- a/src/views/comprehensive/knzzGlApply/xw.vue +++ b/src/views/comprehensive/knzzGlApply/xw.vue @@ -66,6 +66,12 @@ + + + 下载文件 + + + @@ -414,7 +420,34 @@ export default { this.auditForm.deptCmt = '' break } - } + }, + downloadDiploma() { + const raw = this.lookForm.hardFile + if (!raw) return + // 支持逗号分隔的多个文件 + const files = String(raw) + .split(',') + .map((s) => s.trim()) + .filter(Boolean) + + const triggerDownload = (href, filename) => { + const link = document.createElement('a') + link.href = href + // 设置下载文件名(跨域时可能被浏览器忽略,但不影响触发下载/打开) + link.download = filename || '' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } + + files.forEach((file, idx) => { + const isAbsoluteUrl = /^https?:\/\//i.test(file) + const url = isAbsoluteUrl ? file : `${this.baseurl}${file}` + const name = this.getFileName(file) + // 轻微延时,避免浏览器对一次事件同时触发多个下载的限制 + setTimeout(() => triggerDownload(url, name), idx * 200) + }) + }, } } diff --git a/src/views/comprehensive/knzzZzqApply/XgAll.vue b/src/views/comprehensive/knzzZzqApply/XgAll.vue index 3a62f0f..464ffc7 100644 --- a/src/views/comprehensive/knzzZzqApply/XgAll.vue +++ b/src/views/comprehensive/knzzZzqApply/XgAll.vue @@ -65,6 +65,12 @@ + + + 下载文件 + + + 打印
@@ -223,7 +229,34 @@ export default { this.download('/comprehensive/knzzZzqApply/export', { ...this.queryParams }, `apply_${new Date().getTime()}.xlsx`) + }, + downloadDiploma() { + const raw = this.lookForm.applyFile + if (!raw) return + // 支持逗号分隔的多个文件 + const files = String(raw) + .split(',') + .map((s) => s.trim()) + .filter(Boolean) + + const triggerDownload = (href, filename) => { + const link = document.createElement('a') + link.href = href + // 设置下载文件名(跨域时可能被浏览器忽略,但不影响触发下载/打开) + link.download = filename || '' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) } + + files.forEach((file, idx) => { + const isAbsoluteUrl = /^https?:\/\//i.test(file) + const url = isAbsoluteUrl ? file : `${this.baseurl}${file}` + const name = this.getFileName(file) + // 轻微延时,避免浏览器对一次事件同时触发多个下载的限制 + setTimeout(() => triggerDownload(url, name), idx * 200) + }) + }, } } diff --git a/src/views/comprehensive/knzzZzqApply/XwAll.vue b/src/views/comprehensive/knzzZzqApply/XwAll.vue index 344ca76..25a1b64 100644 --- a/src/views/comprehensive/knzzZzqApply/XwAll.vue +++ b/src/views/comprehensive/knzzZzqApply/XwAll.vue @@ -68,6 +68,12 @@
+ + + 下载文件 + + + 打印
@@ -223,7 +229,34 @@ export default { this.download('/comprehensive/knzzZzqApply/export', { ...this.queryParams }, `apply_${new Date().getTime()}.xlsx`) + }, + downloadDiploma() { + const raw = this.lookForm.applyFile + if (!raw) return + // 支持逗号分隔的多个文件 + const files = String(raw) + .split(',') + .map((s) => s.trim()) + .filter(Boolean) + + const triggerDownload = (href, filename) => { + const link = document.createElement('a') + link.href = href + // 设置下载文件名(跨域时可能被浏览器忽略,但不影响触发下载/打开) + link.download = filename || '' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) } + + files.forEach((file, idx) => { + const isAbsoluteUrl = /^https?:\/\//i.test(file) + const url = isAbsoluteUrl ? file : `${this.baseurl}${file}` + const name = this.getFileName(file) + // 轻微延时,避免浏览器对一次事件同时触发多个下载的限制 + setTimeout(() => triggerDownload(url, name), idx * 200) + }) + }, } } diff --git a/src/views/comprehensive/knzzZzqApply/xg.vue b/src/views/comprehensive/knzzZzqApply/xg.vue index a56fb29..286cebf 100644 --- a/src/views/comprehensive/knzzZzqApply/xg.vue +++ b/src/views/comprehensive/knzzZzqApply/xg.vue @@ -71,6 +71,12 @@
+ + + 下载文件 + + + z @@ -418,7 +424,34 @@ export default { this.download('/comprehensive/knzzZzqApply/export', { ...this.queryParams }, `apply_${new Date().getTime()}.xlsx`) - } + }, + downloadDiploma() { + const raw = this.lookForm.applyFile + if (!raw) return + // 支持逗号分隔的多个文件 + const files = String(raw) + .split(',') + .map((s) => s.trim()) + .filter(Boolean) + + const triggerDownload = (href, filename) => { + const link = document.createElement('a') + link.href = href + // 设置下载文件名(跨域时可能被浏览器忽略,但不影响触发下载/打开) + link.download = filename || '' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } + + files.forEach((file, idx) => { + const isAbsoluteUrl = /^https?:\/\//i.test(file) + const url = isAbsoluteUrl ? file : `${this.baseurl}${file}` + const name = this.getFileName(file) + // 轻微延时,避免浏览器对一次事件同时触发多个下载的限制 + setTimeout(() => triggerDownload(url, name), idx * 200) + }) + }, } } diff --git a/src/views/comprehensive/knzzZzqApply/xw.vue b/src/views/comprehensive/knzzZzqApply/xw.vue index 576b9c2..9d525c7 100644 --- a/src/views/comprehensive/knzzZzqApply/xw.vue +++ b/src/views/comprehensive/knzzZzqApply/xw.vue @@ -69,6 +69,12 @@ + + + 下载文件 + + + @@ -416,7 +422,34 @@ export default { this.download('/comprehensive/knzzZzqApply/export', { ...this.queryParams }, `apply_${new Date().getTime()}.xlsx`) - } + }, + downloadDiploma() { + const raw = this.lookForm.applyFile + if (!raw) return + // 支持逗号分隔的多个文件 + const files = String(raw) + .split(',') + .map((s) => s.trim()) + .filter(Boolean) + + const triggerDownload = (href, filename) => { + const link = document.createElement('a') + link.href = href + // 设置下载文件名(跨域时可能被浏览器忽略,但不影响触发下载/打开) + link.download = filename || '' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } + + files.forEach((file, idx) => { + const isAbsoluteUrl = /^https?:\/\//i.test(file) + const url = isAbsoluteUrl ? file : `${this.baseurl}${file}` + const name = this.getFileName(file) + // 轻微延时,避免浏览器对一次事件同时触发多个下载的限制 + setTimeout(() => triggerDownload(url, name), idx * 200) + }) + }, } }