下拉列表的刷选功能失效,按照下拉选中的医嘱类型能过滤出对应收费项目医生进行开单

This commit is contained in:
2025-10-27 14:57:46 +08:00
parent 4d0599eac1
commit f4605b1af7
2 changed files with 77 additions and 34 deletions

View File

@@ -67,7 +67,7 @@ import { throttle } from 'lodash-es';
const props = defineProps({ const props = defineProps({
adviceQueryParams: { adviceQueryParams: {
type: Object, type: Object,
default: '', required: true
}, },
patientInfo: { patientInfo: {
type: Object, type: Object,
@@ -97,39 +97,25 @@ const throttledGetList = throttle(
watch( watch(
() => props.adviceQueryParams, () => props.adviceQueryParams,
(newValue) => { (newValue) => {
queryParams.value.searchKey = newValue.searchKey; console.log('adviceBaseList 接收到参数变化:', newValue);
// queryParams.value.adviceType = newValue.adviceType;
// 直接更新查询参数
queryParams.value.searchKey = newValue.searchKey || '';
// 处理类型筛选
if (newValue.adviceType) { if (newValue.adviceType) {
queryParams.value.adviceTypes = [newValue.adviceType].join(','); // 单个类型
queryParams.value.adviceTypes = newValue.adviceType.toString();
} else { } else {
// 全部类型
queryParams.value.adviceTypes = '1,2,3'; queryParams.value.adviceTypes = '1,2,3';
} }
throttledGetList();
},
{ deep: true }
);
console.log('发送请求参数:', queryParams.value);
getList(); getList();
function getList() { },
queryParams.value.organizationId = props.patientInfo.orgId; { deep: true, immediate: true }
getAdviceBaseInfo(queryParams.value).then((res) => { );
console.log('ssssssssss', res.data.records);
if (res.data.records.length > 0) {
adviceBaseList.value = res.data.records.filter((item) => {
if (item.adviceType == 1 || item.adviceType == 2) {
return handleQuantity(item) != 0;
} else {
return true;
}
});
total.value = res.data.total;
nextTick(() => {
currentIndex.value = 0;
adviceBaseRef.value.setCurrentRow(adviceBaseList.value[0]);
});
}
});
}
// 从priceList列表中获取价格 // 从priceList列表中获取价格
function getPriceFromInventory(row) { function getPriceFromInventory(row) {
if (row.priceList && row.priceList.length > 0) { if (row.priceList && row.priceList.length > 0) {
@@ -138,6 +124,38 @@ function getPriceFromInventory(row) {
} }
return '-'; return '-';
} }
function getList() {
queryParams.value.organizationId = props.patientInfo.orgId;
console.log('发送API请求:', queryParams.value);
getAdviceBaseInfo(queryParams.value).then((res) => {
if (res.data.records && res.data.records.length > 0) {
adviceBaseList.value = res.data.records.filter((item) => {
if (item.adviceType == 1 || item.adviceType == 2) {
return handleQuantity(item) != 0;
} else {
return true;
}
});
console.log('过滤后数据显示:', adviceBaseList.value.length, '条');
total.value = res.data.total;
nextTick(() => {
currentIndex.value = 0;
if (adviceBaseList.value.length > 0) {
adviceBaseRef.value.setCurrentRow(adviceBaseList.value[0]);
}
});
} else {
adviceBaseList.value = [];
}
}).catch(error => {
console.error('获取数据失败:', error);
adviceBaseList.value = [];
});
}
// 处理键盘事件 // 处理键盘事件
const handleKeyDown = (event) => { const handleKeyDown = (event) => {
const key = event.key; const key = event.key;

View File

@@ -561,7 +561,18 @@
(value) => { (value) => {
expandOrder = []; expandOrder = [];
prescriptionList[scope.$index].adviceName = undefined; prescriptionList[scope.$index].adviceName = undefined;
adviceQueryParams.adviceType = value;
// 直接更新查询参数
adviceQueryParams.value.adviceType = value;
adviceQueryParams.value.searchKey = '';
console.log('医嘱类型改变为:', value, '查询参数:', adviceQueryParams.value);
// 确保弹窗重新打开
nextTick(() => {
row.showPopover = true;
handleFocus(scope.row, scope.$index);
});
} }
" "
> >
@@ -751,7 +762,10 @@ const prescriptionList = ref([]);
const form = ref({ const form = ref({
prescriptionList: prescriptionList.value, prescriptionList: prescriptionList.value,
}); });
const adviceQueryParams = ref({}); const adviceQueryParams = ref({
searchKey: '',
adviceType: ''
});
const rowIndex = ref(-1); const rowIndex = ref(-1);
const groupIndex = ref(1); const groupIndex = ref(1);
const groupIndexList = ref([]); const groupIndexList = ref([]);
@@ -933,6 +947,9 @@ function handleAddPrescription() {
return; return;
} }
isAdding.value = true; isAdding.value = true;
// 重置查询参数
adviceQueryParams.value = {};
// 在数组最前方添加一行,让新增行显示在最上边 // 在数组最前方添加一行,让新增行显示在最上边
prescriptionList.value.unshift({ prescriptionList.value.unshift({
uniqueKey: nextId.value++, uniqueKey: nextId.value++,
@@ -979,10 +996,17 @@ function handleDiagnosisChange(item) {
function handleFocus(row, index) { function handleFocus(row, index) {
rowIndex.value = index; rowIndex.value = index;
row.showPopover = true; row.showPopover = true;
// 确保查询参数与当前行类型一致
adviceQueryParams.value = {
adviceType: row.adviceType || '',
searchKey: adviceQueryParams.value.searchKey || ''
};
} }
function handleBlur(row) { function handleBlur(row) {
setTimeout(() => {
row.showPopover = false; row.showPopover = false;
}, 200);
} }
function handleChange(value) { function handleChange(value) {
@@ -1108,6 +1132,7 @@ function selectAdviceBase(key, row) {
inputRefs.value['quantity']?.focus(); inputRefs.value['quantity']?.focus();
} }
}); });
} }
function getOrgList() { function getOrgList() {