diff --git a/src/views/plan/EnamellingMachineStatus.vue b/src/views/plan/EnamellingMachineStatus.vue index 9c81685..9d7f155 100644 --- a/src/views/plan/EnamellingMachineStatus.vue +++ b/src/views/plan/EnamellingMachineStatus.vue @@ -185,6 +185,23 @@ destroy-on-close @close="closeChart" > +
+ + + + + + + + +
时间范围: @@ -261,6 +278,8 @@ const selectedCompletionLevel = ref('all') // 默认显示全部 const salesChartLoading = ref(false) const historyChartLoading = ref(false) +const wmsData = ref([]) +const wmsDataLoading = ref(false) const salesData = ref([]) const historyData = ref([]) const hasSalesData = ref(false) @@ -521,11 +540,13 @@ const showSalesHistory = (row) => { salesData.value = []; historyData.value = []; + wmsData.value = []; hasSalesData.value = false; hasHistoryData.value = false; fetchSalesData(row.model, row.specification); fetchHistoryData(row.model, row.specification, row.wire_disc); + fetchWmsData(row.model, row.specification); }; // 方法:关闭图表 @@ -635,6 +656,34 @@ const fetchHistoryData = (model, specification, wireDisc) => { }); }; +// 获取WMS数据 +const fetchWmsData = (model, specification) => { + wmsDataLoading.value = true; + + const apiUrl = `${API_CONFIG.BASE_URL}/api/wms/records/model-spec?model=${model}&specification=${specification}`; + console.log('WMS API URL:', apiUrl); + + fetch(apiUrl) + .then(response => response.json()) + .then(data => { + console.log('WMS API Response:', data); + if (data.code === 200 && data.data && data.data.records) { + wmsData.value = data.data.records; + console.log('WMS Data:', wmsData.value); + } else { + wmsData.value = []; + console.log('WMS data is empty or error'); + } + }) + .catch(error => { + console.error('WMS数据API调用失败:', error); + wmsData.value = []; + }) + .finally(() => { + wmsDataLoading.value = false; + }); +}; + // 初始化销售图表 const initSalesChart = (retryCount = 0) => { if (!hasSalesData.value && !hasHistoryData.value) {