feat(文档库): 补检查类型与关联项目标签并按关联项目编码搜索

按原型 V10.2 卡片上的两条信息补齐(此前完全没有对应字段):

- DocumentRecord / TemplateResponseDto 增加 examType 与 projectCodes(可选)。
  后端当前不返回,声明为可选是为了它补齐后前端不用再改;取不到时整条标签不渲染。
- 卡片渲染「🔬 检查类型」标签(原型 .exam-tag 蓝底)与「关联项目」编码
  (原型 .proj-code 紫底等宽),配色照抄原型。
- 搜索关键词纳入检查类型与关联项目编码,占位文案改为原型的
  「搜索模板名 / 编号 / 科室 / 关联项目编码」。
- 演示种子补 projectCodes: ['PHA-NAR'](原型 library 里这份文书就是这条)。
  刻意不给 examType:麻精同意书是告知类文书,本来就不挂检查类型,
  演示里看不到这条标签是正确结果,不编造取值。
- mock.ts 的 toLocalDocument 是逐字段列出的,同步带上两个新字段,
  否则演示文库保存一次,卡片上的标签就丢了。
This commit is contained in:
yelan
2026-09-26 19:45:31 +08:00
parent 7a94368bea
commit f871613abe
7 changed files with 95 additions and 3 deletions
@@ -33,8 +33,8 @@ function handleInput(event: Event) {
:value="modelValue"
class="lib-search"
type="search"
placeholder="搜索模板名 / 编号 / 科室 / 分类"
aria-label="搜索模板名称、编号、科室或分类"
placeholder="搜索模板名 / 编号 / 科室 / 关联项目编码"
aria-label="搜索模板名称、编号、科室、分类或关联项目编码"
@input="handleInput"
/>
@@ -64,6 +64,15 @@ const initiateTitle = computed(() =>
const canToggle = computed(() => canToggleStatus(status.value))
const toggleLabel = computed(() => (status.value === '停用' ? '启用' : '停用'))
/**
* 检查类型 / 关联项目编码(原型 V10.2 卡片上的两条信息)。
*
* 两者都只在后端真的给了值时才渲染:告知类文书本来就没有检查类型,
* 编一个取值出来会让卡片看起来比实际更"配置完整"。
*/
const examType = computed(() => props.template.examType?.trim() ?? '')
const projectCodes = computed(() => (props.template.projectCodes ?? []).filter(Boolean))
/** 草稿的「提交审核」只在演示模式露出,真实模式不给这个入口 */
const showSubmitReview = computed(() => props.isMock && status.value === '草稿')
@@ -93,8 +102,14 @@ const togglePermission = computed(() => workflowPermission(toggleAction.value))
<span class="exam-tag" :class="isGeneral ? 'is-general' : 'is-department'">
{{ ownershipLabel }}<template v-if="!isGeneral && sharedCount"> ·+{{ sharedCount }} 科室</template>
</span>
<span v-if="examType" class="exam-tag is-exam">🔬 检查类型:{{ examType }}</span>
</div>
<p v-if="projectCodes.length" class="tpl-projects">
<span>关联项目</span>
<code v-for="code in projectCodes" :key="code" class="proj-code">{{ code }}</code>
</p>
<p class="tpl-desc">{{ template.description || '—' }}</p>
<div class="tpl-ft">
@@ -276,6 +291,33 @@ const togglePermission = computed(() => workflowPermission(toggleAction.value))
background: #e2f5ec;
}
/* 检查类型:原型 .exam-tag 的默认配色(蓝底蓝字),与归属标签的绿底刻意区分 */
.exam-tag.is-exam {
color: #2b6cb0;
background: #eef6fb;
}
/* 关联项目:等宽编码小标签,原型 .proj-code 取紫系 */
.tpl-projects {
display: flex;
flex-wrap: wrap;
gap: 4px;
align-items: center;
margin: 0;
color: var(--mut);
font-size: 11.5px;
}
.proj-code {
padding: 1px 6px;
color: #7a4dbb;
font-family: Consolas, monospace;
font-size: 10.5px;
white-space: nowrap;
background: #f6f1fc;
border-radius: 4px;
}
.tpl-desc {
display: -webkit-box;
flex: 1;