Commit 9990e54b authored by 李纪文's avatar 李纪文

fix: 修改历史回放

parent 1230e64f
...@@ -25,7 +25,7 @@ let twoID = ''; ...@@ -25,7 +25,7 @@ let twoID = '';
let myDiagram = null; let myDiagram = null;
let editionArr = []; let editionArr = [];
const guidAggre = {}; const guidAggre = {};
const bindData = []; let bindData = [];
const stationList = []; const stationList = [];
let historyData = []; // 历史数据 let historyData = []; // 历史数据
...@@ -554,6 +554,7 @@ const ConfigurationView = (props) => { ...@@ -554,6 +554,7 @@ const ConfigurationView = (props) => {
nodeDataArray: [], nodeDataArray: [],
linkDataArray: [], linkDataArray: [],
}; };
bindData = [];
devices.forEach((item, index) => { devices.forEach((item, index) => {
const name = `设备${stationList[index]}`; const name = `设备${stationList[index]}`;
bindData.push({ bindData.push({
...@@ -575,7 +576,8 @@ const ConfigurationView = (props) => { ...@@ -575,7 +576,8 @@ const ConfigurationView = (props) => {
speed = 0; speed = 0;
const json = JSON.parse(myDiagram.model.toJson()); const json = JSON.parse(myDiagram.model.toJson());
const jsonCopy = JSON.parse(JSON.stringify(json)); const jsonCopy = JSON.parse(JSON.stringify(json));
const acrossTables = bindData.map((list) => { const acrossTables = [];
bindData.map((list) => {
let sensors = []; let sensors = [];
jsonCopy.nodeDataArray.forEach((item) => { jsonCopy.nodeDataArray.forEach((item) => {
item.shName && item.stationName === list.name && sensors.push(item.shName); item.shName && item.stationName === list.name && sensors.push(item.shName);
...@@ -583,11 +585,12 @@ const ConfigurationView = (props) => { ...@@ -583,11 +585,12 @@ const ConfigurationView = (props) => {
jsonCopy.linkDataArray.forEach((item) => { jsonCopy.linkDataArray.forEach((item) => {
item.shName && item.stationName === list.name && sensors.push(item.shName); item.shName && item.stationName === list.name && sensors.push(item.shName);
}); });
return { if (sensors.length)
deviceType: list.type, acrossTables.push({
sensors: Array.from(new Set(sensors)).join(','), deviceType: list.type,
deviceCode: list.code, sensors: Array.from(new Set(sensors)).join(','),
}; deviceCode: list.code,
});
}); });
const params = { const params = {
isDilute: true, isDilute: true,
...@@ -605,7 +608,7 @@ const ConfigurationView = (props) => { ...@@ -605,7 +608,7 @@ const ConfigurationView = (props) => {
let timeArr = []; let timeArr = [];
historyData.forEach((item) => { historyData.forEach((item) => {
const timeList = item.dataModel.map((list) => { const timeList = item.dataModel.map((list) => {
return moment(list.pt).format('yyyy-MM-DD HH:mm'); return moment(list.pt).format('yyyy-MM-DD HH:mm:ss');
}); });
timeArr = timeArr.concat(timeList); timeArr = timeArr.concat(timeList);
}); });
...@@ -638,7 +641,7 @@ const ConfigurationView = (props) => { ...@@ -638,7 +641,7 @@ const ConfigurationView = (props) => {
return arr.code === list.stationCode; return arr.code === list.stationCode;
}); });
const pvList = list.dataModel.find((arr) => { const pvList = list.dataModel.find((arr) => {
return moment(arr.pt).format('yyyy-MM-DD HH:mm') === time; return moment(arr.pt).format('yyyy-MM-DD HH:mm:ss') === time;
}); });
if (!bindList || item.stationName !== bindList.name) return false; if (!bindList || item.stationName !== bindList.name) return false;
if ( if (
...@@ -680,7 +683,7 @@ const ConfigurationView = (props) => { ...@@ -680,7 +683,7 @@ const ConfigurationView = (props) => {
return arr.code === list.stationCode; return arr.code === list.stationCode;
}); });
const pvList = list.dataModel.find((arr) => { const pvList = list.dataModel.find((arr) => {
return moment(arr.pt).format('yyyy-MM-DD HH:mm') === time; return moment(arr.pt).format('yyyy-MM-DD HH:mm:ss') === time;
}); });
if (!bindList || item.stationName !== bindList.name) return false; if (!bindList || item.stationName !== bindList.name) return false;
if ( if (
...@@ -735,7 +738,7 @@ const ConfigurationView = (props) => { ...@@ -735,7 +738,7 @@ const ConfigurationView = (props) => {
speed = speed + 1; speed = speed + 1;
if (speed >= timeData.length) { if (speed >= timeData.length) {
play = false; play = false;
loopLoadMethod(timeData.pop()); loopLoadMethod(timeData.slice(-1)[0]);
return false; return false;
} }
chartHistoryDataRender(historyData); chartHistoryDataRender(historyData);
......
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