diff --git a/src/config/api.js b/src/config/api.js index b95cd24..374d7a4 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 b5012d3..a6e8203 100644 --- a/src/views/plan/EquipmentStatus.vue +++ b/src/views/plan/EquipmentStatus.vue @@ -57,6 +57,7 @@ v-model="dialogVisible" title="轴详细信息" width="80%" + top="5vh" :before-close="handleClose">
@@ -107,10 +108,23 @@ {{ selectedAxle.total_gross_weight }}kg
-
+ +
+
+
排产信息
+
+ 产速: + {{ productionScheduleData.axle_final_average_speed }} kg/小时 +
+
+ 每轴均重: + {{ productionScheduleData.axle_final_average_weight }}kg +
+
+
@@ -414,6 +428,10 @@ const selectedTimeRange = ref('近1周'); const activeChartTab = ref('totalNumber'); const hasHistoryData = ref(false); +// 排产信息相关状态 +const productionScheduleData = ref(null); +const productionScheduleLoading = ref(false); + // 图表引用 const totalNumberChartRef = ref(null); const totalNetWeightChartRef = ref(null); @@ -430,9 +448,13 @@ const showAxleDetails = (record, equipmentCode) => { selectedEquipmentCode.value = equipmentCode; dialogVisible.value = true; - // 如果轴在运行且有规格和线盘信息,则获取历史数据 - if (record.update_time && record.specification && record.wire_disc) { + // 重置排产信息 + productionScheduleData.value = null; + + // 如果轴在运行且有规格和线盘信息,则获取历史数据和排产信息 + if (record.update_time && record.model && record.specification && record.wire_disc) { fetchHistoryData(record.model, record.specification, record.wire_disc); + fetchProductionScheduleData(record.model, record.specification, record.wire_disc, equipmentCode, record.axle_number); } else { hasHistoryData.value = false; } @@ -560,6 +582,41 @@ const fetchHistoryData = (model, specification, wireDisc) => { }); }; +// 获取排产信息数据 +const fetchProductionScheduleData = (model, specification, wireDisc, equipmentCode, axleNumber) => { + productionScheduleLoading.value = true; + + // 构建API URL + let apiUrl = `${API_CONFIG.BASE_URL}/api/plan/qb_machine_unit_stats?model=${model}&specification=${specification}&wire_disc=${wireDisc}`; + + fetch(apiUrl) + .then(response => response.json()) + .then(data => { + if (data.code === 200 && data.data && data.data.qb_machine_unit_stats && data.data.qb_machine_unit_stats.data) { + // 构建匹配键 "equipment_code-axle_number" + const matchKey = `${equipmentCode}-${axleNumber}`; + + // 查找匹配的数据 + if (data.data.qb_machine_unit_stats.data[matchKey]) { + productionScheduleData.value = data.data.qb_machine_unit_stats.data[matchKey]; + } else { + console.log(`未找到匹配的排产数据: ${matchKey}`); + productionScheduleData.value = null; + } + } else { + console.log('排产信息API返回格式不正确或无数据'); + productionScheduleData.value = null; + } + }) + .catch(error => { + console.error('排产信息API调用失败:', error); + productionScheduleData.value = null; + }) + .finally(() => { + productionScheduleLoading.value = false; + }); +}; + // 初始化图表 const initCharts = () => { // 销毁已有图表实例 @@ -960,7 +1017,7 @@ const updateCharts = () => { /* 对话框样式 */ .axle-details-container { display: flex; - min-height: 500px; + min-height: 650px; } /* 左侧面板样式 */ @@ -968,7 +1025,7 @@ const updateCharts = () => { flex: 1; padding: 10px 20px 10px 10px; border-right: 1px solid #EBEEF5; - max-height: 500px; + max-height: 650px; overflow-y: auto; } @@ -1029,13 +1086,13 @@ const updateCharts = () => { } .chart { - height: 400px; + height: 500px; width: 100%; } /* 加载状态 */ .chart-loading { - height: 400px; + height: 500px; display: flex; align-items: center; justify-content: center; @@ -1043,7 +1100,7 @@ const updateCharts = () => { /* 无数据状态 */ .no-history-data { - height: 400px; + height: 500px; display: flex; align-items: center; justify-content: center; @@ -1051,6 +1108,19 @@ const updateCharts = () => { font-size: 16px; } +/* 排产信息加载状态 */ +.production-schedule-loading { + height: 60px; + display: flex; + align-items: center; + justify-content: center; +} + +/* 排产信息面板样式 */ +.production-schedule-details { + margin-top: 10px; +} + /* 添加悬停效果,提示用户可以双击 */ .axle-item { cursor: pointer;