Fix Bug #408: 门诊医生站检查明细标签页显示暂无数据 - 修复handleRowClick中resp.items被d.data覆盖后丢失的问题
根因:后端 getInfo 返回 { data: ExamApply, items: ExamApplyItem[] },
前端先将 resp 赋值给 d,随后又执行 d = resp.data,导致 d 变成 ExamApply 对象,
后续 d.items 永远为 undefined,明细列表无法加载。
修复:提前保存 resp.items 到 rawItems 变量,后续使用 rawItems 而非 d.items。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1008,12 +1008,15 @@ function handleRowClick(row) {
|
||||
selectedItems.value = [];
|
||||
activeDetailTab.value = 'applyForm';
|
||||
request({ url: `/exam/apply/${row.applyNo}`, method: 'get' }).then(async res => {
|
||||
const d = res.data || res;
|
||||
if (d.data) Object.assign(form, d.data);
|
||||
if (d.items && Array.isArray(d.items)) {
|
||||
const resp = res.data || res;
|
||||
// 保存 items 在顶层响应中,避免后面 d.data 赋值后丢失
|
||||
const rawItems = resp.items;
|
||||
const d = resp.data || resp;
|
||||
if (d) Object.assign(form, d);
|
||||
if (rawItems && Array.isArray(rawItems)) {
|
||||
try {
|
||||
// 为每个项目加载检查方法
|
||||
const itemsWithMethods = await Promise.all(d.items.map(async m => {
|
||||
const itemsWithMethods = await Promise.all(rawItems.map(async m => {
|
||||
const item = {
|
||||
id: m.itemCode, name: m.itemName,
|
||||
price: m.itemFee || 0, quantity: 1,
|
||||
|
||||
Reference in New Issue
Block a user