feat(signing): 统一演示文书库并支持下载签名原图

This commit is contained in:
yelan
2026-09-16 17:15:10 +08:00
parent 4556515c17
commit 2279f7a624
6 changed files with 381 additions and 106 deletions
@@ -2,6 +2,7 @@ import { computed, reactive, ref, toValue, type MaybeRefOrGetter } from 'vue'
import { ElMessage } from 'element-plus'
import { sendSigningSms } from '@/api/workbench/deliveries'
import { collectFieldDefs } from '@/utils/signing-fields'
import {
createSigningTask,
getPatientProfile,
@@ -196,9 +197,26 @@ export function useSigningTaskForm(options: UseSigningTaskFormOptions) {
errors.visit = ''
}
/**
* 文书必须带签名位才能发起签署:否则签名会随证据固化,但文书上没有落位的地方,
* 签出来的文书看不出患者签过。
*
* 真实模式下后端按 templateVersionId 取版本快照、前端拿不到正文,
* 此时不做判断(返回 true),交由后端校验。
*/
function hasSignatureSlot(template: SigningTemplate) {
if (!template.contentHtml) {
return true
}
return collectFieldDefs(template.contentHtml).some((field) => field.id === 'signature')
}
const signatureMissingMessage = '该文书没有签名占位符,请先在文档库中补上签名位再发起'
function selectTemplate(template: SigningTemplate) {
selectedTemplateId.value = template.id
errors.document = ''
errors.document = hasSignatureSlot(template) ? '' : signatureMissingMessage
if (!template.supportedMethods.includes(method.value)) {
method.value = template.supportedMethods[0] ?? 'pad'
@@ -238,6 +256,9 @@ export function useSigningTaskForm(options: UseSigningTaskFormOptions) {
if (!selectedTemplate.value) {
errors.document = '请至少选择一份文档'
valid = false
} else if (!hasSignatureSlot(selectedTemplate.value)) {
errors.document = signatureMissingMessage
valid = false
}
if (!isSigningMockEnabled && method.value === 'sms') {