refactor(文书预览): 移除文书内容页签与 raw 渲染模式,统一走签署态预览
This commit is contained in:
@@ -30,18 +30,12 @@ import {
|
||||
type SigningFieldProgress,
|
||||
type SigningSignatureRequest,
|
||||
} from '@/utils/signing-document'
|
||||
import { buildPaperSrcDoc, ensureDocumentPaperStyle } from '@/utils/document-paper'
|
||||
import { ensureDocumentPaperStyle } from '@/utils/document-paper'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 文书正文(模板定稿 / 任务固化快照) */
|
||||
contentHtml: string
|
||||
/**
|
||||
* 渲染模式。
|
||||
* - `signing`(默认):按签署态渲染(占位符回填、勾选项交互化、签名域)
|
||||
* - `raw`:原样展示定稿(iframe 隔离模板自带的 `<style>`),仅文书库的「文书内容」页签用
|
||||
*/
|
||||
mode?: 'signing' | 'raw'
|
||||
/** 回填上下文:患者信息 / 签名 / 勾选 / 已填取值 */
|
||||
data?: SigningDocumentData
|
||||
/** 填写项可否改动、签名位可否点击采集 */
|
||||
@@ -68,7 +62,6 @@ const props = withDefaults(
|
||||
variant?: 'plain' | 'card'
|
||||
}>(),
|
||||
{
|
||||
mode: 'signing',
|
||||
data: () => ({}),
|
||||
interactive: false,
|
||||
signatureActionable: undefined,
|
||||
@@ -110,9 +103,6 @@ const processedHtml = computed(() =>
|
||||
}),
|
||||
)
|
||||
|
||||
/** raw 模式的 iframe 文档(自带完整版式的正文原样返回) */
|
||||
const rawSrcDoc = computed(() => buildPaperSrcDoc(props.contentHtml))
|
||||
|
||||
/**
|
||||
* 从渲染后的 DOM 读回填写项取值与勾选清单并上报。
|
||||
* 生成 HTML 时已把取值写成属性/文本,这里再按取值同步一次 DOM 状态,
|
||||
@@ -288,17 +278,8 @@ defineExpose({ getDocumentElement })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- raw 模式:模板定稿可能自带 <style>,必须隔离,否则会污染整个应用 -->
|
||||
<iframe
|
||||
v-if="mode === 'raw'"
|
||||
class="doc-paper-frame"
|
||||
:srcdoc="rawSrcDoc"
|
||||
sandbox=""
|
||||
title="文书原始版式预览"
|
||||
/>
|
||||
|
||||
<!-- eslint-disable vue/no-v-html -- 内容为本系统定稿的文书 HTML(编辑器产出、仅医务人员可改),非任意用户输入 -->
|
||||
<article v-else class="doc-paper" :class="{ 'doc-paper--card': variant === 'card' }">
|
||||
<article class="doc-paper" :class="{ 'doc-paper--card': variant === 'card' }">
|
||||
<div
|
||||
ref="containerRef"
|
||||
class="doc-paper__body"
|
||||
@@ -314,7 +295,7 @@ defineExpose({ getDocumentElement })
|
||||
|
||||
<style scoped>
|
||||
/* 基础排版(p / h2 / h3 / table / th / td / img)在 utils/document-paper.ts 的
|
||||
DOCUMENT_PAPER_CSS 里,运行期注入 head —— 那里是唯一一份,v-html 与 iframe 共用。
|
||||
DOCUMENT_PAPER_CSS 里,运行期注入 head —— 那里是唯一一份。
|
||||
这里只保留容器自己的盒子。 */
|
||||
|
||||
.doc-paper {
|
||||
@@ -331,13 +312,4 @@ defineExpose({ getDocumentElement })
|
||||
.doc-paper__body {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.doc-paper-frame {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 560px;
|
||||
background: #fff;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user