修复检查申请单“执行科室”未获取配置默认值且字段交互逻辑不规范
This commit is contained in:
@@ -694,7 +694,8 @@ function handleAdd() {
|
|||||||
purposeofInspection: '', inspectionArea: '', inspectionMethod: '',
|
purposeofInspection: '', inspectionArea: '', inspectionMethod: '',
|
||||||
applyRemark: '', clinicalDiag: '', purposeDesc: '',
|
applyRemark: '', clinicalDiag: '', purposeDesc: '',
|
||||||
isUrgent: 0, pregnancyState: 0, allergyDesc: '',
|
isUrgent: 0, pregnancyState: 0, allergyDesc: '',
|
||||||
applyStatus: 0, isCharged: 0, isRefunded: 0, isExecuted: 0
|
applyStatus: 0, isCharged: 0, isRefunded: 0, isExecuted: 0,
|
||||||
|
examTypeCode: ''
|
||||||
});
|
});
|
||||||
selectedItems.value = [];
|
selectedItems.value = [];
|
||||||
resetCategoryChecked();
|
resetCategoryChecked();
|
||||||
@@ -710,7 +711,7 @@ function handleSave() {
|
|||||||
}
|
}
|
||||||
// 从已选项目推导检查类型编码(取第一个项目的 checkType,如 CT / ECG / GI)
|
// 从已选项目推导检查类型编码(取第一个项目的 checkType,如 CT / ECG / GI)
|
||||||
const firstCheckType = selectedItems.value[0]?.checkType || 'unknown';
|
const firstCheckType = selectedItems.value[0]?.checkType || 'unknown';
|
||||||
if (!form.examTypeCode) form.examTypeCode = firstCheckType;
|
form.examTypeCode = firstCheckType;
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
...form,
|
...form,
|
||||||
@@ -776,6 +777,16 @@ function handleDelete(row) {
|
|||||||
// ====== 勾选逻辑 ======
|
// ====== 勾选逻辑 ======
|
||||||
function handleItemSelect(checked, item, cat) {
|
function handleItemSelect(checked, item, cat) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
|
if (selectedItems.value.length > 0) {
|
||||||
|
const currentCategory = selectedItems.value[0].checkType;
|
||||||
|
const newCategory = cat.typeCode || '';
|
||||||
|
if (currentCategory !== newCategory) {
|
||||||
|
ElMessage.warning('一个检查单不能同时选择多个项目类型的检查项目');
|
||||||
|
item.checked = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
selectedItems.value.push({
|
selectedItems.value.push({
|
||||||
id: item.id, name: item.name,
|
id: item.id, name: item.name,
|
||||||
price: item.price, quantity: 1,
|
price: item.price, quantity: 1,
|
||||||
@@ -788,13 +799,19 @@ function handleItemSelect(checked, item, cat) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 自动回填执行科室:按检查项目类型 → 检查类型管理里配置的执行科室
|
// 自动回填执行科室:按检查项目类型 → 检查类型管理里配置的执行科室
|
||||||
// 仅在未手动选择时自动填充,避免覆盖用户输入
|
if (selectedItems.value.length === 1 && cat?.performDeptName) {
|
||||||
if (!form.performDeptCode && cat?.performDeptName) {
|
form.performDeptCode = cat.performDeptName;
|
||||||
|
} else if (!form.performDeptCode && cat?.performDeptName) {
|
||||||
form.performDeptCode = cat.performDeptName;
|
form.performDeptCode = cat.performDeptName;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const idx = selectedItems.value.findIndex(s => s.id === item.id);
|
const idx = selectedItems.value.findIndex(s => s.id === item.id);
|
||||||
if (idx > -1) selectedItems.value.splice(idx, 1);
|
if (idx > -1) selectedItems.value.splice(idx, 1);
|
||||||
|
|
||||||
|
if (selectedItems.value.length === 0) {
|
||||||
|
form.performDeptCode = '';
|
||||||
|
form.examTypeCode = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 有选项时切换到明细tab
|
// 有选项时切换到明细tab
|
||||||
if (selectedItems.value.length > 0) {
|
if (selectedItems.value.length > 0) {
|
||||||
@@ -810,6 +827,11 @@ function handleRemoveItem(idx, item) {
|
|||||||
const found = cat.items.find(x => x.id === item.id);
|
const found = cat.items.find(x => x.id === item.id);
|
||||||
if (found) { found.checked = false; break; }
|
if (found) { found.checked = false; break; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectedItems.value.length === 0) {
|
||||||
|
form.performDeptCode = '';
|
||||||
|
form.examTypeCode = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetCategoryChecked() {
|
function resetCategoryChecked() {
|
||||||
|
|||||||
@@ -3512,6 +3512,7 @@ function setValue(row) {
|
|||||||
if (row.adviceType == 5) {
|
if (row.adviceType == 5) {
|
||||||
// 会诊类型:设置默认值
|
// 会诊类型:设置默认值
|
||||||
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId; // 执行科室默认为申请医生的科室
|
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId; // 执行科室默认为申请医生的科室
|
||||||
|
prescriptionList.value[rowIndex.value].positionName = findOrgNameById(props.patientInfo.orgId) || props.patientInfo.orgName || '';
|
||||||
prescriptionList.value[rowIndex.value].quantity = 1; // 执行次数默认1次
|
prescriptionList.value[rowIndex.value].quantity = 1; // 执行次数默认1次
|
||||||
prescriptionList.value[rowIndex.value].unitPrice = row.priceList && row.priceList[0] ? row.priceList[0].price : (row.unitPrice || 0);
|
prescriptionList.value[rowIndex.value].unitPrice = row.priceList && row.priceList[0] ? row.priceList[0].price : (row.unitPrice || 0);
|
||||||
prescriptionList.value[rowIndex.value].totalPrice = prescriptionList.value[rowIndex.value].unitPrice;
|
prescriptionList.value[rowIndex.value].totalPrice = prescriptionList.value[rowIndex.value].unitPrice;
|
||||||
@@ -3522,6 +3523,9 @@ function setValue(row) {
|
|||||||
if (!prescriptionList.value[rowIndex.value].orgId) {
|
if (!prescriptionList.value[rowIndex.value].orgId) {
|
||||||
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId;
|
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId;
|
||||||
}
|
}
|
||||||
|
if (!prescriptionList.value[rowIndex.value].positionName) {
|
||||||
|
prescriptionList.value[rowIndex.value].positionName = findOrgNameById(prescriptionList.value[rowIndex.value].orgId) || props.patientInfo.orgName || '';
|
||||||
|
}
|
||||||
// 🔧 Bug #218 修复:使用组套中维护的quantity,如果没有则默认1
|
// 🔧 Bug #218 修复:使用组套中维护的quantity,如果没有则默认1
|
||||||
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
||||||
// 🔧 Bug #144 修复:安全访问 priceList,防止 orderDetailInfos 为空时出错
|
// 🔧 Bug #144 修复:安全访问 priceList,防止 orderDetailInfos 为空时出错
|
||||||
|
|||||||
Reference in New Issue
Block a user