Fix Bug #465: [住院医生工作站-检验申请] 检验项目选择列表被限制为500项,导致医生无法检索并开立其余800多项
根因分析: 1. 前端参数名错误:getList 发送 pageNum 但后端期望 pageNo,导致分页参数被忽略 2. 后端 MyBatis Plus 分页拦截器单页最多返回500条,前端用 pageSize:9999 无效 3. 总共有1300+条检验项目,但只返回了前500条 修复方案: - 修正参数名为 pageNo 匹配后端接口 - 使用分页循环拉取全部数据(每页500条,循环直到数据全部拉取) - 添加 try/catch 错误处理 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -144,42 +144,56 @@ const applicationListAll = ref();
|
||||
const applicationList = ref();
|
||||
const loading = ref(false);
|
||||
const orgOptions = ref([]); // 科室选项
|
||||
const getList = () => {
|
||||
const getList = async () => {
|
||||
if (!patientInfo.value?.inHospitalOrgId) {
|
||||
applicationList.value = [];
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
getApplicationList({
|
||||
pageSize: 9999,
|
||||
pageNum: 1,
|
||||
categoryCode: '22',
|
||||
organizationId: patientInfo.value.inHospitalOrgId,
|
||||
adviceTypes: [3], //1 药品 2耗材 3诊疗
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
applicationListAll.value = res.data.records;
|
||||
applicationList.value = res.data.records.map((item) => {
|
||||
const priceInfo = item.priceList?.[0] || {};
|
||||
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||
const unit = item.unitCode_dictText || item.unitCode || '';
|
||||
return {
|
||||
adviceDefinitionId: item.adviceDefinitionId,
|
||||
orgId: item.orgId,
|
||||
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
|
||||
key: item.adviceDefinitionId,
|
||||
};
|
||||
});
|
||||
console.log('applicationList========>', JSON.stringify(res.data.records));
|
||||
} else {
|
||||
try {
|
||||
const allRecords = [];
|
||||
let currentPage = 1;
|
||||
const pageSize = 500;
|
||||
|
||||
// 分页拉取全部数据(后端单页最多500条)
|
||||
while (true) {
|
||||
const res = await getApplicationList({
|
||||
pageSize,
|
||||
pageNo: currentPage,
|
||||
categoryCode: '22',
|
||||
organizationId: patientInfo.value.inHospitalOrgId,
|
||||
adviceTypes: [3], // 1 药品 2 耗材 3 诊疗
|
||||
});
|
||||
if (res.code !== 200) {
|
||||
proxy.$message.error(res.message);
|
||||
applicationList.value = [];
|
||||
return;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
const records = res.data?.records || [];
|
||||
allRecords.push(...records);
|
||||
// 当前页不足 pageSize 或已无数据,说明已全部拉取
|
||||
if (records.length < pageSize) break;
|
||||
currentPage++;
|
||||
}
|
||||
|
||||
applicationListAll.value = allRecords;
|
||||
applicationList.value = allRecords.map((item) => {
|
||||
const priceInfo = item.priceList?.[0] || {};
|
||||
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||
const unit = item.unitCode_dictText || item.unitCode || '';
|
||||
return {
|
||||
adviceDefinitionId: item.adviceDefinitionId,
|
||||
orgId: item.orgId,
|
||||
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
|
||||
key: item.adviceDefinitionId,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
proxy.$message.error('获取检验项目列表失败');
|
||||
applicationList.value = [];
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const transferValue = ref([]);
|
||||
const form = reactive({
|
||||
|
||||
Reference in New Issue
Block a user