修复:补全托盘追溯位置回退

This commit is contained in:
焦龙言
2026-07-27 11:50:37 +08:00
parent 8361c11c4c
commit 2ab075f095
2 changed files with 26 additions and 6 deletions
@@ -323,8 +323,10 @@ const reportPageContracts = {
queryKeys: ['pageNum', 'pageSize', 'beginTime', 'endTime', 'palletCode', 'eventType'], queryKeys: ['pageNum', 'pageSize', 'beginTime', 'endTime', 'palletCode', 'eventType'],
columnKeys: [ columnKeys: [
'occurredAt', 'eventType', 'sourceType', 'sourceId', 'palletCode', 'occurredAt', 'eventType', 'sourceType', 'sourceId', 'palletCode',
'beforeState', 'afterState', 'beforeWarehouseName', 'beforeSiteName', 'beforeState', 'afterState', 'beforeWarehouseName', 'beforeWarehouseId',
'beforeLineName', 'afterWarehouseName', 'afterSiteName', 'afterLineName', 'beforeSiteName', 'beforeSiteId', 'beforeLineName', 'beforeLineId',
'afterWarehouseName', 'afterWarehouseId', 'afterSiteName', 'afterSiteId',
'afterLineName', 'afterLineId',
'beforeRemainingPackages', 'afterRemainingPackages', 'operatorName' 'beforeRemainingPackages', 'afterRemainingPackages', 'operatorName'
] ]
} }
@@ -785,6 +787,19 @@ test('六个只读报表页面逐页满足 API、权限、筛选、列和异步
assert.match(source, new RegExp(`\\b${columnKey}\\b`), `${resource} 缺少核心列 ${columnKey}`) 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, /<el-date-picker\b[\s\S]*?type="daterange"[\s\S]*?value-format="YYYY-MM-DD"/) assert.match(source, /<el-date-picker\b[\s\S]*?type="daterange"[\s\S]*?value-format="YYYY-MM-DD"/)
assert.match(source, /<el-table\b[^>]*v-loading="loading"[^>]*:data="reportList"/) assert.match(source, /<el-table\b[^>]*v-loading="loading"[^>]*:data="reportList"/)
assert.match(source, /<template\s+#empty>[\s\S]*?<el-empty\b/) assert.match(source, /<template\s+#empty>[\s\S]*?<el-empty\b/)
@@ -35,12 +35,12 @@
<el-table-column label="变更后状态" prop="afterState" min-width="140" /> <el-table-column label="变更后状态" prop="afterState" min-width="140" />
<el-table-column label="变更前位置" min-width="180" :show-overflow-tooltip="true"> <el-table-column label="变更前位置" min-width="180" :show-overflow-tooltip="true">
<template #default="scope"> <template #default="scope">
{{ locationLabel(scope.row.beforeWarehouseName, scope.row.beforeSiteName, scope.row.beforeLineName) }} {{ formatLocation(scope.row.beforeWarehouseName, scope.row.beforeWarehouseId, scope.row.beforeSiteName, scope.row.beforeSiteId, scope.row.beforeLineName, scope.row.beforeLineId) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="变更后位置" min-width="180" :show-overflow-tooltip="true"> <el-table-column label="变更后位置" min-width="180" :show-overflow-tooltip="true">
<template #default="scope"> <template #default="scope">
{{ locationLabel(scope.row.afterWarehouseName, scope.row.afterSiteName, scope.row.afterLineName) }} {{ formatLocation(scope.row.afterWarehouseName, scope.row.afterWarehouseId, scope.row.afterSiteName, scope.row.afterSiteId, scope.row.afterLineName, scope.row.afterLineId) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="变更前数量" prop="beforeRemainingPackages" width="110" align="right" /> <el-table-column label="变更前数量" prop="beforeRemainingPackages" width="110" align="right" />
@@ -97,8 +97,13 @@ function sourceLabel(sourceType, sourceId) {
return sourceType ? `${sourceType} #${sourceId}` : '—' return sourceType ? `${sourceType} #${sourceId}` : '—'
} }
function locationLabel(warehouseName, siteName, lineName) { function formatLocation(warehouseName, warehouseId, siteName, siteId, lineName, lineId) {
return [warehouseName, siteName, lineName].filter(Boolean).join(' / ') || '—' 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() { function invalidateListRequest() {