This commit is contained in:
zlwu committed 2026-07-06 16:59:53 +08:00
1 parent 973176d508
commit cdaa0ac273
327 files changed
+32861 -25627

No files matched your search

@@ -4,33 +4,30 @@ import { fetchMyProductionTasks } from '@/api/production-task'
import type { ProductionWorkOrderTabKey } from '@/utils/production-work-order-tabs'
import {
resolveTabKeyFromWorkOrder,
tabUsesInfusionTimeFilter,
getProductionWorkOrderTab,
toWorkOrderListQuery,
isAllProductionWorkOrderTab
} from '@/utils/production-work-order-tabs'
import {
toAllTabListQuery,
workOrderMatchesCategory
} from '@/utils/production-work-order-category'
import { toAllTabListQuery, workOrderMatchesCategory } from '@/utils/production-work-order-category'
import { matchesWorkOrderStatusFilter } from '@/utils/status-tag-registry'
import { computeWorkOrderPlannedStartTimeRange } from '@/utils/production-labels'
export type ProductionTaskMineFilters = {
keyword?: string
taskStatus?: string
productionCategory?: string
tabKey: ProductionWorkOrderTabKey
excludeVoidProtocol?: boolean
plannedStartTimeStart?: string
plannedStartTimeEnd?: string
}
export type MineWorkOrderSearchFilters = {
keyword?: string
workOrderStatus?: string | string[]
productionCategory?: string
createTimeStart?: string
createTimeEnd?: string
infusionTimeStart?: string
infusionTimeEnd?: string
tabKey: ProductionWorkOrderTabKey
excludeVoidProtocol?: boolean
}
export type ProductionTaskRow = Record<string, any>
@@ -44,14 +41,6 @@ export type MineWorkOrderEntry = {
const MINE_TASK_FETCH_PAGE_SIZE = 100
function dateInRange(value: string | undefined, start?: string, end?: string): boolean {
const v = (value || '').trim().slice(0, 10)
if (!v) return !start && !end
if (start && v < start) return false
if (end && v > end) return false
return true
}
function keywordMatchesWorkOrder(
row: ProductionWorkOrderItem,
keyword: string,
@@ -64,7 +53,13 @@ function keywordMatchesWorkOrder(
tabKey === 'temporary'
? [row.workOrderNo]
: tabKey === 'outbound_basic_experiment'
? [row.workOrderNo, row.applicationNo, row.projectTitle, row.customerName, row.applicationName]
? [
row.workOrderNo,
row.applicationNo,
row.projectTitle,
row.customerName,
row.applicationName
]
: tab.group === 'outbound'
? [row.workOrderNo, row.applicationNo, row.applicationName, row.patientName]
: [row.workOrderNo, row.sampleCode, row.labStorageCode, row.motherName, row.newbornName]
@@ -137,7 +132,9 @@ export function groupMineTasksByWorkOrder(tasks: ProductionTaskRow[]): MineWorkO
})
}
export function buildPresetTasksMap(entries: MineWorkOrderEntry[]): Record<string, ProductionTaskRow[]> {
export function buildPresetTasksMap(
entries: MineWorkOrderEntry[]
): Record<string, ProductionTaskRow[]> {
const map: Record<string, ProductionTaskRow[]> = {}
for (const entry of entries) {
map[entry.workOrder.id] = entry.tasks
@@ -167,7 +164,10 @@ async function fetchMineTasksByScope(
workOrderType: listQuery.workOrderType,
receptionSource: listQuery.receptionSource,
bizType: listQuery.bizType,
includeStepSummary: true
includeStepSummary: true,
excludeVoidProtocol: filters.excludeVoidProtocol,
plannedStartTimeStart: filters.plannedStartTimeStart,
plannedStartTimeEnd: filters.plannedStartTimeEnd
})
const list = res.list || []
all.push(...list)
@@ -229,7 +229,6 @@ export function filterMineEntriesByWorkOrderSearch(
filters: MineWorkOrderSearchFilters
): MineWorkOrderEntry[] {
const tabKey = filters.tabKey
const tab = getProductionWorkOrderTab(tabKey)!
return entries.filter((entry) => {
const row = entry.workOrder
if (!isAllProductionWorkOrderTab(tabKey) && resolveTabKeyFromWorkOrder(row) !== tabKey) {
@@ -247,13 +246,6 @@ export function filterMineEntriesByWorkOrderSearch(
? resolveTabKeyFromWorkOrder(row)
: tabKey
if (!keywordMatchesWorkOrder(row, filters.keyword || '', keywordTabKey)) return false
if (isAllProductionWorkOrderTab(tabKey) || !tabUsesInfusionTimeFilter(tab)) {
if (!dateInRange(row.createTime, filters.createTimeStart, filters.createTimeEnd)) {
return false
}
} else if (!dateInRange(row.infusionTime, filters.infusionTimeStart, filters.infusionTimeEnd)) {
return false
}
return true
})
}
@@ -273,7 +265,10 @@ export function buildMineTableRows(pageEntries: MineWorkOrderEntry[]): {
presetTasksByWorkOrderId: Record<string, ProductionTaskRow[]>
} {
return {
rows: pageEntries.map((e) => e.workOrder),
rows: pageEntries.map((e) => ({
...e.workOrder,
plannedStartTimeRange: computeWorkOrderPlannedStartTimeRange(e.tasks)
})),
presetTasksByWorkOrderId: buildPresetTasksMap(pageEntries)
}
}