bug446,468,541,548

This commit is contained in:
2026-05-19 11:59:55 +08:00
parent 871e2de574
commit a91ee66368
5 changed files with 216 additions and 87 deletions

View File

@@ -41,7 +41,9 @@
<el-option label="全部" value="" />
<el-option label="待签发" value="0" />
<el-option label="已签发" value="1" />
<el-option label="已出报告" value="6" />
<el-option label="已采证" value="4" />
<el-option label="已送检" value="5" />
<el-option label="报告已出" value="6" />
<el-option label="已作废" value="7" />
</el-select>
</el-form-item>
@@ -91,7 +93,15 @@
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
<el-table-column label="单据状态" width="100" align="center">
<template #default="scope">
<span>{{ parseBillStatus(scope.row.billStatus ?? scope.row.status) }}</span>
<el-tag
:type="getBillStatusTagType(scope.row)"
effect="plain"
round
:class="{ 'report-status-tag': isReportStatus(scope.row) }"
@click="handleStatusClick(scope.row)"
>
{{ parseBillStatus(getBillStatus(scope.row)) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="申请类型" width="100" align="center">
@@ -107,16 +117,16 @@
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
<el-table-column label="操作" align="center" fixed="right" width="220">
<template #default="scope">
<!-- 待签发status=0或null/undefined可修改删除 -->
<template v-if="!scope.row.status || scope.row.status == 0">
<!-- 待签发可修改删除 -->
<template v-if="isPendingStatus(scope.row)">
<el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button>
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template>
<!-- 已签发status=1可撤回 -->
<template v-else-if="scope.row.status == 1">
<!-- 已签发可撤回 -->
<template v-else-if="isIssuedStatus(scope.row)">
<el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button>
</template>
<!-- 校对(2)待接收(3)已收样(4)已出报告(6)已作废(7)仅查看详情 -->
<!-- 采证已送检报告已出已作废仅查看详情 -->
<template v-else>
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
</template>
@@ -212,10 +222,10 @@
</template>
<script setup>
import {computed, getCurrentInstance, ref, watch} from 'vue';
import {computed, getCurrentInstance, nextTick, ref, watch} from 'vue';
import {Refresh, Search} from '@element-plus/icons-vue';
import {patientInfo} from '../../store/patient.js';
import {getInspection, deleteRequestForm, withdrawRequestForm} from './api';
import {getInspection, deleteRequestForm, withdrawRequestForm, getProofResult} from './api';
import {getDepartmentList} from '@/api/public.js';
import LaboratoryTests from '../order/applicationForm/laboratoryTests.vue';
import {saveInspection} from '../order/applicationForm/api.js';
@@ -270,7 +280,7 @@ const fetchData = async () => {
if (res.code === 200 && res.data) {
const raw = res.data?.records || res.data;
const list = Array.isArray(raw) ? raw : [raw];
tableData.value = list.filter(Boolean);
tableData.value = list.filter(Boolean).sort(sortByCreateTimeDesc);
} else {
tableData.value = [];
}
@@ -329,19 +339,95 @@ const labelMap = {
* @param {string|number} status - 状态码
* @returns {string} 状态文本
*/
const getBillStatus = (row) => {
return row?.billStatus ?? row?.status ?? row?.statusEnum ?? row?.applyStatus;
};
const parseBillStatus = (status) => {
const statusMap = {
'0': '待签发',
'1': '已签发',
'2': '已校对',
'3': '待接收',
'4': '已收样',
'6': '已出报告',
'2': '已采证',
'3': '已送检',
'4': '已采证',
'5': '已送检',
'6': '报告已出',
'8': '报告已出',
'7': '已作废',
};
return statusMap[String(status)] || '-';
};
const getBillStatusTagType = (row) => {
const typeMap = {
'0': 'info',
'1': 'primary',
'2': 'primary',
'3': 'warning',
'4': 'primary',
'5': 'warning',
'6': 'success',
'7': 'danger',
'8': 'success',
};
return typeMap[String(getBillStatus(row))] || 'info';
};
const isPendingStatus = (row) => {
const status = getBillStatus(row);
return status === undefined || status === null || status === '' || String(status) === '0';
};
const isIssuedStatus = (row) => String(getBillStatus(row)) === '1';
const isReportStatus = (row) => ['6', '8'].includes(String(getBillStatus(row)));
const sortByCreateTimeDesc = (a, b) => {
const aTime = a?.createTime ? new Date(a.createTime).getTime() : 0;
const bTime = b?.createTime ? new Date(b.createTime).getTime() : 0;
return bTime - aTime;
};
const handleStatusClick = (row) => {
if (isReportStatus(row)) {
handleViewReport(row);
}
};
const pickReportUrl = (data, row) => {
if (!data) return '';
if (typeof data === 'string') return data;
const raw = data.records || data;
const list = Array.isArray(raw) ? raw : [raw];
const matched =
list.find((item) => {
const reportNo = item.busNo || item.reportNo || item.applyNo || item.prescriptionNo;
return reportNo && row.prescriptionNo && String(reportNo) === String(row.prescriptionNo);
}) || list[0];
return matched?.requestUrl || matched?.pdfUrl || matched?.reportUrl || matched?.url || '';
};
const handleViewReport = async (row) => {
try {
const res = await getProofResult({
encounterId: row.encounterId || patientInfo.value?.encounterId,
prescriptionNo: row.prescriptionNo,
});
if (res?.code === 200) {
const url = pickReportUrl(res.data, row);
if (url) {
window.open(url, '_blank');
return;
}
}
proxy.$modal?.msgWarning?.('暂未获取到检验报告链接');
} catch (e) {
proxy.$modal?.msgError?.(e.message || '获取检验报告失败');
}
};
/**
* 解析申请类型(优先级代码)
* @param {string} descJson - JSON字符串
@@ -462,12 +548,12 @@ const handleViewDetail = async (row) => {
* 修改检验申请单(待签发状态)
*/
const handleEdit = async (row) => {
// 确保科室数据已加载
if (!orgOptions.value || orgOptions.value.length === 0) {
await getLocationInfo();
}
editRowData.value = row;
editDialogVisible.value = true;
await nextTick();
editFormRef.value?.getList?.();
editFormRef.value?.getLocationInfo?.();
editFormRef.value?.getDiagnosisList?.();
};
/**
@@ -646,6 +732,10 @@ defineExpose({
animation: rotating 2s linear infinite;
}
.report-status-tag {
cursor: pointer;
}
@keyframes rotating {
0% {
transform: rotate(0deg);