feat(documents): implement document library management

This commit is contained in:
yelan
2026-08-27 16:47:31 +08:00
parent 24d8a9ece1
commit e7aa4843b7
7 changed files with 1378 additions and 17 deletions
@@ -0,0 +1,320 @@
<script setup lang="ts">
import { computed } from 'vue'
import { documentStatusLabels } from '../mock'
import type { DocumentTemplate } from '../types'
const props = defineProps<{
visible: boolean
template: DocumentTemplate | null
}>()
const emit = defineEmits<{
close: []
use: [template: DocumentTemplate]
}>()
const statusLabel = computed(() => {
if (!props.template) {
return ''
}
return documentStatusLabels[props.template.status]
})
</script>
<template>
<Teleport to="body">
<div
v-if="visible && template"
class="dialog-mask"
role="presentation"
@click.self="emit('close')"
>
<section
class="preview-dialog"
role="dialog"
aria-modal="true"
aria-labelledby="document-preview-title"
>
<header class="dialog-header">
<div class="dialog-title">
<h2 id="document-preview-title">{{ template.name }}</h2>
<span class="word-badge">类 Word 版式</span>
<span class="status-badge">{{ statusLabel }}</span>
</div>
<button type="button" class="close-button" aria-label="关闭预览" @click="emit('close')">
×
</button>
</header>
<div class="dialog-body">
<article class="preview-paper">
<h3>{{ template.name }}</h3>
<p class="paper-number">模板编号:{{ template.code }} · 版本 {{ template.version }}</p>
<p>
患者:<strong>{患者姓名}</strong> · 性别:<strong>{性别}</strong> · 年龄:<strong
>{年龄}</strong
>
</p>
<p>
门诊/住院号:<strong>{就诊号}</strong> · 科室:<strong>{{
template.department
}}</strong>
· 日期:<strong>{签署日期}</strong>
</p>
<p>
医务人员已就本项检查、治疗的适应证、禁忌证、医疗风险、替代方案及可能出现的不良后果向本人(或授权委托人)充分说明,本人已完全理解上述内容,自愿接受并签署确认。
</p>
<p>
本文档采用电子方式签署,患者手写签名图片将合成至下方签名域,文档原件与签名原图双留存。
</p>
<div class="signature-area">
<div>
<span>患者 / 授权委托人签名:</span>
<div class="signature-line">签名域(自动合成)</div>
</div>
<div>
<span>日期:</span>
<div class="signature-line date-line">自动填充</div>
</div>
</div>
</article>
</div>
<footer class="dialog-footer">
<p>占位符由系统在签署时自动填充,当前仅用于原型演示。</p>
<button type="button" class="footer-button secondary" @click="emit('close')">关闭</button>
<button type="button" class="footer-button primary" @click="emit('use', template)">
用此模板发起签署
</button>
</footer>
</section>
</div>
</Teleport>
</template>
<style scoped>
.dialog-mask {
position: fixed;
z-index: 20;
inset: 0;
display: flex;
padding: 16px;
overflow-y: auto;
background: rgb(9 40 52 / 45%);
}
.preview-dialog {
display: flex;
flex-direction: column;
width: 720px;
max-width: 96vw;
max-height: calc(100vh - 32px);
margin: auto;
overflow: hidden;
background: #fff;
border-radius: 14px;
box-shadow: var(--sh-modal);
animation: dialog-pop 0.18s ease;
}
@keyframes dialog-pop {
from {
opacity: 0;
transform: scale(0.96) translateY(8px);
}
to {
opacity: 1;
transform: none;
}
}
.dialog-header {
display: flex;
gap: 12px;
align-items: center;
padding: 12px 18px;
border-bottom: 1px solid var(--line);
}
.dialog-title {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
min-width: 0;
}
.dialog-title h2 {
margin: 0;
overflow: hidden;
color: var(--ink);
font-size: 15px;
text-overflow: ellipsis;
white-space: nowrap;
}
.word-badge,
.status-badge {
padding: 3px 9px;
font-size: 11px;
font-weight: 700;
border-radius: 12px;
}
.word-badge {
color: var(--brand);
background: var(--brand-l);
}
.status-badge {
color: var(--ok);
background: var(--ok-l);
}
.close-button {
flex-shrink: 0;
margin-left: auto;
color: var(--mut);
font-size: 20px;
line-height: 1;
background: transparent;
}
.close-button:hover {
color: var(--ink);
}
.dialog-body {
min-height: 0;
padding: 12px 18px;
overflow-y: auto;
}
.preview-paper {
min-height: 420px;
padding: 26px 34px;
color: var(--ink);
font-size: 13px;
line-height: 1.9;
background: #fff;
border: 1px solid #eef4f6;
box-shadow: 0 1px 5px rgb(13 62 81 / 5%);
}
.preview-paper h3 {
margin: 0 0 6px;
color: var(--ink);
font-size: 17px;
text-align: center;
letter-spacing: 2px;
}
.preview-paper p {
margin: 0 0 7px;
text-indent: 2em;
text-align: justify;
}
.preview-paper .paper-number {
margin-bottom: 18px;
color: var(--mut);
font-size: 12px;
text-align: center;
text-indent: 0;
}
.signature-area {
display: flex;
flex-wrap: wrap;
gap: 40px;
align-items: flex-end;
margin-top: 22px;
}
.signature-area > div > span {
display: block;
margin-bottom: 6px;
color: var(--mut);
font-size: 12.5px;
}
.signature-line {
display: flex;
align-items: center;
justify-content: center;
min-width: 200px;
min-height: 64px;
color: var(--mut);
border-bottom: 2px dashed var(--line);
}
.signature-line.date-line {
min-width: 130px;
}
.dialog-footer {
display: flex;
gap: 10px;
align-items: center;
padding: 10px 18px;
background: #f8fbfc;
border-top: 1px solid var(--line);
}
.dialog-footer p {
max-width: 46%;
margin: 0;
overflow: hidden;
color: var(--mut);
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.footer-button {
padding: 7px 13px;
font-size: 12px;
font-weight: 700;
border-radius: 7px;
}
.footer-button.secondary {
margin-left: auto;
color: var(--brand);
background: #fff;
border: 1px solid var(--brand);
}
.footer-button.primary {
color: #fff;
background: var(--brand);
border: 1px solid var(--brand);
}
.footer-button:hover {
filter: brightness(0.96);
}
@media (max-width: 680px) {
.preview-paper {
padding: 22px 18px;
}
.dialog-footer {
flex-wrap: wrap;
}
.dialog-footer p {
width: 100%;
max-width: none;
}
.footer-button.secondary {
margin-left: 0;
}
}
</style>