提交
This commit is contained in:
1 parent
0b50eff3d8
commit
ee364e24aa
323 files changed
+57731
-35766
No files matched your search
@@ -1,14 +1,23 @@
|
||||
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, matchesTemporaryQcSourceFilter } from '@/utils/qc-work-order-groups'
|
||||
import {
|
||||
groupInboundQcWorkOrders,
|
||||
matchesTemporaryQcSourceFilter
|
||||
} from '@/utils/qc-work-order-groups'
|
||||
import type { QcWorkOrderTabKey } from '@/utils/qc-work-order-tabs'
|
||||
import {
|
||||
resolveTabKeyFromWorkOrder,
|
||||
tabUsesInfusionTimeFilter,
|
||||
getQcWorkOrderTab,
|
||||
toWorkOrderListQuery
|
||||
toWorkOrderListQuery,
|
||||
isAllQcWorkOrderTab
|
||||
} from '@/utils/qc-work-order-tabs'
|
||||
import {
|
||||
matchesAllTabTriggerSource,
|
||||
toAllTabListQuery,
|
||||
workOrderMatchesCategory
|
||||
} from '@/utils/qc-work-order-category'
|
||||
|
||||
export type QcTaskMineFilters = {
|
||||
keyword?: string
|
||||
@@ -21,6 +30,7 @@ export type MineWorkOrderSearchFilters = {
|
||||
keyword?: string
|
||||
workOrderStatus?: string
|
||||
triggerSource?: string
|
||||
qcCategory?: string
|
||||
createTimeStart?: string
|
||||
createTimeEnd?: string
|
||||
infusionTimeStart?: string
|
||||
@@ -45,7 +55,11 @@ function dateInRange(value: string | undefined, start?: string, end?: string): b
|
||||
return true
|
||||
}
|
||||
|
||||
function keywordMatchesWorkOrder(row: QcWorkOrder, keyword: string, tabKey: QcWorkOrderTabKey): boolean {
|
||||
function keywordMatchesWorkOrder(
|
||||
row: QcWorkOrder,
|
||||
keyword: string,
|
||||
tabKey: QcWorkOrderTabKey
|
||||
): boolean {
|
||||
const kw = keyword.trim().toLowerCase()
|
||||
if (!kw) return true
|
||||
const tab = getQcWorkOrderTab(tabKey)!
|
||||
@@ -53,10 +67,16 @@ function keywordMatchesWorkOrder(row: QcWorkOrder, keyword: string, tabKey: QcWo
|
||||
tabKey === 'temporary'
|
||||
? [row.workOrderNo, row.productionWorkOrderNo]
|
||||
: 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.workOrderNo, row.protocolNo, row.sampleCode, row.labStorageCode]
|
||||
return fields.some((f) => (f || '').toLowerCase().includes(kw))
|
||||
}
|
||||
|
||||
@@ -68,21 +88,29 @@ export function filterMineEntriesByWorkOrderSearch(
|
||||
const tab = getQcWorkOrderTab(tabKey)!
|
||||
return entries.filter((entry) => {
|
||||
const row = entry.workOrder
|
||||
if (resolveTabKeyFromWorkOrder(row) !== tabKey) return false
|
||||
if (!isAllQcWorkOrderTab(tabKey) && resolveTabKeyFromWorkOrder(row) !== tabKey) {
|
||||
return false
|
||||
}
|
||||
if (isAllQcWorkOrderTab(tabKey) && !workOrderMatchesCategory(row, filters.qcCategory || '')) {
|
||||
return false
|
||||
}
|
||||
if (filters.workOrderStatus && row.workOrderStatus !== filters.workOrderStatus) return false
|
||||
if (filters.triggerSource) {
|
||||
if (tabKey === 'temporary') {
|
||||
if (isAllQcWorkOrderTab(tabKey)) {
|
||||
if (!matchesAllTabTriggerSource(row, filters.triggerSource)) return false
|
||||
} else if (tabKey === 'temporary') {
|
||||
if (!matchesTemporaryQcSourceFilter(row, filters.triggerSource)) return false
|
||||
} else if (tab.listLayout !== 'standalone' && row.triggerSource !== filters.triggerSource) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (!keywordMatchesWorkOrder(row, filters.keyword || '', tabKey)) return false
|
||||
if (tabUsesInfusionTimeFilter(tab)) {
|
||||
if (!dateInRange(row.infusionTime, filters.infusionTimeStart, filters.infusionTimeEnd)) {
|
||||
const keywordTabKey = isAllQcWorkOrderTab(tabKey) ? resolveTabKeyFromWorkOrder(row) : tabKey
|
||||
if (!keywordMatchesWorkOrder(row, filters.keyword || '', keywordTabKey)) return false
|
||||
if (isAllQcWorkOrderTab(tabKey) || !tabUsesInfusionTimeFilter(tab)) {
|
||||
if (!dateInRange(row.createTime, filters.createTimeStart, filters.createTimeEnd)) {
|
||||
return false
|
||||
}
|
||||
} else if (!dateInRange(row.createTime, filters.createTimeStart, filters.createTimeEnd)) {
|
||||
} else if (!dateInRange(row.infusionTime, filters.infusionTimeStart, filters.infusionTimeEnd)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -91,7 +119,9 @@ export function filterMineEntriesByWorkOrderSearch(
|
||||
|
||||
export async function fetchAllMineTasks(filters: QcTaskMineFilters): Promise<QcTask[]> {
|
||||
const tab = getQcWorkOrderTab(filters.tabKey)!
|
||||
const listQuery = toWorkOrderListQuery(tab)
|
||||
const listQuery = isAllQcWorkOrderTab(filters.tabKey)
|
||||
? toAllTabListQuery('')
|
||||
: toWorkOrderListQuery(tab)
|
||||
const pageSize = MINE_TASK_FETCH_PAGE_SIZE
|
||||
let page = 1
|
||||
const all: QcTask[] = []
|
||||
@@ -103,7 +133,7 @@ export async function fetchAllMineTasks(filters: QcTaskMineFilters): Promise<QcT
|
||||
keyword: filters.keyword || undefined,
|
||||
taskType: filters.taskType || undefined,
|
||||
taskStatus: filters.taskStatus || undefined,
|
||||
qcBizType: tab.workOrderType,
|
||||
qcBizType: listQuery.workOrderType,
|
||||
receptionSource: listQuery.receptionSource,
|
||||
bizType: listQuery.bizType
|
||||
})
|
||||
@@ -262,11 +292,15 @@ export function buildMineCardListModel(
|
||||
tasks: QcTask[],
|
||||
tabKey: QcWorkOrderTabKey
|
||||
): MineCardListModel {
|
||||
const entries = groupMineTasksByWorkOrder(tasks).filter((e) => e.tabKey === tabKey)
|
||||
const entries = groupMineTasksByWorkOrder(tasks).filter((e) =>
|
||||
isAllQcWorkOrderTab(tabKey) ? true : e.tabKey === tabKey
|
||||
)
|
||||
const presetTasksByWorkOrderId = buildPresetTasksMap(entries)
|
||||
const tab = getQcWorkOrderTab(tabKey)!
|
||||
const useInboundGroups = tab.listLayout === 'inbound-grouped'
|
||||
const inboundGroups = useInboundGroups ? groupInboundQcWorkOrders(entries.map((e) => e.workOrder)) : []
|
||||
const inboundGroups = useInboundGroups
|
||||
? groupInboundQcWorkOrders(entries.map((e) => e.workOrder))
|
||||
: []
|
||||
const standaloneEntries = useInboundGroups ? [] : entries
|
||||
return {
|
||||
inboundGroups,
|
||||
|
||||
Reference in new issue
Block a user