diff --git a/src/pages/warehouse/inventoryCount-comps/countModel.js b/src/pages/warehouse/inventoryCount-comps/countModel.js index 78fe026..1b021cf 100644 --- a/src/pages/warehouse/inventoryCount-comps/countModel.js +++ b/src/pages/warehouse/inventoryCount-comps/countModel.js @@ -971,26 +971,29 @@ export function normalizeGoodsDetailInfo(row, mode) { const checkers = Array.isArray(checkersRaw) ? checkersRaw.filter(Boolean).join('、') : String(checkersRaw || ''); // 库位明细(每库位一行:账面 / 实盘 / 盈亏),顺便汇总记录条数与最近上报时间 - // 未盘点库位只是任务范围占位(record_ids 空且无盘点人/上报时间),不作为「盘点记录」展示 + // 未盘点库位是任务范围占位:保留展示以便看到待盘库位,但实盘按 -- 处理、不参与盈亏、不计入记录条数 const rawLocations = Array.isArray(source.locations) ? source.locations : []; - const checkedLocations = rawLocations.filter(isCheckedLocation); let recordCount = 0; let lastCheckedAt = ''; - const locations = checkedLocations.map((item, index) => { + const locations = rawLocations.map((item, index) => { const loc = item && typeof item === 'object' ? item : {}; + const checked = isCheckedLocation(loc); const locationCode = firstValue(loc, ['location_code', 'locationCode']) || ''; const locationName = firstValue(loc, ['location_name', 'locationName']) || ''; const spaceId = firstValue(loc, ['space_id', 'location_id', 'locationId', 'spaceId']); const recordIds = Array.isArray(loc.record_ids) ? loc.record_ids.filter(id => id !== null && id !== undefined && id !== '') : []; const systemQuantity = toNumberOrNull(loc.system_quantity !== undefined ? loc.system_quantity : loc.systemQuantity); - const quantity = toNumberOrNull(loc.quantity); + // 未盘库位的 quantity 后端会回 0,直接展示会算出「账实相符」,因此按未盘置空 + const quantity = checked ? toNumberOrNull(loc.quantity) : null; const checkedAt = firstValue(loc, ['checked_at', 'checkedAt']); const checkerName = firstValue(loc, ['checker_name', 'checkerName']); recordCount += recordIds.length; if (checkedAt && checkedAt > lastCheckedAt) lastCheckedAt = checkedAt; - const diff = systemQuantity === null || quantity === null ? null : quantity - systemQuantity; + const diff = checked && systemQuantity !== null && quantity !== null ? quantity - systemQuantity : null; return { key: `loc-${locationCode || index + 1}`, + // 该库位是否已盘(占位行 checked=false:实盘 --、不可删除) + checked, // 左滑删除用:整库位的记录 ID 列表(recordDelete 支持数组) recordIds, recordId: recordIds.length === 1 ? recordIds[0] : '', diff --git a/src/pages/warehouse/inventoryCountGoods.vue b/src/pages/warehouse/inventoryCountGoods.vue index 97527d1..8c056a5 100644 --- a/src/pages/warehouse/inventoryCountGoods.vue +++ b/src/pages/warehouse/inventoryCountGoods.vue @@ -155,11 +155,12 @@ function resolveSystemQuantity(goodsInfo) { return sys === null || sys === undefined ? null : Number(sys); } -/** 是否已盘(有库位明细/作业记录) */ +/** 是否已盘(有已盘库位明细/作业记录;未盘占位行不算) */ function resolveHasChecked(goodsInfo) { const info = goodsInfo || {}; - if (Array.isArray(info.locations) && info.locations.length) return true; - return Number(info.recordCount) > 0; + if (Number(info.recordCount) > 0) return true; + const locations = Array.isArray(info.locations) ? info.locations : []; + return locations.some(item => item && item.checked); } /** 已盘合计:优先接口 checked_quantity,缺失时用库位明细合计 */ @@ -278,7 +279,8 @@ export default { statusText: '', statusClass: '', meta, - goodsCount: locations.length, + // 「共 N 条」按实际已盘库位数统计(未盘占位行不计入) + goodsCount: locations.filter(item => item && item.checked).length, unknownCount: 0, children: locations };