feat(market): 新增委托加工业务并复用临床科研流程
独立 biz_type=contract_processing,申请/缴费/出库与临床科研共用逻辑; 业务子类型支持胎盘冻干粉/脂肪外泌体/NK/MSC/其他自定义,并补充菜单与生产质检 Tab。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
964384108a
commit
9b5e68f4ae
58 files changed
+717
-116
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import type { OutboundQcDetail } from '@/api/qc-work-order'
|
||||
import type { ViewField, ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
import { maskIdCard } from '@/utils/mask-sensitive'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
import {
|
||||
applicationStatusLabel,
|
||||
applicationStatusTagType,
|
||||
@@ -18,6 +19,7 @@ export type OutboundViewContextVariant =
|
||||
| 'pilot_service'
|
||||
| 'clinical_application'
|
||||
| 'basic_experiment'
|
||||
| 'contract_processing'
|
||||
|
||||
const SECTION_TITLES: Record<
|
||||
OutboundViewContextVariant,
|
||||
@@ -34,6 +36,10 @@ const SECTION_TITLES: Record<
|
||||
basic_experiment: {
|
||||
application: '临床科研申请信息',
|
||||
schedule: '交付计划信息'
|
||||
},
|
||||
contract_processing: {
|
||||
application: '委托加工申请信息',
|
||||
schedule: '交付计划信息'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +62,7 @@ function buildDefaultApplicationFields(
|
||||
app: NonNullable<OutboundQcDetail['application']>,
|
||||
variant: OutboundViewContextVariant
|
||||
) {
|
||||
if (variant === 'basic_experiment') {
|
||||
if (isResearchLikeBiz(variant)) {
|
||||
return buildBasicExperimentApplicationFields(app)
|
||||
}
|
||||
return [
|
||||
@@ -82,6 +88,7 @@ export function buildOutboundPilotContextSections(
|
||||
const schedule = detail.infusionSchedule
|
||||
const products = detail.products || []
|
||||
const titles = SECTION_TITLES[variant]
|
||||
const researchLike = isResearchLikeBiz(variant)
|
||||
const result: ViewSection[] = []
|
||||
|
||||
if (app) {
|
||||
@@ -91,7 +98,7 @@ export function buildOutboundPilotContextSections(
|
||||
})
|
||||
}
|
||||
|
||||
if (patient && variant !== 'basic_experiment') {
|
||||
if (patient && !researchLike) {
|
||||
result.push({
|
||||
title: '患者信息',
|
||||
fields: [
|
||||
@@ -113,7 +120,7 @@ export function buildOutboundPilotContextSections(
|
||||
})
|
||||
}
|
||||
|
||||
if (plan && variant !== 'basic_experiment') {
|
||||
if (plan && !researchLike) {
|
||||
result.push({
|
||||
title: '输注方案信息',
|
||||
fields: [
|
||||
@@ -128,12 +135,12 @@ export function buildOutboundPilotContextSections(
|
||||
}
|
||||
|
||||
if (schedule) {
|
||||
const pickupLabel = variant === 'basic_experiment' ? '交付时间' : '输注时间'
|
||||
const pickupLabel = researchLike ? '交付时间' : '输注时间'
|
||||
const scheduleFields: ViewField[] = [
|
||||
{ label: pickupLabel, value: schedule.infusionTime || '—' }
|
||||
]
|
||||
|
||||
if (variant === 'basic_experiment') {
|
||||
if (researchLike) {
|
||||
scheduleFields.push({
|
||||
label: '售卖金额',
|
||||
value:
|
||||
@@ -154,7 +161,7 @@ export function buildOutboundPilotContextSections(
|
||||
tagType: scheduleStatusTagType(schedule.scheduleStatus || '') as ViewField['tagType']
|
||||
})
|
||||
|
||||
if (variant !== 'basic_experiment') {
|
||||
if (!researchLike) {
|
||||
scheduleFields.push({
|
||||
label: '输注状态',
|
||||
value: infusionStatusLabel(schedule.infusionStatus || ''),
|
||||
@@ -186,9 +193,9 @@ export function buildOutboundPilotContextSections(
|
||||
}
|
||||
|
||||
export function resolveOutboundViewVariant(bizType?: string | null): OutboundViewContextVariant {
|
||||
if (bizType === 'clinical_application' || bizType === 'basic_experiment') {
|
||||
return bizType
|
||||
}
|
||||
if (bizType === 'clinical_application') return 'clinical_application'
|
||||
if (bizType === 'contract_processing') return 'contract_processing'
|
||||
if (bizType === 'basic_experiment') return 'basic_experiment'
|
||||
return 'pilot_service'
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ function keywordMatchesWorkOrder(
|
||||
const fields =
|
||||
tabKey === 'temporary'
|
||||
? [row.remark]
|
||||
: tabKey === 'outbound_basic_experiment'
|
||||
: tabKey === 'outbound_basic_experiment' || tabKey === 'outbound_contract_processing'
|
||||
? [
|
||||
row.workOrderNo,
|
||||
row.applicationNo,
|
||||
|
||||
@@ -251,6 +251,19 @@ const CARD_META_BY_TAB: Record<ProductionWorkOrderTabKey, ProductionWorkOrderCar
|
||||
allowEditRemark: true,
|
||||
allowDelete: false
|
||||
},
|
||||
outbound_contract_processing: {
|
||||
tabKey: 'outbound_contract_processing',
|
||||
showCategoryTag: false,
|
||||
showProtocolFeeSummary: false,
|
||||
showOutboundFeeSummary: true,
|
||||
showCellProducts: true,
|
||||
metaFields: outboundBasicExperimentFields,
|
||||
allowDispatchQc: true,
|
||||
allowSampleReception: false,
|
||||
allowDispatchComplete: true,
|
||||
allowEditRemark: true,
|
||||
allowDelete: false
|
||||
},
|
||||
outbound_clinical_application: {
|
||||
tabKey: 'outbound_clinical_application',
|
||||
showCategoryTag: false,
|
||||
|
||||
@@ -26,6 +26,7 @@ const CATEGORY_LABELS: Record<ProductionWorkOrderCategoryKey, string> = {
|
||||
inbound_research_donation: '科研捐赠',
|
||||
outbound_pilot_service: '中试服务',
|
||||
outbound_basic_experiment: '临床科研',
|
||||
outbound_contract_processing: '委托加工',
|
||||
temporary: '临时'
|
||||
}
|
||||
|
||||
@@ -34,6 +35,7 @@ const CATEGORY_TAG_TYPES: Record<ProductionWorkOrderCategoryKey, TagType> = {
|
||||
inbound_research_donation: 'primary',
|
||||
outbound_pilot_service: 'info',
|
||||
outbound_basic_experiment: 'info',
|
||||
outbound_contract_processing: 'info',
|
||||
temporary: 'warning'
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,17 @@ describe('production work order tabs — hide pilot service', () => {
|
||||
const pilot = { workOrderType: 'outbound', bizType: 'pilot_service' }
|
||||
const defaultPilot = { workOrderType: 'outbound' }
|
||||
const basic = { workOrderType: 'outbound', bizType: 'basic_experiment' }
|
||||
const contract = { workOrderType: 'outbound', bizType: 'contract_processing' }
|
||||
assert.equal(isPilotServiceOutboundWorkOrder(pilot), true)
|
||||
assert.equal(isPilotServiceOutboundWorkOrder(defaultPilot), true)
|
||||
assert.equal(workOrderMatchesTab(pilot as any, 'all'), false)
|
||||
assert.equal(workOrderMatchesTab(defaultPilot as any, 'all'), false)
|
||||
assert.equal(workOrderMatchesTab(basic as any, 'all'), true)
|
||||
assert.equal(workOrderMatchesTab(contract as any, 'all'), true)
|
||||
assert.equal(workOrderMatchesTab(contract as any, 'outbound_contract_processing'), true)
|
||||
})
|
||||
|
||||
it('visible tabs include contract processing', () => {
|
||||
assert.ok(PRODUCTION_WORK_ORDER_VISIBLE_TABS.some((t) => t.key === 'outbound_contract_processing'))
|
||||
})
|
||||
})
|
||||
@@ -6,6 +6,7 @@ export type ProductionWorkOrderTabKey =
|
||||
| 'inbound_research_donation'
|
||||
| 'outbound_pilot_service'
|
||||
| 'outbound_basic_experiment'
|
||||
| 'outbound_contract_processing'
|
||||
| 'outbound_clinical_application'
|
||||
| 'temporary'
|
||||
|
||||
@@ -17,7 +18,7 @@ export type ProductionWorkOrderTabConfig = {
|
||||
group: ProductionWorkOrderTabGroup
|
||||
workOrderType: 'inbound' | 'outbound' | 'temporary'
|
||||
receptionSource?: 'cell_storage' | 'research_donation'
|
||||
bizType?: 'pilot_service' | 'basic_experiment' | 'clinical_application'
|
||||
bizType?: 'pilot_service' | 'basic_experiment' | 'contract_processing' | 'clinical_application'
|
||||
listLayout: 'inbound-grouped' | 'standalone'
|
||||
/** 侧栏 Tab 不展示(保留 key 供路由/数据解析) */
|
||||
hidden?: boolean
|
||||
@@ -65,6 +66,14 @@ export const PRODUCTION_WORK_ORDER_TABS: ProductionWorkOrderTabConfig[] = [
|
||||
bizType: 'basic_experiment',
|
||||
listLayout: 'standalone'
|
||||
},
|
||||
{
|
||||
key: 'outbound_contract_processing',
|
||||
label: '委托加工生产',
|
||||
group: 'outbound',
|
||||
workOrderType: 'outbound',
|
||||
bizType: 'contract_processing',
|
||||
listLayout: 'standalone'
|
||||
},
|
||||
{
|
||||
key: 'outbound_clinical_application',
|
||||
label: '临床应用生产',
|
||||
@@ -129,6 +138,7 @@ export function resolveTabKeyFromWorkOrder(row: {
|
||||
if (wt === 'outbound') {
|
||||
const bt = row.bizType || 'pilot_service'
|
||||
if (bt === 'basic_experiment') return 'outbound_basic_experiment'
|
||||
if (bt === 'contract_processing') return 'outbound_contract_processing'
|
||||
if (bt === 'clinical_application') return 'outbound_clinical_application'
|
||||
return 'outbound_pilot_service'
|
||||
}
|
||||
@@ -140,7 +150,7 @@ export function resolveTabKeyFromWorkOrder(row: {
|
||||
export function keywordPlaceholderForTab(tab: ProductionWorkOrderTabConfig): string {
|
||||
if (tab.key === 'all') return '工单号 / 样本编码 / 申请单号 / 产品名称等'
|
||||
if (tab.key === 'temporary') return '备注'
|
||||
if (tab.key === 'outbound_basic_experiment') {
|
||||
if (tab.key === 'outbound_basic_experiment' || tab.key === 'outbound_contract_processing') {
|
||||
return '工单号/申请单号/课题名称/客户'
|
||||
}
|
||||
if (tab.group === 'outbound') return '工单号/申请单号/申请单名称/患者'
|
||||
|
||||
@@ -75,7 +75,7 @@ function keywordMatchesWorkOrder(
|
||||
const fields =
|
||||
tabKey === 'temporary'
|
||||
? [row.workOrderNo, row.productionWorkOrderNo]
|
||||
: tabKey === 'outbound_basic_experiment'
|
||||
: tabKey === 'outbound_basic_experiment' || tabKey === 'outbound_contract_processing'
|
||||
? [
|
||||
row.workOrderNo,
|
||||
row.applicationNo,
|
||||
|
||||
@@ -356,6 +356,20 @@ const CARD_META_BY_TAB: Record<QcWorkOrderTabKey, QcWorkOrderCardMetaConfig> = {
|
||||
allowEditRemark: true,
|
||||
allowDelete: false
|
||||
},
|
||||
outbound_contract_processing: {
|
||||
tabKey: 'outbound_contract_processing',
|
||||
listLayout: 'outbound-grouped',
|
||||
showCategoryTag: false,
|
||||
showTriggerTag: true,
|
||||
showProtocolFeeSummary: false,
|
||||
showOutboundFeeSummary: true,
|
||||
showCellProducts: true,
|
||||
metaFields: outboundGroupedFields,
|
||||
buildGroupContextParts: buildOutboundBasicExperimentGroupContext,
|
||||
allowEditTemporary: false,
|
||||
allowEditRemark: true,
|
||||
allowDelete: false
|
||||
},
|
||||
outbound_clinical_application: {
|
||||
tabKey: 'outbound_clinical_application',
|
||||
listLayout: 'standalone',
|
||||
|
||||
@@ -25,6 +25,7 @@ const CATEGORY_LABELS: Record<QcWorkOrderCategoryKey, string> = {
|
||||
inbound_research_donation: '科研捐赠',
|
||||
outbound_pilot_service: '中试服务',
|
||||
outbound_basic_experiment: '临床科研',
|
||||
outbound_contract_processing: '委托加工',
|
||||
temporary: '临时'
|
||||
}
|
||||
|
||||
@@ -33,6 +34,7 @@ const CATEGORY_TAG_TYPES: Record<QcWorkOrderCategoryKey, TagType> = {
|
||||
inbound_research_donation: 'primary',
|
||||
outbound_pilot_service: 'info',
|
||||
outbound_basic_experiment: 'info',
|
||||
outbound_contract_processing: 'info',
|
||||
temporary: 'warning'
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,17 @@ describe('qc work order tabs — hide pilot service', () => {
|
||||
const pilot = { workOrderType: 'outbound', bizType: 'pilot_service' }
|
||||
const defaultPilot = { workOrderType: 'outbound' }
|
||||
const basic = { workOrderType: 'outbound', bizType: 'basic_experiment' }
|
||||
const contract = { workOrderType: 'outbound', bizType: 'contract_processing' }
|
||||
assert.equal(isPilotServiceOutboundWorkOrder(pilot), true)
|
||||
assert.equal(isPilotServiceOutboundWorkOrder(defaultPilot), true)
|
||||
assert.equal(workOrderMatchesTab(pilot as any, 'all'), false)
|
||||
assert.equal(workOrderMatchesTab(defaultPilot as any, 'all'), false)
|
||||
assert.equal(workOrderMatchesTab(basic as any, 'all'), true)
|
||||
assert.equal(workOrderMatchesTab(contract as any, 'all'), true)
|
||||
assert.equal(workOrderMatchesTab(contract as any, 'outbound_contract_processing'), true)
|
||||
})
|
||||
|
||||
it('visible tabs include contract processing', () => {
|
||||
assert.ok(QC_WORK_ORDER_VISIBLE_TABS.some((t) => t.key === 'outbound_contract_processing'))
|
||||
})
|
||||
})
|
||||
@@ -6,6 +6,7 @@ export type QcWorkOrderTabKey =
|
||||
| 'inbound_research_donation'
|
||||
| 'outbound_pilot_service'
|
||||
| 'outbound_basic_experiment'
|
||||
| 'outbound_contract_processing'
|
||||
| 'outbound_clinical_application'
|
||||
| 'temporary'
|
||||
|
||||
@@ -17,7 +18,7 @@ export type QcWorkOrderTabConfig = {
|
||||
group: QcWorkOrderTabGroup
|
||||
workOrderType?: 'inbound' | 'outbound' | 'temporary'
|
||||
receptionSource?: 'cell_storage' | 'research_donation'
|
||||
bizType?: 'pilot_service' | 'basic_experiment' | 'clinical_application'
|
||||
bizType?: 'pilot_service' | 'basic_experiment' | 'contract_processing' | 'clinical_application'
|
||||
listLayout: 'inbound-grouped' | 'outbound-grouped' | 'standalone'
|
||||
/** 侧栏 Tab 不展示(保留 key 供路由/数据解析) */
|
||||
hidden?: boolean
|
||||
@@ -65,6 +66,14 @@ export const QC_WORK_ORDER_TABS: QcWorkOrderTabConfig[] = [
|
||||
bizType: 'basic_experiment',
|
||||
listLayout: 'outbound-grouped'
|
||||
},
|
||||
{
|
||||
key: 'outbound_contract_processing',
|
||||
label: '委托加工质检',
|
||||
group: 'outbound',
|
||||
workOrderType: 'outbound',
|
||||
bizType: 'contract_processing',
|
||||
listLayout: 'outbound-grouped'
|
||||
},
|
||||
{
|
||||
key: 'outbound_clinical_application',
|
||||
label: '临床应用质检',
|
||||
@@ -127,6 +136,7 @@ export function resolveTabKeyFromWorkOrder(row: {
|
||||
if (wt === 'outbound') {
|
||||
const bt = row.bizType || 'pilot_service'
|
||||
if (bt === 'basic_experiment') return 'outbound_basic_experiment'
|
||||
if (bt === 'contract_processing') return 'outbound_contract_processing'
|
||||
if (bt === 'clinical_application') return 'outbound_clinical_application'
|
||||
return 'outbound_pilot_service'
|
||||
}
|
||||
@@ -142,7 +152,7 @@ export function tabUsesInfusionTimeFilter(tab: QcWorkOrderTabConfig): boolean {
|
||||
export function keywordPlaceholderForTab(tab: QcWorkOrderTabConfig): string {
|
||||
if (tab.key === 'all') return '工单号 / 样本编码 / 母亲姓名 / 申请单号 / 产品名称等'
|
||||
if (tab.key === 'temporary') return '工单号 / 外部编号'
|
||||
if (tab.key === 'outbound_basic_experiment') {
|
||||
if (tab.key === 'outbound_basic_experiment' || tab.key === 'outbound_contract_processing') {
|
||||
return '工单号/申请单号/课题名称/客户'
|
||||
}
|
||||
if (tab.group === 'outbound') return '工单号/申请单号/申请单名称/患者'
|
||||
@@ -157,7 +167,9 @@ export function keywordPlaceholderForTab(tab: QcWorkOrderTabConfig): string {
|
||||
|
||||
export function filterTimeLabelForTab(tab: QcWorkOrderTabConfig): string {
|
||||
if (tab.key === 'all') return '创建时间'
|
||||
if (tab.key === 'outbound_basic_experiment') return '交付时间'
|
||||
if (tab.key === 'outbound_basic_experiment' || tab.key === 'outbound_contract_processing') {
|
||||
return '交付时间'
|
||||
}
|
||||
if (tab.group === 'outbound') return '输注时间'
|
||||
return '创建时间'
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/** 临床科研 / 委托加工:共用申请、交付、缴费、出库流程 */
|
||||
export const RESEARCH_LIKE_BIZ_TYPES = ['basic_experiment', 'contract_processing'] as const
|
||||
|
||||
export type ResearchLikeBizType = (typeof RESEARCH_LIKE_BIZ_TYPES)[number]
|
||||
|
||||
export function isResearchLikeBiz(bizType?: string | null): boolean {
|
||||
return RESEARCH_LIKE_BIZ_TYPES.includes((bizType || '') as ResearchLikeBizType)
|
||||
}
|
||||
|
||||
export function isContractProcessing(bizType?: string | null): boolean {
|
||||
return (bizType || '') === 'contract_processing'
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
import { resolveVoidTypeLabel } from '@/utils/void-type-dict'
|
||||
import { isResearchLikeBiz } from '@/utils/research-like-biz'
|
||||
|
||||
// ── 类型定义 ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -228,7 +229,8 @@ export const receptionSource: StatusRegistry = {
|
||||
outbound: { label: '出库', tagType: 'primary' },
|
||||
pilot_service: { label: '中试服务', tagType: 'primary' },
|
||||
clinical_application: { label: '临床应用', tagType: 'warning' },
|
||||
basic_experiment: { label: '临床科研', tagType: 'primary' }
|
||||
basic_experiment: { label: '临床科研', tagType: 'primary' },
|
||||
contract_processing: { label: '委托加工', tagType: 'primary' }
|
||||
}
|
||||
export const receptionSourceLabel = createLabelGetter(receptionSource)
|
||||
export const receptionSourceTagType = createTagTypeGetter(receptionSource)
|
||||
@@ -761,7 +763,8 @@ export function bizTypeLabel(type: string): string {
|
||||
const map: Record<string, string> = {
|
||||
pilot_service: '中试服务',
|
||||
clinical_application: '临床应用',
|
||||
basic_experiment: '临床科研'
|
||||
basic_experiment: '临床科研',
|
||||
contract_processing: '委托加工'
|
||||
}
|
||||
return map[type] || type || '-'
|
||||
}
|
||||
@@ -769,14 +772,15 @@ export function bizTypeTagType(type: string): string {
|
||||
const map: Record<string, string> = {
|
||||
pilot_service: 'primary',
|
||||
clinical_application: 'warning',
|
||||
basic_experiment: 'primary'
|
||||
basic_experiment: 'primary',
|
||||
contract_processing: 'primary'
|
||||
}
|
||||
return map[type] || 'info'
|
||||
}
|
||||
|
||||
// ========== 中试服务 - 产品状态 ==========
|
||||
export function productStatusLabel(status: string, bizType?: string): string {
|
||||
const isBasicExperiment = bizType === 'basic_experiment'
|
||||
const isBasicExperiment = isResearchLikeBiz(bizType)
|
||||
const map: Record<string, string> = {
|
||||
dtz: isBasicExperiment ? '待交付' : '待输注',
|
||||
yrqr: '已用户确认',
|
||||
|
||||
Reference in new issue
Block a user