From b0380b3e5405987d0433a7dbdff73040c26dc611 Mon Sep 17 00:00:00 2001 From: huangjinysf Date: Fri, 19 Dec 2025 15:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E5=B7=B2=E7=BB=8F=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BA=86=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E5=8A=9F=E8=83=BD=E3=80=82=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E6=98=AF=E6=88=91=E6=89=80=E5=81=9A=E7=9A=84=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 创建了一个新的组件 EquipmentStatus.vue ,用于显示设备运行状态 在 plan/index.vue 中添加了"设备运行状态"按钮和相应的处理函数 在 api.js 中添加了设备状态API的端点配置 功能说明: 点击"设备运行状态"按钮,系统会调用 http://localhost:8100/api/plan/equipment/status/ API API返回的设备数据会以卡片形式展示,每个设备一张卡片 每个设备卡片中,根据 axle_number 分为左侧和右侧两部分显示 每个 status_records 显示为一个小方块,包含: 轴编号 规格 型号 完成度百分比 如果 status_records 为空,显示"设备当前未运行" 运行中的轴会有绿色边框标识,未运行的轴显示为灰色 --- src/config/api.js | 3 +- src/views/plan/EquipmentStatus.vue | 165 +++++++++++++++++++++++++++++ src/views/plan/index.vue | 32 ++++++ 3 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 src/views/plan/EquipmentStatus.vue diff --git a/src/config/api.js b/src/config/api.js index ef58140..d368d6f 100644 --- a/src/config/api.js +++ b/src/config/api.js @@ -8,6 +8,7 @@ export const API_CONFIG = { ENDPOINTS: { HELLO: '/api/hello', PARETO_ANALYSIS: '/api/qc/pareto', - WORKBENCH_BADNESS: '/api/qc/badness/workbench' + WORKBENCH_BADNESS: '/api/qc/badness/workbench', + EQUIPMENT_STATUS: '/api/plan/equipment/status/' } } \ No newline at end of file diff --git a/src/views/plan/EquipmentStatus.vue b/src/views/plan/EquipmentStatus.vue new file mode 100644 index 0000000..810a98f --- /dev/null +++ b/src/views/plan/EquipmentStatus.vue @@ -0,0 +1,165 @@ + + + + + \ No newline at end of file diff --git a/src/views/plan/index.vue b/src/views/plan/index.vue index aeeb5ac..87ab374 100644 --- a/src/views/plan/index.vue +++ b/src/views/plan/index.vue @@ -54,6 +54,14 @@ v-hasPermi="['warehouse:WmsImportResult:export']" >产品特征分析 + + 设备运行状态 + @@ -67,6 +75,7 @@ :selected-time-range="queryForm.selectedTimeRange" :pareto-data="paretoData" :date-range="dateRange" + :equipment-data="equipmentData" @ai-analysis-complete="handleAIAnalysisComplete" /> @@ -94,6 +103,7 @@ import { ref, reactive, shallowRef } from 'vue' import { API_CONFIG } from "@/config/api" import ParetoAnalysis from './ParetoAnalysis.vue' import ItemAnalysis from './ItemAnalysis.vue' +import EquipmentStatus from './EquipmentStatus.vue' import EmptyContent from './EmptyContent.vue' const showSearch = ref(true) @@ -113,6 +123,7 @@ const dateRange = ref({ start_date: '', end_date: '' }) +const equipmentData = ref([]) // 当前显示的组件 const currentComponent = shallowRef(EmptyContent) @@ -194,6 +205,27 @@ function handleItemAnalysis() { currentComponent.value = ItemAnalysis; } +// 设备状态按钮点击事件 +function handleEquipmentStatus() { + // 调用设备状态API + fetch(`${API_CONFIG.BASE_URL}${API_CONFIG.ENDPOINTS.EQUIPMENT_STATUS}`) + .then(response => response.json()) + .then(data => { + if (data.code === 200 && data.data && data.data.equipment_status_list) { + equipmentData.value = data.data.equipment_status_list; + message.value = data.message || '设备状态数据获取成功'; + // 切换到设备状态组件 + currentComponent.value = EquipmentStatus; + } else { + message.value = '设备状态数据获取失败'; + } + }) + .catch(error => { + console.error('设备状态API调用失败:', error); + message.value = '设备状态API调用失败'; + }); +} +