feat(wms-warehouse): 添加钢卷右键领料功能
新增仓库视图右键菜单触发钢卷选择弹窗,支持平面视图和3D视图右键选中钢卷,实现快速领料流程,包含领料弹窗、工序选择和接口调用逻辑
This commit is contained in:
@@ -92,7 +92,8 @@
|
||||
<tbody>
|
||||
<tr v-for="c in tableRows" :key="c.id"
|
||||
:class="{ sel: detail && detail.id === c.id }"
|
||||
@click="showCoilDetail(c.id)">
|
||||
@click="showCoilDetail(c.id)"
|
||||
@contextmenu.prevent="handleRowRightClick(c)">
|
||||
<td>{{ c.posKey }} L{{ c.layer }}</td>
|
||||
<td>{{ c.coilNo }}</td>
|
||||
<td>{{ c.specification }}</td>
|
||||
@@ -306,6 +307,7 @@ export default {
|
||||
|
||||
const dom = this.renderer.domElement;
|
||||
dom.addEventListener('click', this.onCanvasClick);
|
||||
dom.addEventListener('contextmenu', this.onContextMenu);
|
||||
dom.addEventListener('mousedown', this.onMouseDown);
|
||||
dom.addEventListener('mousemove', this.onMouseMove);
|
||||
dom.addEventListener('mouseup', this.onMouseUp);
|
||||
@@ -608,6 +610,32 @@ export default {
|
||||
this.closeDetail();
|
||||
},
|
||||
|
||||
onContextMenu(e) {
|
||||
e.preventDefault();
|
||||
const rect = this.renderer.domElement.getBoundingClientRect();
|
||||
this.mouseVec.x = ((e.clientX - rect.left) / rect.width) * 2 - 1;
|
||||
this.mouseVec.y = -((e.clientY - rect.top) / rect.height) * 2 + 1;
|
||||
this.raycaster.setFromCamera(this.mouseVec, this.camera);
|
||||
const targets = [];
|
||||
this.scene.traverse((o) => { if (o.userData && o.userData.coilId) targets.push(o); });
|
||||
const hits = this.raycaster.intersectObjects(targets, true);
|
||||
if (hits.length > 0) {
|
||||
let obj = hits[0].object;
|
||||
while (obj.parent && !(obj.userData && obj.userData.coilId)) obj = obj.parent;
|
||||
if (obj.userData && obj.userData.coilId) {
|
||||
const coil = this.coilList.find(c => c.id === obj.userData.coilId);
|
||||
if (coil) {
|
||||
this.$emit('coil-selected', {
|
||||
coilId: coil.id,
|
||||
currentCoilNo: coil.coilNo,
|
||||
warehouseId: coil.warehouseId,
|
||||
warehouseName: coil.warehouseName,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async showCoilDetail(cid) {
|
||||
const coil = this.coilList.find((c) => c.id === cid);
|
||||
if (!coil) return;
|
||||
@@ -638,6 +666,15 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
handleRowRightClick(coil) {
|
||||
this.$emit('coil-selected', {
|
||||
coilId: coil.id,
|
||||
currentCoilNo: coil.coilNo,
|
||||
warehouseId: coil.warehouseId,
|
||||
warehouseName: coil.warehouseName,
|
||||
});
|
||||
},
|
||||
|
||||
closeDetail() {
|
||||
this.detail = null;
|
||||
this.applyHighlight();
|
||||
|
||||
Reference in New Issue
Block a user