|
|
|
|
@ -324,10 +324,45 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handlePrint() { // 打印
|
|
|
|
|
// const watermarkText = this.userInfo.user_name + " " + this.userInfo.dept_name
|
|
|
|
|
// Watermark.set({ watermark_txt: watermarkText }) // 添加水印
|
|
|
|
|
Print('#printBody') |
|
|
|
|
Watermark.remove() // 删除水印
|
|
|
|
|
const loading = this.$loading({ |
|
|
|
|
lock: true, |
|
|
|
|
text: 'Loading', |
|
|
|
|
spinner: 'el-icon-loading', |
|
|
|
|
background: 'rgba(0, 0, 0, 0.7)' |
|
|
|
|
}); |
|
|
|
|
const option = this.deepClone(this.option) |
|
|
|
|
this.option.detail = true |
|
|
|
|
if (this.option.column) { |
|
|
|
|
this.option.column.forEach(col => { |
|
|
|
|
this.handleTemporaryPrintOption(col) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
if (this.option.group) { |
|
|
|
|
this.option.group.forEach(g => { |
|
|
|
|
g.column.forEach(col => { |
|
|
|
|
this.handleTemporaryPrintOption(col) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
setTimeout(() => { |
|
|
|
|
loading.close() |
|
|
|
|
// const watermarkText = this.userInfo.user_name + " " + this.userInfo.dept_name
|
|
|
|
|
// Watermark.set({ watermark_txt: watermarkText }) // 添加水印
|
|
|
|
|
Print('#printBody') |
|
|
|
|
this.option = option |
|
|
|
|
Watermark.remove() // 删除水印
|
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
// 生成打印临时option
|
|
|
|
|
handleTemporaryPrintOption(obj) { |
|
|
|
|
if (!obj.type) return |
|
|
|
|
obj.span = 24 |
|
|
|
|
if (obj.type == 'dynamic') { |
|
|
|
|
obj.children.type = 'form' |
|
|
|
|
obj.children.column.forEach(col => { |
|
|
|
|
this.handleTemporaryPrintOption(col) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 关闭当前tag,并跳转
|
|
|
|
|
handleCloseTag(path) { |
|
|
|
|
|