feat(文书管理): 增加版本工作流与版本历史

- 模板状态按后端原始状态展示与筛选,待审核与已驳回分开展示
- 仅已发布模板可发起签署,新增提交审核/审核通过/驳回等动作
- 新增版本历史弹窗,复用统一的模板时间格式化方法
- 演示数据补齐已签署任务的签名图,并提供获取签名 dataURL 的接口
- 修复编辑器插入占位符时未定位光标导致内容落到文首的问题
This commit is contained in:
yelan
2026-09-17 16:44:54 +08:00
parent 81922d774f
commit 97c5182ba4
13 changed files with 982 additions and 64 deletions
@@ -9,7 +9,7 @@ import {
type SigningFieldProgress,
} from '@/utils/signing-document'
import { documentStatusLabels } from '../mock'
import { readStatusLabel, readStatusTone } from '../mock'
import type { DocumentTemplate } from '../types'
const props = defineProps<{
@@ -74,19 +74,17 @@ watch(
},
)
const statusLabel = computed(() => {
if (!props.template) {
return ''
}
const statusLabel = computed(() => (props.template ? readStatusLabel(props.template) : ''))
return documentStatusLabels[props.template.status]
})
/** 徽标配色与文书卡片同口径:草稿/待审核/已驳回/已发布/已归档各不相同 */
const statusTone = computed(() => (props.template ? readStatusTone(props.template) : 'draft'))
/** 与文书卡片保持同一口径:草稿与已归档不可发起签署 */
/**
* 与文书卡片保持同一口径:只有已发布(后端 APPROVED / PUBLISHED)才能发起签署。
* 不放行 review —— 它同时承载待审核与已驳回,两者都未定稿。
*/
const canInitiate = computed(
() =>
Boolean(props.template?.contentHtml) &&
(props.template?.status === 'published' || props.template?.status === 'review'),
() => Boolean(props.template?.contentHtml) && props.template?.status === 'published',
)
// 预置文书的 contentHtml 是完整 HTML 文档(自带版式样式);
@@ -179,7 +177,7 @@ function syncPreviewFields() {
<div class="dialog-title">
<h2 id="document-preview-title">{{ template.name }}</h2>
<span class="word-badge">类 Word 版式</span>
<span class="status-badge">{{ statusLabel }}</span>
<span class="status-badge" :class="'tone-' + statusTone">{{ statusLabel }}</span>
</div>
<button type="button" class="close-button" aria-label="关闭预览" @click="emit('close')">
×
@@ -291,7 +289,7 @@ function syncPreviewFields() {
type="button"
class="footer-button primary"
:disabled="!canInitiate"
:title="canInitiate ? '用此模板发起签署' : '仅已发布或待复审的模板可发起签署'"
:title="canInitiate ? '用此模板发起签署' : '仅已发布(审核通过)的模板可发起签署'"
@click="emit('use', template)"
>
用此模板发起签署
@@ -377,7 +375,24 @@ function syncPreviewFields() {
background: var(--brand-l);
}
.status-badge {
/* 状态徽标配色:与文书卡片同一套色调,草稿/待审核/已驳回不再一律显示成绿色 */
.status-badge.tone-draft,
.status-badge.tone-archived {
color: #8a9aa3;
background: #eceef0;
}
.status-badge.tone-review {
color: var(--warn);
background: var(--warn-l);
}
.status-badge.tone-rejected {
color: var(--err);
background: var(--err-l);
}
.status-badge.tone-published {
color: var(--ok);
background: var(--ok-l);
}