2025-12-08 11:48:20 +08:00
|
|
|
|
<template>
|
2025-12-20 15:12:07 +08:00
|
|
|
|
<div class="multi-layer-grid" ref="gridContainer">
|
|
|
|
|
|
<!-- 列标尺区域 - 添加切换按钮 -->
|
2025-12-08 11:48:20 +08:00
|
|
|
|
<div class="col-ruler" :style="{ '--cell-width': `${cellWidth}px` }">
|
|
|
|
|
|
<div class="ruler-empty"></div>
|
2025-12-19 18:06:55 +08:00
|
|
|
|
<div v-for="col in sortedColumnKeys" :key="`col-${col}`" class="ruler-item">
|
2025-12-20 15:12:07 +08:00
|
|
|
|
<!-- 列标尺文本 -->
|
|
|
|
|
|
<span class="column-number">{{ col }}</span>
|
|
|
|
|
|
<!-- 拆分/合并切换按钮 -->
|
|
|
|
|
|
<button class="split-merge-toggle"
|
|
|
|
|
|
:class="{ 'is-split': getColumnLevel(col) === 4, 'is-merge': getColumnLevel(col) === 3 }"
|
|
|
|
|
|
@click.stop="handleColumnToggle(col)" :title="getColumnLevel(col) === 3 ? '点击切换为小卷状态' : '点击切换为大卷状态'">
|
|
|
|
|
|
<i class="el-icon-s-tools"></i>
|
|
|
|
|
|
<span class="toggle-text">{{ getColumnLevel(col) === 3 ? '大卷状态' : '小卷状态' }}</span>
|
|
|
|
|
|
</button>
|
2025-12-08 11:48:20 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row-grid-wrapper">
|
2025-12-19 18:06:55 +08:00
|
|
|
|
<div class="row-ruler" :style="{ '--total-height': `${rulerTotalHeight}px` }">
|
|
|
|
|
|
<div v-for="row in rulerMaxRow" :key="`row-${row}`" class="ruler-item">
|
2025-12-08 11:48:20 +08:00
|
|
|
|
{{ row }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-12-19 18:06:55 +08:00
|
|
|
|
<div class="grid-container" :style="{
|
|
|
|
|
|
'--half-cell-width': `${halfCellWidth}px`,
|
|
|
|
|
|
'--cell-width': `${cellWidth}px`,
|
|
|
|
|
|
'--column-count': sortedColumnKeys.length * 2,
|
|
|
|
|
|
'--total-height': `${rulerTotalHeight}px`
|
|
|
|
|
|
}">
|
|
|
|
|
|
<template v-for="column in sortedColumnKeys">
|
2025-12-20 15:12:07 +08:00
|
|
|
|
<div class="column-container layer-1-container" v-if="columnWarehouseData[column]" :style="{
|
|
|
|
|
|
gridRow: '1 / -1',
|
|
|
|
|
|
gridColumn: `${(column - 1) * 2 + 1} / ${(column - 1) * 2 + 2}`,
|
|
|
|
|
|
'--item-height': `${columnWarehouseData[column].cellHeight}px`
|
|
|
|
|
|
}">
|
|
|
|
|
|
<div v-for="warehouse in columnWarehouseData[column].layer1"
|
|
|
|
|
|
:key="`warehouse-1-${warehouse.actualWarehouseId}`" class="warehouse-cell layer-1"
|
|
|
|
|
|
:class="{ disabled: warehouse.isEnabled === 0 }" @click.stop="handleCellClick(warehouse)">
|
2025-12-19 18:06:55 +08:00
|
|
|
|
<div class="cell-name">
|
|
|
|
|
|
<div class="cell-line1">{{ warehouse.actualWarehouseName || '-' }}</div>
|
|
|
|
|
|
<div class="cell-line2">{{ warehouse.currentCoilNo || '-' }}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-12-08 11:48:20 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-12-20 15:12:07 +08:00
|
|
|
|
<div class="column-container layer-2-container" v-if="columnWarehouseData[column]" :style="{
|
|
|
|
|
|
gridRow: '1 / -1',
|
|
|
|
|
|
gridColumn: `${(column - 1) * 2 + 2} / ${(column - 1) * 2 + 3}`,
|
|
|
|
|
|
'--item-height': `${columnWarehouseData[column].cellHeight}px`,
|
|
|
|
|
|
'--offset-value': `${columnWarehouseData[column].cellHeight * 0.5}px`,
|
|
|
|
|
|
height: `${(columnWarehouseData[column].layer2.length * columnWarehouseData[column].cellHeight)}px`
|
|
|
|
|
|
}">
|
|
|
|
|
|
<div v-for="warehouse in columnWarehouseData[column].layer2"
|
|
|
|
|
|
:key="`warehouse-2-${warehouse.actualWarehouseId}`" class="warehouse-cell layer-2"
|
|
|
|
|
|
:class="{ disabled: warehouse.isEnabled === 0 }" :style="{
|
|
|
|
|
|
transform: `translateY(var(--offset-value))`,
|
|
|
|
|
|
position: 'relative'
|
|
|
|
|
|
}" @click.stop="handleCellClick(warehouse)">
|
2025-12-19 18:06:55 +08:00
|
|
|
|
<div class="cell-name">
|
|
|
|
|
|
<div class="cell-line1">{{ warehouse.actualWarehouseName || '-' }}</div>
|
|
|
|
|
|
<div class="cell-line2">{{ warehouse.currentCoilNo || '-' }}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-12-08 11:48:20 +08:00
|
|
|
|
</div>
|
2025-12-19 18:06:55 +08:00
|
|
|
|
</template>
|
2025-12-08 11:48:20 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-12-20 15:12:07 +08:00
|
|
|
|
<el-dialog title="钢卷库位详情" :visible.sync="dialogOpen" width="600px" append-to-body>
|
2025-12-08 11:48:20 +08:00
|
|
|
|
<el-descriptions :column="2" border size="small" v-if="currentWarehouse">
|
|
|
|
|
|
<el-descriptions-item label="库位编码">{{ currentWarehouse.actualWarehouseCode }}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="库位名称">{{ currentWarehouse.actualWarehouseName || '无' }}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="钢卷编号">{{ currentWarehouse.currentCoilNo || '无' }}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="所属层级">{{ currentWarehouse.parsedInfo.layer || '未知' }}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="行号">{{ currentWarehouse.parsedInfo.row || '未知' }}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="列号">{{ currentWarehouse.parsedInfo.column || '未知' }}</el-descriptions-item>
|
2025-12-20 15:12:07 +08:00
|
|
|
|
<el-descriptions-item label="一级编码">{{ currentWarehouse.parsedInfo.warehouseFirst || '未知'
|
|
|
|
|
|
}}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="二级编码">{{ currentWarehouse.parsedInfo.warehouseSecond || '未知'
|
|
|
|
|
|
}}</el-descriptions-item>
|
2025-12-08 11:48:20 +08:00
|
|
|
|
<el-descriptions-item label="启用状态">
|
|
|
|
|
|
<el-tag :type="currentWarehouse.isEnabled === 1 ? 'success' : 'danger'">
|
2025-12-19 18:06:55 +08:00
|
|
|
|
{{ currentWarehouse.isEnabled === 1 ? '未占用' : currentWarehouse.currentCoilNo }}
|
2025-12-08 11:48:20 +08:00
|
|
|
|
</el-tag>
|
|
|
|
|
|
</el-descriptions-item>
|
2025-12-19 18:06:55 +08:00
|
|
|
|
<el-descriptions-item label="库位码">
|
|
|
|
|
|
<QRCode :content="currentWarehouse.actualWarehouseId" :size="60" />
|
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="备注信息" span="2">{{ currentWarehouse.remark || '无' }}</el-descriptions-item>
|
2025-12-08 11:48:20 +08:00
|
|
|
|
</el-descriptions>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-12-19 18:06:55 +08:00
|
|
|
|
import QRCode from '@/components/QRCode/index.vue';
|
|
|
|
|
|
|
2025-12-08 11:48:20 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: "SteelCoilWarehouse",
|
2025-12-19 18:06:55 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
QRCode
|
|
|
|
|
|
},
|
2025-12-08 11:48:20 +08:00
|
|
|
|
props: {
|
2025-12-19 18:06:55 +08:00
|
|
|
|
columns: {
|
2025-12-08 11:48:20 +08:00
|
|
|
|
type: Object,
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
default: () => ({})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
dialogOpen: false,
|
2025-12-08 11:48:20 +08:00
|
|
|
|
currentWarehouse: null,
|
|
|
|
|
|
containerWidth: 0,
|
2025-12-19 18:06:55 +08:00
|
|
|
|
resizeTimer: null,
|
|
|
|
|
|
currentContextWarehouse: null,
|
|
|
|
|
|
rulerRowHeight: 80,
|
2025-12-20 15:12:07 +08:00
|
|
|
|
// rulerMaxRow: 0,
|
|
|
|
|
|
isMounted: false
|
2025-12-08 11:48:20 +08:00
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
2025-12-19 18:06:55 +08:00
|
|
|
|
sortedColumnKeys() {
|
|
|
|
|
|
return Object.keys(this.columns)
|
|
|
|
|
|
.map(key => Number(key))
|
|
|
|
|
|
.sort((a, b) => a - b);
|
2025-12-08 11:48:20 +08:00
|
|
|
|
},
|
2025-12-19 18:06:55 +08:00
|
|
|
|
rulerTotalHeight() {
|
|
|
|
|
|
return this.rulerMaxRow * this.rulerRowHeight;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
cellWidth() {
|
2025-12-19 18:06:55 +08:00
|
|
|
|
if (!this.containerWidth || this.sortedColumnKeys.length === 0) return 60;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
const availableWidth = Math.max(0, this.containerWidth - 30);
|
2025-12-19 18:06:55 +08:00
|
|
|
|
return availableWidth / this.sortedColumnKeys.length;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
halfCellWidth() {
|
|
|
|
|
|
return this.cellWidth / 2;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
},
|
|
|
|
|
|
columnWarehouseData() {
|
|
|
|
|
|
const result = {};
|
|
|
|
|
|
this.sortedColumnKeys.forEach(column => {
|
|
|
|
|
|
const columnData = this.columns[column] || {};
|
|
|
|
|
|
const layer1 = (columnData.layer1 || []).sort((a, b) => a.parsedInfo.row - b.parsedInfo.row);
|
|
|
|
|
|
const layer2 = (columnData.layer2 || []).sort((a, b) => a.parsedInfo.row - b.parsedInfo.row);
|
|
|
|
|
|
const totalRows = layer1.length;
|
|
|
|
|
|
const cellHeight = totalRows === 0
|
|
|
|
|
|
? this.rulerRowHeight
|
|
|
|
|
|
: (totalRows > this.rulerMaxRow
|
|
|
|
|
|
? this.rulerTotalHeight / totalRows
|
|
|
|
|
|
: this.rulerRowHeight);
|
|
|
|
|
|
|
|
|
|
|
|
result[column] = {
|
|
|
|
|
|
layer1,
|
|
|
|
|
|
layer2,
|
|
|
|
|
|
cellHeight,
|
|
|
|
|
|
totalRows
|
|
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
return result;
|
|
|
|
|
|
},
|
|
|
|
|
|
rulerMaxRow() {
|
|
|
|
|
|
// 取所有列中level为3的第一层的最大行数
|
2025-12-22 10:18:58 +08:00
|
|
|
|
// 如果不存在level为3的列,则不执行filter操作,直接去最大值
|
|
|
|
|
|
// 如果存在level为3的列,则取layer1且level为3的最大行数
|
|
|
|
|
|
const columns = Object.values(this.columns)
|
|
|
|
|
|
const columnsOnlyLevel3 = columns.filter(col => col.layer1?.[0]?.parsedInfo?.level === 3);
|
|
|
|
|
|
let maxRows = []
|
|
|
|
|
|
if (columnsOnlyLevel3.length > 0) {
|
|
|
|
|
|
maxRows = columnsOnlyLevel3
|
2025-12-20 15:12:07 +08:00
|
|
|
|
.map(col => col.layer1?.length || 0);
|
2025-12-22 10:18:58 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
maxRows = columns
|
|
|
|
|
|
.map(col => col.layer1?.length || 0);
|
|
|
|
|
|
}
|
2025-12-20 15:12:07 +08:00
|
|
|
|
return maxRows.length > 0 ? Math.max(...maxRows) : 0;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-12-19 18:06:55 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
columns: {
|
|
|
|
|
|
immediate: true,
|
2025-12-20 15:12:07 +08:00
|
|
|
|
deep: true,
|
2025-12-19 18:06:55 +08:00
|
|
|
|
handler(newVal) {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
if (this.isMounted) {
|
|
|
|
|
|
clearTimeout(this.resizeTimer);
|
|
|
|
|
|
this.resizeTimer = setTimeout(() => {
|
|
|
|
|
|
this.calcContainerWidth();
|
|
|
|
|
|
}, 50);
|
2025-12-19 18:06:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-12-08 11:48:20 +08:00
|
|
|
|
mounted() {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
this.isMounted = true;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
this.calcContainerWidth();
|
|
|
|
|
|
window.addEventListener('resize', this.handleResize);
|
|
|
|
|
|
},
|
|
|
|
|
|
beforeUnmount() {
|
|
|
|
|
|
window.removeEventListener('resize', this.handleResize);
|
|
|
|
|
|
clearTimeout(this.resizeTimer);
|
2025-12-20 15:12:07 +08:00
|
|
|
|
this.isMounted = false;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
// 获取指定列的level值(3=合并,4=拆分)
|
|
|
|
|
|
getColumnLevel(column) {
|
|
|
|
|
|
const columnData = this.columns[column] || {};
|
|
|
|
|
|
// 优先取列级别的level,若无则取第一个库位的level
|
|
|
|
|
|
if (columnData.level) return columnData.level;
|
|
|
|
|
|
const firstWarehouse = columnData.layer1?.[0] || columnData.layer2?.[0];
|
|
|
|
|
|
return firstWarehouse?.parsedInfo?.level || 3; // 默认合并状态
|
2025-12-19 18:06:55 +08:00
|
|
|
|
},
|
2025-12-20 15:12:07 +08:00
|
|
|
|
// 处理列拆分/合并状态切换
|
|
|
|
|
|
handleColumnToggle(column) {
|
|
|
|
|
|
const currentLevel = this.getColumnLevel(column);
|
|
|
|
|
|
// 切换level:3↔4
|
|
|
|
|
|
const newLevel = currentLevel === 3 ? 4 : 3;
|
|
|
|
|
|
// 向父组件发送切换事件,由父组件更新columns数据
|
|
|
|
|
|
// 如果切换为合并状态,调用handleMergeWarehouse方法
|
|
|
|
|
|
// 需要二次确认
|
|
|
|
|
|
console.log(this.columns[column])
|
|
|
|
|
|
const columnData = this.columns[column] || {};
|
|
|
|
|
|
const columnFlag = columnData.layer1?.[0]?.actualWarehouseCode?.substring(0, 4) || ''; // 取前四位
|
|
|
|
|
|
|
|
|
|
|
|
this.$confirm(`确认将列 ${column} 切换为${newLevel === 3 ? '大卷' : '小卷'}状态吗?`, '提示', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
// 构造出请求数据
|
|
|
|
|
|
|
|
|
|
|
|
const payload = {
|
|
|
|
|
|
// 列的前四位,例如:F2A1
|
|
|
|
|
|
columnFlag,
|
|
|
|
|
|
}
|
|
|
|
|
|
console.log(payload, newLevel)
|
|
|
|
|
|
if (newLevel === 3) {
|
|
|
|
|
|
// 获取待分割的ID, 对应列第一层的前五个和第二层的前五个
|
|
|
|
|
|
const splitIds = [];
|
|
|
|
|
|
const layer1Warehouses = columnData.layer1 || [];
|
|
|
|
|
|
const layer2Warehouses = columnData.layer2 || [];
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < layer1Warehouses.length; i++) {
|
|
|
|
|
|
if (layer1Warehouses[i]) splitIds.push(layer1Warehouses[i].parentId);
|
|
|
|
|
|
}
|
|
|
|
|
|
for (let i = 0; i < layer2Warehouses.length; i++) {
|
|
|
|
|
|
if (layer2Warehouses[i]) splitIds.push(layer2Warehouses[i].parentId);
|
|
|
|
|
|
}
|
|
|
|
|
|
// 1. 先统计每个 parentId 出现的次数
|
2025-12-20 15:58:14 +08:00
|
|
|
|
// const countMap = splitIds.reduce((map, id) => {
|
|
|
|
|
|
// map.set(id, (map.get(id) || 0) + 1);
|
|
|
|
|
|
// return map;
|
|
|
|
|
|
// }, new Map());
|
2025-12-20 15:12:07 +08:00
|
|
|
|
|
|
|
|
|
|
// 2. 过滤出至少出现两次的 parentId,再去重(map的key本身唯一,去重可省略但保留更严谨)
|
2025-12-20 15:58:14 +08:00
|
|
|
|
// payload.locationIds = [...new Set(
|
|
|
|
|
|
// splitIds.filter(id => countMap.get(id) >= 2)
|
|
|
|
|
|
// )];
|
|
|
|
|
|
payload.locationIds = [...new Set(splitIds)]
|
2025-12-20 15:12:07 +08:00
|
|
|
|
console.log(payload)
|
|
|
|
|
|
this.handleMergeWarehouse(payload);
|
|
|
|
|
|
} else if (newLevel === 4) {
|
|
|
|
|
|
// 获取待分割的ID, 对应列第一层的前五个和第二层的前五个
|
|
|
|
|
|
const splitIds = [];
|
|
|
|
|
|
const layer1Warehouses = columnData.layer1 || [];
|
|
|
|
|
|
const layer2Warehouses = columnData.layer2 || [];
|
|
|
|
|
|
const maxSplitCount = 5; // 最多拆分5个
|
|
|
|
|
|
for (let i = 0; i < maxSplitCount; i++) {
|
|
|
|
|
|
if (layer1Warehouses[i]) splitIds.push(layer1Warehouses[i].actualWarehouseId);
|
|
|
|
|
|
if (layer2Warehouses[i]) splitIds.push(layer2Warehouses[i].actualWarehouseId);
|
|
|
|
|
|
}
|
|
|
|
|
|
payload.splitIds = splitIds;
|
|
|
|
|
|
console.log(payload)
|
|
|
|
|
|
// 如果切换为拆分状态,调用handleSplitWarehouse方法
|
|
|
|
|
|
this.handleSplitWarehouse(payload);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 其他情况,数据异常
|
|
|
|
|
|
this.$message.error(`列 ${column} 切换状态异常,当前状态为${currentLevel}`);
|
|
|
|
|
|
// this.handleMergeWarehouse(column);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2025-12-19 18:06:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
getInterlacedWarehouseIds(warehouse) {
|
|
|
|
|
|
if (!warehouse?.parsedInfo) return [];
|
|
|
|
|
|
const { column, row } = warehouse.parsedInfo;
|
|
|
|
|
|
const columnData = this.columns[column];
|
|
|
|
|
|
if (!columnData) return [];
|
2025-12-20 15:12:07 +08:00
|
|
|
|
|
2025-12-19 18:06:55 +08:00
|
|
|
|
const ids = [];
|
|
|
|
|
|
const layer1Warehouse = columnData.layer1.find(w => w.parsedInfo.row === row);
|
|
|
|
|
|
const layer2Warehouse = columnData.layer2.find(w => w.parsedInfo.row === row);
|
|
|
|
|
|
if (layer1Warehouse) ids.push(layer1Warehouse.actualWarehouseId);
|
|
|
|
|
|
if (layer2Warehouse) ids.push(layer2Warehouse.actualWarehouseId);
|
|
|
|
|
|
return ids;
|
|
|
|
|
|
},
|
2025-12-08 11:48:20 +08:00
|
|
|
|
calcContainerWidth() {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
if (!this.$refs.gridContainer) {
|
|
|
|
|
|
this.containerWidth = 0;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.containerWidth = this.$refs.gridContainer.clientWidth || 0;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
handleResize() {
|
|
|
|
|
|
clearTimeout(this.resizeTimer);
|
|
|
|
|
|
this.resizeTimer = setTimeout(() => {
|
|
|
|
|
|
this.calcContainerWidth();
|
|
|
|
|
|
}, 100);
|
|
|
|
|
|
},
|
|
|
|
|
|
handleCellClick(warehouse) {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
console.log('格子点击触发,仓库数据:', warehouse);
|
|
|
|
|
|
this.currentWarehouse = { ...warehouse };
|
|
|
|
|
|
this.dialogOpen = true;
|
2025-12-19 18:06:55 +08:00
|
|
|
|
},
|
2025-12-20 15:12:07 +08:00
|
|
|
|
handleSplitWarehouse(payload) {
|
|
|
|
|
|
this.$emit('split-warehouse', payload);
|
2025-12-19 18:06:55 +08:00
|
|
|
|
},
|
2025-12-20 15:12:07 +08:00
|
|
|
|
handleMergeWarehouse(payload) {
|
|
|
|
|
|
this.$emit('merge-warehouse', payload);
|
2025-12-19 18:06:55 +08:00
|
|
|
|
},
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
.multi-layer-grid {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
width: 100%;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
height: 100%;
|
|
|
|
|
|
box-sizing: border-box;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.col-ruler {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
height: 30px;
|
|
|
|
|
|
line-height: 30px;
|
2025-12-19 18:06:55 +08:00
|
|
|
|
background: #f5f7fa;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
border-bottom: 1px solid #e4e7ed;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
width: 100%;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
box-sizing: border-box;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
overflow: hidden;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
|
|
|
|
|
|
.ruler-empty {
|
|
|
|
|
|
width: 30px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #606266;
|
|
|
|
|
|
border-right: 1px solid #e4e7ed;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ruler-item {
|
|
|
|
|
|
width: var(--cell-width);
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #606266;
|
|
|
|
|
|
border-right: 1px solid #e4e7ed;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
flex-shrink: 0;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
position: relative; // 为切换按钮定位做准备
|
|
|
|
|
|
|
|
|
|
|
|
// 列号文本
|
|
|
|
|
|
.column-number {
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 拆分/合并切换按钮
|
|
|
|
|
|
.split-merge-toggle {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
transform: translateY(0);
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
border: 1px solid #e4e7ed;
|
|
|
|
|
|
border-bottom-left-radius: 4px;
|
|
|
|
|
|
border-bottom-right-radius: 4px;
|
|
|
|
|
|
padding: 2px 6px;
|
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 2px;
|
|
|
|
|
|
opacity: 0.7;
|
|
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
|
color: #606266;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 拆分状态样式
|
|
|
|
|
|
&.is-split {
|
|
|
|
|
|
background: #e8f5e9;
|
|
|
|
|
|
border-color: #2e7d32;
|
|
|
|
|
|
color: #2e7d32;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 合并状态样式
|
|
|
|
|
|
&.is-merge {
|
|
|
|
|
|
background: #fff3e0;
|
|
|
|
|
|
border-color: #e65100;
|
|
|
|
|
|
color: #e65100;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-icon-s-tools {
|
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.toggle-text {
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.row-grid-wrapper {
|
|
|
|
|
|
display: flex;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
width: 100%;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
height: calc(100% - 30px);
|
|
|
|
|
|
box-sizing: border-box;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
overflow: hidden;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.row-ruler {
|
|
|
|
|
|
width: 30px;
|
2025-12-19 18:06:55 +08:00
|
|
|
|
background: #f5f7fa;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
border-right: 1px solid #e4e7ed;
|
|
|
|
|
|
flex-shrink: 0;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
overflow: hidden;
|
2025-12-19 18:06:55 +08:00
|
|
|
|
height: var(--total-height);
|
2025-12-08 11:48:20 +08:00
|
|
|
|
|
|
|
|
|
|
.ruler-item {
|
|
|
|
|
|
height: 80px;
|
|
|
|
|
|
line-height: 80px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: #606266;
|
|
|
|
|
|
border-bottom: 1px solid #e4e7ed;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.grid-container {
|
|
|
|
|
|
display: grid;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
width: 100%;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
grid-template-columns: repeat(var(--column-count), minmax(0, var(--half-cell-width)));
|
2025-12-20 15:12:07 +08:00
|
|
|
|
grid-auto-rows: var(--total-height);
|
2025-12-19 18:06:55 +08:00
|
|
|
|
gap: 0px;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
box-sizing: border-box;
|
2025-12-20 15:12:07 +08:00
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
2025-12-19 18:06:55 +08:00
|
|
|
|
height: var(--total-height);
|
2025-12-20 15:12:07 +08:00
|
|
|
|
overflow: hidden;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
-ms-overflow-style: none;
|
|
|
|
|
|
scrollbar-width: none;
|
|
|
|
|
|
|
|
|
|
|
|
&::-webkit-scrollbar {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
display: none;
|
|
|
|
|
|
width: 0;
|
|
|
|
|
|
height: 0;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-19 18:06:55 +08:00
|
|
|
|
.column-container {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
|
padding: 1px;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
border: 1px solid #e4e7ed;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
&.layer-1-container {
|
|
|
|
|
|
background-color: #fff3e020;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.layer-2-container {
|
|
|
|
|
|
background-color: #e8f5e920;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-08 11:48:20 +08:00
|
|
|
|
.warehouse-cell {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
height: var(--item-height);
|
2025-12-08 11:48:20 +08:00
|
|
|
|
border: 1px solid #e4e7ed;
|
2025-12-19 18:06:55 +08:00
|
|
|
|
border-radius: 4px;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.2s;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
|
overflow: hidden;
|
2025-12-19 18:06:55 +08:00
|
|
|
|
margin: 1px 0;
|
|
|
|
|
|
transform-origin: top center;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
|
|
|
|
|
|
&.layer-1:not(.disabled) {
|
2025-12-19 18:06:55 +08:00
|
|
|
|
background: #fff3e0;
|
|
|
|
|
|
color: #e65100;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.layer-2:not(.disabled) {
|
2025-12-19 18:06:55 +08:00
|
|
|
|
background: #e8f5e9;
|
|
|
|
|
|
color: #2e7d32;
|
|
|
|
|
|
z-index: 1;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.disabled {
|
2025-12-19 18:06:55 +08:00
|
|
|
|
background: #fafafa;
|
|
|
|
|
|
color: #909399;
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
opacity: 0.8;
|
|
|
|
|
|
|
2025-12-08 11:48:20 +08:00
|
|
|
|
&:hover {
|
|
|
|
|
|
border-color: #e4e7ed;
|
|
|
|
|
|
background: #fafafa;
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&:not(.disabled):hover {
|
2025-12-19 18:06:55 +08:00
|
|
|
|
border-color: #90caf9;
|
|
|
|
|
|
background: #f0f8ff;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
z-index: 2;
|
2025-12-19 18:06:55 +08:00
|
|
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.cell-name {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 90%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
padding: 0 4px;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
|
|
.cell-line1 {
|
2025-12-19 18:06:55 +08:00
|
|
|
|
font-size: 12px;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
line-height: 1.2;
|
2025-12-19 18:06:55 +08:00
|
|
|
|
margin-bottom: 2px;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.cell-line2 {
|
2025-12-19 18:06:55 +08:00
|
|
|
|
font-size: 11px;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
line-height: 1.2;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.disabled & .cell-line1,
|
|
|
|
|
|
.disabled & .cell-line2 {
|
2025-12-20 15:12:07 +08:00
|
|
|
|
color: #909399;
|
2025-12-08 11:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.layer-1:not(.disabled) & .cell-line1,
|
|
|
|
|
|
.layer-1:not(.disabled) & .cell-line2 {
|
|
|
|
|
|
color: #e65100;
|
|
|
|
|
|
}
|
2025-12-19 18:06:55 +08:00
|
|
|
|
|
2025-12-08 11:48:20 +08:00
|
|
|
|
.layer-2:not(.disabled) & .cell-line1,
|
|
|
|
|
|
.layer-2:not(.disabled) & .cell-line2 {
|
|
|
|
|
|
color: #2e7d32;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|