feat(仓库管理): 优化仓库网格布局并增强库位编码解析
- 在WarehouseGrid组件中添加layerData变化的调试日志 - 将overview.vue中的网格列数从10增加到30 - 重构WarehouseBird组件中的库位编码解析逻辑,支持更灵活的编码格式 - 优化WarehouseInterlaced组件的布局,添加横向滚动容器并改进单元格宽度计算 - 同步列标尺和网格区域的滚动行为
This commit is contained in:
@@ -48,11 +48,8 @@
|
||||
<div class="empty-text">该分类下暂无库位数据</div>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="openInitDialog">初始化库位</el-button>
|
||||
</div>
|
||||
<warehouse-interlaced
|
||||
v-else="warehouseList.length"
|
||||
:id="id" :columns="columns"
|
||||
@split-warehouse="handleSplitWarehouse"
|
||||
@merge-warehouse="handleMergeWarehouse" />
|
||||
<warehouse-interlaced v-else="warehouseList.length" :id="id" :columns="columns"
|
||||
@split-warehouse="handleSplitWarehouse" @merge-warehouse="handleMergeWarehouse" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -105,10 +102,21 @@ export default {
|
||||
},
|
||||
/**
|
||||
* 解析第三级库位编码
|
||||
* 新规则:
|
||||
* 1. 前三位:数字或字母的任意组合
|
||||
* 2. column:从第五位开始到第一个"-"为止(支持多位数)
|
||||
* 3. 保留 row(两位数字)、layer(数字)的解析规则
|
||||
*/
|
||||
parseWarehouseCode(code) {
|
||||
if (!code) return null;
|
||||
const reg = /^([A-Za-z])(\d+[A-Za-z])(\d)-(\d{2})-(\d+)$/;
|
||||
|
||||
// 新正则表达式解析规则
|
||||
// ^([A-Za-z0-9]{3}) :匹配前3位(数字/字母)
|
||||
// . :匹配第4位(任意单个字符)
|
||||
// ([^-]+) :匹配column(到第一个"-"为止,至少1位)
|
||||
// -(\d{2}) :匹配row(两位数字)
|
||||
// -(\d+) :匹配layer(一位或多位数字)
|
||||
const reg = /^([A-Za-z0-9]{3})([^-]+)-(\d{2})-(\d+)$/;
|
||||
const match = code.match(reg);
|
||||
|
||||
if (!match) {
|
||||
@@ -118,11 +126,12 @@ export default {
|
||||
|
||||
return {
|
||||
level: 3,
|
||||
warehouseFirst: match[1],
|
||||
warehouseSecond: match[2],
|
||||
column: Number(match[3]),
|
||||
row: Number(match[4]),
|
||||
layer: match[5],
|
||||
warehousePrefix: match[1], // 前三位(数字/字母),替代原warehouseFirst/warehouseSecond
|
||||
warehouseFirst: match[1].slice(0, 2), // 前三位的前两个字符
|
||||
warehouseSecond: match[1].slice(2, 3), // 前三位的第三个字符
|
||||
column: Number(match[2]), // 第五位到第一个"-"的内容(多位数)
|
||||
row: Number(match[3]), // 两位数字的行号
|
||||
layer: match[4] // 层级数字(可多位数)
|
||||
};
|
||||
},
|
||||
|
||||
@@ -131,7 +140,7 @@ export default {
|
||||
*/
|
||||
parseWarehouseCodeFourth(code) {
|
||||
if (!code) return null;
|
||||
const reg = /^([A-Za-z])(\d+[A-Za-z])(\d)-X(\d{2})-(\d+)$/;
|
||||
const reg = /^([A-Za-z0-9]{3})([^-]+)-X(\d{2})-(\d+)$/;
|
||||
const match = code.match(reg);
|
||||
|
||||
if (!match) {
|
||||
@@ -139,13 +148,17 @@ export default {
|
||||
return null;
|
||||
}
|
||||
|
||||
// console.log('match:', match);
|
||||
|
||||
return {
|
||||
level: 4,
|
||||
warehouseFirst: match[1],
|
||||
warehouseSecond: match[2],
|
||||
column: Number(match[3]),
|
||||
row: Number(match[4]),
|
||||
layer: match[5],
|
||||
warehousePrefix: match[1],
|
||||
warehouseFirst: match[1].slice(0, 2), // 前三位的前两个字符
|
||||
warehouseSecond: match[1].slice(2, 3), // 前三位的第三个字符
|
||||
// warehouseSecond: match[2],
|
||||
column: Number(match[2]),
|
||||
row: Number(match[3]),
|
||||
layer: match[4],
|
||||
};
|
||||
},
|
||||
|
||||
@@ -200,7 +213,7 @@ export default {
|
||||
// 2. 对每列的两层数据分别按行号排序
|
||||
Object.keys(columnMap).forEach((column) => {
|
||||
const columnData = columnMap[column];
|
||||
|
||||
|
||||
// 按行号排序(保证展示顺序正确)
|
||||
columnData.layer1.sort((a, b) => a.parsedInfo.row - b.parsedInfo.row);
|
||||
columnData.layer2.sort((a, b) => a.parsedInfo.row - b.parsedInfo.row);
|
||||
@@ -310,7 +323,7 @@ export default {
|
||||
// 分列容器样式
|
||||
.layers-container {
|
||||
display: flex;
|
||||
|
||||
|
||||
.layer-section {
|
||||
flex: 1;
|
||||
max-width: 50%;
|
||||
|
||||
Reference in New Issue
Block a user