diff --git a/src/config/api.js b/src/config/api.js index 374d7a4..b95cd24 100644 --- a/src/config/api.js +++ b/src/config/api.js @@ -1,8 +1,8 @@ // API配置文件 export const API_CONFIG = { // API服务器基础地址 - // BASE_URL: 'http://192.168.110.38:8100', - BASE_URL: 'http://localhost:8100', + BASE_URL: 'http://192.168.110.38:8100', + // BASE_URL: 'http://localhost:8100', // API端点 ENDPOINTS: { diff --git a/src/views/plan/EquipmentStatus.vue b/src/views/plan/EquipmentStatus.vue index a6e8203..1cc2e76 100644 --- a/src/views/plan/EquipmentStatus.vue +++ b/src/views/plan/EquipmentStatus.vue @@ -11,13 +11,13 @@
-
{{ record.axle_number }} (不在运行)
-
{{ record.specification }}
-
{{ record.model }}
+
规格: {{ record.specification }}
+
型号: {{ record.model }}
线盘: {{ record.raw_wire_disc || '无' }}
完成度: {{ (record.degree_of_completion * 100).toFixed(0) }}%
@@ -28,13 +28,13 @@
-
{{ record.axle_number }} (不在运行)
-
{{ record.specification }}
-
{{ record.model }}
+
规格: {{ record.specification }}
+
型号: {{ record.model }}
线盘: {{ record.raw_wire_disc || '无' }}
完成度: {{ (record.degree_of_completion * 100).toFixed(0) }}%
@@ -121,10 +121,17 @@ {{ productionScheduleData.axle_final_average_weight }}kg
- +
+
当前订单
+
+ 设备轴号: + {{ selectedAxle.axle_number }} +
+
+ 总轴数: + {{ selectedAxle.total_quantity }} +
+
@@ -263,9 +270,9 @@ const getLeftAxles = (equipment) => { axle.includes('左') || axle.includes('left') ); - // 记录已经处理的轴号,避免重复显示 - const processedAxles = new Set(); + // 存储所有的轴记录,包括重复的轴号 const resultAxles = []; + const processedAxles = new Set(); // 用于跟踪已处理的轴号 // 处理运行中的记录 for (const record of equipment.status_records) { @@ -273,12 +280,27 @@ const getLeftAxles = (equipment) => { // 检查记录中包含哪些左侧轴 for (const axleNumber of validLeftAxles) { - if (record.axle_number.includes(axleNumber) && !processedAxles.has(axleNumber)) { - processedAxles.add(axleNumber); - resultAxles.push({ - ...record, - axle_number: axleNumber // 使用实际的轴号而不是复合轴号 - }); + if (record.axle_number.includes(axleNumber)) { + // 对于复合轴号(如"左1,左2")需要特殊处理 + if (record.axle_number.includes(',')) { + // 分割复合轴号,检查是否包含当前轴号 + const axleNumbers = record.axle_number.split(','); + if (axleNumbers.includes(axleNumber)) { + resultAxles.push({ + ...record, + axle_number: axleNumber, // 使用单个轴号 + axle_count: axleNumbers.length // 更新轴数为实际数量 + }); + processedAxles.add(axleNumber); + } + } else { + // 单个轴号 + resultAxles.push({ + ...record, + axle_number: axleNumber // 使用实际的轴号 + }); + processedAxles.add(axleNumber); + } } } } @@ -300,11 +322,19 @@ const getLeftAxles = (equipment) => { } } - // 按照有效轴号列表的顺序排序 + // 按照有效轴号列表的顺序排序,相同轴号的记录会排在一起 return resultAxles.sort((a, b) => { const aIndex = validLeftAxles.indexOf(a.axle_number); const bIndex = validLeftAxles.indexOf(b.axle_number); - return aIndex - bIndex; + if (aIndex !== bIndex) { + return aIndex - bIndex; + } + // 如果轴号相同,按更新时间排序(最新的在前) + if (a.update_time && b.update_time) { + return new Date(b.update_time) - new Date(a.update_time); + } + // 如果一个有更新时间一个没有,有更新时间的在前 + return a.update_time ? -1 : 1; }); }; @@ -332,9 +362,9 @@ const getRightAxles = (equipment) => { axle.includes('右') || axle.includes('right') ); - // 记录已经处理的轴号,避免重复显示 - const processedAxles = new Set(); + // 存储所有的轴记录,包括重复的轴号 const resultAxles = []; + const processedAxles = new Set(); // 用于跟踪已处理的轴号 // 处理运行中的记录 for (const record of equipment.status_records) { @@ -342,12 +372,27 @@ const getRightAxles = (equipment) => { // 检查记录中包含哪些右侧轴 for (const axleNumber of validRightAxles) { - if (record.axle_number.includes(axleNumber) && !processedAxles.has(axleNumber)) { - processedAxles.add(axleNumber); - resultAxles.push({ - ...record, - axle_number: axleNumber // 使用实际的轴号而不是复合轴号 - }); + if (record.axle_number.includes(axleNumber)) { + // 对于复合轴号(如"右1,右2")需要特殊处理 + if (record.axle_number.includes(',')) { + // 分割复合轴号,检查是否包含当前轴号 + const axleNumbers = record.axle_number.split(','); + if (axleNumbers.includes(axleNumber)) { + resultAxles.push({ + ...record, + axle_number: axleNumber, // 使用单个轴号 + axle_count: axleNumbers.length // 更新轴数为实际数量 + }); + processedAxles.add(axleNumber); + } + } else { + // 单个轴号 + resultAxles.push({ + ...record, + axle_number: axleNumber // 使用实际的轴号 + }); + processedAxles.add(axleNumber); + } } } } @@ -369,11 +414,19 @@ const getRightAxles = (equipment) => { } } - // 按照有效轴号列表的顺序排序 + // 按照有效轴号列表的顺序排序,相同轴号的记录会排在一起 return resultAxles.sort((a, b) => { const aIndex = validRightAxles.indexOf(a.axle_number); const bIndex = validRightAxles.indexOf(b.axle_number); - return aIndex - bIndex; + if (aIndex !== bIndex) { + return aIndex - bIndex; + } + // 如果轴号相同,按更新时间排序(最新的在前) + if (a.update_time && b.update_time) { + return new Date(b.update_time) - new Date(a.update_time); + } + // 如果一个有更新时间一个没有,有更新时间的在前 + return a.update_time ? -1 : 1; }); }; @@ -959,18 +1012,30 @@ const updateCharts = () => { font-size: 12px; color: #606266; margin-bottom: 2px; + background-color: rgba(64, 158, 255, 0.1); + padding: 2px 4px; + border-radius: 3px; + display: inline-block; } .axle-model { font-size: 12px; color: #909399; margin-bottom: 2px; + background-color: rgba(103, 194, 58, 0.1); + padding: 2px 4px; + border-radius: 3px; + display: inline-block; } .axle-disc { font-size: 12px; color: #606266; margin-bottom: 2px; + background-color: rgba(230, 162, 60, 0.1); + padding: 2px 4px; + border-radius: 3px; + display: inline-block; } .axle-progress { @@ -1121,6 +1186,11 @@ const updateCharts = () => { margin-top: 10px; } +/* 当前订单面板样式 */ +.current-order-details { + margin-top: 10px; +} + /* 添加悬停效果,提示用户可以双击 */ .axle-item { cursor: pointer;