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