From 00b4687091e2b19fc86462a74302fab5e32bfdf6 Mon Sep 17 00:00:00 2001 From: weizong song Date: Mon, 11 May 2026 14:37:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E9=97=B4=E6=8E=A5=E5=85=B3?= =?UTF-8?q?=E8=81=94=E6=94=AF=E4=BB=98=E6=9C=AA=E5=B1=95=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D,=E6=89=93=E5=8D=B0=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=87=BA=E7=8E=B0=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/print.js | 10 +++++++++- src/views/dashboard/index.vue | 18 +++++++++++++++--- src/views/flow/create.vue | 29 +++++++++++++++++------------ 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/utils/print.js b/src/utils/print.js index 871440a..eddffd9 100644 --- a/src/utils/print.js +++ b/src/utils/print.js @@ -1,5 +1,13 @@ import store from '@/store' import moment from 'moment' + +function sanitizePrintFieldHtml(html) { + const wrapper = document.createElement('div') + wrapper.innerHTML = html || '' + wrapper.querySelectorAll('input[type="file"], .el-upload__input').forEach(el => el.remove()) + return wrapper.innerHTML +} + /** * @param{string} printJs 打印模版 * @param{boolean} isLog 是否带审批 @@ -78,7 +86,7 @@ export async function print(printJs, isLog, form, logContent) { printStr = printStr.replace(fieldMath,subFormBody) // console.log(fieldMath, printStr) } else { - printStr = printStr.replace(fieldMath,`${value}`) + printStr = printStr.replace(fieldMath,`${sanitizePrintFieldHtml(value)}`) } } } else { diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 452223a..375d463 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -507,7 +507,8 @@ export default { try { await this.getFlows(); const res = await getInfo() - this.usualFlows = res.quick_enter?res.quick_enter:[] + const quickEnterIds = this.normalizeQuickEnter(res.quick_enter) + this.usualFlows = this.flows.filter(flow => quickEnterIds.includes(Number(flow.id))) // const res = await configIndex({ // filter: [ // { @@ -533,16 +534,27 @@ export default { console.error(err); } }, + normalizeQuickEnter(quickEnter) { + if (!quickEnter) return [] + if (!Array.isArray(quickEnter)) return [] + return quickEnter.map(item => { + if (item && typeof item === 'object') { + return Number(item.id) + } + return Number(item) + }).filter(id => Number.isInteger(id) && id > 0) + }, openQucik(){ + const quickEnterIds = this.normalizeQuickEnter(this.usualFlows) this.flows.map(flow => { - const isChecked = this.usualFlows.some(usualFlow => usualFlow.id === flow.id); + const isChecked = quickEnterIds.includes(Number(flow.id)); flow.checked = isChecked }); this.isShowQuick = true }, updatequick(){ this.quickLoading = true - let arr = this.flows.filter((i)=> i.checked===true) + let arr = this.flows.filter((i)=> i.checked===true).map(i => Number(i.id)) saveMyself({ quick_enter:arr }).then(res=>{ diff --git a/src/views/flow/create.vue b/src/views/flow/create.vue index ca09dae..960540a 100644 --- a/src/views/flow/create.vue +++ b/src/views/flow/create.vue @@ -2281,25 +2281,30 @@ export default { // 加载关联的支付信息 async loadRelatedPayments() { if (!this.$route.query.flow_id) { - return; + return } - + this.loadingPayments = true; try { - // request.js 成功时会直接返回 res.data(也就是 payment 对象或 null) - const payment = await getPaymentsByFlowId(this.$route.query.flow_id, { all: true }); - // 接口约定:要么无数据(null),要么唯一的一条记录 - if (payment) { + // request.js 成功时会直接返回 res.data;兼容旧接口单对象和新接口数组。 + const result = await getPaymentsByFlowId(this.$route.query.flow_id, { all: true }) + const payments = Array.isArray(result) ? result : (result ? [result] : []) + if (payments.length > 0) { // 兼容 breadcrumb 为字符串或数组 - if (payment.payment_type_info && payment.payment_type_info.breadcrumb) { - const bc = payment.payment_type_info.breadcrumb; + payments.forEach((payment) => { + if (!payment.payment_type_info || !payment.payment_type_info.breadcrumb) { + return + } + const bc = payment.payment_type_info.breadcrumb if (Array.isArray(bc)) { - payment.payment_type_info.breadcrumb = bc; + payment.payment_type_info.breadcrumb = bc } else if (typeof bc === 'string') { - payment.payment_type_info.breadcrumb = bc.split(/\s*>\s*|\s*\/\s*/).filter(Boolean); + payment.payment_type_info.breadcrumb = bc.split(/\s*>\s*|\s*\/\s*/).filter(Boolean) } - } - this.relatedPayments = [payment]; + }) + this.relatedPayments = payments + + const payment = payments[0] // 支付模板元素(用于展示 fields) await this.loadPaymentTemplateElements(payment);