feat: 提交
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
* 文档库的展示口径:状态、归属、文档类型。
|
||||
*
|
||||
* 状态只有**两档**:启用中 / 停用(2026-09-28 收敛)。
|
||||
* 原先沿用原型 V10.2 的 libStatuses(启用中 / 草稿 / 归档 / 需复审 / 停用),
|
||||
* 那套带着「发布 → 审核」的工作流;后端已确认不要审核链路、状态会重写,
|
||||
* 因此前端先收成两个页签,不再有草稿 / 归档 / 需复审。
|
||||
* 状态筛选只有**两组**:启用中 / 停用(2026-09-28 收敛)。卡片可以显示「待发布」等
|
||||
* 具体版本状态,但不为这些状态增加独立页签。
|
||||
* 后端仍保留完整版本状态;readLibraryStatus 在这里将它们归入两个筛选组。
|
||||
*
|
||||
* 后端模板状态枚举(DRAFT / PENDING_REVIEW / APPROVED / PUBLISHED / DISABLED /
|
||||
* ARCHIVED)在接口重写前仍会出现,因此这里保留一次**折叠**:把原始状态压成两档。
|
||||
* ARCHIVED)在接口中保留,因此这里提供**折叠**:把原始状态压成两个筛选组。
|
||||
* 反向映射(口径 → 后端)只保留「按状态过滤」这一处需要,见 toBackendStatusFilter。
|
||||
*/
|
||||
import type { DocumentRecord, DocumentStatus } from '@/api/management/types'
|
||||
import type { TemplateVersionAction } from '@/api/management/documents'
|
||||
|
||||
/** 文档库页签与卡片上的状态,取值即显示文案 */
|
||||
export type DocumentLibraryStatus = '启用中' | '停用'
|
||||
@@ -93,6 +93,52 @@ export function canInitiateSigning(status: DocumentLibraryStatus): boolean {
|
||||
return status === '启用中'
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端版本状态对应的文书操作。DRAFT 和 DISABLED 使用 enable;APPROVED 使用 publish;
|
||||
* 已发布版本使用 disable。审核中、驳回和归档状态不提供切换。
|
||||
*/
|
||||
export function templateWorkflowAction(
|
||||
record: Pick<DocumentRecord, 'status' | 'backendStatus'>,
|
||||
): TemplateVersionAction | null {
|
||||
switch (record.backendStatus?.toUpperCase()) {
|
||||
case 'DRAFT':
|
||||
case 'DISABLED':
|
||||
return 'enable'
|
||||
case 'APPROVED':
|
||||
return 'publish'
|
||||
case 'PUBLISHED':
|
||||
return 'disable'
|
||||
case 'PENDING_REVIEW':
|
||||
case 'REJECTED':
|
||||
case 'ARCHIVED':
|
||||
return null
|
||||
default:
|
||||
// 演示文库没有后端状态,仍按启用中 / 停用两档切换。
|
||||
if (record.backendStatus) return null
|
||||
return readLibraryStatus(record) === '停用' ? 'enable' : 'disable'
|
||||
}
|
||||
}
|
||||
|
||||
export function templateWorkflowLabel(
|
||||
record: Pick<DocumentRecord, 'status' | 'backendStatus'>,
|
||||
): string {
|
||||
switch (record.backendStatus?.toUpperCase()) {
|
||||
case 'DRAFT':
|
||||
case 'APPROVED':
|
||||
return '发布'
|
||||
case 'DISABLED':
|
||||
return '启用'
|
||||
case 'PUBLISHED':
|
||||
return '停用'
|
||||
default:
|
||||
return record.backendStatus
|
||||
? ''
|
||||
: readLibraryStatus(record) === '停用'
|
||||
? '启用'
|
||||
: '停用'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档归属:原型把「通用(全院)」当作科室清单里的一个选项一起勾选,
|
||||
* 勾中它就等于全院通用,其余科室勾选一并作废(见 docDeptPicks / openDocProps)。
|
||||
|
||||
Reference in New Issue
Block a user