diff --git a/klp-ui/src/views/wms/warehouse/components/WarehouseBird.vue b/klp-ui/src/views/wms/warehouse/components/WarehouseBird.vue
index 7542b94b..250688bd 100644
--- a/klp-ui/src/views/wms/warehouse/components/WarehouseBird.vue
+++ b/klp-ui/src/views/wms/warehouse/components/WarehouseBird.vue
@@ -11,14 +11,36 @@
总列数:
{{ statistics.columnCount }}
-
- 各列库位分布:
-
-
- 第{{ column }}列:{{ count }}个
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -52,9 +74,9 @@
该分类下暂无库位数据
初始化库位
-
+
@@ -92,8 +114,12 @@ export default {
statistics: {
total: 0,
columnCount: 0,
- columnDetail: {}
+ columnDetail: {},
+ // 占用情况
+ // 每一列每一层的总数和已占用数量
+ layerDetail: {}
},
+ tableData: []
};
},
watch: {
@@ -110,6 +136,30 @@ export default {
this.$emit('split-warehouse', warehouse);
},
+ // 1. 转换layerDetail为表格所需的数组格式
+ formatTableData() {
+ const layerDetail = this.statistics.layerDetail;
+ this.tableData = Object.keys(layerDetail).map(column => {
+ const layer1 = layerDetail[column].layer1;
+ const layer2 = layerDetail[column].layer2;
+ return {
+ column: column, // 列号
+ // 第一层数据
+ layer1_total: layer1.total,
+ layer1_occupied: layer1.occupied,
+ layer1_free: layer1.free,
+ // 第二层数据
+ layer2_total: layer2.total,
+ layer2_occupied: layer2.occupied,
+ layer2_free: layer2.free,
+ // 该列总计
+ column_total: layer1.total + layer2.total,
+ column_occupied: layer1.occupied + layer2.occupied,
+ column_free: layer1.free + layer2.free
+ };
+ });
+ },
+
handleMergeWarehouse(warehouse) {
this.$emit('merge-warehouse', warehouse);
},
@@ -179,15 +229,14 @@ export default {
};
},
- /**
- * 重构:按列构建库位数据结构,每列分为两层数组
- */
buildWarehouseBox(list) {
const columnMap = {}; // 按列分组的核心对象
const statistics = {
total: list.length,
columnCount: 0,
columnDetail: {},
+ // 占用情况:每一列每一层的总数、已占用、未占用数量
+ layerDetail: {}
};
// 1. 按列分组,每列内部分为layer1和layer2两个数组
@@ -239,12 +288,42 @@ export default {
// 3. 更新统计信息(适配分列逻辑)
statistics.columnCount = Object.keys(columnMap).length;
Object.keys(columnMap).forEach((column) => {
- statistics.columnDetail[column] = columnMap[column].total;
+ const columnData = columnMap[column];
+ // 列维度总数量
+ statistics.columnDetail[column] = columnData.total;
+
+ // ========== 新增:layerDetail 层级统计逻辑 ==========
+ // 初始化当前列的层级统计结构
+ statistics.layerDetail[column] = {
+ layer1: {
+ total: 0, // 该层总库位数
+ occupied: 0, // 已占用(isEnabled=0)
+ free: 0 // 未占用(isEnabled=1)
+ },
+ layer2: {
+ total: 0,
+ occupied: 0,
+ free: 0
+ }
+ };
+
+ // 统计第一层
+ const layer1Data = columnData.layer1;
+ statistics.layerDetail[column].layer1.total = layer1Data.length;
+ statistics.layerDetail[column].layer1.occupied = layer1Data.filter(item => item.isEnabled === 0).length;
+ statistics.layerDetail[column].layer1.free = layer1Data.filter(item => item.isEnabled === 1).length;
+
+ // 统计第二层
+ const layer2Data = columnData.layer2;
+ statistics.layerDetail[column].layer2.total = layer2Data.length;
+ statistics.layerDetail[column].layer2.occupied = layer2Data.filter(item => item.isEnabled === 0).length;
+ statistics.layerDetail[column].layer2.free = layer2Data.filter(item => item.isEnabled === 1).length;
});
// 4. 赋值到响应式数据
this.columns = columnMap;
this.statistics = statistics;
+ this.formatTableData();
},
/**