Files
zkxw/web-admin/src/api/qc-task.ts
T
2026-07-06 16:59:53 +08:00

232 lines
5.5 KiB
TypeScript

import request from '@/utils/http'
import type {
QcBasicExperimentFeeSummary,
QcProtocolPaymentSummary,
QcProtocolSiblingSample,
OutboundQcDetailProduct
} from '@/api/qc-work-order'
type PageList<T> = {
list: T[]
total: number
page: number
pageSize: number
totalPages: number
}
export type QcTaskReceptionDetail = {
protocolNo?: string
sampleCode?: string
sampleTypeName?: string
isSpecial?: boolean
specialRemark?: string
sourceType?: string
sourceTypeLabel?: string
receptionTime?: string
handlerName?: string
receiveTemperature?: string
volumeMl?: number
netWeightG?: number
acceptConclusion?: string
acceptConclusionLabel?: string
remark?: string
transportType?: string
expressCompanyName?: string
waybillNo?: string
carrierName?: string
carrierPhone?: string
etaTime?: string
checkResults?: Array<{ itemName?: string; checked?: boolean }>
receiveAttachments?: string
receiveAttachmentFiles?: Array<{
id?: string
fileUrl?: string
fileName?: string
fileType?: string
}>
}
export type QcTask = {
id: string
workOrderId: string
workOrderNo?: string
orderSource?: string
taskNo: string
taskType: string
itemCode: string
itemName: string
companyId?: string
companyName?: string
feeAmount?: number
taskStatus: string
conclusion?: string
conclusionLabel?: string
qcBizType?: string
qcBizTypeLabel?: string
receptionId?: string
protocolSampleId?: string
collectionProtocolId?: string
receptionSource?: string
receptionSourceLabel?: string
protocolNo?: string
protocolStatus?: string
protocolStatusLabel?: string
sampleCode?: string
sampleTypeName?: string
isSpecial?: boolean
specialRemark?: string
receptionTime?: string
handlerName?: string
workOrderStatus?: string
cellProductId?: string
cellProductCode?: string
cellProductName?: string
cellProductTypeName?: string
cellProductPassage?: string
cellProductSpecName?: string
thirdPartyAttachments?: string
attachmentFiles?: Array<{ id?: string; fileUrl: string; fileName?: string; fileType?: string }>
completedTime?: string
completedBy?: string
assigneeUserIds?: string[]
assigneeUserNames?: string
sourceLineId?: string
batchId?: string
batchName?: string
batchNo?: string
remark?: string
createTime?: string
updateTime?: string
/** 列表级工单摘要(我的任务接口批量 enrich) */
triggerSource?: string
triggerSourceLabel?: string
hasLab?: boolean
hasThirdParty?: boolean
workOrderCreateTime?: string
workOrderRemark?: string
labStorageCode?: string
applicationNo?: string
applicationName?: string
projectTitle?: string
customerName?: string
channelName?: string
patientName?: string
motherName?: string
newbornName?: string
isSpecial?: boolean
specialRemark?: string
infusionTime?: string
sortNo?: number | null
totalCourseCount?: number | null
products?: OutboundQcDetailProduct[]
cellType?: string
specText?: string
productionWorkOrderId?: string
productionWorkOrderNo?: string
bizType?: string
bizTypeLabel?: string
paymentSummary?: QcProtocolPaymentSummary | null
feeSummary?: QcBasicExperimentFeeSummary | null
/** 列表级工单摘要:未完成标题栏角标数字 */
unfinishedBadgeCount?: number
/** 列表 enrich:同协议下全部样本 */
protocolSiblingSamples?: QcProtocolSiblingSample[]
}
export type QcTaskOperateScope = 'mine' | 'manage'
export type QcTaskDetail = QcTask & {
reception?: QcTaskReceptionDetail
attachmentFiles?: Array<{ id?: string; fileUrl: string; fileName?: string }>
results?: Array<{
paramName: string
paramUnit?: string
paramType: string
paramValue: string
}>
}
export function fetchQcTaskList(params?: {
page?: number
pageSize?: number
keyword?: string
taskType?: string
taskStatus?: string
workOrderId?: string
qcBizType?: string
}) {
return request.get<PageList<QcTask>>({
url: '/web/admin/qc-tasks',
params
})
}
export function fetchMyQcTaskList(params?: {
page?: number
pageSize?: number
keyword?: string
taskType?: string
taskStatus?: string
qcBizType?: string
receptionSource?: string
bizType?: string
}) {
return request.get<PageList<QcTask>>({
url: '/web/admin/qc-tasks/mine',
params
})
}
export function fetchQcTaskDetail(id: string) {
return request.get<QcTaskDetail>({
url: `/web/admin/qc-tasks/${id}`
})
}
export function fetchStartQcTask(id: string, operateScope?: QcTaskOperateScope) {
return request.post<QcTask>({
url: `/web/admin/qc-tasks/${id}/start`,
params: operateScope === 'mine' ? { operateScope: 'mine' } : undefined
})
}
export function fetchCompleteQcTask(id: string) {
return request.post<QcTask>({
url: `/web/admin/qc-tasks/${id}/complete`
})
}
export function fetchUpdateQcTaskAttachments(
id: string,
thirdPartyAttachments: string,
operateScope?: QcTaskOperateScope
) {
return request.put<QcTask>({
url: `/web/admin/qc-tasks/${id}/attachments`,
params: operateScope === 'mine' ? { operateScope: 'mine' } : undefined,
data: { thirdPartyAttachments }
})
}
export function fetchCreateQcTask(data: {
taskType: string
itemCode: string
itemName: string
companyId?: string
companyName?: string
feeAmount?: number
sampleCode?: string
qcBizType?: string
workOrderId?: string
remark?: string
}) {
return request.post<QcTask>({
url: '/web/admin/qc-tasks',
params: data
})
}
export function fetchDeleteQcTask(id: string) {
return request.del({ url: `/web/admin/qc-tasks/${id}` })
}