feat(签署文书): 统一签署态文书样式并精简演示种子为单份麻精同意书
This commit is contained in:
@@ -22,6 +22,15 @@ export interface DocumentRecord {
|
||||
versionId?: string
|
||||
departmentId?: string | null
|
||||
departmentName?: string
|
||||
/**
|
||||
* 除归属科室外还共享给哪些科室。
|
||||
*
|
||||
* 原型 V10.2 的「文档归属」支持多选科室,但后端 CreateTemplateRequest 只接受
|
||||
* 单个 departmentId + campusId,这个字段因此**只在演示文库里有值**;
|
||||
* 真实接口补齐多科室归属前,页面不会为它编造取值(缺省即 undefined,
|
||||
* 卡片上的「·+N 科室」据此决定是否显示)。
|
||||
*/
|
||||
sharedDepartments?: string[]
|
||||
campusId?: string | null
|
||||
campusName?: string
|
||||
description?: string
|
||||
|
||||
@@ -264,20 +264,42 @@ const defaultMockRecords: SigningTaskRecord[] = [
|
||||
* ② 签名图:种子任务里标了「已签署」却不带签名,会出现「列表说已签署、打开没有签名、
|
||||
* 产物列表也是空的」这种自相矛盾的状态,下载的 PDF 也缺签名。
|
||||
* 这里给缺签名的已签署任务补一张示意签名;真实签署过的任务已有签名图,不会被覆盖。
|
||||
* ③ 文书绑定:种子的 documentId 是按早期「一类文书一个任务」写死的(tpl-001…tpl-006)。
|
||||
* 演示文书库现在只保留一份麻精知情同意书,那些模板已经不在库里——不重绑的话
|
||||
* 每个任务详情都会落到「未能取到模板正文」的占位版式,签名位、勾选项、页眉
|
||||
* 这些签署链路在演示环境里一次都走不到。重绑按序号在库里取,库里以后增删文书
|
||||
* 任务会跟着走,不会再脱钩。
|
||||
*/
|
||||
function hydrateTaskDocuments(records: SigningTaskRecord[]): SigningTaskRecord[] {
|
||||
const templates = new Map(readLocalSigningTemplates().map((template) => [template.id, template]))
|
||||
const library = readLocalSigningTemplates()
|
||||
const templates = new Map(library.map((template) => [template.id, template]))
|
||||
// 只重绑到「确实有正文」的文书:换成一个同样取不到正文的模板,等于白换,
|
||||
// 还会把任务上的文书名改成与详情内容不符的一个
|
||||
const usable = library.filter((template) => template.contentHtml)
|
||||
|
||||
return records.map((record) => {
|
||||
return records.map((record, index) => {
|
||||
let next = record
|
||||
|
||||
if (next.status === 'signed' && !next.signatureDataUrl) {
|
||||
next = { ...next, signatureDataUrl: DEMO_SIGNATURE_DATA_URL }
|
||||
}
|
||||
|
||||
const template = templates.get(next.documentId)
|
||||
const bound = templates.get(next.documentId)
|
||||
|
||||
if (!template?.contentHtml) {
|
||||
// 库里已经没有这个 documentId 了。带固化正文的任务不重绑——那是留痕的一部分。
|
||||
if (!bound && !next.documentContentHtml && usable.length) {
|
||||
const fallback = usable[index % usable.length]
|
||||
|
||||
return {
|
||||
...next,
|
||||
documentId: fallback.id,
|
||||
documentName: fallback.name,
|
||||
templateVersionId: fallback.versionId,
|
||||
documentContentHtml: fallback.contentHtml,
|
||||
}
|
||||
}
|
||||
|
||||
if (!bound?.contentHtml) {
|
||||
return next
|
||||
}
|
||||
|
||||
@@ -291,8 +313,8 @@ function hydrateTaskDocuments(records: SigningTaskRecord[]): SigningTaskRecord[]
|
||||
|
||||
return {
|
||||
...next,
|
||||
templateVersionId: next.templateVersionId || template.versionId,
|
||||
documentContentHtml: template.contentHtml,
|
||||
templateVersionId: next.templateVersionId || bound.versionId,
|
||||
documentContentHtml: bound.contentHtml,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user