initWarnHistorybyWaterId(item) {
this.xAxisData = [];
this.seriesData = [];
// 循环获取所有设备报警信息
this.warringInfos = new Map();
let langth = [];
let a;
let count = 0;
const promiseQueue = [];
if (item.data) {
this.hasData = true
item.data.forEach((ele) => {
a = false;
let query = {};
query.deviceCode = ele.deviceInfo.deviceCode;
(query.pageNum = 1), (query.pageSize = 10);
// 获取报警信息
let a = this.function2(query);
promiseQueue.push(a);
});
Promise.all(promiseQueue).then((values) => {
for (const [key, value] of this.warringInfos) {
this.xAxisData.push(key);
this.seriesData.push(value);
}
this.iniEcharts();
});
}else{
this.hasData = false
}
},
function2(query) {
let that = this;
// 你的逻辑代码
return amlAlarmList(query).then((resp) => {
if (resp.rows.length > 0) {
resp.rows.forEach((element) => {
if (that.warringInfos.has(element.warnItemName)) {
that.warringInfos.set(
element.warnItemName,
that.warringInfos.get(element.warnItemName) + 1
);
} else {
let str = element.warnItemName;
that.warringInfos.set(element.warnItemName, 1);
}
});
}
});
},