| | |
| | | endTime: undefined, |
| | | }); |
| | | const queryParams = reactive({ |
| | | pointNo: "", |
| | | start: undefined, |
| | | end: undefined, |
| | | codes: [], |
| | | startDate: undefined, |
| | | endDate: undefined, |
| | | }) |
| | | function getYMDHMS() { |
| | | let timestamp = new Date().getTime(); |
| | |
| | | visible.value = true; |
| | | if (dataForm.value.id) { |
| | | try { |
| | | queryParams.pointNo=dataForm.value.pointNo; |
| | | queryParams.start = dataForm.value.startTime; |
| | | queryParams.end = dataForm.value.endTime; |
| | | queryParams.codes=[dataForm.value.pointNo]; |
| | | queryParams.startDate = dataForm.value.startTime; |
| | | queryParams.endDate = dataForm.value.endTime; |
| | | const data = await DaPoint.getPointDaChart(queryParams) |
| | | const dataList = []; |
| | | const xAxisData = []; |
| | | data[dataForm.value.pointNo].forEach(function (value) { |
| | | // 判断数据是否为布尔型 |
| | | if (typeof value["value"] === "boolean") { |
| | | value["value"] = value["value"]? 1 : 0; |
| | | } |
| | | dataList.push([value["time"], value["value"]]); |
| | | xAxisData.push(value["time"]); |
| | | }); |
| | | let seriesData = []; |
| | | seriesData.push({ |
| | | name: "采集值", |
| | | type: "line", |
| | | data: dataList, |
| | | showSymbol: false, |
| | | smooth: false, |
| | | lineStyle: { |
| | | normal: { |
| | | color: "#5B8FF9", |
| | | width: 1, |
| | | let seriesData = [] |
| | | data.series.forEach(item => { |
| | | seriesData.push({ |
| | | name: item.name, |
| | | type: "line", |
| | | data: item.data, |
| | | showSymbol: true, |
| | | smooth: false, |
| | | lineStyle: { |
| | | normal: { |
| | | color: "#5B8FF9", |
| | | width: 1, |
| | | }, |
| | | }, |
| | | }, |
| | | }); |
| | | }); |
| | | }) |
| | | |
| | | myChart = echarts.init(chartDom.value); |
| | | const option = { |
| | | title: { |
| | |
| | | xAxis: { |
| | | type: "category", |
| | | boundaryGap: false, |
| | | data: xAxisData, |
| | | data: data.categories, |
| | | }, |
| | | yAxis: { |
| | | type: "value", |
| | |
| | | ], |
| | | series: seriesData, |
| | | }; |
| | | myChart.clear(); |
| | | myChart.setOption(option); |
| | | } catch (error) { |
| | | console.error(error) |