|
|
@ -4,6 +4,9 @@ const moment = require("../../../utils/moment"); |
|
|
|
|
|
|
|
function setOption(chart, data1, data2,xdata) { |
|
|
|
const option = { |
|
|
|
tooltip: { |
|
|
|
trigger: 'item' |
|
|
|
}, |
|
|
|
legend: { |
|
|
|
data:['设备故障率', '设备完好率'], |
|
|
|
top: '-5px' |
|
|
@ -162,9 +165,9 @@ Page({ |
|
|
|
}, |
|
|
|
//分类统计设备,异常-正常-未知个数
|
|
|
|
classifiedStatistics:function(list,len){ |
|
|
|
let normal = 0; |
|
|
|
let normal = len; |
|
|
|
let abnormal = 0; |
|
|
|
let unknown = len; |
|
|
|
let unknown = 0; |
|
|
|
list.forEach((item) => { |
|
|
|
const inspectContent = item.alarm ? (item?.points?.inspectContent || []) : []; |
|
|
|
if (inspectContent && inspectContent.length && Array.isArray(inspectContent)&&inspectContent.some(o=>o.deviceId)) { |
|
|
@ -175,28 +178,28 @@ Page({ |
|
|
|
const state = item.patrolRecordIssueHandles[0].state; |
|
|
|
if (state === 6) { |
|
|
|
// 正常
|
|
|
|
normal += 1; |
|
|
|
unknown-=1 |
|
|
|
// normal += 1;
|
|
|
|
// unknown-=1
|
|
|
|
} else if (state === 5) { |
|
|
|
// 未知
|
|
|
|
// unknown += 1;
|
|
|
|
unknown += 1; |
|
|
|
normal -= 1; |
|
|
|
} else { |
|
|
|
// 异常
|
|
|
|
abnormal += 1; |
|
|
|
unknown-=1 |
|
|
|
normal-=1 |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 正常
|
|
|
|
normal += 1; |
|
|
|
unknown-=1 |
|
|
|
// normal += 1;
|
|
|
|
// unknown-=1
|
|
|
|
} |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
console.log('sssss',normal,unknown,abnormal) |
|
|
|
return {normal,unknown,abnormal} |
|
|
|
}, |
|
|
|
//统计每天异常-正常-未知个数
|
|
|
@ -210,8 +213,8 @@ Page({ |
|
|
|
// 初始化每一天的统计为零
|
|
|
|
dateRange.forEach((date) => { |
|
|
|
dailyCounts[date] = { |
|
|
|
normal: 0, |
|
|
|
unknown: len, |
|
|
|
normal: len, |
|
|
|
unknown: 0, |
|
|
|
abnormal: 0 |
|
|
|
}; |
|
|
|
}); |
|
|
@ -221,13 +224,14 @@ Page({ |
|
|
|
if (dailyCounts[inspectionDate] !== undefined) { |
|
|
|
const status = item.patrolRecordIssueHandles.length ? item.patrolRecordIssueHandles[0].state : 6; |
|
|
|
if (status === 6) { |
|
|
|
dailyCounts[inspectionDate].normal += 1; |
|
|
|
dailyCounts[inspectionDate].unknown -= 1; |
|
|
|
// dailyCounts[inspectionDate].normal += 1;
|
|
|
|
// dailyCounts[inspectionDate].unknown -= 1;
|
|
|
|
} else if (status === 5) { |
|
|
|
// dailyCounts[inspectionDate].unknown += 1;
|
|
|
|
dailyCounts[inspectionDate].unknown += 1; |
|
|
|
dailyCounts[inspectionDate].normal -= 1; |
|
|
|
} else { |
|
|
|
dailyCounts[inspectionDate].abnormal += 1; |
|
|
|
dailyCounts[inspectionDate].unknown -= 1; |
|
|
|
dailyCounts[inspectionDate].normal -= 1; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|