添加echarts接口联调

This commit is contained in:
hzz 2023-12-07 16:58:49 +08:00
parent b82917ebb4
commit f444cb2e15

View File

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