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,23 +144,40 @@ const applicationListAll = ref();
|
|||||||
const applicationList = ref();
|
const applicationList = ref();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const orgOptions = ref([]); // 科室选项
|
const orgOptions = ref([]); // 科室选项
|
||||||
const getList = () => {
|
const getList = async () => {
|
||||||
if (!patientInfo.value?.inHospitalOrgId) {
|
if (!patientInfo.value?.inHospitalOrgId) {
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
getApplicationList({
|
try {
|
||||||
pageSize: 9999,
|
const allRecords = [];
|
||||||
pageNum: 1,
|
let currentPage = 1;
|
||||||
|
const pageSize = 500;
|
||||||
|
|
||||||
|
// 分页拉取全部数据(后端单页最多500条)
|
||||||
|
while (true) {
|
||||||
|
const res = await getApplicationList({
|
||||||
|
pageSize,
|
||||||
|
pageNo: currentPage,
|
||||||
categoryCode: '22',
|
categoryCode: '22',
|
||||||
organizationId: patientInfo.value.inHospitalOrgId,
|
organizationId: patientInfo.value.inHospitalOrgId,
|
||||||
adviceTypes: [3], // 1 药品 2 耗材 3 诊疗
|
adviceTypes: [3], // 1 药品 2 耗材 3 诊疗
|
||||||
})
|
});
|
||||||
.then((res) => {
|
if (res.code !== 200) {
|
||||||
if (res.code === 200) {
|
proxy.$message.error(res.message);
|
||||||
applicationListAll.value = res.data.records;
|
applicationList.value = [];
|
||||||
applicationList.value = res.data.records.map((item) => {
|
return;
|
||||||
|
}
|
||||||
|
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 priceInfo = item.priceList?.[0] || {};
|
||||||
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||||
const unit = item.unitCode_dictText || item.unitCode || '';
|
const unit = item.unitCode_dictText || item.unitCode || '';
|
||||||
@@ -171,15 +188,12 @@ const getList = () => {
|
|||||||
key: item.adviceDefinitionId,
|
key: item.adviceDefinitionId,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
console.log('applicationList========>', JSON.stringify(res.data.records));
|
} catch (e) {
|
||||||
} else {
|
proxy.$message.error('获取检验项目列表失败');
|
||||||
proxy.$message.error(res.message);
|
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
}
|
} finally {
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
const transferValue = ref([]);
|
const transferValue = ref([]);
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
|
|||||||
Reference in New Issue
Block a user