diff --git a/src/api/qc.ts b/src/api/qc.ts index 2fac823..10f6ca4 100644 --- a/src/api/qc.ts +++ b/src/api/qc.ts @@ -1,4 +1,5 @@ import { http } from '@/api/http' +import type { RecordAbnormal } from '@/api/abnormal' import type { Elder } from '@/api/elder' import type { Order } from '@/api/order' import type { ChangePlanData, Plan } from '@/api/plan' @@ -112,6 +113,13 @@ export interface BatchPassData { recordIds: string[] } +/** 异常处理入参(处理结果 + 选填处理意见)。 */ +export interface HandleAbnormalData { + /** handled(已处理)/ closed(已关闭)。 */ + handleStatus: string + handleResult?: string +} + /** 异常联动改计划入参:复用 plan.change 字段 + abnormalId。 */ export interface ExceptionLinkData extends ChangePlanData { abnormalId: string @@ -151,3 +159,8 @@ export function exceptionLink(data: ExceptionLinkData): Promise { export function correctQc(data: CorrectData): Promise { return http.post('/qc/correct', data) } + +/** 异常处理/关闭(写 handle_status + 处理意见)。 */ +export function handleAbnormal(id: string, data: HandleAbnormalData): Promise { + return http.post(`/qc/abnormal/${id}/handle`, data) +} diff --git a/src/pages/ltc/qc/index.vue b/src/pages/ltc/qc/index.vue index 2387438..747af0c 100644 --- a/src/pages/ltc/qc/index.vue +++ b/src/pages/ltc/qc/index.vue @@ -102,6 +102,7 @@ :actions-width="120" > + + + + + + + + + + + + + + + + @@ -399,6 +419,7 @@ import { batchPassQc, exceptionLink, getQcDetail, + handleAbnormal, passQc, pendingList, returnQc, @@ -727,6 +748,41 @@ function handleAbnormalReset(): void { else abnormalPage.value = 1 } +// ---- 异常处理/关闭 ---- +const handleVisible = ref(false) +const handling = ref(false) +const handleAbnormalId = ref('') +const handleForm = reactive({ handleStatus: '', handleResult: '' }) + +function openHandle(row: Record): void { + handleAbnormalId.value = String(row.id) + handleForm.handleStatus = '' + handleForm.handleResult = '' + handleVisible.value = true +} + +async function confirmHandle(): Promise { + if (!handleForm.handleStatus) { + ElMessage.warning('请选择处理结果') + return + } + handling.value = true + try { + await handleAbnormal(handleAbnormalId.value, { + handleStatus: handleForm.handleStatus, + handleResult: handleForm.handleResult.trim() || undefined, + }) + ElMessage.success('已处理') + handleVisible.value = false + void fetchAbnormal() + void fetchPending() + } catch (e) { + if (e instanceof ApiError) ElMessage.error(e.message) + } finally { + handling.value = false + } +} + // ---- 异常联动改计划 ---- interface LinkItemDraft { svcId: string