From ba640310152826d5aada960296847d5fb3a2ed48 Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Mon, 8 Sep 2025 09:57:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=89=93=E5=8D=B0=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=80=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bpm/processInstance/detail/PrintDialog.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/views/bpm/processInstance/detail/PrintDialog.vue b/src/views/bpm/processInstance/detail/PrintDialog.vue index 99cde927b..c152c0196 100644 --- a/src/views/bpm/processInstance/detail/PrintDialog.vue +++ b/src/views/bpm/processInstance/detail/PrintDialog.vue @@ -128,7 +128,7 @@ const printObj = ref({ + + -- Gitee From bd91bd9057a803f2ec7064267db57865a88f2620 Mon Sep 17 00:00:00 2001 From: Lesan <1960681385@qq.com> Date: Mon, 8 Sep 2025 11:27:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0radio=E3=80=81che?= =?UTF-8?q?ckbox=E3=80=81select=E6=89=93=E5=8D=B0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processInstance/detail/PrintDialog.vue | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/views/bpm/processInstance/detail/PrintDialog.vue b/src/views/bpm/processInstance/detail/PrintDialog.vue index c152c0196..ab17f8c0f 100644 --- a/src/views/bpm/processInstance/detail/PrintDialog.vue +++ b/src/views/bpm/processInstance/detail/PrintDialog.vue @@ -30,23 +30,37 @@ const open = async (id: string) => { defineExpose({ open }) const parseFormFields = () => { - // TODO @lesan:form field 有可能基于 form-create 什么 api 生成么?好像也挺难的 = = - // TODO @芋艿:默认打印可以直接用form-create的预览表单模式,但是自定义模板打印就没法这么做 const formFieldsObj = decodeFields(printData.value.processInstance.processDefinition.formFields) const processVariables = printData.value.processInstance.formVariables let res: any = [] for (const item of formFieldsObj) { const id = item['field'] const name = item['title'] - let html = '暂不支持此类型的表单展示' - // TODO 完善各类型表单的展示 - // TODO @lesan:要不 UploadImg、UploadFile 特殊处理下,其它就 else processVariables[item['field']]? - // TODO @芋艿:感觉很多都要处理一下,select那些都要转为可读的label,还有子表单那些,都需要处理一下... - // TODO @lesan:有办法基于 form-create api 来读取值么?如果不行,就兜底让大模型生成一些常用的。子表单可以往后放; - if (item['type'] === 'input') { - html = processVariables[item['field']] - } else if (item['type'] === 'UploadImg') { - html = `` + const variable = processVariables[item['field']] + let html = variable + switch (item['type']) { + case 'UploadImg': { + let imgEl = document.createElement('img') + imgEl.setAttribute('src', variable) + imgEl.setAttribute('style', 'max-width: 600px;') + html = imgEl.outerHTML + break + } + case 'radio': + case 'checkbox': + case 'select': { + const options = item['options'] || [] + const temp: any = [] + if (Array.isArray(variable)) { + const labels = options.filter((o) => variable.includes(o.value)).map((o) => o.label) + temp.push(...labels) + } else { + const opt = options.find((o) => o.value === variable) + temp.push(opt.label) + } + html = temp.join(',') + } + // TODO 更多表单打印展示 } printDataMap.value[item['field']] = html res.push({ id, name, html }) @@ -128,7 +142,7 @@ const printObj = ref({ -- Gitee