diff --git a/shierfeng-fastapi-frontend/scripts/verify-business-contract.mjs b/shierfeng-fastapi-frontend/scripts/verify-business-contract.mjs index f9af49e..4ad1040 100644 --- a/shierfeng-fastapi-frontend/scripts/verify-business-contract.mjs +++ b/shierfeng-fastapi-frontend/scripts/verify-business-contract.mjs @@ -323,8 +323,10 @@ const reportPageContracts = { queryKeys: ['pageNum', 'pageSize', 'beginTime', 'endTime', 'palletCode', 'eventType'], columnKeys: [ 'occurredAt', 'eventType', 'sourceType', 'sourceId', 'palletCode', - 'beforeState', 'afterState', 'beforeWarehouseName', 'beforeSiteName', - 'beforeLineName', 'afterWarehouseName', 'afterSiteName', 'afterLineName', + 'beforeState', 'afterState', 'beforeWarehouseName', 'beforeWarehouseId', + 'beforeSiteName', 'beforeSiteId', 'beforeLineName', 'beforeLineId', + 'afterWarehouseName', 'afterWarehouseId', 'afterSiteName', 'afterSiteId', + 'afterLineName', 'afterLineId', 'beforeRemainingPackages', 'afterRemainingPackages', 'operatorName' ] } @@ -785,6 +787,19 @@ test('六个只读报表页面逐页满足 API、权限、筛选、列和异步 assert.match(source, new RegExp(`\\b${columnKey}\\b`), `${resource} 缺少核心列 ${columnKey}`) } + if (resource === 'palletTrace') { + assert.match( + source, + /formatLocation\(\s*scope\.row\.beforeWarehouseName,\s*scope\.row\.beforeWarehouseId,\s*scope\.row\.beforeSiteName,\s*scope\.row\.beforeSiteId,\s*scope\.row\.beforeLineName,\s*scope\.row\.beforeLineId\s*\)/, + 'palletTrace 变更前位置必须同时传入仓库、现场和产线的名称与 ID' + ) + assert.match( + source, + /formatLocation\(\s*scope\.row\.afterWarehouseName,\s*scope\.row\.afterWarehouseId,\s*scope\.row\.afterSiteName,\s*scope\.row\.afterSiteId,\s*scope\.row\.afterLineName,\s*scope\.row\.afterLineId\s*\)/, + 'palletTrace 变更后位置必须同时传入仓库、现场和产线的名称与 ID' + ) + } + assert.match(source, /]*v-loading="loading"[^>]*:data="reportList"/) assert.match(source, /[\s\S]*? @@ -97,8 +97,13 @@ function sourceLabel(sourceType, sourceId) { return sourceType ? `${sourceType} #${sourceId}` : '—' } -function locationLabel(warehouseName, siteName, lineName) { - return [warehouseName, siteName, lineName].filter(Boolean).join(' / ') || '—' +function formatLocation(warehouseName, warehouseId, siteName, siteId, lineName, lineId) { + const locations = [ + warehouseName || (warehouseId === undefined || warehouseId === null ? undefined : `仓库#${warehouseId}`), + siteName || (siteId === undefined || siteId === null ? undefined : `现场#${siteId}`), + lineName || (lineId === undefined || lineId === null ? undefined : `产线#${lineId}`) + ] + return locations.filter(Boolean).join(' / ') || '—' } function invalidateListRequest() {