refactor(文书预览): 移除文书内容页签与 raw 渲染模式,统一走签署态预览
This commit is contained in:
@@ -2,14 +2,17 @@
|
||||
/**
|
||||
* 文书库的模板预览。
|
||||
*
|
||||
* 它只是**统一预览弹窗**在文书库这一处的配置:两个页签(文书内容 / 签署预览)+
|
||||
* 「用此模板发起签署」出口。纸的渲染、外框、页脚按钮都在 components/document/ 里,
|
||||
* 它只是**统一预览弹窗**在文书库这一处的配置:签署预览 + 「用此模板发起签署」出口。
|
||||
* 纸的渲染、外框、页脚按钮都在 components/document/ 里,
|
||||
* 这里不再实现任何渲染逻辑 —— 改版前这一处自己抄了一份基础排版(表格边框、字号、宋体),
|
||||
* 与签署工作台那份已经分叉。
|
||||
*
|
||||
* 两个页签的区别只在渲染模式:
|
||||
* - 文书内容:`mode="raw"`,原样展示定稿(iframe 隔离模板自带的 `<style>`);
|
||||
* - 签署预览:`mode="signing"`,按签署时效果渲染,占位符用示例患者填充、☑/☐ 可直接点。
|
||||
* **只有签署预览一种形态**(2026-09-27 去掉了原来的「文书内容」页签):
|
||||
* 按签署时效果渲染,占位符用示例患者填充、☑ / ☐ 可直接点。
|
||||
* 原来的「文书内容」走 `DocumentPaper` 的 `raw` 模式(iframe 原样展示定稿),
|
||||
* 与签署态并排会让科室看到两份长得不一样的同一份文书,
|
||||
* 也让人不知道该以哪一份为准 —— 已连同 `raw` 模式一起删除。
|
||||
* 要看原始定稿请走卡片的「编辑正文」。
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue'
|
||||
|
||||
@@ -38,11 +41,8 @@ const emit = defineEmits<{
|
||||
use: [template: DocumentTemplate]
|
||||
}>()
|
||||
|
||||
/** 预览页签:「文书内容」看原始定稿,「签署预览」看占位符填充与勾选交互化后的样子 */
|
||||
const activeTab = ref('content')
|
||||
|
||||
/**
|
||||
* 签署预览里的试填结果,仅用于预览反馈,不作为签署证据。
|
||||
* 预览里的试填结果,仅用于预览反馈,不作为签署证据。
|
||||
* 只在页脚展示一行汇总,所以只留计数与清单,不留整份取值。
|
||||
*/
|
||||
const filledCount = ref(0)
|
||||
@@ -58,8 +58,7 @@ watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
// 每次打开都回到「文书内容」,并把上一次的试填结果清掉
|
||||
activeTab.value = 'content'
|
||||
// 每次打开都把上一次的试填结果清掉
|
||||
filledCount.value = 0
|
||||
totalCount.value = 0
|
||||
selectedLabels.value = []
|
||||
@@ -67,7 +66,7 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
/** 状态口径统一走 library.ts:卡片、页签、预览三处必须是同一档 */
|
||||
/** 状态口径统一走 library.ts:卡片、徽标、预览三处必须是同一档 */
|
||||
const libraryStatus = computed<DocumentLibraryStatus>(() =>
|
||||
props.template ? readLibraryStatus(props.template) : '草稿',
|
||||
)
|
||||
@@ -91,26 +90,12 @@ const canInitiate = computed(
|
||||
() => Boolean(props.template?.contentHtml) && canInitiateSigning(libraryStatus.value),
|
||||
)
|
||||
|
||||
const tabs = computed(() => [
|
||||
{ key: 'content', label: '文书内容' },
|
||||
{
|
||||
key: 'signing',
|
||||
label: '签署预览',
|
||||
disabled: !props.template?.contentHtml,
|
||||
hint: '按签署时的效果渲染:占位符填充、勾选表交互化、签名域',
|
||||
},
|
||||
])
|
||||
|
||||
const badges = computed(() => [
|
||||
{ text: '类 Word 版式', tone: 'brand' as const },
|
||||
{ text: libraryStatus.value, tone: statusTone.value },
|
||||
])
|
||||
|
||||
const note = computed(() =>
|
||||
activeTab.value === 'signing'
|
||||
? `按签署时效果渲染:占位符已用示例患者「${PREVIEW_PATIENT.patientName}」填充,空白处是待补录的下划线、☑ / ☐ 可直接点击确认交互效果(预览不保存结果)。`
|
||||
: '',
|
||||
)
|
||||
const note = `按签署时效果渲染:占位符已用示例患者「${PREVIEW_PATIENT.patientName}」填充,空白处是待补录的下划线、☑ / ☐ 可直接点击确认交互效果(预览不保存结果)。`
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -118,18 +103,14 @@ const note = computed(() =>
|
||||
:visible="visible && Boolean(template)"
|
||||
:title="template?.name ?? ''"
|
||||
:badges="badges"
|
||||
:tabs="tabs"
|
||||
:active-tab="activeTab"
|
||||
:mode="activeTab === 'signing' ? 'signing' : 'raw'"
|
||||
:content-html="template?.contentHtml ?? ''"
|
||||
:data="PREVIEW_PATIENT"
|
||||
:interactive="activeTab === 'signing'"
|
||||
:interactive="true"
|
||||
:note="note"
|
||||
:loading="loading"
|
||||
:error="error ? '模板内容加载失败,请关闭后重试。' : ''"
|
||||
:empty-text="`「${template?.name ?? ''}」暂无结构化正文`"
|
||||
@close="emit('close')"
|
||||
@update:active-tab="activeTab = $event"
|
||||
@field-change="handleFieldChange"
|
||||
@selection-change="selectedLabels = $event"
|
||||
>
|
||||
@@ -176,7 +157,7 @@ const note = computed(() =>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<span v-if="activeTab === 'signing' && totalCount" class="preview-note-footer">
|
||||
<span v-if="totalCount" class="preview-note-footer">
|
||||
填写项 {{ filledCount }} / {{ totalCount }} 项已填<template v-if="selectedLabels.length"
|
||||
>・已勾选 {{ selectedLabels.length }} 项:{{ selectedLabels.join('、') }}</template
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user