记录查询
This commit is contained in:
@@ -60,6 +60,12 @@
|
||||
<GlLook v-if="lookV" id="printDiv" :form-data="lookForm" />
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form v-if="lookForm.hardFile" label-width="120px">
|
||||
<el-form-item label="证明材料">
|
||||
<el-button type="primary" size="mini" icon="el-icon-download" @click="downloadDiploma">下载文件</el-button>
|
||||
</el-form-item>
|
||||
<FileUpload v-model="lookForm.hardFile" />
|
||||
</el-form>
|
||||
<el-button v-print="printContent">打印</el-button>
|
||||
<hr>
|
||||
<el-timeline>
|
||||
@@ -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)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user