Merge remote-tracking branch 'origin/0.8.X' into 0.8.X

This commit is contained in:
2026-06-30 10:24:48 +08:00
12 changed files with 311 additions and 31 deletions

View File

@@ -91,20 +91,14 @@ export default {
return this.findFirstLeaf(this.item, this.basePath)
},
menuStyle() {
console.log('[SidebarItem] 完整 item 对象:', JSON.parse(JSON.stringify(this.item)))
console.log('[SidebarItem] item.meta:', this.item.meta)
console.log('[SidebarItem] item.meta?.style 原始值:', this.item.meta && this.item.meta.style)
if (this.item.meta && this.item.meta.style) {
try {
const parsed = JSON.parse(this.item.meta.style)
console.log('[SidebarItem] ✅ menuStyle 解析成功:', parsed)
return parsed
} catch (e) {
console.warn('[SidebarItem] ❌ JSON.parse 失败:', e)
return {}
}
}
console.log('[SidebarItem] ⚠️ item.meta.style 为空,返回 {}')
return {}
}
},

View File

@@ -49,13 +49,10 @@ const permission = {
arr.forEach(item => {
const title = (item.meta && item.meta.title) || item.name || ''
const styleVal = item.meta && item.meta.style
console.log('[permission] depth=' + depth, title, 'meta.style=', styleVal)
if (item.children) logMetaStyle(item.children, depth + 1)
})
}
console.log('[permission] === getRouters 原始数据 ===')
logMetaStyle(res.data)
console.log('[permission] === getRouters 数据结束 ===')
const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata)

34
klp-ui/src/utils/meta.js Normal file
View File

@@ -0,0 +1,34 @@
// lockValue: 锁值用于防止并发操作不同的lockValue对应不同的锁
// 1分步加工 2. 退火 3. 酸轧 4. 酸轧分条 4. 合卷
export const PROCESSES = [
{ name: '酸连轧工序', actionType: 11, api: 'pendingAction', lockValue: 3 },
{ name: '酸轧分条工序', actionType: 120, api: 'pendingAction', lockValue: 4 },
{ name: '酸轧合卷', actionType: 201, api: 'pendingAction', lockValue: 5 },
{ name: '镀锌合卷', actionType: 202, api: 'pendingAction', lockValue: 5 },
{ name: '脱脂合卷', actionType: 203, api: 'pendingAction', lockValue: 5 },
{ name: '拉矫平整合卷', actionType: 204, api: 'pendingAction', lockValue: 5 },
{ name: '双机架合卷', actionType: 205, api: 'pendingAction', lockValue: 5 },
{ name: '镀铬合卷', actionType: 206, api: 'pendingAction', lockValue: 5 },
{ name: '镀锌工序', actionType: 501, api: 'specialSplit', lockValue: 1 },
{ name: '脱脂工序', actionType: 502, api: 'specialSplit', lockValue: 1 },
{ name: '拉矫平整工序', actionType: 503, api: 'specialSplit', lockValue: 1 },
{ name: '双机架工序', actionType: 504, api: 'specialSplit', lockValue: 1 },
{ name: '镀铬工序', actionType: 505, api: 'specialSplit', lockValue: 1 },
{ name: '纵剪分条工序', actionType: 506, api: 'specialSplit', lockValue: 1 },
{ name: '酸轧修复工序', actionType: 520, api: 'specialSplit', lockValue: 1 },
{ name: '镀锌修复工序', actionType: 521, api: 'specialSplit', lockValue: 1 },
{ name: '脱脂修复工序', actionType: 522, api: 'specialSplit', lockValue: 1 },
{ name: '拉矫修复工序', actionType: 523, api: 'specialSplit', lockValue: 1 },
{ name: '双机架修复工序', actionType: 524, api: 'specialSplit', lockValue: 1 },
{ name: '镀铬修复工序', actionType: 525, api: 'specialSplit', lockValue: 1 },
]
export const PRODUCTION_LINES = [
{ name: '镀锌线', id: 1, processes: '501,202,521', hasPendingAction: true },
{ name: '酸轧线', id: 2, processes: '11,120,201,520', hasPendingAction: true },
{ name: '脱脂线', id: 3, processes: '203,502,522', hasPendingAction: true },
{ name: '镀铬线', id: 4, processes: '206,505,525', hasPendingAction: true },
{ name: '双机架', id: 5, processes: '205,504,524', hasPendingAction: true },
{ name: '退火线', id: 6, processes: '600', hasPendingAction: false },
{ name: '拉矫线', id: 7, processes: '204,503,523', hasPendingAction: true },
]

View File

@@ -316,6 +316,8 @@ export default {
status: 0,
dataType: 1,
exclusiveStatus: 0,
// 只查询退火原料库的卷
warehouseId: '1988150648993148929'
},
statusForm: {
planId: undefined,

View File

@@ -258,6 +258,8 @@ export default {
status: 0,
dataType: 1,
exclusiveStatus: 0,
// 只查询退火原料库的卷
warehouseId: '1988150648993148929'
},
statusForm: {
planId: undefined,

View File

@@ -2,13 +2,13 @@
<div class="app-container comparison-report" v-loading="loading">
<!-- 查询条件 -->
<el-card shadow="never" class="filter-card">
<div class="line-tabs-row">
<el-radio-group v-model="actionTypes" size="small" @change="handleQuery">
<el-radio-button label="">全部</el-radio-button>
<el-radio-button v-for="line in lineOptions" :key="line.value" :label="line.value">{{ line.label }}</el-radio-button>
</el-radio-group>
</div>
<el-form label-width="70px" inline class="filter-form">
<el-form-item label="产线">
<el-select style="width: 150px;" v-model="actionTypes" placeholder="产线" clearable @change="handleQuery" size="small">
<el-option label="全部" value="" />
<el-option v-for="line in lineOptions" :key="line.value" :label="line.label" :value="line.value" />
</el-select>
</el-form-item>
<el-form-item label="品质">
<muti-select v-model="queryParams.qualityStatusCsv" :options="dict.type.coil_quality_status"
placeholder="品质" clearable style="width: 150px;" size="small" />
@@ -176,7 +176,7 @@ export default {
baseStartTime: baseMonthStart, baseEndTime: baseMonthEnd,
queryParams: { enterCoilNo: '', currentCoilNo: '', itemName: '', itemSpecification: '', itemMaterial: '', itemManufacturer: '', qualityStatusCsv: '' },
lossColumns: [], outputColumns: [],
actionTypes: '',
actionTypes: '11,120,201,520',
lineOptions: [
{ label: '酸轧线', value: '11,120,201,520' }, { label: '镀锌线', value: '202,501,521' },
{ label: '双机架', value: '205,504,524' }, { label: '镀铬线', value: '206,505,525' },
@@ -355,6 +355,7 @@ export default {
.comparison-report { min-width: 900px; }
.filter-card { margin-bottom: 8px; }
.filter-card >>> .el-card__body { padding: 8px 12px 8px; }
.line-tabs-row { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #eee; }
.filter-form { margin-bottom: 0; }
.filter-form .el-form-item { margin-bottom: 6px; margin-right: 4px; }
.filter-form >>> .el-form-item__label { font-size: 12px; }

View File

@@ -2,13 +2,13 @@
<div v-loading="loading" class="app-container line-report">
<!-- 查询条件 -->
<div class="filter-area">
<div class="line-tabs-row">
<el-radio-group v-model="actionTypes" size="small" @change="handleQuery">
<el-radio-button label="">全部</el-radio-button>
<el-radio-button v-for="line in lineOptions" :key="line.value" :label="line.value">{{ line.label }}</el-radio-button>
</el-radio-group>
</div>
<el-form label-width="70px" inline class="filter-form">
<el-form-item label="产线">
<el-select v-model="actionTypes" style="width: 150px;" placeholder="产线" clearable size="small" @change="handleQuery">
<el-option label="全部" value="" />
<el-option v-for="line in lineOptions" :key="line.value" :label="line.label" :value="line.value" />
</el-select>
</el-form-item>
<el-form-item label="品质">
<muti-select
v-model="queryParams.qualityStatusCsv"
@@ -236,7 +236,7 @@ export default {
enterCoilNo: '', currentCoilNo: '', itemName: '', itemSpecification: '',
itemMaterial: '', itemManufacturer: '', qualityStatusCsv: ''
},
actionTypes: '',
actionTypes: '11,120,201,520',
lineOptions: [
{ label: '酸轧线', value: '11,120,201,520' }, { label: '镀锌线', value: '202,501,521' },
{ label: '双机架', value: '205,504,524' }, { label: '镀铬线', value: '206,505,525' },
@@ -810,6 +810,7 @@ export default {
<style scoped>
.line-report { min-width: 900px; }
.filter-area { background: #fff; padding: 8px 12px; margin-bottom: 8px; border-bottom: 1px solid #e4e7ed; }
.line-tabs-row { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #eee; }
.filter-form { margin-bottom: 0; }
.filter-form .el-form-item { margin-bottom: 6px; margin-right: 4px; }
.filter-form >>> .el-form-item__label { font-size: 12px; }

View File

@@ -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();

View File

@@ -80,7 +80,7 @@
</div>
<warehouse-interlaced v-else="warehouseList.length" :id="id" :columns="columns" :canToggle="canToggle"
:canRelease="canRelease" @split-warehouse="handleSplitWarehouse" @merge-warehouse="handleMergeWarehouse"
@release-warehouse="handleReleaseWarehouse" />
@release-warehouse="handleReleaseWarehouse" @coil-selected="handleCoilSelected" />
</div>
</div>
</template>
@@ -179,6 +179,10 @@ export default {
handleReleaseWarehouse(warehouse) {
this.$emit('release-warehouse', warehouse);
},
handleCoilSelected(coil) {
this.$emit('coil-selected', coil);
},
/**
* 解析第三级库位编码
* 新规则:

View File

@@ -41,7 +41,8 @@
}">
<div v-for="warehouse in columnWarehouseData[column].layer1"
:key="`warehouse-1-${warehouse.actualWarehouseId}`" class="warehouse-cell layer-1"
:class="{ disabled: warehouse.isEnabled === 0, error: warehouse.isEnabled === 0 && warehouse.currentCoilNo == null }" @click.stop="handleCellClick(warehouse)">
:class="{ disabled: warehouse.isEnabled === 0, error: warehouse.isEnabled === 0 && warehouse.currentCoilNo == null }" @click.stop="handleCellClick(warehouse)"
@contextmenu.prevent.stop="handleCellContextMenu(warehouse)">
<div class="cell-name">
<div class="cell-line1">{{ warehouse.actualWarehouseName || '-' }}</div>
<div class="cell-line2">{{ warehouse.currentCoilNo || '-' }}</div>
@@ -61,7 +62,8 @@
:class="{ disabled: warehouse.isEnabled === 0, error: warehouse.isEnabled === 0 && warehouse.currentCoilNo == null }" :style="{
transform: `translateY(var(--offset-value))`,
position: 'relative'
}" @click.stop="handleCellClick(warehouse)">
}" @click.stop="handleCellClick(warehouse)"
@contextmenu.prevent.stop="handleCellContextMenu(warehouse)">
<div class="cell-name">
<div class="cell-line1">{{ warehouse.actualWarehouseName || '-' }}</div>
<div class="cell-line2">{{ warehouse.currentCoilNo || '-' }}</div>
@@ -433,6 +435,16 @@ export default {
this.currentWarehouse = { ...warehouse };
this.dialogOpen = true;
},
handleCellContextMenu(warehouse) {
if (!warehouse.coilId) return;
this.$emit('coil-selected', {
coilId: warehouse.coilId,
currentCoilNo: warehouse.currentCoilNo,
warehouseId: warehouse.actualWarehouseId,
warehouseName: warehouse.actualWarehouseName || warehouse.actualWarehouseCode,
});
},
handleSplitWarehouse(payload) {
this.$emit('split-warehouse', payload);
},

View File

@@ -13,7 +13,7 @@
<!-- 右侧仓库信息区域 - 2D / 3D 双视图 tab -->
<div class="warehouse-container" v-if="selectedNodeId" v-loading="rightLoading" element-loading-text="加载中..."
element-loading-spinner="el-icon-loading">
<el-tabs v-model="activeTab" class="overview-tabs">
<el-tabs v-model="activeTab" class="overview-tabs" @tab-click="handleTabClick">
<el-tab-pane label="平面视图" name="bird">
<!-- <button buttonLoading type="primary" @click="exportAllQrcodes">导出二维码</button> -->
<WarehouseBird
@@ -22,10 +22,12 @@
@open-init-dialog="openInitDialog"
@split-warehouse="handleSplitWarehouse"
@merge-warehouse="handleMergeWarehouse"
@coil-selected="handleCoilSelected"
/>
</el-tab-pane>
<el-tab-pane label="数字孪生 3D" name="three">
<Warehouse3D v-if="activeTab === 'three'" :warehouse-list="warehouseList" :parent-id="selectedNodeId" />
<Warehouse3D v-if="activeTab === 'three'" :warehouse-list="warehouseList" :parent-id="selectedNodeId"
@coil-selected="handleCoilSelected" />
</el-tab-pane>
</el-tabs>
</div>
@@ -36,6 +38,29 @@
</div>
</div>
<!-- 领料弹窗 -->
<el-dialog title="领料" :visible.sync="pickMaterialDialogVisible" width="900px" destroy-on-close append-to-body>
<div v-loading="coilFullInfoLoading" element-loading-text="正在加载钢卷信息...">
<CoilInfoRender v-if="selectedCoilFullInfo" :coilInfo="selectedCoilFullInfo" :column="4" border
:showOnlyValue="true" title="钢卷信息" />
<div v-else-if="!coilFullInfoLoading" class="no-coil-data">暂无钢卷数据</div>
</div>
<el-form v-if="selectedCoilFullInfo" style="margin-top: 16px">
<el-form-item label="选择工序" required>
<el-select v-model="selectedProcess" placeholder="请选择工序" style="width: 300px">
<el-option v-for="p in processList" :key="p.actionType" :label="p.name" :value="p.actionType" />
</el-select>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="pickMaterialDialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirmPickMaterial" :loading="pickLoading"
:disabled="!selectedProcess">确认领料</el-button>
</template>
</el-dialog>
<!-- 库位初始化弹窗 -->
<el-dialog title="库位初始化" :visible.sync="initDialogVisible" width="700px" destroy-on-close append-to-body center>
<el-form ref="initFormRef" :model="initForm" :rules="initFormRules" label-width="100px" size="mini">
@@ -71,6 +96,9 @@
<script>
import { listActualWarehouse, treeActualWarehouseTwoLevel, getActualWarehouse, generateLocations, splitActualWarehouse, mergeActualWarehouse } from "@/api/wms/actualWarehouse";
import { getMaterialCoil, startSpecialSplit } from "@/api/wms/coil";
import { addPendingAction } from "@/api/wms/pendingAction";
import { PROCESSES } from "./processes";
import WarehouseBird from './components/WarehouseBird.vue';
import Warehouse3D from './components/Warehouse3D.vue';
import jsPDF from 'jspdf';
@@ -125,6 +153,14 @@ export default {
isSwitching: false,
nodeClickTimer: null,
buttonLoading: false,
// 领料相关
pickMaterialDialogVisible: false,
selectedCoilInfo: null,
selectedCoilFullInfo: null,
selectedProcess: '',
pickLoading: false,
coilFullInfoLoading: false,
processList: PROCESSES,
};
},
created() {
@@ -134,6 +170,110 @@ export default {
if (this.nodeClickTimer) clearTimeout(this.nodeClickTimer);
},
methods: {
handleCoilSelected(coil) {
this.selectedCoilInfo = { ...coil };
this.openPickMaterialDialog();
},
clearCoilSelection() {
this.selectedCoilInfo = null;
this.selectedCoilFullInfo = null;
this.selectedProcess = '';
},
handleTabClick() {
this.clearCoilSelection();
},
async openPickMaterialDialog() {
if (!this.selectedCoilInfo || !this.selectedCoilInfo.coilId) {
this.$message.warning('请先选中一个钢卷');
return;
}
this.pickMaterialDialogVisible = true;
this.selectedProcess = '';
this.coilFullInfoLoading = true;
try {
const res = await getMaterialCoil(this.selectedCoilInfo.coilId);
this.selectedCoilFullInfo = res.data || {};
} catch (err) {
this.$message.error('获取钢卷信息失败:' + err.message);
this.selectedCoilFullInfo = null;
} finally {
this.coilFullInfoLoading = false;
}
},
async confirmPickMaterial() {
if (!this.selectedProcess) {
this.$message.warning('请选择工序');
return;
}
const process = this.processList.find(p => p.actionType == this.selectedProcess);
if (!process) {
this.$message.error('未知的工序');
return;
}
const coil = this.selectedCoilInfo;
try {
await this.$confirm(
`确认对钢卷 ${coil.currentCoilNo || coil.coilId} 进行【${process.name}】领料操作?`,
'二次确认',
{ confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }
);
} catch {
return;
}
this.pickLoading = true;
try {
let actionId = null;
if (process.api === 'pendingAction') {
const pendingData = {
coilId: coil.coilId,
currentCoilNo: coil.currentCoilNo,
actionType: process.actionType,
actionStatus: 0,
sourceType: 'manual',
warehouseId: coil.warehouseId,
priority: 0,
lockValue: process.lockValue,
};
await addPendingAction(pendingData);
} else {
const res = await startSpecialSplit(coil.coilId, process.actionType);
actionId = res.data;
}
this.$message.success('领料成功,已创建待操作任务');
this.pickMaterialDialogVisible = false;
this.clearCoilSelection();
// 跳转到工序操作界面
// const path = this.getOperationRoutePath(process.actionType);
// this.$router.push({
// path,
// query: {
// coilId: coil.coilId,
// actionId: actionId || '',
// actionTypeCode: process.actionType,
// actionType: process.name,
// }
// });
} catch (err) {
this.$message.error('领料失败:' + (err.message || '未知错误'));
} finally {
this.pickLoading = false;
}
},
getOperationRoutePath(actionType) {
if (actionType >= 100 && actionType <= 199) return '/wms/split';
if (actionType >= 200 && actionType <= 299) return '/wms/merge';
return '/wms/typing';
},
/**
* 处理分割库位事件
*/
@@ -222,7 +362,6 @@ export default {
let currentX = margin; // 当前X坐标
let currentY = margin; // 当前Y坐标
let currentIndex = 0; // 当前处理的库位索引
// const list = this.warehouseList.filter(item => item.actualWarehouseCode.includes('X'));
const list = this.warehouseList;
const totalCount = list.length;
@@ -307,6 +446,7 @@ export default {
this.rightLoading = true;
this.selectedNodeId = node.actualWarehouseId;
this.selectedNode = node;
this.clearCoilSelection();
this.getWarehouseList(node.actualWarehouseId)
.finally(() => {
@@ -317,6 +457,7 @@ export default {
this.selectedNodeId = "";
this.selectedNode = null;
this.warehouseList = [];
this.clearCoilSelection();
}
}, 300);
},
@@ -505,6 +646,13 @@ export default {
}
}
.no-coil-data {
text-align: center;
padding: 32px;
color: #909399;
font-size: 14px;
}
// 初始化网格选择器样式
.grid-selector-container {
width: 100%;
@@ -553,4 +701,4 @@ export default {
}
}
}
</style>
</style>

View File

@@ -0,0 +1,48 @@
export const PROCESSES = [
{ name: '酸连轧工序', actionType: 11, api: 'pendingAction', lockValue: 3 },
{ name: '酸轧分条工序', actionType: 120, api: 'pendingAction', lockValue: 4 },
{ name: '酸轧合卷', actionType: 201, api: 'pendingAction', lockValue: 5 },
{ name: '镀锌合卷', actionType: 202, api: 'pendingAction', lockValue: 5 },
{ name: '脱脂合卷', actionType: 203, api: 'pendingAction', lockValue: 5 },
{ name: '拉矫平整合卷', actionType: 204, api: 'pendingAction', lockValue: 5 },
{ name: '双机架合卷', actionType: 205, api: 'pendingAction', lockValue: 5 },
{ name: '镀铬合卷', actionType: 206, api: 'pendingAction', lockValue: 5 },
{ name: '镀锌工序', actionType: 501, api: 'specialSplit' },
{ name: '脱脂工序', actionType: 502, api: 'specialSplit' },
{ name: '拉矫平整工序', actionType: 503, api: 'specialSplit' },
{ name: '双机架工序', actionType: 504, api: 'specialSplit' },
{ name: '镀铬工序', actionType: 505, api: 'specialSplit' },
{ name: '纵剪分条工序', actionType: 506, api: 'specialSplit' },
{ name: '酸轧修复工序', actionType: 520, api: 'specialSplit' },
{ name: '镀锌修复工序', actionType: 521, api: 'specialSplit' },
{ name: '脱脂修复工序', actionType: 522, api: 'specialSplit' },
{ name: '拉矫修复工序', actionType: 523, api: 'specialSplit' },
{ name: '双机架修复工序', actionType: 524, api: 'specialSplit' },
{ name: '镀铬修复工序', actionType: 525, api: 'specialSplit' },
]
/**
* 酸轧加工(actionType=11)、酸轧分条(actionType=120)、所有合卷(actionType 200-210)使用 addPendingAction
* 其他工序使用 startSpecialSplit
*/
export function getProcessApi(actionType) {
if (actionType === 11 || actionType === 120 || (actionType >= 200 && actionType <= 210)) {
return 'pendingAction'
}
return 'specialSplit'
}
export function getLockValue(actionType) {
if (actionType === 11) return 3
if (actionType === 120) return 4
if (actionType >= 200 && actionType <= 210) return 5
return undefined
}
export function getProcessByName(name) {
return PROCESSES.find(p => p.name === name)
}
export function getProcessByActionType(actionType) {
return PROCESSES.find(p => p.actionType === actionType)
}