feat(qc): 新增检查项模板管理功能及穿梭框组件
refactor(warehouse): 优化库位网格布局和响应式设计 fix(wms): 移除异常详情页的路由变化条件判断 style(qc): 统一检查任务对话框宽度为700px feat(qc): 新增检查项模板API及相关页面组件
This commit is contained in:
@@ -2,16 +2,15 @@
|
||||
<div>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-divider content-position="left">第{{ layer }}层库位</el-divider>
|
||||
<!-- 转置按钮 -->
|
||||
<el-button type="text" icon="el-icon-refresh-left" size="mini" @click="toggleTranspose">
|
||||
{{ isTransposed ? '恢复行列' : '行列转置' }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid-scroll-container" ref="scrollContainerRef">
|
||||
<div class="scroll-content">
|
||||
<div class="scroll-content" ref="contentRef">
|
||||
<!-- 列标尺(顶部) -->
|
||||
<div class="col-ruler">
|
||||
<div class="col-ruler" :style="{ '--cell-width': `${cellWidth}px` }">
|
||||
<div class="ruler-empty"></div>
|
||||
<div v-for="col in transposedLayerData.maxColumn" :key="`col-${layer}-${col}`" class="ruler-item">
|
||||
{{ col }}
|
||||
@@ -27,9 +26,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 库位网格 -->
|
||||
<div class="grid-container"
|
||||
:style="{ gridTemplateColumns: `repeat(${transposedLayerData.maxColumn}, 60px)` }">
|
||||
<!-- 库位网格 - 修复伪元素遮挡问题 -->
|
||||
<div class="grid-container"
|
||||
:style="{
|
||||
'--cell-width': `${cellWidth}px`,
|
||||
'--column-count': transposedLayerData.maxColumn
|
||||
}">
|
||||
<!-- 库位格子 -->
|
||||
<div v-for="warehouse in transposedLayerData.warehouses" :key="warehouse.actualWarehouseId"
|
||||
class="warehouse-cell" :class="{ disabled: warehouse.isEnabled === 0 }"
|
||||
@@ -47,23 +49,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 库位详情弹窗 -->
|
||||
<!-- 弹窗修复:改回 .sync 绑定,恢复 footer 插槽写法 -->
|
||||
<el-dialog title="库位详情" :visible.sync="dialogVisible" width="600px" destroy-on-close append-to-body center>
|
||||
<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.parsedInfo.layer || '未知' }}</el-descriptions-item>
|
||||
<!-- 弹窗内行列显示适配转置状态 -->
|
||||
<el-descriptions-item label="行号">
|
||||
{{ isTransposed ? currentWarehouse.parsedInfo.column : currentWarehouse.parsedInfo.row || '未知' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="列号">
|
||||
{{ isTransposed ? currentWarehouse.parsedInfo.row : currentWarehouse.parsedInfo.column || '未知' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="一级编码">{{ currentWarehouse.parsedInfo.warehouseFirst || '未知'
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="二级编码">{{ currentWarehouse.parsedInfo.warehouseSecond || '未知'
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="一级编码">{{ currentWarehouse.parsedInfo.warehouseFirst || '未知' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="二级编码">{{ currentWarehouse.parsedInfo.warehouseSecond || '未知' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="启用状态">
|
||||
<el-tag :type="currentWarehouse.isEnabled === 1 ? 'success' : 'danger'">
|
||||
{{ currentWarehouse.isEnabled === 1 ? '启用' : '禁用' }}
|
||||
@@ -81,7 +80,6 @@
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -91,12 +89,10 @@ export default {
|
||||
name: "WarehouseGrid",
|
||||
components: { QRCode },
|
||||
props: {
|
||||
// 层号
|
||||
layer: {
|
||||
type: [String, Number],
|
||||
required: true
|
||||
},
|
||||
// 层数据
|
||||
layerData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
@@ -110,27 +106,21 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 弹窗状态
|
||||
dialogVisible: false,
|
||||
currentWarehouse: null,
|
||||
// 转置状态:false-原始布局 | true-行列转置
|
||||
isTransposed: false
|
||||
isTransposed: false,
|
||||
containerWidth: 0,
|
||||
resizeTimer: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
/**
|
||||
* 处理转置后的层数据(视图层映射,不修改原数据)
|
||||
*/
|
||||
transposedLayerData() {
|
||||
const { maxRow, maxColumn, warehouses } = this.layerData;
|
||||
|
||||
// 转置后的基础行列数
|
||||
const transMaxRow = this.isTransposed ? maxColumn : maxRow;
|
||||
const transMaxColumn = this.isTransposed ? maxRow : maxColumn;
|
||||
|
||||
// 深拷贝库位数据,避免修改原数据
|
||||
// 深拷贝避免修改原数据
|
||||
const transWarehouses = JSON.parse(JSON.stringify(warehouses)).map(item => {
|
||||
// 转置时互换行列解析值
|
||||
if (this.isTransposed && item.parsedInfo) {
|
||||
const { row, column } = item.parsedInfo;
|
||||
item.parsedInfo.row = column;
|
||||
@@ -139,7 +129,7 @@ export default {
|
||||
return item;
|
||||
});
|
||||
|
||||
// 转置后重新排序(原:行→列 | 转置:列→行)
|
||||
// 排序保证网格展示顺序正确
|
||||
transWarehouses.sort((a, b) => {
|
||||
if (a.parsedInfo.row !== b.parsedInfo.row) {
|
||||
return a.parsedInfo.row - b.parsedInfo.row;
|
||||
@@ -147,7 +137,6 @@ export default {
|
||||
return a.parsedInfo.column - b.parsedInfo.column;
|
||||
});
|
||||
|
||||
// 转置后重新计算空占位数量
|
||||
const totalGrid = transMaxRow * transMaxColumn;
|
||||
const emptyCount = Math.max(0, totalGrid - transWarehouses.length);
|
||||
|
||||
@@ -157,23 +146,55 @@ export default {
|
||||
warehouses: transWarehouses,
|
||||
emptyCount
|
||||
};
|
||||
},
|
||||
cellWidth() {
|
||||
if (!this.containerWidth || this.transposedLayerData.maxColumn === 0) return 60;
|
||||
// 容器可用宽度 = 滚动容器宽度 - 行标尺宽度(30px)
|
||||
const availableWidth = Math.max(0, this.containerWidth - 30);
|
||||
// 均分宽度,最小60px
|
||||
const averageWidth = availableWidth / this.transposedLayerData.maxColumn;
|
||||
return Math.max(60, averageWidth);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isTransposed() {
|
||||
this.calcContainerWidth();
|
||||
},
|
||||
layerData: {
|
||||
deep: true,
|
||||
handler() {
|
||||
this.calcContainerWidth();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.calcContainerWidth();
|
||||
window.addEventListener('resize', this.handleResize);
|
||||
},
|
||||
beforeUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize);
|
||||
clearTimeout(this.resizeTimer);
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 切换转置状态
|
||||
*/
|
||||
calcContainerWidth() {
|
||||
if (this.$refs.scrollContainerRef) {
|
||||
this.containerWidth = this.$refs.scrollContainerRef.clientWidth;
|
||||
}
|
||||
},
|
||||
handleResize() {
|
||||
clearTimeout(this.resizeTimer);
|
||||
this.resizeTimer = setTimeout(() => {
|
||||
this.calcContainerWidth();
|
||||
}, 100);
|
||||
},
|
||||
toggleTranspose() {
|
||||
this.isTransposed = !this.isTransposed;
|
||||
// 重置弹窗选中状态(可选)
|
||||
this.dialogVisible = false;
|
||||
this.currentWarehouse = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击库位格子展示详情
|
||||
*/
|
||||
// 修复点击事件:增加日志便于调试,确保赋值正确
|
||||
handleCellClick(warehouse) {
|
||||
console.log('点击库位:', warehouse); // 调试用
|
||||
this.currentWarehouse = warehouse;
|
||||
this.dialogVisible = true;
|
||||
}
|
||||
@@ -187,68 +208,41 @@ export default {
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
position: relative; // 为转置按钮提供定位上下文
|
||||
min-height: 100px; // 防止空数据时高度为0
|
||||
position: relative;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
// 转置按钮(固定位置)
|
||||
.transpose-btn {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
z-index: 20; // 高于滚动容器
|
||||
color: #409eff;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
padding: 0 8px;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
border-radius: 4px;
|
||||
|
||||
&:hover {
|
||||
color: #1e88e5;
|
||||
background: #e8f4ff;
|
||||
}
|
||||
}
|
||||
|
||||
// 核心滚动容器:横向滚动,列标尺+网格共享滚动条
|
||||
.grid-scroll-container {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
position: relative;
|
||||
padding-bottom: 8px; // 给滚动条留空间
|
||||
padding-bottom: 8px;
|
||||
|
||||
// 优化滚动条样式
|
||||
&::-webkit-scrollbar {
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 4px;
|
||||
|
||||
&:hover {
|
||||
background: #a8a8a8;
|
||||
}
|
||||
}
|
||||
|
||||
// 兼容非webkit浏览器
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: #c1c1c1 #f1f1f1;
|
||||
}
|
||||
|
||||
// 滚动内容容器:列标尺 + 行标尺+网格
|
||||
.scroll-content {
|
||||
display: inline-block;
|
||||
background: #fff;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
// 列标尺样式
|
||||
.col-ruler {
|
||||
display: flex;
|
||||
height: 30px;
|
||||
@@ -266,7 +260,8 @@ export default {
|
||||
}
|
||||
|
||||
.ruler-item {
|
||||
width: 60px;
|
||||
width: var(--cell-width);
|
||||
min-width: 60px;
|
||||
text-align: center;
|
||||
font-weight: 600;
|
||||
color: #606266;
|
||||
@@ -276,13 +271,11 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// 行标尺 + 网格容器
|
||||
.row-grid-wrapper {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// 行标尺样式
|
||||
.row-ruler {
|
||||
width: 30px;
|
||||
background: #eef2f7;
|
||||
@@ -300,16 +293,26 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// 库位网格容器
|
||||
.grid-container {
|
||||
display: grid;
|
||||
gap: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
// 库位格子
|
||||
// 修复伪元素遮挡点击事件:添加 pointer-events: none
|
||||
&::before {
|
||||
content: '';
|
||||
width: calc(var(--cell-width) * var(--column-count));
|
||||
display: block;
|
||||
height: 0;
|
||||
visibility: hidden;
|
||||
pointer-events: none; // 关键:让伪元素不拦截点击事件
|
||||
}
|
||||
|
||||
.warehouse-cell {
|
||||
width: var(--cell-width);
|
||||
min-width: 60px;
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 0;
|
||||
display: flex;
|
||||
@@ -320,18 +323,20 @@ export default {
|
||||
transition: all 0.2s;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
flex-shrink: 0;
|
||||
position: relative; // 确保层级正常
|
||||
z-index: 1; // 高于伪元素
|
||||
|
||||
&:hover {
|
||||
border-color: #409eff;
|
||||
background: #e8f4ff;
|
||||
z-index: 1;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
background: #f5f5f5;
|
||||
color: #909399;
|
||||
cursor: not-allowed;
|
||||
|
||||
&:hover {
|
||||
border-color: #e6e6e6;
|
||||
background: #f5f5f5;
|
||||
@@ -341,14 +346,17 @@ export default {
|
||||
.cell-name {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
word-break: break-all;
|
||||
text-align: center;
|
||||
padding: 0 2px;
|
||||
}
|
||||
}
|
||||
|
||||
// 空占位格子
|
||||
.empty-cell {
|
||||
background: #fafafa;
|
||||
border-style: solid;
|
||||
border-color: #e6e6e6;
|
||||
pointer-events: none; // 空格子不需要点击事件
|
||||
|
||||
.cell-code {
|
||||
color: #c0c4cc;
|
||||
|
||||
Reference in New Issue
Block a user