疾病报告管理-》报告卡管理:查看报卡详情页缺失“历史审核记录”展示
This commit is contained in:
@@ -518,13 +518,16 @@
|
||||
@close="handleDrawerClose"
|
||||
>
|
||||
<template #append>
|
||||
<!-- 审核记录 -->
|
||||
<div class="audit-records-section" v-if="auditRecords.length > 0">
|
||||
<!-- 审核记录:查看/审核都展示,保证留痕可追溯 -->
|
||||
<div
|
||||
class="audit-records-section"
|
||||
v-if="drawerMode === 'view' || (drawerMode === 'audit' && auditRecords.length > 0)"
|
||||
>
|
||||
<h3 class="section-title">审核记录</h3>
|
||||
<el-timeline>
|
||||
<el-timeline v-if="auditRecords.length > 0">
|
||||
<el-timeline-item
|
||||
v-for="record in auditRecords"
|
||||
:key="record.auditId"
|
||||
v-for="(record, idx) in auditRecords"
|
||||
:key="record.auditId || idx"
|
||||
:timestamp="record.auditTime"
|
||||
placement="top"
|
||||
:type="getAuditType(record.auditStatusTo)"
|
||||
@@ -538,8 +541,8 @@
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="record-detail">
|
||||
<span v-if="record.auditOpinion">审核意见:{{ record.auditOpinion }}</span>
|
||||
<span v-if="record.reasonForReturn">退回原因:{{ record.reasonForReturn }}</span>
|
||||
<div v-if="record.auditOpinion">审核意见:{{ record.auditOpinion }}</div>
|
||||
<div v-if="record.reasonForReturn">退回原因:{{ record.reasonForReturn }}</div>
|
||||
</div>
|
||||
<div class="record-status">
|
||||
{{ getStatusName(record.auditStatusFrom) }} → {{ getStatusName(record.auditStatusTo) }}
|
||||
@@ -548,6 +551,7 @@
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
<el-empty v-else description="暂无审核记录" />
|
||||
</div>
|
||||
|
||||
<!-- 审核操作区域 -->
|
||||
@@ -652,6 +656,7 @@ import InfectiousDiseaseReportDialog from '@/views/doctorstation/components/diag
|
||||
import {
|
||||
listInfectiousCards,
|
||||
getInfectiousCard,
|
||||
getAuditRecords,
|
||||
auditInfectiousCard,
|
||||
returnInfectiousCard,
|
||||
revokeAuditCard,
|
||||
@@ -706,6 +711,8 @@ const drawerMode = ref('view'); // view | audit
|
||||
const drawerLoading = ref(false);
|
||||
const reportDialogRef = ref(null);
|
||||
const currentCard = ref({});
|
||||
// 锁定当前打开的卡号,防止异步/串单导致写错审核记录
|
||||
const activeCardNo = ref('');
|
||||
const auditRecords = ref([]);
|
||||
const auditForm = ref({
|
||||
auditOpinion: '',
|
||||
@@ -950,6 +957,8 @@ async function handleRevokeAudit(row) {
|
||||
async function loadCardDetail(cardNo) {
|
||||
drawerLoading.value = true;
|
||||
try {
|
||||
activeCardNo.value = String(cardNo || '').trim();
|
||||
auditRecords.value = [];
|
||||
// 使用详情 API 获取卡片详细信息
|
||||
const res = await getInfectiousCard(cardNo);
|
||||
if (res.code === 200 && res.data) {
|
||||
@@ -962,8 +971,36 @@ async function loadCardDetail(cardNo) {
|
||||
deptName: res.data.deptName || res.data.createDeptName,
|
||||
diseaseName: res.data.diseaseName || getDiseaseName(res.data.diseaseCode),
|
||||
};
|
||||
// 如果没有单独的审核记录 API,尝试从详情数据中获取
|
||||
auditRecords.value = res.data.auditRecords || res.auditRecords || [];
|
||||
|
||||
const normalizeAuditRecords = (payload) => {
|
||||
if (!payload) return [];
|
||||
if (Array.isArray(payload)) return payload;
|
||||
// 兼容:data 里再包一层
|
||||
if (Array.isArray(payload.data)) return payload.data;
|
||||
// 兼容:分页/列表常见字段
|
||||
if (Array.isArray(payload.records)) return payload.records;
|
||||
if (Array.isArray(payload.rows)) return payload.rows;
|
||||
if (Array.isArray(payload.list)) return payload.list;
|
||||
return [];
|
||||
};
|
||||
|
||||
// 优先使用审核记录 API,确保能看到完整历史;失败再回退到详情内嵌字段
|
||||
try {
|
||||
const recordRes = await getAuditRecords(String(cardNo || '').trim());
|
||||
if (recordRes?.code === 200) {
|
||||
auditRecords.value = normalizeAuditRecords(recordRes.data);
|
||||
} else {
|
||||
auditRecords.value = normalizeAuditRecords(res.data.auditRecords || res.auditRecords);
|
||||
if (auditRecords.value.length === 0) {
|
||||
ElMessage.warning(recordRes?.msg || '获取审核记录失败');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
auditRecords.value = normalizeAuditRecords(res.data.auditRecords || res.auditRecords);
|
||||
if (auditRecords.value.length === 0) {
|
||||
ElMessage.warning('获取审核记录失败');
|
||||
}
|
||||
}
|
||||
reportDialogRef.value?.showReport(currentCard.value);
|
||||
} else {
|
||||
ElMessage.error('获取卡片详情失败');
|
||||
@@ -993,8 +1030,18 @@ async function handlePassCard() {
|
||||
}
|
||||
|
||||
try {
|
||||
const cardNo = String(activeCardNo.value || currentCard.value.cardNo || '').trim();
|
||||
if (!cardNo) {
|
||||
ElMessage.error('未获取到报卡编号,请重新打开后再试');
|
||||
return;
|
||||
}
|
||||
// 防止串单:展示的 currentCard 与锁定卡号不一致时禁止提交
|
||||
if (currentCard.value?.cardNo && String(currentCard.value.cardNo).trim() !== cardNo) {
|
||||
ElMessage.error('报卡编号发生变化,请重新打开报卡后再审核');
|
||||
return;
|
||||
}
|
||||
const res = await auditInfectiousCard({
|
||||
cardNo: currentCard.value.cardNo,
|
||||
cardNo,
|
||||
auditOpinion: auditForm.value.auditOpinion,
|
||||
status: '2'
|
||||
});
|
||||
@@ -1027,8 +1074,17 @@ async function handleReturnCard() {
|
||||
}
|
||||
|
||||
try {
|
||||
const cardNo = String(activeCardNo.value || currentCard.value.cardNo || '').trim();
|
||||
if (!cardNo) {
|
||||
ElMessage.error('未获取到报卡编号,请重新打开后再试');
|
||||
return;
|
||||
}
|
||||
if (currentCard.value?.cardNo && String(currentCard.value.cardNo).trim() !== cardNo) {
|
||||
ElMessage.error('报卡编号发生变化,请重新打开报卡后再退回');
|
||||
return;
|
||||
}
|
||||
const res = await returnInfectiousCard({
|
||||
cardNo: currentCard.value.cardNo,
|
||||
cardNo,
|
||||
returnReason: auditForm.value.returnReason,
|
||||
status: '5'
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user