Browse Source

数据监控接口字段修改

develop
fuguobin 9 months ago
parent
commit
583bac2695
  1. 7
      src/views/dashboard/components/BarChart.vue
  2. 61
      src/views/dashboard/components/LineChart.vue
  3. 7
      src/views/dashboard/components/returnChart.vue
  4. 8
      src/views/details/index.vue

7
src/views/dashboard/components/BarChart.vue

@ -7,6 +7,7 @@ import { randomColor, endTime, debounce } from '@/utils/index';
import { getSupplyTemperatureRanking } from '@/api/dashboard/index';
// import { Ref } from 'vue';
// const complaintRef: Ref<HTMLElement | any> = ref(null);
const complaintRef = ref();
import useCounter from '@/store/modules/date';
const counterStore = useCounter();
const yearMonthDay = ref();
@ -100,7 +101,7 @@ function dataInfo(data) {
// ];
const colors = ['#5470c6', '#91cc75', '#fac858', '#1a94bc', '#f26b1f', '#5bae23'];
const ccolors = {};
const chart = echarts.init(document.getElementById('stackedLine'));
const chart = echarts.init(complaintRef.value);
mapEcharts.value = chart;
var updateFrequency = 1000; //
var years = [];
@ -285,7 +286,7 @@ function dataInfo(data) {
options.yAxis.data = year.cname.split(',');
options.series[0].data = year.cut.split(',');
options.graphic.elements[0].style.text = year.cdate;
const chart = echarts.init(document.getElementById('stackedLine'));
// const chart = echarts.init(complaintRef.value);
chart.setOption(options);
}
//
@ -330,7 +331,7 @@ onUnmounted(() => {
// });
// });
// console.log(options.series);
// const chart = echarts.init(document.getElementById('stackedLine'));
// const chart = echarts.init(complaintRef.value);
// chart.setOption(options);
// } else {
// clearTimeout(timer.value);

61
src/views/dashboard/components/LineChart.vue

@ -53,11 +53,11 @@ const options = {
},
dataset: {
source: [
['product', '2024-01-01', '2024-01-02', '2024-01-03', '2024-01-04', '2024-01-05', '2024-01-06', '2024-01-07'],
['供温', 59.2, 78.9, 87.8, 79.5, 52.4, 90.7, 55],
['回温', 42.0, 60.1, 62.8, 55.9, 30.2, 79.2, 20],
['供温均温', 52, 77, 75, 70.1, 53.4, 50, 40],
['回温均温', 40, 52, 61, 49, 20.4, 61.8, 10]
// ['product', '2024-01-01', '2024-01-02', '2024-01-03', '2024-01-04', '2024-01-05', '2024-01-06', '2024-01-07'],
// ['', 59.2, 78.9, 87.8, 79.5, 52.4, 90.7, 55],
// ['', 42.0, 60.1, 62.8, 55.9, 30.2, 79.2, 20],
// ['', 52, 77, 75, 70.1, 53.4, 50, 40],
// ['', 40, 52, 61, 49, 20.4, 61.8, 10]
]
},
xAxis: {
@ -70,7 +70,7 @@ const options = {
yAxis: [
{
type: 'value',
name: '温度(℃)',
name: '',
scale: true, //
nameTextStyle: {
color: '#000',
@ -102,32 +102,40 @@ const options = {
type: 'line',
smooth: true,
seriesLayoutBy: 'row',
emphasis: {
focus: 'series'
tooltip: {
valueFormatter: function (value: any) {
return value + ' ℃';
}
}
},
{
type: 'line',
smooth: true,
seriesLayoutBy: 'row',
emphasis: {
focus: 'series'
tooltip: {
valueFormatter: function (value: any) {
return value + ' ℃';
}
}
},
{
type: 'line',
smooth: true,
seriesLayoutBy: 'row',
emphasis: {
focus: 'series'
tooltip: {
valueFormatter: function (value: any) {
return value + ' ℃';
}
}
},
{
type: 'line',
smooth: true,
seriesLayoutBy: 'row',
emphasis: {
focus: 'series'
tooltip: {
valueFormatter: function (value: any) {
return value + ' ℃';
}
}
}
]
@ -135,24 +143,33 @@ const options = {
onMounted(() => {
//
const chart = echarts.init(document.getElementById(props.id) as HTMLDivElement);
chart.setOption(options);
// const chart = echarts.init(document.getElementById(props.id) as HTMLDivElement);
// chart.setOption(options);
getFirstLine();
//
window.addEventListener('resize', () => {
chart.resize();
});
// window.addEventListener('resize', () => {
// chart.resize();
// });
});
function getFirstLine() {
//
const params = {};
getFirstLineApi().then((res: any) => {
if (res.code === 200 && Object.keys(res.data).length != 0) {
options.dataset.source = res.data.source;
options.yAxis[0].name = `单位(${res.data.unit})`;
const chart = echarts.init(document.getElementById(props.id) as HTMLDivElement);
if (res.code === 200 && Object.keys(res.data).length != 0) {
options.dataset.source = res.data;
options.yAxis[0].name = '单位(℃)';
chart.setOption(options);
} else {
chart.showLoading({
text: '暂无数据',
color: '#fff',
textColor: '#303133',
maskColor: '#fff',
fontSize: 16,
zlevel: 0
});
}
});
}

7
src/views/dashboard/components/returnChart.vue

@ -7,6 +7,7 @@ import { randomColor, endTime, debounce } from '@/utils/index';
import { getBackTemperatureRanking } from '@/api/dashboard/index';
// import { Ref } from 'vue';
// const complaintRef: Ref<HTMLElement | any> = ref(null);
const complaintRef = ref();
import useCounter from '@/store/modules/date';
const counterStore = useCounter();
const yearMonthDay = ref();
@ -100,7 +101,7 @@ function dataInfo(data) {
// ];
const colors = ['#5470c6', '#91cc75', '#fac858', '#1a94bc', '#f26b1f', '#5bae23'];
const ccolors = {};
const chart = echarts.init(document.getElementById('returnChart'));
const chart = echarts.init(complaintRef.value);
mapEcharts.value = chart;
var updateFrequency = 1000; //
var years = [];
@ -285,7 +286,7 @@ function dataInfo(data) {
options.yAxis.data = year.cname.split(',');
options.series[0].data = year.cut.split(',');
options.graphic.elements[0].style.text = year.cdate;
const chart = echarts.init(document.getElementById('returnChart'));
// const chart = echarts.init(complaintRef.value);
chart.setOption(options);
}
//
@ -330,7 +331,7 @@ onUnmounted(() => {
// });
// });
// console.log(options.series);
// const chart = echarts.init(document.getElementById('returnChart'));
// const chart = echarts.init(complaintRef.value);
// chart.setOption(options);
// } else {
// clearTimeout(timer.value);

8
src/views/details/index.vue

@ -895,6 +895,14 @@ function getDevicePolling() {
params.stepType = '3';
params.queryType = 2;
console.log(params);
if (filterForm.paramCode === '') {
ElMessage({
message: '请选择曲线参数',
type: 'warning'
});
clearTimeout(timer.value);
return;
}
getDeviceInfosPolling(params).then((res: any) => {
if (res.code === 200) {
if (isCurrentRoute.value) {

Loading…
Cancel
Save