refactor(文书库): 状态口径收敛为启用中/停用两档并移除审核链路
This commit is contained in:
@@ -68,23 +68,21 @@ watch(
|
||||
|
||||
/** 状态口径统一走 library.ts:卡片、徽标、预览三处必须是同一档 */
|
||||
const libraryStatus = computed<DocumentLibraryStatus>(() =>
|
||||
props.template ? readLibraryStatus(props.template) : '草稿',
|
||||
props.template ? readLibraryStatus(props.template) : '启用中',
|
||||
)
|
||||
|
||||
/** 文书状态 → 预览弹窗徽标色调(弹窗只认 brand / ok / warn / mut 四档) */
|
||||
const BADGE_TONES: Record<DocumentStatusTone, 'ok' | 'warn' | 'mut'> = {
|
||||
const BADGE_TONES: Record<DocumentStatusTone, 'ok' | 'mut'> = {
|
||||
enabled: 'ok',
|
||||
review: 'warn',
|
||||
draft: 'mut',
|
||||
archived: 'mut',
|
||||
stopped: 'mut',
|
||||
}
|
||||
|
||||
const statusTone = computed(() => BADGE_TONES[readStatusTone(libraryStatus.value)])
|
||||
|
||||
/**
|
||||
* 与文书卡片保持同一口径:只有「启用中」的文书能发起签署。
|
||||
* 「需复审」不放行——它同时承载待审核与已驳回,两者都未定稿。
|
||||
* 与文书卡片同一口径:只有「启用中」的文书能发起签署。
|
||||
* 预览这一侧手里就有正文(列表接口不返回,进预览时按需取回),
|
||||
* 所以比卡片多判一道正文——空正文签出来的是一份与模板无关的白纸。
|
||||
*/
|
||||
const canInitiate = computed(
|
||||
() => Boolean(props.template?.contentHtml) && canInitiateSigning(libraryStatus.value),
|
||||
|
||||
@@ -5,7 +5,6 @@ import type { TemplateVersionAction } from '@/api/management/documents'
|
||||
|
||||
import {
|
||||
canInitiateSigning,
|
||||
canToggleStatus,
|
||||
DOCUMENT_STATUS_DOT,
|
||||
isGeneralOwnership,
|
||||
readLibraryStatus,
|
||||
@@ -16,15 +15,6 @@ import type { DocumentTemplate } from '../types'
|
||||
|
||||
const props = defineProps<{
|
||||
template: DocumentTemplate
|
||||
/**
|
||||
* 演示模式。
|
||||
*
|
||||
* 真实模式下卡片只有「停用 / 启用」这一个状态动作:后端菜单资源树里的
|
||||
* 「发布 / 提交审核」按钮虽在,但原型 V10.2 已经抛弃那条工作流,
|
||||
* 科室侧不该再看到「提交审核」这一步(草稿的送审改由属性/正文弹窗完成,
|
||||
* 或直接由医务管理放行)。
|
||||
*/
|
||||
isMock: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -33,7 +23,6 @@ const emit = defineEmits<{
|
||||
'edit-content': [template: DocumentTemplate]
|
||||
history: [template: DocumentTemplate]
|
||||
'toggle-status': [template: DocumentTemplate]
|
||||
'submit-review': [template: DocumentTemplate]
|
||||
initiate: [template: DocumentTemplate]
|
||||
}>()
|
||||
|
||||
@@ -55,13 +44,18 @@ const ownershipLabel = computed(() =>
|
||||
*/
|
||||
const sharedCount = computed(() => props.template.sharedDepartments?.length ?? 0)
|
||||
|
||||
/** 只有「启用中」能发起签署;其余状态要么没定稿,要么已下线 */
|
||||
/**
|
||||
* 只有「启用中」能发起签署;「停用」已下线。
|
||||
*
|
||||
* 这里只看状态,不看正文——真实模式的列表接口不返回正文,按正文判断会让所有
|
||||
* 真实模板的「发起」按钮都消失。缺正文由发起那一步拦下(见 index.vue 的 toSigningTemplate)。
|
||||
*/
|
||||
const canInitiate = computed(() => canInitiateSigning(status.value))
|
||||
const initiateTitle = computed(() =>
|
||||
canInitiate.value ? '用此文书发起签署' : '仅「启用中」的文书可发起签署',
|
||||
)
|
||||
|
||||
const canToggle = computed(() => canToggleStatus(status.value))
|
||||
/** 两档之间都能来回切,所以这个按钮没有「不适用」的状态 */
|
||||
const toggleLabel = computed(() => (status.value === '停用' ? '启用' : '停用'))
|
||||
|
||||
/**
|
||||
@@ -73,9 +67,6 @@ const toggleLabel = computed(() => (status.value === '停用' ? '启用' : '停
|
||||
const examType = computed(() => props.template.examType?.trim() ?? '')
|
||||
const projectCodes = computed(() => (props.template.projectCodes ?? []).filter(Boolean))
|
||||
|
||||
/** 草稿的「提交审核」只在演示模式露出,真实模式不给这个入口 */
|
||||
const showSubmitReview = computed(() => props.isMock && status.value === '草稿')
|
||||
|
||||
/** 停用/启用走的是后端版本动作:停用 → disable,启用 → publish */
|
||||
const toggleAction = computed<TemplateVersionAction>(() =>
|
||||
status.value === '停用' ? 'publish' : 'disable',
|
||||
@@ -142,7 +133,6 @@ const togglePermission = computed(() => workflowPermission(toggleAction.value))
|
||||
<span class="ft-spacer" />
|
||||
|
||||
<button
|
||||
v-if="canToggle"
|
||||
v-permission="togglePermission"
|
||||
type="button"
|
||||
class="card-button"
|
||||
@@ -155,16 +145,6 @@ const togglePermission = computed(() => workflowPermission(toggleAction.value))
|
||||
>
|
||||
{{ toggleLabel }}
|
||||
</button>
|
||||
<button
|
||||
v-if="showSubmitReview"
|
||||
v-permission="permissions.publish"
|
||||
type="button"
|
||||
class="card-button"
|
||||
title="提交审核,审核通过后自动发布"
|
||||
@click="emit('submit-review', template)"
|
||||
>
|
||||
提交审核
|
||||
</button>
|
||||
<button
|
||||
v-if="canInitiate"
|
||||
v-permission="permissions.initiate"
|
||||
@@ -243,13 +223,6 @@ const togglePermission = computed(() => workflowPermission(toggleAction.value))
|
||||
background: var(--ok-l);
|
||||
}
|
||||
|
||||
.tone-review {
|
||||
color: var(--warn);
|
||||
background: var(--warn-l);
|
||||
}
|
||||
|
||||
.tone-draft,
|
||||
.tone-archived,
|
||||
.tone-stopped {
|
||||
color: #8a9aa3;
|
||||
background: #eceef0;
|
||||
|
||||
Reference in New Issue
Block a user