bug446,468,541,548
This commit is contained in:
@@ -41,7 +41,9 @@
|
|||||||
<el-option label="全部" value="" />
|
<el-option label="全部" value="" />
|
||||||
<el-option label="待签发" value="0" />
|
<el-option label="待签发" value="0" />
|
||||||
<el-option label="已签发" value="1" />
|
<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-option label="已作废" value="7" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -91,7 +93,15 @@
|
|||||||
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
|
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
|
||||||
<el-table-column label="单据状态" width="100" align="center">
|
<el-table-column label="单据状态" width="100" align="center">
|
||||||
<template #default="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="申请类型" width="100" align="center">
|
<el-table-column label="申请类型" width="100" align="center">
|
||||||
@@ -107,16 +117,16 @@
|
|||||||
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
||||||
<el-table-column label="操作" align="center" fixed="right" width="220">
|
<el-table-column label="操作" align="center" fixed="right" width="220">
|
||||||
<template #default="scope">
|
<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="primary" @click="handleEdit(scope.row)">修改</el-button>
|
||||||
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
</template>
|
</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>
|
<el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 已校对(2)、待接收(3)、已收样(4)、已出报告(6)、已作废(7):仅查看详情 -->
|
<!-- 已采证、已送检、报告已出、已作废:仅查看详情 -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
|
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -212,10 +222,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<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 {Refresh, Search} from '@element-plus/icons-vue';
|
||||||
import {patientInfo} from '../../store/patient.js';
|
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 {getDepartmentList} from '@/api/public.js';
|
||||||
import LaboratoryTests from '../order/applicationForm/laboratoryTests.vue';
|
import LaboratoryTests from '../order/applicationForm/laboratoryTests.vue';
|
||||||
import {saveInspection} from '../order/applicationForm/api.js';
|
import {saveInspection} from '../order/applicationForm/api.js';
|
||||||
@@ -270,7 +280,7 @@ const fetchData = async () => {
|
|||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
const raw = res.data?.records || res.data;
|
const raw = res.data?.records || res.data;
|
||||||
const list = Array.isArray(raw) ? raw : [raw];
|
const list = Array.isArray(raw) ? raw : [raw];
|
||||||
tableData.value = list.filter(Boolean);
|
tableData.value = list.filter(Boolean).sort(sortByCreateTimeDesc);
|
||||||
} else {
|
} else {
|
||||||
tableData.value = [];
|
tableData.value = [];
|
||||||
}
|
}
|
||||||
@@ -329,19 +339,95 @@ const labelMap = {
|
|||||||
* @param {string|number} status - 状态码
|
* @param {string|number} status - 状态码
|
||||||
* @returns {string} 状态文本
|
* @returns {string} 状态文本
|
||||||
*/
|
*/
|
||||||
|
const getBillStatus = (row) => {
|
||||||
|
return row?.billStatus ?? row?.status ?? row?.statusEnum ?? row?.applyStatus;
|
||||||
|
};
|
||||||
|
|
||||||
const parseBillStatus = (status) => {
|
const parseBillStatus = (status) => {
|
||||||
const statusMap = {
|
const statusMap = {
|
||||||
'0': '待签发',
|
'0': '待签发',
|
||||||
'1': '已签发',
|
'1': '已签发',
|
||||||
'2': '已校对',
|
'2': '已采证',
|
||||||
'3': '待接收',
|
'3': '已送检',
|
||||||
'4': '已收样',
|
'4': '已采证',
|
||||||
'6': '已出报告',
|
'5': '已送检',
|
||||||
|
'6': '报告已出',
|
||||||
|
'8': '报告已出',
|
||||||
'7': '已作废',
|
'7': '已作废',
|
||||||
};
|
};
|
||||||
return statusMap[String(status)] || '-';
|
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字符串
|
* @param {string} descJson - JSON字符串
|
||||||
@@ -462,12 +548,12 @@ const handleViewDetail = async (row) => {
|
|||||||
* 修改检验申请单(待签发状态)
|
* 修改检验申请单(待签发状态)
|
||||||
*/
|
*/
|
||||||
const handleEdit = async (row) => {
|
const handleEdit = async (row) => {
|
||||||
// 确保科室数据已加载
|
|
||||||
if (!orgOptions.value || orgOptions.value.length === 0) {
|
|
||||||
await getLocationInfo();
|
|
||||||
}
|
|
||||||
editRowData.value = row;
|
editRowData.value = row;
|
||||||
editDialogVisible.value = true;
|
editDialogVisible.value = true;
|
||||||
|
await nextTick();
|
||||||
|
editFormRef.value?.getList?.();
|
||||||
|
editFormRef.value?.getLocationInfo?.();
|
||||||
|
editFormRef.value?.getDiagnosisList?.();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -646,6 +732,10 @@ defineExpose({
|
|||||||
animation: rotating 2s linear infinite;
|
animation: rotating 2s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.report-status-tag {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes rotating {
|
@keyframes rotating {
|
||||||
0% {
|
0% {
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
|
|||||||
@@ -134,10 +134,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup name="LaboratoryTests">
|
<script setup name="LaboratoryTests">
|
||||||
import {getCurrentInstance, onMounted, reactive, ref, watch, computed} from 'vue';
|
import {getCurrentInstance, nextTick, onMounted, reactive, ref, watch, computed} from 'vue';
|
||||||
import {patientInfo} from '../../../store/patient.js';
|
import {patientInfo} from '../../../store/patient.js';
|
||||||
import {getApplicationList, saveInspection} from './api';
|
import {getApplicationList, saveInspection} from './api';
|
||||||
import {getOrgList} from '@/views/doctorstation/components/api.js';
|
import {getDepartmentList} from '@/api/public.js';
|
||||||
import {getEncounterDiagnosis} from '../../api.js';
|
import {getEncounterDiagnosis} from '../../api.js';
|
||||||
import {ElMessage} from 'element-plus';
|
import {ElMessage} from 'element-plus';
|
||||||
|
|
||||||
@@ -168,6 +168,7 @@ const loading = ref(false);
|
|||||||
const orgOptions = ref([]);
|
const orgOptions = ref([]);
|
||||||
const searchKey = ref('');
|
const searchKey = ref('');
|
||||||
const totalCount = ref(0);
|
const totalCount = ref(0);
|
||||||
|
const skipDeptAutoFill = ref(false);
|
||||||
|
|
||||||
// 将已加载的全部数据转为 transfer 组件所需的格式
|
// 将已加载的全部数据转为 transfer 组件所需的格式
|
||||||
const buildTransferData = (records) => {
|
const buildTransferData = (records) => {
|
||||||
@@ -263,7 +264,31 @@ const form = reactive({
|
|||||||
otherDiagnosisList: [], //其他断目录
|
otherDiagnosisList: [], //其他断目录
|
||||||
});
|
});
|
||||||
const rules = reactive({});
|
const rules = reactive({});
|
||||||
|
|
||||||
|
const normalizeOrgTreeIds = (nodes) => {
|
||||||
|
if (!Array.isArray(nodes)) return [];
|
||||||
|
return nodes.map((node) => ({
|
||||||
|
...node,
|
||||||
|
id: node.id != null ? String(node.id) : node.id,
|
||||||
|
children: node.children?.length ? normalizeOrgTreeIds(node.children) : undefined,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
const resolveTargetDepartmentId = (rawId) => {
|
||||||
|
if (rawId == null || rawId === '') return '';
|
||||||
|
const node = findTreeItem(orgOptions.value, rawId);
|
||||||
|
return node ? String(node.id) : String(rawId);
|
||||||
|
};
|
||||||
|
|
||||||
|
const applyTargetDepartmentEcho = () => {
|
||||||
|
if (form.targetDepartment) {
|
||||||
|
form.targetDepartment = resolveTargetDepartmentId(form.targetDepartment);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
getLocationInfo();
|
||||||
|
getDiagnosisList();
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
@@ -292,8 +317,9 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 保存用户手动选择的发往科室(提交时需要保留)
|
// 保存用户手动选择/回显的发往科室(提交、编辑回显时需要保留)
|
||||||
const manualDept = type === 2 ? form.targetDepartment : '';
|
const manualDept =
|
||||||
|
type === 2 || (isEditMode.value && form.targetDepartment) ? form.targetDepartment : '';
|
||||||
// 清空科室
|
// 清空科室
|
||||||
form.targetDepartment = '';
|
form.targetDepartment = '';
|
||||||
if (arr.length > 0) {
|
if (arr.length > 0) {
|
||||||
@@ -313,8 +339,8 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
|||||||
const findItem = findTreeItem(orgOptions.value, obj.orgId);
|
const findItem = findTreeItem(orgOptions.value, obj.orgId);
|
||||||
if (!findItem) {
|
if (!findItem) {
|
||||||
// type=2(提交)时,若用户已手动选择发往科室,则允许提交
|
// type=2(提交)时,若用户已手动选择发往科室,则允许提交
|
||||||
if (type === 2 && manualDept) {
|
if ((type === 2 || isEditMode.value) && manualDept) {
|
||||||
form.targetDepartment = manualDept;
|
form.targetDepartment = resolveTargetDepartmentId(manualDept);
|
||||||
isRelease = true;
|
isRelease = true;
|
||||||
} else if (type === 2 && !manualDept) {
|
} else if (type === 2 && !manualDept) {
|
||||||
// 提交时用户未手动选择科室,才提示错误
|
// 提交时用户未手动选择科室,才提示错误
|
||||||
@@ -330,10 +356,10 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
|||||||
}
|
}
|
||||||
if (findItem && isRelease) {
|
if (findItem && isRelease) {
|
||||||
// 提交时若用户已选「发往科室」,不得用项目默认执行科室覆盖
|
// 提交时若用户已选「发往科室」,不得用项目默认执行科室覆盖
|
||||||
if (type === 2 && manualDept) {
|
if ((type === 2 || isEditMode.value) && manualDept) {
|
||||||
form.targetDepartment = manualDept;
|
form.targetDepartment = resolveTargetDepartmentId(manualDept);
|
||||||
} else {
|
} else {
|
||||||
form.targetDepartment = findItem.id;
|
form.targetDepartment = String(findItem.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -343,6 +369,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
|||||||
watch(
|
watch(
|
||||||
() => transferValue.value,
|
() => transferValue.value,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
|
if (skipDeptAutoFill.value) return;
|
||||||
if (isInitializing.value) return;
|
if (isInitializing.value) return;
|
||||||
projectWithDepartment(newValue, 1);
|
projectWithDepartment(newValue, 1);
|
||||||
}
|
}
|
||||||
@@ -382,7 +409,11 @@ const applyEditTransferSelection = () => {
|
|||||||
const uniq = [...new Set(selectedIds)]
|
const uniq = [...new Set(selectedIds)]
|
||||||
// 设置初始化标志,防止 transferValue 变化触发 projectWithDepartment 覆盖 descJson 中的科室值
|
// 设置初始化标志,防止 transferValue 变化触发 projectWithDepartment 覆盖 descJson 中的科室值
|
||||||
isInitializing.value = true
|
isInitializing.value = true
|
||||||
|
skipDeptAutoFill.value = true
|
||||||
transferValue.value = uniq
|
transferValue.value = uniq
|
||||||
|
nextTick(() => {
|
||||||
|
skipDeptAutoFill.value = false
|
||||||
|
})
|
||||||
isInitializing.value = false
|
isInitializing.value = false
|
||||||
if (newData.requestFormDetailList.length && uniq.length === 0) {
|
if (newData.requestFormDetailList.length && uniq.length === 0) {
|
||||||
console.warn(
|
console.warn(
|
||||||
@@ -406,6 +437,7 @@ watch(
|
|||||||
form[key] = obj[key]
|
form[key] = obj[key]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
applyTargetDepartmentEcho()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('解析 descJson 失败:', e)
|
console.error('解析 descJson 失败:', e)
|
||||||
}
|
}
|
||||||
@@ -416,7 +448,14 @@ watch(
|
|||||||
{ immediate: true, deep: true }
|
{ immediate: true, deep: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
// 编辑模式下,applicationListAll 加载完成后重新回显已选项目
|
watch(
|
||||||
|
() => orgOptions.value,
|
||||||
|
() => {
|
||||||
|
applyTargetDepartmentEcho()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 编辑模式下,项目字典加载完成后重新回显已选项目
|
||||||
watch(
|
watch(
|
||||||
() => applicationListAll.value,
|
() => applicationListAll.value,
|
||||||
() => {
|
() => {
|
||||||
@@ -436,6 +475,7 @@ watch(
|
|||||||
isInitializing.value = true;
|
isInitializing.value = true;
|
||||||
transferValue.value = selectedIds;
|
transferValue.value = selectedIds;
|
||||||
isInitializing.value = false;
|
isInitializing.value = false;
|
||||||
|
applyEditTransferSelection();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -488,9 +528,9 @@ const submit = () => {
|
|||||||
};
|
};
|
||||||
/** 查询科室 */
|
/** 查询科室 */
|
||||||
const getLocationInfo = () => {
|
const getLocationInfo = () => {
|
||||||
getOrgList().then((res) => {
|
return getDepartmentList().then((res) => {
|
||||||
orgOptions.value = res.data.records;
|
orgOptions.value = normalizeOrgTreeIds(res.data || []);
|
||||||
console.log('科室========>', JSON.stringify(orgOptions.value));
|
applyTargetDepartmentEcho();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 获取诊断目录
|
// 获取诊断目录
|
||||||
|
|||||||
@@ -804,7 +804,7 @@ function checkUnit(item, row) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 行双击打开编辑块,"待保存"和"待签发"均可编辑
|
// 行双击打开编辑块:待保存、待签发医嘱均可编辑;已签发/已完成/停止不允许编辑
|
||||||
function clickRowDb(row, column, event) {
|
function clickRowDb(row, column, event) {
|
||||||
// 检查点击的是否是复选框
|
// 检查点击的是否是复选框
|
||||||
if (event && event.target.closest('.el-checkbox')) {
|
if (event && event.target.closest('.el-checkbox')) {
|
||||||
@@ -815,14 +815,18 @@ function clickRowDb(row, column, event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
row.showPopover = false;
|
row.showPopover = false;
|
||||||
// statusEnum == 1 包含"待保存(无requestId)"和"待签发(有requestId)",均允许编辑
|
|
||||||
if (row.statusEnum == 1) {
|
if (row.statusEnum == 1) {
|
||||||
// 确保治疗类型为字符串,方便与单选框 label 对齐,默认为长期医嘱('1')
|
// 确保治疗类型为字符串,方便与单选框 label 对齐,默认为长期医嘱('1')
|
||||||
row.therapyEnum = String(row.therapyEnum ?? '1');
|
row.therapyEnum = String(row.therapyEnum ?? '1');
|
||||||
row.isEdit = true;
|
row.isEdit = true;
|
||||||
const index = prescriptionList.value.findIndex((item) => item.uniqueKey === row.uniqueKey);
|
const index = prescriptionList.value.findIndex((item) => item.uniqueKey === row.uniqueKey);
|
||||||
prescriptionList.value[index] = row;
|
rowIndex.value = index;
|
||||||
|
if (index !== -1) {
|
||||||
|
prescriptionList.value[index] = row;
|
||||||
|
}
|
||||||
expandOrder.value = [row.uniqueKey];
|
expandOrder.value = [row.uniqueKey];
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgWarning('仅待保存或待签发医嘱允许编辑');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,7 +262,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {computed, nextTick, onMounted, ref, watch} from 'vue';
|
import {nextTick, onMounted, ref} from 'vue';
|
||||||
import {ElMessage, ElMessageBox} from 'element-plus';
|
import {ElMessage, ElMessageBox} from 'element-plus';
|
||||||
// Element Plus 图标导入
|
// Element Plus 图标导入
|
||||||
import {User} from '@element-plus/icons-vue';
|
import {User} from '@element-plus/icons-vue';
|
||||||
@@ -366,9 +366,9 @@ const rawPrescriptionList = ref([]); // 原始未分组数据
|
|||||||
const groupedPrescriptionList = ref([]); // 按encounterId分组后的数据
|
const groupedPrescriptionList = ref([]); // 按encounterId分组后的数据
|
||||||
const activeCollapseNames = ref([]); // Collapse激活状态
|
const activeCollapseNames = ref([]); // Collapse激活状态
|
||||||
const selectedRows = ref({}); // 选中的行数据
|
const selectedRows = ref({}); // 选中的行数据
|
||||||
const totalItemsCount = ref(0); // 总医嘱项数
|
|
||||||
const totalAmount = ref(0); // 总金额(保留4位小数)
|
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
|
/** Tab 切换同步日期时跳过 date-picker change,避免与 v-model 循环触发 */
|
||||||
|
const syncingDateFromTab = ref(false);
|
||||||
const selectedFeeItems = ref([]);
|
const selectedFeeItems = ref([]);
|
||||||
const currentPatientInfo = ref(null);
|
const currentPatientInfo = ref(null);
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
@@ -381,24 +381,6 @@ const userStore = useUserStore();
|
|||||||
const userId = ref(safeGet(userStore, 'id', ''));
|
const userId = ref(safeGet(userStore, 'id', ''));
|
||||||
const orgId = ref(safeGet(userStore, 'orgId', ''));
|
const orgId = ref(safeGet(userStore, 'orgId', ''));
|
||||||
|
|
||||||
// ========== 计算属性 ==========
|
|
||||||
// 计算总统计信息(总项数、总金额)
|
|
||||||
const calculateTotalStats = computed(() => {
|
|
||||||
let itemsCount = 0;
|
|
||||||
let amount = 0;
|
|
||||||
|
|
||||||
safeArray(groupedPrescriptionList.value).forEach((patientGroup) => {
|
|
||||||
safeArray(patientGroup).forEach((item) => {
|
|
||||||
itemsCount++;
|
|
||||||
// 累加单价,保留4位小数精度
|
|
||||||
amount = Math.round((amount + Number(safeGet(item, 'unitPrice', 0))) * 10000) / 10000;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
totalItemsCount.value = itemsCount;
|
|
||||||
totalAmount.value = amount;
|
|
||||||
});
|
|
||||||
|
|
||||||
// ========== 方法 ==========
|
// ========== 方法 ==========
|
||||||
/**
|
/**
|
||||||
* 计算单个患者的总金额(保留4位小数)
|
* 计算单个患者的总金额(保留4位小数)
|
||||||
@@ -447,16 +429,19 @@ const handleTableSelectionChange = (index, val) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期Tab切换
|
* 按 Tab 同步日期范围(避免 date-picker @change 与 Tab v-model 互相覆盖)
|
||||||
* @param {Object} tab - 标签页
|
* @param {string} rangeType - today | yesterday | custom
|
||||||
*/
|
*/
|
||||||
const handleDateTabClick = (tab) => {
|
const applyDateRangeByTab = (rangeType) => {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const yesterday = new Date(today);
|
const yesterday = new Date(today);
|
||||||
yesterday.setDate(today.getDate() - 1);
|
yesterday.setDate(today.getDate() - 1);
|
||||||
const format = (date) => formatDateStr(date, 'YYYY-MM-DD');
|
const format = (date) => formatDateStr(date, 'YYYY-MM-DD');
|
||||||
|
|
||||||
switch (safeGet(tab, 'paneName')) {
|
syncingDateFromTab.value = true;
|
||||||
|
dateRange.value = rangeType;
|
||||||
|
|
||||||
|
switch (rangeType) {
|
||||||
case 'today':
|
case 'today':
|
||||||
dateRangeValue.value = [format(today), format(today)];
|
dateRangeValue.value = [format(today), format(today)];
|
||||||
break;
|
break;
|
||||||
@@ -464,27 +449,54 @@ const handleDateTabClick = (tab) => {
|
|||||||
dateRangeValue.value = [format(yesterday), format(yesterday)];
|
dateRangeValue.value = [format(yesterday), format(yesterday)];
|
||||||
break;
|
break;
|
||||||
case 'custom':
|
case 'custom':
|
||||||
if (!dateRangeValue.value.length) {
|
if (safeArray(dateRangeValue.value).length < 2) {
|
||||||
dateRangeValue.value = [format(today), format(today)];
|
dateRangeValue.value = [format(today), format(today)];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
syncingDateFromTab.value = false;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期选择器变化
|
* 日期Tab切换
|
||||||
|
* @param {Object} tab - 标签页
|
||||||
|
*/
|
||||||
|
const handleDateTabClick = (tab) => {
|
||||||
|
const rangeType = tab?.paneName ?? tab?.props?.name;
|
||||||
|
if (!rangeType) return;
|
||||||
|
applyDateRangeByTab(rangeType);
|
||||||
|
handleQuery();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期选择器变化(仅用户手动改日期时切到「自定义」)
|
||||||
* @param {Array} val - 选中日期
|
* @param {Array} val - 选中日期
|
||||||
*/
|
*/
|
||||||
const handleDatePickerChange = (val) => {
|
const handleDatePickerChange = (val) => {
|
||||||
|
if (syncingDateFromTab.value) return;
|
||||||
|
|
||||||
const dateVal = safeArray(val);
|
const dateVal = safeArray(val);
|
||||||
if (dateVal.length === 2) {
|
if (dateVal.length !== 2) return;
|
||||||
|
|
||||||
|
const start = new Date(dateVal[0]);
|
||||||
|
const end = new Date(dateVal[1]);
|
||||||
|
if (start > end) {
|
||||||
|
ElMessage.warning('开始日期不能晚于结束日期');
|
||||||
|
syncingDateFromTab.value = true;
|
||||||
|
dateRangeValue.value = [dateVal[1], dateVal[0]];
|
||||||
|
nextTick(() => {
|
||||||
|
syncingDateFromTab.value = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dateRange.value !== 'custom') {
|
||||||
dateRange.value = 'custom';
|
dateRange.value = 'custom';
|
||||||
const start = new Date(dateVal[0]);
|
|
||||||
const end = new Date(dateVal[1]);
|
|
||||||
if (start > end) {
|
|
||||||
ElMessage.warning('开始日期不能晚于结束日期');
|
|
||||||
dateRangeValue.value = [dateVal[1], dateVal[0]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -714,24 +726,7 @@ const handleSingleDelete = (row) => {
|
|||||||
};
|
};
|
||||||
// ========== 初始化 ==========
|
// ========== 初始化 ==========
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 设置默认日期
|
applyDateRangeByTab('today');
|
||||||
const today = new Date();
|
|
||||||
const defaultDate = formatDateStr(today, 'YYYY-MM-DD');
|
|
||||||
dateRangeValue.value = [defaultDate, defaultDate];
|
|
||||||
|
|
||||||
// 监听日期变化自动查询
|
|
||||||
watch(
|
|
||||||
[dateRange, dateRangeValue],
|
|
||||||
([newRange, newVal], [oldRange, oldVal]) => {
|
|
||||||
if (oldRange !== undefined && safeArray(newVal).length === 2) {
|
|
||||||
handleQuery();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ deep: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
// 初始化统计信息
|
|
||||||
calculateTotalStats.value;
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,7 @@
|
|||||||
:disabled="allItemsSubmitted"
|
:disabled="allItemsSubmitted"
|
||||||
@click="handleSignAndSubmit"
|
@click="handleSignAndSubmit"
|
||||||
>
|
>
|
||||||
{{ allItemsSubmitted ? '已签发' : (isSigned ? '提交医嘱' : '一键签名并生成医嘱') }}
|
{{ allItemsSubmitted ? '已签发' : '一键签名并生成医嘱' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user