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)'