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 @@ + + + + + + {{ equipment.equipment_code }} + + + + + + {{ record.axle_number }} + {{ record.specification }} + {{ record.model }} + 完成度: {{ (record.degree_of_completion * 100).toFixed(0) }}% + + + + + {{ record.axle_number }} + {{ record.specification }} + {{ record.model }} + 完成度: {{ (record.degree_of_completion * 100).toFixed(0) }}% + + + + + 设备当前未运行 + + + + + + + + + + \ 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调用失败'; + }); +} +