Commit fc501814 authored by 李纪文's avatar 李纪文

fix: 增加统计查看

parent 14a4cb57
...@@ -8,7 +8,7 @@ const baseURI = typeof DUMI_TYPE !== 'undefined' && DUMI_TYPE === 'dumi' ? '/api ...@@ -8,7 +8,7 @@ const baseURI = typeof DUMI_TYPE !== 'undefined' && DUMI_TYPE === 'dumi' ? '/api
// 获取统计数据 // 获取统计数据
export function getStatisticsInfo(data) { export function getStatisticsInfo(data) {
return request({ return request({
url: `${baseURI}/PandaMonitor/Monitor/Device/EquipmentDataReport`, url: `${baseURI}/PandaMonitor/Monitor/Device/EquipmentDataReportByBack`,
method: REQUEST_METHOD_POST, method: REQUEST_METHOD_POST,
data, data,
}); });
......
...@@ -41,8 +41,8 @@ const StatisticalHistoryView = (props) => { ...@@ -41,8 +41,8 @@ const StatisticalHistoryView = (props) => {
// 自定义时间类型 // 自定义时间类型
const onPickerChange = (value) => { const onPickerChange = (value) => {
setPicker(value); setPicker(value);
const start = moment(dateTime).subtract(2, value).format('YYYY-MM-DD 00:00:00'); let start = moment(dateTime).subtract(2, value).startOf(value).format('YYYY-MM-DD 00:00:00');
const end = moment(dateTime).format('YYYY-MM-DD 23:59:59'); let end = moment(dateTime).endOf(value).format('YYYY-MM-DD 23:59:59');
setTime({ startDate: start, endDate: end }); setTime({ startDate: start, endDate: end });
}; };
...@@ -156,8 +156,9 @@ const StatisticalHistoryView = (props) => { ...@@ -156,8 +156,9 @@ const StatisticalHistoryView = (props) => {
const dataTable = data0.map((item, index) => { const dataTable = data0.map((item, index) => {
return { return {
...item, ...item,
value1: data1[index]?.value, value0: item?.value === 0 || item?.value ? item?.value : '-',
value2: data1[index]?.value, value1: data1[index]?.value === 0 || data1[index]?.value ? data1[index]?.value : '-',
value2: data2[index]?.value === 0 || data2[index]?.value ? data2[index]?.value : '-',
}; };
}); });
renderChart(dataChart, data); renderChart(dataChart, data);
...@@ -169,11 +170,14 @@ const StatisticalHistoryView = (props) => { ...@@ -169,11 +170,14 @@ const StatisticalHistoryView = (props) => {
const { unit, dName } = data; const { unit, dName } = data;
const series = []; const series = [];
dataInfo.data.forEach((item, index) => { dataInfo.data.forEach((item, index) => {
const config = dName.indexOf('流量') > -1 ? { areaStyle: {} } : {}; const config = !index && dName.indexOf('流量') > -1 ? { areaStyle: {} } : {};
const style = index ? {lineStyle:{normal:{type:'dashed'}}} : {}
const list = { const list = {
name: dataInfo.name[index], name: dataInfo.name[index],
type: 'line', type: 'line',
smooth: true,
...config, ...config,
...style,
data: item.map((arr) => { data: item.map((arr) => {
return { return {
name: arr.pt, name: arr.pt,
...@@ -198,8 +202,8 @@ const StatisticalHistoryView = (props) => { ...@@ -198,8 +202,8 @@ const StatisticalHistoryView = (props) => {
containLabel: true, containLabel: true,
left: 10, left: 10,
right: 10, right: 10,
top: 10, // top: 20,
bottom: 10 bottom: 10,
}, },
toolbox: { toolbox: {
show: false, show: false,
...@@ -235,7 +239,7 @@ const StatisticalHistoryView = (props) => { ...@@ -235,7 +239,7 @@ const StatisticalHistoryView = (props) => {
}; };
const renderTable = (dataInfo, timeName) => { const renderTable = (dataInfo, timeName) => {
const dataIndex = ['value', 'value1', 'value2']; const dataIndex = ['value0', 'value1', 'value2'];
const column1 = [ const column1 = [
{ {
title: '时间', title: '时间',
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
} }
&-chart { &-chart {
flex: 3; flex: 4;
overflow: hidden; overflow: hidden;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment