| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873 |
- /**
- * 状态标签注册表 — 全局集中定义所有枚举字段的 label + tagType
- */
- import { resolveVoidTypeLabel } from '@/utils/void-type-dict'
- // ── 类型定义 ──────────────────────────────────────────────────────────────────
- /** el-tag 的 type 属性值 */
- export type TagType = 'success' | 'warning' | 'danger' | 'info' | '' | 'primary'
- /** 单条枚举映射 */
- export interface StatusItem {
- label: string
- tagType: TagType
- }
- /** 注册表类型 */
- export type StatusRegistry = Record<string, StatusItem>
- // ── 工厂函数 ──────────────────────────────────────────────────────────────────
- function createLabelGetter(registry: StatusRegistry) {
- return (code: string): string => registry[code]?.label ?? code ?? '—'
- }
- function createTagTypeGetter(registry: StatusRegistry) {
- return (code: string): TagType => registry[code]?.tagType ?? 'info'
- }
- // ══════════════════════════════════════════════════════════════════════════════
- // 协议 / 存储 域
- // ══════════════════════════════════════════════════════════════════════════════
- export const protocolStatus: StatusRegistry = {
- dsx: { label: '待生效', tagType: 'info' },
- sxz: { label: '生效中', tagType: 'primary' },
- ygq: { label: '已过期', tagType: 'warning' },
- yzf: { label: '已作废', tagType: 'danger' },
- sdfq: { label: '属地废弃', tagType: 'danger' },
- zky: { label: '转科研', tagType: 'primary' }
- }
- /** 协议/捐赠单无效态(与样本接收、生产工单列表过滤口径一致) */
- export const INACTIVE_PROTOCOL_STATUSES = ['yzf', 'sdfq'] as const
- export function isInactiveProtocolStatus(status?: string): boolean {
- const code = (status || '').trim()
- return (INACTIVE_PROTOCOL_STATUSES as readonly string[]).includes(code)
- }
- export const protocolStatusLabel = createLabelGetter(protocolStatus)
- export const protocolStatusTagType = createTagTypeGetter(protocolStatus)
- /** 协议状态展示文案;已作废时追加作废类型,如「已作废(客户毁存)」 */
- export function protocolStatusDisplayLabel(status: string, voidType?: string): string {
- const base = protocolStatusLabel(status)
- if ((status || '').trim() !== 'yzf') return base
- const vt = resolveVoidTypeLabel(voidType || '')
- return vt ? `${base}(${vt})` : base
- }
- export const donationStatus: StatusRegistry = {
- dsx: { label: '待生效', tagType: 'info' },
- sxz: { label: '生效中', tagType: 'primary' },
- ygq: { label: '已过期', tagType: 'warning' },
- yzf: { label: '已作废', tagType: 'danger' },
- sdfq: { label: '属地废弃', tagType: 'danger' },
- zckc: { label: '转细胞存储', tagType: 'primary' }
- }
- export const donationStatusLabel = createLabelGetter(donationStatus)
- export const donationStatusTagType = createTagTypeGetter(donationStatus)
- /** 捐赠协议状态展示文案;已作废时追加作废类型 */
- export function donationStatusDisplayLabel(status: string, voidType?: string): string {
- const base = donationStatusLabel(status)
- if ((status || '').trim() !== 'yzf') return base
- const vt = resolveVoidTypeLabel(voidType || '')
- return vt ? `${base}(${vt})` : base
- }
- /** 按来源(细胞存储 / 科研捐赠)展示协议状态,已作废时带作废类型 */
- export function protocolStatusDisplayLabelBySource(
- status: string,
- source: string,
- voidType?: string
- ): string {
- return source === 'research_donation'
- ? donationStatusDisplayLabel(status, voidType)
- : protocolStatusDisplayLabel(status, voidType)
- }
- export const sampleStatus: StatusRegistry = {
- ycj: { label: '已采集', tagType: 'primary' },
- jcz: { label: '检测中', tagType: 'warning' },
- yrk: { label: '已入库', tagType: 'success' },
- yzf: { label: '已作废', tagType: 'danger' }
- }
- export const sampleStatusLabel = createLabelGetter(sampleStatus)
- export const sampleStatusTagType = createTagTypeGetter(sampleStatus)
- export const sampleCollectionFlag: StatusRegistry = {
- uncollected: { label: '未采集', tagType: 'info' },
- collected: { label: '已采集', tagType: 'success' },
- voided: { label: '已作废', tagType: 'danger' }
- }
- export const sampleCollectionFlagLabel = createLabelGetter(sampleCollectionFlag)
- export const sampleCollectionFlagTagType = createTagTypeGetter(sampleCollectionFlag)
- export const sampleReceptionFlag: StatusRegistry = {
- none: { label: '未接收', tagType: 'info' },
- js: { label: '已接收', tagType: 'success' },
- bj: { label: '拒收', tagType: 'danger' }
- }
- export const sampleReceptionFlagLabel = createLabelGetter(sampleReceptionFlag)
- export const sampleReceptionFlagTagType = createTagTypeGetter(sampleReceptionFlag)
- export const sampleQcFlag: StatusRegistry = {
- incomplete: { label: '未完成', tagType: 'warning' },
- complete: { label: '已完成', tagType: 'success' },
- voided: { label: '已作废', tagType: 'danger' }
- }
- export const sampleQcFlagLabel = createLabelGetter(sampleQcFlag)
- export const sampleQcFlagTagType = createTagTypeGetter(sampleQcFlag)
- export const sampleStorageFlag: StatusRegistry = {
- none: { label: '未入库', tagType: 'info' },
- yrk: { label: '已入库', tagType: 'success' },
- rejected: { label: '拒绝入库', tagType: 'danger' }
- }
- export const sampleStorageFlagLabel = createLabelGetter(sampleStorageFlag)
- export const sampleStorageFlagTagType = createTagTypeGetter(sampleStorageFlag)
- export const handleDoneFlag: StatusRegistry = {
- '1': { label: '已办理', tagType: 'success' },
- '0': { label: '未办理', tagType: 'info' }
- }
- export const handleDoneFlagLabel = createLabelGetter(handleDoneFlag)
- export const handleDoneFlagTagType = createTagTypeGetter(handleDoneFlag)
- export const payStatus: StatusRegistry = {
- dfj: { label: '已付款', tagType: 'primary' },
- jfqrz: { label: '付款确认中', tagType: 'warning' },
- yjf: { label: '付款完成', tagType: 'success' },
- tfqrz: { label: '退费确认中', tagType: 'warning' },
- ytf: { label: '已退费', tagType: 'danger' }
- }
- export const payStatusLabel = createLabelGetter(payStatus)
- export const payStatusTagType = createTagTypeGetter(payStatus)
- export const auditStatus: StatusRegistry = {
- shtg: { label: '审核通过', tagType: 'success' },
- shth: { label: '审核退回', tagType: 'danger' }
- }
- export const auditStatusLabel = createLabelGetter(auditStatus)
- export const auditStatusTagType = createTagTypeGetter(auditStatus)
- export const payMode: StatusRegistry = {
- dj: { label: '趸交', tagType: 'primary' },
- fq: { label: '分期', tagType: 'warning' },
- djfq: { label: '趸交+分期', tagType: 'warning' },
- fgd: { label: '分改趸', tagType: 'warning' }
- }
- export const payModeLabel = createLabelGetter(payMode)
- export const payModeTagType = createTagTypeGetter(payMode)
- export const paymentChaseStatus: StatusRegistry = {
- overdue: { label: '已逾期', tagType: 'danger' },
- upcoming: { label: '即将到期', tagType: 'warning' }
- }
- export const paymentChaseStatusLabel = createLabelGetter(paymentChaseStatus)
- export const paymentChaseStatusTagType = createTagTypeGetter(paymentChaseStatus)
- export const periodFinanceAudit: StatusRegistry = {
- dfj: { label: '待缴费', tagType: 'info' },
- jfqrz: { label: '确认中', tagType: 'warning' },
- yjf: { label: '已通过', tagType: 'success' },
- partial: { label: '部分到账', tagType: 'primary' }
- }
- export const periodFinanceAuditLabel = createLabelGetter(periodFinanceAudit)
- export const periodFinanceAuditTagType = createTagTypeGetter(periodFinanceAudit)
- /** 样本缴费进度 Tag(勿与转账笔 payStatus 混用:payStatus.dfj=已付款) */
- export const samplePaymentProgress: StatusRegistry = {
- dfj: { label: '待缴费', tagType: 'info' },
- bfyj: { label: '部分已缴', tagType: 'primary' },
- yjq: { label: '已缴清', tagType: 'success' }
- }
- export const samplePaymentProgressLabel = createLabelGetter(samplePaymentProgress)
- export const samplePaymentProgressTagType = createTagTypeGetter(samplePaymentProgress)
- export const transferType: StatusRegistry = {
- wxzz: { label: '微信转账', tagType: 'success' },
- zzbzz: { label: '支付宝转账', tagType: 'primary' },
- yhkzz: { label: '银行卡转账', tagType: 'info' },
- xj: { label: '现金', tagType: 'warning' },
- lszz: { label: '乐刷', tagType: 'primary' }
- }
- export const transferTypeLabel = createLabelGetter(transferType)
- export const transferTypeTagType = createTagTypeGetter(transferType)
- export const transportType: StatusRegistry = {
- kdys: { label: '快递运输', tagType: 'info' },
- ryxd: { label: '人员携带', tagType: 'success' }
- }
- export const transportTypeLabel = createLabelGetter(transportType)
- export const transportTypeTagType = createTagTypeGetter(transportType)
- export const receptionSource: StatusRegistry = {
- cell_storage: { label: '细胞存储', tagType: 'primary' },
- research_donation: { label: '科研捐赠', tagType: 'warning' },
- outbound: { label: '出库', tagType: 'primary' },
- pilot_service: { label: '中试服务', tagType: 'primary' },
- clinical_application: { label: '临床应用', tagType: 'warning' },
- basic_experiment: { label: '基础实验', tagType: 'primary' }
- }
- export const receptionSourceLabel = createLabelGetter(receptionSource)
- export const receptionSourceTagType = createTagTypeGetter(receptionSource)
- export const newbornSex: StatusRegistry = {
- '1': { label: '男', tagType: 'primary' },
- '0': { label: '女', tagType: 'success' }
- }
- export const newbornSexLabel = createLabelGetter(newbornSex)
- export const newbornSexTagType = createTagTypeGetter(newbornSex)
- export const deliveryMode: StatusRegistry = {
- sc: { label: '顺产', tagType: 'info' },
- pgc: { label: '剖宫产', tagType: 'warning' }
- }
- export const deliveryModeLabel = createLabelGetter(deliveryMode)
- export const deliveryModeTagType = createTagTypeGetter(deliveryMode)
- export const sourceType: StatusRegistry = {
- direct: { label: '独立新建', tagType: 'info' },
- from_storage: { label: '从存储转来', tagType: 'primary' }
- }
- export const sourceTypeLabel = createLabelGetter(sourceType)
- export const sourceTypeTagType = createTagTypeGetter(sourceType)
- // ══════════════════════════════════════════════════════════════════════════════
- // 质检域
- // ══════════════════════════════════════════════════════════════════════════════
- export const qcBizType: StatusRegistry = {
- inbound: { label: '入库质检', tagType: 'success' },
- outbound: { label: '出库质检', tagType: 'primary' },
- temporary: { label: '临时质检', tagType: 'warning' }
- }
- export const qcBizTypeLabel = createLabelGetter(qcBizType)
- export const qcBizTypeTagType = createTagTypeGetter(qcBizType)
- export const workOrderStatus: StatusRegistry = {
- dpz: { label: '待配置', tagType: 'info' },
- ypz: { label: '已配置', tagType: 'success' },
- ywc: { label: '已完成', tagType: 'success' },
- yzf: { label: '已作废', tagType: 'danger' }
- }
- export const workOrderStatusLabel = createLabelGetter(workOrderStatus)
- export const workOrderStatusTagType = createTagTypeGetter(workOrderStatus)
- export const QC_WORK_ORDER_STATUS_FILTER_OPTIONS = Object.entries(workOrderStatus).map(
- ([value, meta]) => ({
- value,
- label: meta.label
- })
- )
- export function joinWorkOrderStatusFilter(statuses: string[]): string | undefined {
- const list = statuses.map((s) => s.trim()).filter(Boolean)
- return list.length ? list.join(',') : undefined
- }
- export function matchesWorkOrderStatusFilter(
- status: string,
- filter: string | string[] | undefined
- ): boolean {
- if (!filter) return true
- const list = Array.isArray(filter)
- ? filter
- : filter
- .split(',')
- .map((s) => s.trim())
- .filter(Boolean)
- if (!list.length) return true
- return list.includes(status)
- }
- export const productionWorkOrderStatus: StatusRegistry = {
- dpz: { label: '待配置', tagType: 'info' },
- jxz: { label: '进行中', tagType: 'warning' },
- ywc: { label: '已完成', tagType: 'success' },
- yzf: { label: '已作废', tagType: 'danger' }
- }
- export const productionWorkOrderStatusLabel = createLabelGetter(productionWorkOrderStatus)
- export const productionWorkOrderStatusTagType = createTagTypeGetter(productionWorkOrderStatus)
- export const PRODUCTION_WORK_ORDER_STATUS_FILTER_OPTIONS = Object.entries(
- productionWorkOrderStatus
- ).map(([value, meta]) => ({
- value,
- label: meta.label
- }))
- export const taskType: StatusRegistry = {
- sysz: { label: '实验室自检', tagType: 'success' },
- dsfjc: { label: '第三方检测', tagType: 'primary' }
- }
- export const taskTypeLabel = createLabelGetter(taskType)
- export const taskTypeTagType = createTagTypeGetter(taskType)
- export const qcConclusion: StatusRegistry = {
- tg: { label: '通过', tagType: 'success' },
- btg: { label: '不通过', tagType: 'danger' }
- }
- export const qcTaskConclusionLabel = createLabelGetter(qcConclusion)
- export const qcTaskConclusionTagType = createTagTypeGetter(qcConclusion)
- /** 工单级质检结论(列表卡片):合格 / 不合格;无结论返回空串 */
- export const qcWorkOrderConclusionLabelMap: StatusRegistry = {
- tg: { label: '合格', tagType: 'success' },
- btg: { label: '不合格', tagType: 'danger' }
- }
- export const qcWorkOrderConclusionLabel = createLabelGetter(qcWorkOrderConclusionLabelMap)
- export const qcWorkOrderConclusionTagType = createTagTypeGetter(qcWorkOrderConclusionLabelMap)
- /** 无 tg/btg 时展示「待结论」(待办醒目,用 danger) */
- export function qcConclusionDisplayLabel(code?: string | null): string {
- const c = (code || '').trim()
- if (c === 'tg' || c === 'btg') return qcTaskConclusionLabel(c)
- return '待结论'
- }
- export function qcConclusionDisplayTagType(code?: string | null): TagType {
- const c = (code || '').trim()
- if (c === 'tg' || c === 'btg') return qcTaskConclusionTagType(c)
- return 'danger'
- }
- export const taskStatus: StatusRegistry = {
- dzx: { label: '待执行', tagType: 'danger' },
- jxz: { label: '进行中', tagType: 'warning' },
- ywc: { label: '已完成', tagType: 'success' }
- }
- export const taskStatusLabel = createLabelGetter(taskStatus)
- export const taskStatusTagType = createTagTypeGetter(taskStatus)
- export const acceptConclusion: StatusRegistry = {
- js: { label: '接收', tagType: 'success' },
- bj: { label: '拒收', tagType: 'danger' }
- }
- export const acceptConclusionLabel = createLabelGetter(acceptConclusion)
- export const acceptConclusionTagType = createTagTypeGetter(acceptConclusion)
- // ══════════════════════════════════════════════════════════════════════════════
- // 渠道域
- // ══════════════════════════════════════════════════════════════════════════════
- export const channelType: StatusRegistry = {
- yy: { label: '医院', tagType: 'primary' },
- hzjg: { label: '合作机构', tagType: 'success' },
- zs: { label: '诊所', tagType: 'warning' },
- zfjg: { label: '政府机构', tagType: 'danger' },
- qt: { label: '其他', tagType: 'info' }
- }
- export const channelTypeLabel = createLabelGetter(channelType)
- export const channelTypeTagType = createTagTypeGetter(channelType)
- export const agreementType: StatusRegistry = {
- kyxy: { label: '框架协议', tagType: 'primary' },
- zsxy: { label: '中试协议', tagType: 'success' },
- lcxy: { label: '临床协议', tagType: 'warning' },
- jcsy: { label: '基础实验', tagType: 'primary' }
- }
- export const agreementTypeLabel = createLabelGetter(agreementType)
- export const agreementTypeTagType = createTagTypeGetter(agreementType)
- export const agreementStatus: StatusRegistry = {
- dsx: { label: '待生效', tagType: 'info' },
- sxz: { label: '生效中', tagType: 'primary' },
- yzf: { label: '已作废', tagType: 'danger' }
- }
- export const agreementStatusLabel = createLabelGetter(agreementStatus)
- export const agreementStatusTagType = createTagTypeGetter(agreementStatus)
- export const settlementType: StatusRegistry = {
- yj: { label: '月结', tagType: '' },
- jj: { label: '季结', tagType: 'success' },
- nj: { label: '年结', tagType: 'warning' },
- dcjs: { label: '单次结算', tagType: 'danger' }
- }
- export const settlementTypeLabel = createLabelGetter(settlementType)
- export const settlementTypeTagType = createTagTypeGetter(settlementType)
- // ══════════════════════════════════════════════════════════════════════════════
- // 订单域
- // ══════════════════════════════════════════════════════════════════════════════
- export const orderStatus: StatusRegistry = {
- pending_payment: { label: '待支付', tagType: 'warning' },
- pending_confirm: { label: '待收货', tagType: 'info' },
- completed: { label: '已完成', tagType: 'success' },
- cancelled: { label: '已取消', tagType: 'danger' }
- }
- export const orderStatusLabel = createLabelGetter(orderStatus)
- export const orderStatusTagType = createTagTypeGetter(orderStatus)
- export const deliveryStatusMap: StatusRegistry = {
- pending_dispatch: { label: '待分配配送', tagType: 'info' },
- delivering: { label: '配送中', tagType: 'warning' },
- delivered: { label: '配送完成', tagType: 'success' }
- }
- export const deliveryStatusLabel = createLabelGetter(deliveryStatusMap)
- export const deliveryStatusTagType = createTagTypeGetter(deliveryStatusMap)
- export const paymentMethod: StatusRegistry = {
- online: { label: '线上支付', tagType: 'success' },
- offline: { label: '线下支付', tagType: 'info' }
- }
- export const paymentMethodLabel = createLabelGetter(paymentMethod)
- export const paymentMethodTagType = createTagTypeGetter(paymentMethod)
- export const orderPayStatus: StatusRegistry = {
- pending_payment: { label: '待支付', tagType: 'warning' },
- paid: { label: '已支付', tagType: 'success' }
- }
- export const orderPayStatusLabel = createLabelGetter(orderPayStatus)
- export const orderPayStatusTagType = createTagTypeGetter(orderPayStatus)
- // ══════════════════════════════════════════════════════════════════════════════
- // 系统 / 通用域
- // ══════════════════════════════════════════════════════════════════════════════
- /** 通用启用/停用(数据库 status 字段 1/0) */
- export const enableStatus: StatusRegistry = {
- '1': { label: '正常', tagType: 'success' },
- '0': { label: '停用', tagType: 'danger' }
- }
- export const enableStatusLabel = createLabelGetter(enableStatus)
- export const enableStatusTagType = createTagTypeGetter(enableStatus)
- /** 性别(客户等业务表) */
- export const sex: StatusRegistry = {
- '0': { label: '男', tagType: 'primary' },
- '1': { label: '女', tagType: 'success' }
- }
- export const sexLabel = createLabelGetter(sex)
- export const sexTagType = createTagTypeGetter(sex)
- /** 预签约订单状态 */
- export const presignOrderStatus: StatusRegistry = {
- draft: { label: '草稿', tagType: 'info' },
- active: { label: '进行中', tagType: 'warning' },
- converted: { label: '已转正式', tagType: 'success' },
- void: { label: '已作废', tagType: 'danger' }
- }
- export const presignOrderStatusLabel = createLabelGetter(presignOrderStatus)
- export const presignOrderStatusTagType = createTagTypeGetter(presignOrderStatus)
- /** 请假状态 */
- export const leaveStatus: StatusRegistry = {
- draft: { label: '草稿', tagType: 'info' },
- pending: { label: '审批中', tagType: 'warning' },
- approved: { label: '已通过', tagType: 'success' },
- rejected: { label: '已驳回', tagType: 'danger' },
- cancelled: { label: '已取消', tagType: 'info' }
- }
- export const leaveStatusLabel = createLabelGetter(leaveStatus)
- export const leaveStatusTagType = createTagTypeGetter(leaveStatus)
- /** 数据权限范围 */
- export const dataScope: StatusRegistry = {
- '1': { label: '全部数据', tagType: '' },
- '2': { label: '本部门数据', tagType: 'info' },
- '3': { label: '本部门及以下', tagType: 'info' },
- '4': { label: '仅本人', tagType: 'warning' },
- '5': { label: '自定义', tagType: 'primary' }
- }
- export const dataScopeLabel = createLabelGetter(dataScope)
- export const dataScopeTagType = createTagTypeGetter(dataScope)
- /** 洁净室等级 */
- export const cleanRoomGrade: StatusRegistry = {
- A: { label: 'A级', tagType: 'warning' },
- B: { label: 'B级', tagType: '' },
- C: { label: 'C级', tagType: 'info' },
- D: { label: 'D级', tagType: 'info' }
- }
- export const cleanRoomGradeLabel = createLabelGetter(cleanRoomGrade)
- export const cleanRoomGradeTagType = createTagTypeGetter(cleanRoomGrade)
- /** 样本编码类型 */
- export const sampleCodeType: StatusRegistry = {
- zxbm: { label: '造血编码', tagType: 'info' },
- qdbm: { label: '脐带编码', tagType: 'primary' }
- }
- export const sampleCodeTypeLabel = createLabelGetter(sampleCodeType)
- export const sampleCodeTypeTagType = createTagTypeGetter(sampleCodeType)
- /** 耗材包类型 */
- export const packType: StatusRegistry = {
- bzhcb: { label: '标准耗材包', tagType: 'primary' },
- zdyhcb: { label: '自定义耗材包', tagType: 'warning' }
- }
- export const packTypeLabel = createLabelGetter(packType)
- export const packTypeTagType = createTagTypeGetter(packType)
- /** 生产物料类型 */
- export const productionMaterialType: StatusRegistry = {
- reagent: { label: '试剂', tagType: 'primary' },
- consumable: { label: '耗材', tagType: 'success' },
- configured_reagent: { label: '配置试剂', tagType: 'warning' }
- }
- export const productionMaterialTypeLabel = createLabelGetter(productionMaterialType)
- export const productionMaterialTypeTagType = createTagTypeGetter(productionMaterialType)
- export const productionMaterialUsageSourceType: StatusRegistry = {
- manual_in: { label: '手动入库', tagType: 'success' },
- manual_out: { label: '手动出库', tagType: 'warning' },
- manual_discard: { label: '手动废弃', tagType: 'danger' },
- step_save: { label: '生产扣减', tagType: 'primary' },
- prep_consume: { label: '配制消耗', tagType: 'info' },
- prep_in: { label: '配制入库', tagType: 'success' }
- }
- export const productionMaterialUsageSourceTypeLabel = createLabelGetter(
- productionMaterialUsageSourceType
- )
- export const productionMaterialUsageSourceTypeTagType = createTagTypeGetter(
- productionMaterialUsageSourceType
- )
- // ══════════════════════════════════════════════════════════════════════════════
- // 入库放行审核域
- // ══════════════════════════════════════════════════════════════════════════════
- export const storageReleaseConclusion: StatusRegistry = {
- tg: { label: '通过', tagType: 'success' },
- btg: { label: '不通过', tagType: 'danger' }
- }
- export const storageReleaseConclusionLabel = createLabelGetter(storageReleaseConclusion)
- export const storageReleaseConclusionTagType = createTagTypeGetter(storageReleaseConclusion)
- export const storageStatus: StatusRegistry = {
- drk: { label: '待入库', tagType: 'warning' },
- yrk: { label: '已入库', tagType: 'success' }
- }
- export const storageStatusLabel = createLabelGetter(storageStatus)
- export const storageStatusTagType = createTagTypeGetter(storageStatus)
- // ══════════════════════════════════════════════════════════════════════════════
- // 渠道服务订单域
- // ══════════════════════════════════════════════════════════════════════════════
- /** 渠道服务订单类型 */
- export const channelServiceOrderType: StatusRegistry = {
- yfk: { label: '预付款充值', tagType: 'primary' },
- gmcp: { label: '购买产品份数', tagType: 'success' }
- }
- export const channelServiceOrderTypeLabel = createLabelGetter(channelServiceOrderType)
- export const channelServiceOrderTypeTagType = createTagTypeGetter(channelServiceOrderType)
- /** 渠道服务订单状态 */
- export const channelServiceOrderStatus: StatusRegistry = {
- dsx: { label: '待生效', tagType: 'info' },
- dqr: { label: '待确认', tagType: 'warning' },
- yqr: { label: '已确认', tagType: 'success' },
- sxz: { label: '生效中', tagType: 'primary' },
- tfqrz: { label: '退款确认中', tagType: 'danger' },
- ytf: { label: '已退款', tagType: 'info' },
- yzf: { label: '已作废', tagType: 'info' }
- }
- export const channelServiceOrderStatusLabel = createLabelGetter(channelServiceOrderStatus)
- export const channelServiceOrderStatusTagType = createTagTypeGetter(channelServiceOrderStatus)
- // ══════════════════════════════════════════════════════════════════════════════
- // 流水域
- // ══════════════════════════════════════════════════════════════════════════════
- // 流水类型
- export const txnTypeLabel = (type: string): string => {
- const map: Record<string, string> = {
- recharge: '充值',
- refund: '退款',
- purchase: '购买产品',
- unsubscribe: '退订产品',
- settlement: '输注结算'
- }
- return map[type] || type
- }
- export const txnTypeTagType = (type: string): string => {
- const map: Record<string, string> = {
- recharge: '',
- refund: 'danger',
- purchase: 'success',
- unsubscribe: 'warning',
- settlement: 'primary'
- }
- return map[type] || 'info'
- }
- // 流水状态
- export const txnStatusLabel = (status: string): string => {
- const map: Record<string, string> = {
- dsx: '待生效',
- dqr: '待财务确认',
- yqr: '已确认',
- yzf: '已作废'
- }
- return map[status] || status
- }
- export const txnStatusTagType = (status: string): string => {
- const map: Record<string, string> = {
- dsx: 'info',
- dqr: 'warning',
- yqr: 'success',
- yzf: 'danger'
- }
- return map[status] || 'info'
- }
- /** 中试申请单状态 */
- export function applicationStatusLabel(status: string): string {
- const map: Record<string, string> = { dks: '待开始', jxz: '进行中', ywc: '已完成', yzf: '已作废' }
- return map[status] || status || '-'
- }
- export function applicationStatusTagType(
- status: string
- ): '' | 'success' | 'warning' | 'danger' | 'info' {
- const map: Record<string, '' | 'success' | 'warning' | 'danger' | 'info'> = {
- dks: 'info',
- jxz: 'warning',
- ywc: 'success',
- yzf: 'danger'
- }
- return map[status] || 'info'
- }
- // ========== 中试服务体检状态 ==========
- export function checkupStatusLabel(status: string): string {
- const map: Record<string, string> = {
- dtj: '待体检',
- ytj: '已体检'
- }
- return map[status] || status || '-'
- }
- export function checkupStatusTagType(status: string): string {
- const map: Record<string, string> = {
- dtj: 'warning',
- ytj: 'success'
- }
- return map[status] || 'info'
- }
- export function feeStatusLabel(status: string): string {
- const map: Record<string, string> = {
- wjs: '未结算',
- yjs: '已结算'
- }
- return map[status] || status || '-'
- }
- export function feeStatusTagType(status: string): string {
- const map: Record<string, string> = {
- wjs: 'info',
- yjs: 'success'
- }
- return map[status] || 'info'
- }
- // ========== 中试服务 - 输注计划状态 ==========
- export function scheduleStatusLabel(status: string): string {
- const map: Record<string, string> = {
- dsc: '待生产',
- ysc: '已生产',
- yjf: '已交付',
- yqx: '已取消'
- }
- return map[status] || status || '-'
- }
- export function scheduleStatusTagType(status: string): string {
- const map: Record<string, string> = {
- dsc: 'info',
- ysc: 'primary',
- yjf: 'success',
- yqx: 'danger'
- }
- return map[status] || 'info'
- }
- // ========== 中试服务 - 输注状态 ==========
- export function infusionStatusLabel(status: string): string {
- const map: Record<string, string> = {
- dtz: '待输注',
- yrqr: '已用户确认',
- yqx: '已取消',
- ywc: '已完成'
- }
- return map[status] || status || '-'
- }
- export function infusionStatusTagType(status: string): string {
- const map: Record<string, string> = {
- dtz: 'info',
- yrqr: 'warning',
- yqx: 'danger',
- ywc: 'success'
- }
- return map[status] || 'info'
- }
- // ========== 中试服务 - 输注方式(字典 szfs) ==========
- export function infusionMethodLabel(method: string): string {
- const map: Record<string, string> = {
- jmsz: '静脉输注',
- pxzs: '皮下注射',
- jbzs: '局部注射',
- qt: '其他'
- }
- return map[method] || method || '—'
- }
- // ========== 中试服务 - 质检状态 ==========
- export function qcStatusLabel(status: string): string {
- const map: Record<string, string> = { dzc: '待质检', yzj: '已质检', yqx: '已取消' }
- return map[status] || status || '-'
- }
- export function qcStatusTagType(status: string): string {
- const map: Record<string, string> = { dzc: 'info', yzj: 'success', yqx: 'danger' }
- return map[status] || 'info'
- }
- // ========== 中试服务 - 放行审核结论 ==========
- export function releaseReviewConclusionLabel(conclusion: string): string {
- const map: Record<string, string> = { tg: '通过', btg: '不通过' }
- return map[conclusion] || conclusion || '-'
- }
- export function releaseReviewConclusionTagType(conclusion: string): string {
- const map: Record<string, string> = { tg: 'success', btg: 'danger' }
- return map[conclusion] || 'info'
- }
- // ========== 中试服务 - 业务类型 ==========
- export function bizTypeLabel(type: string): string {
- const map: Record<string, string> = {
- pilot_service: '中试服务',
- clinical_application: '临床应用',
- basic_experiment: '基础实验'
- }
- return map[type] || type || '-'
- }
- export function bizTypeTagType(type: string): string {
- const map: Record<string, string> = {
- pilot_service: 'primary',
- clinical_application: 'warning',
- basic_experiment: 'primary'
- }
- return map[type] || 'info'
- }
- // ========== 中试服务 - 产品状态 ==========
- export function productStatusLabel(status: string, bizType?: string): string {
- const isBasicExperiment = bizType === 'basic_experiment'
- const map: Record<string, string> = {
- dtz: isBasicExperiment ? '待交付' : '待输注',
- yrqr: '已用户确认',
- yqx: '已取消',
- ywc: '已完成'
- }
- return map[status] || status || '-'
- }
- export function productStatusTagType(status: string): string {
- const map: Record<string, string> = {
- dtz: 'info',
- yrqr: 'warning',
- yqx: 'danger',
- ywc: 'success'
- }
- return map[status] || 'info'
- }
- // ========== 设备管理 - 设备状态 ==========
- export const equipmentStatus: StatusRegistry = {
- '1': { label: '正常', tagType: 'success' },
- '0': { label: '异常', tagType: 'danger' }
- }
- export const equipmentStatusLabel = createLabelGetter(equipmentStatus)
- export const equipmentStatusTagType = createTagTypeGetter(equipmentStatus)
- // ========== 洁净服管理 - 洁净服状态 ==========
- export const garmentStatus: StatusRegistry = {
- zc: { label: '正常', tagType: 'success' },
- yfq: { label: '已废弃', tagType: 'info' }
- }
- export const garmentStatusLabel = createLabelGetter(garmentStatus)
- export const garmentStatusTagType = createTagTypeGetter(garmentStatus)
- // ========== 细胞产品库 - 产品状态 ==========
- export function cellProductStatusLabel(status: string): string {
- const map: Record<string, string> = {
- frozen: '已冻存',
- in_production: '生产中',
- sold: '已售卖',
- used: '已使用',
- voided: '已作废',
- thawed: '已复苏'
- }
- return map[status] || status || '—'
- }
- export function cellProductStatusTagType(status: string): string {
- const map: Record<string, string> = {
- frozen: 'success',
- in_production: 'warning',
- sold: 'warning',
- used: 'info',
- voided: 'danger',
- thawed: 'info'
- }
- return map[status] || 'info'
- }
- /** 细胞产品库状态码(出库物料「出库细胞」台账快照) */
- const CELL_PRODUCT_STATUS_CODES = new Set([
- 'frozen',
- 'in_production',
- 'sold',
- 'used',
- 'voided',
- 'thawed'
- ])
- /** 输注/交付计划产品状态码 */
- const SCHEDULE_PRODUCT_STATUS_CODES = new Set(['dtz', 'yrqr', 'yqx', 'ywc'])
- const LEGACY_SCHEDULE_PRODUCT_STATUS: Record<string, string> = {
- 待输注: 'dtz',
- 已用户确认: 'yrqr',
- 已取消: 'yqx',
- 已完成: 'ywc'
- }
- function normalizeScheduleProductStatusCode(status: string): string {
- const code = (status || '').trim()
- return LEGACY_SCHEDULE_PRODUCT_STATUS[code] || code
- }
- /**
- * 出库物料「出库细胞」状态展示:优先细胞产品库状态,兼容计划产品状态码与历史中文值。
- */
- export function outboundMaterialCellStatusLabel(status: string, bizType?: string): string {
- const code = (status || '').trim()
- if (!code) return '—'
- if (CELL_PRODUCT_STATUS_CODES.has(code)) {
- return cellProductStatusLabel(code)
- }
- const normalized = normalizeScheduleProductStatusCode(code)
- if (SCHEDULE_PRODUCT_STATUS_CODES.has(normalized)) {
- return productStatusLabel(normalized, bizType)
- }
- return cellProductStatusLabel(code)
- }
- export function outboundMaterialCellStatusTagType(status: string, bizType?: string): TagType {
- const code = (status || '').trim()
- if (!code) return 'info'
- if (CELL_PRODUCT_STATUS_CODES.has(code)) {
- return cellProductStatusTagType(code) as TagType
- }
- const normalized = normalizeScheduleProductStatusCode(code)
- if (SCHEDULE_PRODUCT_STATUS_CODES.has(normalized)) {
- return productStatusTagType(normalized) as TagType
- }
- return cellProductStatusTagType(code) as TagType
- }
|