From fae53717ce5d60db0d5ed620dd5a2644f4907c72 Mon Sep 17 00:00:00 2001 From: ssc <273702440@qq.com> Date: Thu, 10 Feb 2022 14:56:07 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=A1=A8=E5=8D=95=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/plugin/workflow/mixins/ex-form.js | 43 +++++++++++++++++-- .../process/external/Leave/detail.vue | 2 +- .../process/external/template/detail.vue | 2 +- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/views/plugin/workflow/mixins/ex-form.js b/src/views/plugin/workflow/mixins/ex-form.js index 3a27617..753063e 100644 --- a/src/views/plugin/workflow/mixins/ex-form.js +++ b/src/views/plugin/workflow/mixins/ex-form.js @@ -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) { diff --git a/src/views/plugin/workflow/process/external/Leave/detail.vue b/src/views/plugin/workflow/process/external/Leave/detail.vue index 9195f47..5a3c796 100644 --- a/src/views/plugin/workflow/process/external/Leave/detail.vue +++ b/src/views/plugin/workflow/process/external/Leave/detail.vue @@ -19,7 +19,7 @@ -
-