提交
This commit is contained in:
1 parent
4daf990fab
commit
1ca2668112
219 files changed
+29817
-20945
No files matched your search
@@ -1,5 +1,4 @@
|
||||
import type { QcWorkOrder } from '@/api/qc-work-order'
|
||||
import { fetchQcWorkOrderDetail } from '@/api/qc-work-order'
|
||||
import { fetchMyQcTaskList, type QcTask } from '@/api/qc-task'
|
||||
import {
|
||||
groupInboundQcWorkOrders,
|
||||
@@ -18,6 +17,7 @@ import {
|
||||
toAllTabListQuery,
|
||||
workOrderMatchesCategory
|
||||
} from '@/utils/qc-work-order-category'
|
||||
import { matchesWorkOrderStatusFilter } from '@/utils/status-tag-registry'
|
||||
|
||||
export type QcTaskMineFilters = {
|
||||
keyword?: string
|
||||
@@ -28,7 +28,7 @@ export type QcTaskMineFilters = {
|
||||
|
||||
export type MineWorkOrderSearchFilters = {
|
||||
keyword?: string
|
||||
workOrderStatus?: string
|
||||
workOrderStatus?: string | string[]
|
||||
triggerSource?: string
|
||||
qcCategory?: string
|
||||
createTimeStart?: string
|
||||
@@ -76,7 +76,14 @@ function keywordMatchesWorkOrder(
|
||||
]
|
||||
: tab.group === 'outbound'
|
||||
? [row.workOrderNo, row.applicationNo, row.applicationName, row.patientName]
|
||||
: [row.workOrderNo, row.protocolNo, row.sampleCode, row.labStorageCode]
|
||||
: [
|
||||
row.workOrderNo,
|
||||
row.protocolNo,
|
||||
row.sampleCode,
|
||||
row.labStorageCode,
|
||||
row.motherName,
|
||||
row.newbornName
|
||||
]
|
||||
return fields.some((f) => (f || '').toLowerCase().includes(kw))
|
||||
}
|
||||
|
||||
@@ -94,7 +101,7 @@ export function filterMineEntriesByWorkOrderSearch(
|
||||
if (isAllQcWorkOrderTab(tabKey) && !workOrderMatchesCategory(row, filters.qcCategory || '')) {
|
||||
return false
|
||||
}
|
||||
if (filters.workOrderStatus && row.workOrderStatus !== filters.workOrderStatus) return false
|
||||
if (!matchesWorkOrderStatusFilter(row.workOrderStatus, filters.workOrderStatus)) return false
|
||||
if (filters.triggerSource) {
|
||||
if (isAllQcWorkOrderTab(tabKey)) {
|
||||
if (!matchesAllTabTriggerSource(row, filters.triggerSource)) return false
|
||||
@@ -149,30 +156,8 @@ export async function fetchAllMineTasks(filters: QcTaskMineFilters): Promise<QcT
|
||||
export async function enrichMineEntriesWithWorkOrders(
|
||||
entries: MineWorkOrderEntry[]
|
||||
): Promise<MineWorkOrderEntry[]> {
|
||||
const cache = new Map<string, QcWorkOrder>()
|
||||
const uniqueIds = [...new Set(entries.map((entry) => entry.workOrderId))]
|
||||
await Promise.all(
|
||||
uniqueIds.map(async (id) => {
|
||||
try {
|
||||
const detail = await fetchQcWorkOrderDetail(id)
|
||||
cache.set(id, detail)
|
||||
} catch {
|
||||
// 保留任务聚合的工单摘要
|
||||
}
|
||||
})
|
||||
)
|
||||
return entries.map((entry) => {
|
||||
const detail = cache.get(entry.workOrderId)
|
||||
if (!detail) return entry
|
||||
return {
|
||||
...entry,
|
||||
workOrder: {
|
||||
...detail,
|
||||
hasLab: detail.hasLab ?? entry.workOrder.hasLab,
|
||||
hasThirdParty: detail.hasThirdParty ?? entry.workOrder.hasThirdParty
|
||||
}
|
||||
}
|
||||
})
|
||||
// 工单摘要已由 /qc-tasks/mine 接口批量 enrich,无需再逐条请求详情
|
||||
return entries
|
||||
}
|
||||
|
||||
export function paginateMineEntries<T>(items: T[], page: number, pageSize: number) {
|
||||
@@ -221,11 +206,12 @@ export function buildWorkOrderFromTasks(tasks: QcTask[]): QcWorkOrder {
|
||||
workOrderNo: t.workOrderNo || '—',
|
||||
workOrderType: woType,
|
||||
workOrderStatus: t.workOrderStatus || '',
|
||||
receptionId: '',
|
||||
protocolSampleId: '',
|
||||
collectionProtocolId: '',
|
||||
receptionId: t.receptionId || '',
|
||||
protocolSampleId: t.protocolSampleId || '',
|
||||
collectionProtocolId: t.collectionProtocolId || '',
|
||||
protocolNo: t.protocolNo || '',
|
||||
sampleCode: t.sampleCode || '',
|
||||
labStorageCode: t.labStorageCode,
|
||||
receptionSource: t.receptionSource,
|
||||
receptionSourceLabel: t.receptionSourceLabel,
|
||||
qcBizType: t.qcBizType || woType,
|
||||
@@ -239,13 +225,34 @@ export function buildWorkOrderFromTasks(tasks: QcTask[]): QcWorkOrder {
|
||||
sampleTypeName: t.sampleTypeName,
|
||||
receptionTime: t.receptionTime,
|
||||
handlerName: t.handlerName,
|
||||
hasLab: tasks.some((x) => x.taskType === 'sysz'),
|
||||
hasThirdParty: tasks.some((x) => x.taskType === 'dsfjc'),
|
||||
createTime: t.createTime || '',
|
||||
bizType: woType === 'outbound' ? t.receptionSource : undefined,
|
||||
bizTypeLabel: woType === 'outbound' ? t.receptionSourceLabel : undefined,
|
||||
hasLab: t.hasLab ?? tasks.some((x) => x.taskType === 'sysz'),
|
||||
hasThirdParty: t.hasThirdParty ?? tasks.some((x) => x.taskType === 'dsfjc'),
|
||||
createTime: t.workOrderCreateTime || t.createTime || '',
|
||||
bizType: woType === 'outbound' ? t.bizType || t.receptionSource : undefined,
|
||||
bizTypeLabel: woType === 'outbound' ? t.bizTypeLabel || t.receptionSourceLabel : undefined,
|
||||
applicationNo: t.applicationNo,
|
||||
applicationName: t.applicationName,
|
||||
projectTitle: t.projectTitle,
|
||||
customerName: t.customerName,
|
||||
channelName: t.channelName,
|
||||
patientName: t.patientName,
|
||||
motherName: t.motherName,
|
||||
newbornName: t.newbornName,
|
||||
sortNo: t.sortNo,
|
||||
totalCourseCount: t.totalCourseCount,
|
||||
infusionTime: t.infusionTime,
|
||||
products: t.products,
|
||||
cellType: t.cellType,
|
||||
specText: t.specText,
|
||||
triggerSource: t.triggerSource,
|
||||
triggerSourceLabel: t.triggerSourceLabel,
|
||||
productionWorkOrderId: t.productionWorkOrderId,
|
||||
productionWorkOrderNo: t.productionWorkOrderNo,
|
||||
protocolStatus: t.protocolStatus,
|
||||
protocolStatusLabel: t.protocolStatusLabel
|
||||
protocolStatusLabel: t.protocolStatusLabel,
|
||||
paymentSummary: t.paymentSummary,
|
||||
feeSummary: t.feeSummary,
|
||||
remark: t.workOrderRemark || t.remark
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user