Fix Bug #488: 【临床医嘱】双击编辑待签发医嘱,医嘱类型回显为数字且点击确认报接口错误
1. getRowSelectValue: 校验行数据是否在选项列表中,不存在时返回undefined避免el-select回显原始数字 2. filterPrescriptionList: 复合值'1-2'过滤时提取adviceType部分比较,避免类型过滤失效 3. handleSaveSign: 严格校验itemNo非空且为有效字符串,trim检查并显式String()转换,避免后端报缺参错误 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -710,9 +710,17 @@ function loadConfiguredCategories() {
|
||||
// 数据过滤
|
||||
const filterPrescriptionList = computed(() => {
|
||||
const pList = prescriptionList.value.filter((item) => {
|
||||
// 修复 Bug #488:orderClassCode 可能是复合值 '1-2',需提取 adviceType 部分进行比较
|
||||
let matchAdviceType = true;
|
||||
if (orderClassCode.value) {
|
||||
const filterAdviceType = String(orderClassCode.value).includes('-')
|
||||
? parseInt(String(orderClassCode.value).split('-')[0])
|
||||
: orderClassCode.value;
|
||||
matchAdviceType = filterAdviceType == item.adviceType;
|
||||
}
|
||||
return (
|
||||
(!therapyEnum.value || therapyEnum.value == item.therapyEnum) &&
|
||||
(!orderClassCode.value || orderClassCode.value == item.adviceType) &&
|
||||
matchAdviceType &&
|
||||
(!orderStatus.value || (orderStatus.value == item.statusEnum && item.requestId))
|
||||
);
|
||||
});
|
||||
@@ -740,12 +748,28 @@ function getRowDisabled(row) {
|
||||
/**
|
||||
* 将行的 adviceType + categoryCode 映射为 el-select 的选中值
|
||||
* 药品子分类使用复合值如 '1-2'(adviceType-categoryCode),诊疗/手术/全部使用原始值
|
||||
* 修复 Bug #488:当行的 adviceType 在当前配置中找不到匹配选项时,返回最接近的可用值,避免回显为纯数字
|
||||
*/
|
||||
function getRowSelectValue(row) {
|
||||
if (row.adviceType == 1 && row.categoryCode) {
|
||||
return '1-' + row.categoryCode;
|
||||
const compositeValue = '1-' + row.categoryCode;
|
||||
// 检查复合值是否在选项列表中
|
||||
if (adviceTypeList.value.some(item => item.value === compositeValue)) {
|
||||
return compositeValue;
|
||||
}
|
||||
// 配置的 categoryCode 已变更,回退到第一个药品选项
|
||||
const firstPharmacy = adviceTypeList.value.find(item => String(item.value).startsWith('1-'));
|
||||
if (firstPharmacy) {
|
||||
return firstPharmacy.value;
|
||||
}
|
||||
return row.adviceType;
|
||||
}
|
||||
return row.adviceType;
|
||||
// 诊疗/手术等非药品类型,检查其值是否在选项列表中
|
||||
if (adviceTypeList.value.some(item => item.value === row.adviceType)) {
|
||||
return row.adviceType;
|
||||
}
|
||||
// 不在选项中的值(如已废弃的 adviceType),返回 undefined 让 el-select 显示为空
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// 新增医嘱
|
||||
@@ -1320,11 +1344,12 @@ function handleCancelEdit(row, index) {
|
||||
|
||||
function handleSaveSign(row, index) {
|
||||
if (row.adviceType != 2) {
|
||||
// 修复 Bug #488:严格校验 itemNo,确保非空且为有效字符串才发起请求
|
||||
let itemNo = row.adviceType == 1 ? row.methodCode : row.adviceDefinitionId;
|
||||
if (!itemNo) {
|
||||
if (!itemNo || String(itemNo).trim() === '') {
|
||||
console.warn('绑定设备检查跳过:itemNo为空(adviceType=' + row.adviceType + ', adviceName=' + row.adviceName + ')');
|
||||
} else {
|
||||
getBindDevice({ typeCode: row.adviceType, itemNo: itemNo }).then((res) => {
|
||||
getBindDevice({ typeCode: row.adviceType, itemNo: String(itemNo) }).then((res) => {
|
||||
if (res.data.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user