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
@@ -1,4 +1,4 @@
import { MOCK_STORAGE_KEYS, readMockState, writeMockState } from '@/utils/mock-storage'
import { readDocumentLibrary, writeDocumentLibrary } from '@/utils/mock-document-library'
import type { SigningDocumentData } from '@/utils/signing-document'
import type { DocumentDepartment, DocumentStatus } from './types'
@@ -17,17 +17,17 @@ export const documentStatusOptions = Object.entries(documentStatusLabels).map(([
export { documentStatusLabels }
// Word 自维护方案:文书库初始为空,所有文书由科室通过 Word 编辑器(粘贴 / 导入 .docx)创建维护。
export const documentLibrary: DocumentDepartment[] = []
/** 读取演示文书库:优先用本地保存的数据,没有则用初始空库(调用方负责再克隆一份使用) */
// 演示文书库的种子与读取逻辑都在 utils/mock-document-library:
// 文档库页面和签署工作台必须读同一份数据,否则会出现「文档库里维护的模板,签署端选不到」,
// 或者签署端混着一批文档库里看不到、也无法维护的模板。
/** 读取演示文书库:优先用本地保存的,没有则用种子(调用方负责再克隆一份使用) */
export function loadDocumentLibrary(): DocumentDepartment[] {
return readMockState<DocumentDepartment[]>(MOCK_STORAGE_KEYS.documentLibrary) ?? documentLibrary
return readDocumentLibrary()
}
/** 保存演示文书库,刷新后仍可继续编辑、预览与发起签署 */
export function saveDocumentLibrary(library: DocumentDepartment[]): void {
writeMockState(MOCK_STORAGE_KEYS.documentLibrary, library)
writeDocumentLibrary(library)
}
/**
@@ -261,8 +261,9 @@ async function loadTaskDetail(id: string | null) {
throw detailResult.reason
}
selectedTask.value = detailResult.value
signingAnswers.value = { ...(detailResult.value.fieldAnswers ?? {}) }
const detail = detailResult.value
selectedTask.value = detail
signingAnswers.value = { ...(detail?.fieldAnswers ?? {}) }
if (eventsResult.status === 'fulfilled') {
taskEvents.value = eventsResult.value
@@ -465,6 +466,8 @@ async function handleTaskAction(action: SigningTaskAction) {
if (artifact) {
await downloadArtifact(artifact)
} else if (isSigningMockEnabled) {
ElMessage.info('原型环境不生成 PDF,可在下方「签署文件」中下载签名原图')
} else {
ElMessage.info('当前任务暂无签署后 PDF')
}