feat(c4): 异常处理台处理/关闭接线

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
liuyun 2026-10-15 01:50:44 +08:00
parent 44386e90ae
commit 07f528428c
2 changed files with 69 additions and 0 deletions

View File

@ -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<Plan> {
export function correctQc(data: CorrectData): Promise<QcRecord> {
return http.post<QcRecord>('/qc/correct', data)
}
/** 异常处理/关闭(写 handle_status + 处理意见)。 */
export function handleAbnormal(id: string, data: HandleAbnormalData): Promise<RecordAbnormal> {
return http.post<RecordAbnormal>(`/qc/abnormal/${id}/handle`, data)
}

View File

@ -102,6 +102,7 @@
:actions-width="120"
>
<template #actions="{ row }">
<el-button v-permission="'abnormal:handle'" link type="warning" @click="openHandle(row)">处理</el-button>
<el-button v-permission="'qc:exception-link'" link type="primary" :disabled="row.linkPlanChange" @click="openLink(row)">
{{ row.linkPlanChange ? '已联动' : '联动改计划' }}
</el-button>
@ -229,6 +230,25 @@
</template>
</el-dialog>
<!-- 异常处理/关闭 -->
<el-dialog v-model="handleVisible" title="异常处理" width="480px">
<el-form :model="handleForm" label-width="90px">
<el-form-item label="处理结果" required>
<el-select v-model="handleForm.handleStatus" placeholder="请选择" style="width: 100%">
<el-option label="已处理" value="handled" />
<el-option label="已关闭" value="closed" />
</el-select>
</el-form-item>
<el-form-item label="处理意见">
<el-input v-model="handleForm.handleResult" type="textarea" :rows="3" placeholder="选填" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="handleVisible = false">取消</el-button>
<el-button type="primary" :loading="handling" @click="confirmHandle">确认</el-button>
</template>
</el-dialog>
<!-- 异常联动改计划 -->
<el-dialog v-model="linkVisible" title="异常联动改计划" width="860px">
<el-alert v-if="linkAbnormal" class="mb-sm" type="info" :closable="false" :title="`关联老人:${elderName(linkAbnormal.elderId)} · 异常分类:${ABNORMAL_TYPE_LABEL_MAP[linkAbnormal.abnormalType] ?? linkAbnormal.abnormalType}`" />
@ -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<string, any>): void {
handleAbnormalId.value = String(row.id)
handleForm.handleStatus = ''
handleForm.handleResult = ''
handleVisible.value = true
}
async function confirmHandle(): Promise<void> {
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