修复收费工作站-门诊挂号:挂号类型字段内容重复显示
This commit is contained in:
@@ -1155,7 +1155,10 @@ function getHealthcare(data) {
|
||||
form.value.organizationId = data.organizationId;
|
||||
|
||||
getHealthcareMetadata(param).then((response) => {
|
||||
healthcareList.value = response.data.records;
|
||||
// 对数据进行去重处理,name去重
|
||||
const uniqueRecords = removeDuplicateHealthcareItems(response.data.records);
|
||||
healthcareList.value = uniqueRecords;
|
||||
console.log('去重后的数据列表,healthcareList', healthcareList.value)
|
||||
console.log('getHealthcareMetadata', 'response', response.data);
|
||||
// 使用 nextTick 确保数据更新后再过滤
|
||||
nextTick(() => {
|
||||
@@ -1167,6 +1170,21 @@ function getHealthcare(data) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据name对挂号类型数据进行去重 */
|
||||
function removeDuplicateHealthcareItems(records) {
|
||||
const seenNames = new Set();
|
||||
const uniqueRecords = [];
|
||||
|
||||
for (const item of records) {
|
||||
if (item.name && !seenNames.has(item.name)) {
|
||||
seenNames.add(item.name);
|
||||
uniqueRecords.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueRecords;
|
||||
}
|
||||
|
||||
/** 根据就诊科室和挂号类型过滤医生列表 */
|
||||
function filterDoctorsByHealthcare() {
|
||||
// 如果没有医生列表,直接返回
|
||||
|
||||
Reference in New Issue
Block a user