Merge branch 'master' of https://gitea.xinyuxi.com/zhanggaoming/xh-medical-sign-web
This commit is contained in:
@@ -5,8 +5,10 @@ withDefaults(
|
||||
total: number
|
||||
/** 只在演示模式下展示「重置演示数据」:真实环境不该出现这个自测入口 */
|
||||
showReset?: boolean
|
||||
canCreate?: boolean
|
||||
canExport?: boolean
|
||||
}>(),
|
||||
{ showReset: false },
|
||||
{ showReset: false, canCreate: false, canExport: false },
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -40,11 +42,11 @@ function handleInput(event: Event) {
|
||||
aria-label="搜索模板名称、编号或科室"
|
||||
@input="handleInput"
|
||||
/>
|
||||
<button type="button" class="tool-button primary" @click="emit('add')">
|
||||
<button v-if="canCreate" type="button" class="tool-button primary" @click="emit('add')">
|
||||
<span aria-hidden="true">+</span>
|
||||
新增文档
|
||||
</button>
|
||||
<button type="button" class="tool-button secondary" @click="emit('export')">
|
||||
<button v-if="canExport" type="button" class="tool-button secondary" @click="emit('export')">
|
||||
导出模板包
|
||||
</button>
|
||||
<button
|
||||
|
||||
@@ -8,6 +8,9 @@ import { readStatusLabel, readStatusTone } from '../mock'
|
||||
|
||||
const props = defineProps<{
|
||||
template: DocumentTemplate
|
||||
canEdit: boolean
|
||||
canInitiate: boolean
|
||||
canRemove: boolean
|
||||
/** 演示模式下「删除」是真删;真实模式下语义是下架(模板无 DELETE 接口,走归档) */
|
||||
isMock: boolean
|
||||
}>()
|
||||
@@ -26,17 +29,19 @@ const statusLabel = computed(() => readStatusLabel(props.template))
|
||||
/** 配色按后端状态分组取(待审核与已驳回不能共用一个颜色) */
|
||||
const statusTone = computed(() => readStatusTone(props.template))
|
||||
|
||||
/**
|
||||
* 只有已发布(后端 APPROVED / PUBLISHED)的模板可以发起签署。
|
||||
*
|
||||
* 这里不再放行 review:review 同时承载后端的 PENDING_REVIEW(待审核)与
|
||||
* REJECTED(已驳回),两者都还没通过审核。允许它们发起签署,
|
||||
* 等于让未定稿的文书进入签署流程,签出来的文书也无法追溯是哪一版定稿。
|
||||
*/
|
||||
const canInitiate = computed(() => props.template.status === 'published')
|
||||
/** 只有已发布 / 待复审的模板可以发起签署;草稿与已归档不可用 */
|
||||
const canInitiateTemplate = computed(
|
||||
() =>
|
||||
props.canInitiate &&
|
||||
(props.template.status === 'published' || props.template.status === 'review'),
|
||||
)
|
||||
|
||||
const initiateTitle = computed(() =>
|
||||
canInitiate.value ? '用此模板发起签署' : '仅已发布(审核通过)的模板可发起签署',
|
||||
canInitiateTemplate.value
|
||||
? '用此模板发起签署'
|
||||
: props.canInitiate
|
||||
? '仅已发布或待复审的模板可发起签署'
|
||||
: '当前账号没有发起签署任务的权限',
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -111,8 +116,11 @@ const removeTitle = computed(() => (props.isMock ? '删除此文书' : '下架
|
||||
</span>
|
||||
<div class="template-actions">
|
||||
<button type="button" class="card-button" @click="emit('preview', template)">预览</button>
|
||||
<button type="button" class="card-button" @click="emit('edit', template)">编辑</button>
|
||||
<button v-if="canEdit" type="button" class="card-button" @click="emit('edit', template)">
|
||||
编辑
|
||||
</button>
|
||||
<button
|
||||
v-if="canInitiate"
|
||||
type="button"
|
||||
class="card-button"
|
||||
title="查看该文书的版本历史"
|
||||
@@ -124,6 +132,7 @@ const removeTitle = computed(() => (props.isMock ? '删除此文书' : '下架
|
||||
v-if="canInitiate"
|
||||
type="button"
|
||||
class="card-button primary"
|
||||
:disabled="!canInitiateTemplate"
|
||||
:title="initiateTitle"
|
||||
@click="emit('initiate', template)"
|
||||
>
|
||||
@@ -150,6 +159,7 @@ const removeTitle = computed(() => (props.isMock ? '删除此文书' : '下架
|
||||
{{ action.label }}
|
||||
</button>
|
||||
<button
|
||||
v-if="canRemove"
|
||||
type="button"
|
||||
class="card-button danger"
|
||||
:title="removeTitle"
|
||||
|
||||
Reference in New Issue
Block a user