From 4e6d155ca593c32d443e859e9e513eb4a0a9aaa4 Mon Sep 17 00:00:00 2001 From: zhangdi <15053473693@163.com> Date: Tue, 6 Jan 2026 13:41:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E4=BA=A7=E7=9C=8B=E6=9D=BF=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedulingDashboard/container.vue | 133 +++--- .../schedulingException/index.vue | 36 +- .../components/orderDialog.vue | 378 ++++++++++++++++++ .../statisticalAnalysis/index.vue | 245 +++++++++++- 4 files changed, 734 insertions(+), 58 deletions(-) create mode 100644 src/views/productionSchedulingPlan/statisticalAnalysis/components/orderDialog.vue diff --git a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue index 7cdf213..6eb9b47 100644 --- a/src/views/productionSchedulingPlan/schedulingDashboard/container.vue +++ b/src/views/productionSchedulingPlan/schedulingDashboard/container.vue @@ -303,6 +303,7 @@ v-for="(task, taskIndex) in layer" :key="taskIndex" class="task-bar" + @click="showTaskDetail(task)" :class="{ 'task-bar-narrow': getWidthPercent(task.planStartTime, task.planEndTime) < 2.1, @@ -774,6 +775,20 @@ export default { } }, methods: { + showTaskDetail(task) { + console.log('showTaskDetail', task); + // 4. 通过 postMessage 通知父页面 + window.parent.postMessage( + { + type: 'TASK_DETAILS', + batchNo: task.batchNo, + woCode: task.woCode, + partCode: task.partCode, + cardNo: task.cardNo + }, + '*' // 生产环境建议指定父页面域名(如 "https://parent-domain.com"),避免安全风险 + ); + }, // 根据层索引确定窄任务文本的垂直偏移 getNarrowTaskOffsetByLayer(layerIndex) { // 偶数层在上方显示(负值),奇数层在下方显示(正值) @@ -1056,56 +1071,84 @@ export default { // 数据处理 processData(rawData) { const tasks = []; - const orders = []; - - // 遍历数组对象 - rawData.forEach(item => { - const woCode = item.woCode; // 提取车间订单号 - const woTasks = item.workOrderList || []; // 提取任务列表 - - // 提取订单信息(取第一个任务的基础信息) - if (woTasks.length > 0) { - const firstTask = woTasks[0]; - orders.push({ - woCode, - partCode: firstTask.partCode, - batchNo: firstTask.batchNo, - makeQty: firstTask.makeQty, - productIdent: firstTask.productIdent, - priorityAps: firstTask.priorityAps, - }); - } + const orders = []; + + // 遍历数组对象 + rawData.forEach(item => { + const woCode = item.woCode; // 提取车间订单号 + const woTasks = item.workOrderList || []; // 提取任务列表 + + // 提取订单信息(取第一个任务的基础信息) + if (woTasks.length > 0) { + const firstTask = woTasks[0]; + orders.push({ + woCode, + partCode: firstTask.partCode, + batchNo: firstTask.batchNo, + makeQty: firstTask.makeQty, + productIdent: firstTask.productIdent, + priorityAps: firstTask.priorityAps, + }); + } - // 处理任务数据 - // 按工序名称分组并合并任务 - const groupedTasks = {}; - woTasks.forEach(task => { - if (!groupedTasks[task.processName]) { - groupedTasks[task.processName] = []; - } - groupedTasks[task.processName].push(task); - }); - Object.values(groupedTasks).forEach(group => { - const minStartTime = Math.min(...group.map(t => this.parseTimeToHours(t.planStartTime))); - const maxEndTime = Math.max(...group.map(t => this.parseTimeToHours(t.planEndTime))); - - // 创建合并后的任务 - const mergedTask = { - ...group[0], // 保留第一个任务的基础信息 - planStartTime: this.formatHoursToTime(minStartTime), // 合并后的开始时间 - planEndTime: this.formatHoursToTime(maxEndTime), // 合并后的结束时间 - }; + // 按工序名称分组并合并任务 + const groupedTasks = {}; + woTasks.forEach(task => { + if (!groupedTasks[task.processName]) { + groupedTasks[task.processName] = []; + } + groupedTasks[task.processName].push(task); + }); - tasks.push(mergedTask); - }); + // 合并相同工序的任务 + Object.values(groupedTasks).forEach(group => { + // 按开始时间排序 + const sortedTasks = [...group].sort((a, b) => { + const aStart = this.parseTimeToHours(a.planStartTime); + const bStart = this.parseTimeToHours(b.planStartTime); + return aStart - bStart; }); - this.allOrders = orders; - this.totalOrders = orders.length; - this.taskData = tasks; + // 合并符合条件的任务 + const mergedTasks = []; + let currentMergedTask = null; - this.updateCurrentPageOrders(); - this.loading = false; + sortedTasks.forEach(task => { + if (!currentMergedTask) { + // 初始化第一个任务 + currentMergedTask = { ...task }; + } else { + // 检查当前任务的开始时间是否等于前一个任务的结束时间 + const prevEnd = this.parseTimeToHours(currentMergedTask.planEndTime); + const currStart = this.parseTimeToHours(task.planStartTime); + + if (prevEnd === currStart) { + // 合并任务:更新结束时间 + currentMergedTask.planEndTime = task.planEndTime; + } else { + // 当前任务无法合并,保存之前的合并任务,并重新初始化 + mergedTasks.push(currentMergedTask); + currentMergedTask = { ...task }; + } + } + }); + + // 保存最后一个合并任务 + if (currentMergedTask) { + mergedTasks.push(currentMergedTask); + } + + // 将合并后的任务添加到总任务列表 + tasks.push(...mergedTasks); + }); + }); + + this.allOrders = orders; + this.totalOrders = orders.length; + this.taskData = tasks; + + this.updateCurrentPageOrders(); + this.loading = false; }, formatHoursToTime(hours) { const baseDate = new Date(this.baseDate); diff --git a/src/views/productionSchedulingPlan/schedulingException/index.vue b/src/views/productionSchedulingPlan/schedulingException/index.vue index d133cf5..4a60328 100644 --- a/src/views/productionSchedulingPlan/schedulingException/index.vue +++ b/src/views/productionSchedulingPlan/schedulingException/index.vue @@ -16,6 +16,15 @@ @refresh-change="refreshChange" @on-load="onLoad" > + + 处理 + + @@ -95,8 +104,22 @@ export default { gridBtn: false, searchMenuPosition: 'right', align: 'center', - menu: false, + menu: true, column: [ + { + label: '时间', + prop: 'cycledate', + search: true, + sortable: true, + span: 12, + hide: true, + type: 'date', + searchRange: true, + startPlaceholder: '开始时间', + endPlaceholder: '结束时间', + format: 'YYYY-MM-DD', + valueFormat: 'YYYY-MM-DD', + }, { label: '异常原因', prop: 'errorInfo', @@ -114,8 +137,8 @@ export default { // span: 12, // }, { - label: '计划员', - prop: 'planUser', + label: '调度员', + prop: 'dispatcher', search: false, sortable: true, width: 150, @@ -264,6 +287,9 @@ export default { }; }, methods: { + handleFn(row){ + this.$router.push({path:'/productionSchedulingPlan/basic/equipmentCapacity'}) + }, searchReset() { this.query = {}; this.onLoad(this.page); @@ -287,6 +313,10 @@ export default { onLoad(page, params = {}) { this.loading = true; this.data = []; + if (!!params.cycledate) { + this.query.startTime = params.cycledate[0]; + this.query.endTime = params.cycledate[1]; + } getYieldOrderList( page.currentPage, page.pageSize, diff --git a/src/views/productionSchedulingPlan/statisticalAnalysis/components/orderDialog.vue b/src/views/productionSchedulingPlan/statisticalAnalysis/components/orderDialog.vue new file mode 100644 index 0000000..daca134 --- /dev/null +++ b/src/views/productionSchedulingPlan/statisticalAnalysis/components/orderDialog.vue @@ -0,0 +1,378 @@ + + + + + + + + 取 消 + 确 定 + + + + + + diff --git a/src/views/productionSchedulingPlan/statisticalAnalysis/index.vue b/src/views/productionSchedulingPlan/statisticalAnalysis/index.vue index 28f9a5a..019f9a9 100644 --- a/src/views/productionSchedulingPlan/statisticalAnalysis/index.vue +++ b/src/views/productionSchedulingPlan/statisticalAnalysis/index.vue @@ -5,12 +5,11 @@ :table-loading="loading" :data="data" v-model="form" + v-model:search="query" v-model:page="page" ref="crud" - @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" - @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @@ -20,16 +19,87 @@ {{ row.schedulingRate }}% + + + {{ + row.totalCount + }} + + + + {{ + row.schedulingCount + }} + + + + {{ + row.unschedulingCount + }} + + + + {{ + row.errorCount + }} + + + + + + + + {{ column }} + + + {{ column }} + + + {{ column }} + + + {{ column }} + + + {{ column }} + + + {{ column }} + + + {{ column }} + + + + + + + + + @@ -209,4 +420,18 @@ export default { background-color: #284c89 !important; color: #fff; } +:deep(.el-table__footer-wrapper) { + display: none; +} +.table__summary { + background-color: #fafafa; + border: 1px solid #ebeef5; + div { + text-align: center; + line-height: 23px; + border-bottom: var(--el-table-border); + padding: 0 12px; + font-size: var(--el-font-size-base); + } +}