From f444cb2e1536986ac5055bccbb11a7a83b91fdae Mon Sep 17 00:00:00 2001 From: hzz Date: Thu, 7 Dec 2023 16:58:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0echarts=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/MicroExhibition/index.vue | 36 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/views/MicroExhibition/index.vue b/src/views/MicroExhibition/index.vue index 35b157a..55d8156 100644 --- a/src/views/MicroExhibition/index.vue +++ b/src/views/MicroExhibition/index.vue @@ -118,21 +118,8 @@ let stepList = reactive([ }, ]) let hzdata = ref([]) -let xData = ref(["1171902", - "10201557", - "1171701", - "1170304"]) +let xData = ref([]) let seriesData = ref([ - { - type: 'bar', - "data": [80, 100, 80, 80], - "name": "计划产量" - }, - { - type: 'bar', - "data": [0, 444, 14, 1912], - "name": "实际产量" - } ]) let list = [ [1, '自动缝纫机', 29, 1, '95%', '12min'], @@ -141,7 +128,26 @@ let list = [ [1, '自动缝纫机', 29, 1, '95%', '12min'], [1, '自动缝纫机', 29, 1, '95%', '12min'],] + //获取echarts数据 +function getDeviceProduction() { + getmDeviceProduction().then((res: any) => { + if (res.code == 200) { + let data = res.data + console.log(data.series, 'data.series'); + + seriesData.value = data.series.map(item=>{ + return { + name: item.name == '计划完成' ? '计划产量' : '实际产量', + type: 'bar', + data: item.data + } + }) + xData.value = data.xData + } + }) +} +//获取设备列表 function getmDevList() { getmDeviceList().then((res: any) => { if (res.code == 200) { @@ -301,7 +307,7 @@ function errWebsocket(val) { onMounted(() => { - + getDeviceProduction() getmDevList() connectWebsocket(null, null, getWebsocket, errWebsocket) document.getElementById('app').style.backgroundColor = 'rgba(0, 11, 18, 1)'