Browse Source

feat:fix bugs

master
zhaobing’ 1 year ago
parent
commit
369060f391
  1. 3
      weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.js
  2. 34
      weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js
  3. 9
      weapp/package/report/report.js

3
weapp/package/deviceBigdataGraph/lifeWarning/lifeWarning.js

@ -11,6 +11,9 @@ const moment = require("../../../utils/moment");
function setOption (chart, seriesData, xData) { function setOption (chart, seriesData, xData) {
const option = { const option = {
tooltip: {
trigger: 'item'
},
grid: { grid: {
top: '5%', top: '5%',
left: '3%', left: '3%',

34
weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js

@ -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;
} }
} }
}); });

9
weapp/package/report/report.js

@ -63,7 +63,10 @@ Page({
devicesList:that.data.data[e.detail.value].devices, devicesList:that.data.data[e.detail.value].devices,
scenePointId:that.data.data[e.detail.value].id, scenePointId:that.data.data[e.detail.value].id,
// patrolTemplate:[] // patrolTemplate:[]
patrolTemplateIndex:null
}) })
}, },
// 预览图片 // 预览图片
previewImg: function (e) { previewImg: function (e) {
@ -80,6 +83,7 @@ Page({
}, },
//结构物改变函数 //结构物改变函数
structChange(event) { structChange(event) {
// console.log('pointIndex',this.data.pointIndex)
const that = this const that = this
that.setData({ that.setData({
structListIndex: event.detail.value, structListIndex: event.detail.value,
@ -87,8 +91,8 @@ Page({
pointList:[],//选择结构物后先置空先前的点位列表 pointList:[],//选择结构物后先置空先前的点位列表
patrolTemplate:[], patrolTemplate:[],
inspectContentArr:[], inspectContentArr:[],
patrolTemplateIndex:undefined, patrolTemplateIndex:null,
pointIndex:undefined pointIndex:null
}) })
const projectId=that.data?.structList[event.detail.value]?.id const projectId=that.data?.structList[event.detail.value]?.id
@ -110,6 +114,7 @@ Page({
name:item.name name:item.name
} }
}) })
// console.log('patrolTemplateIndex',this.data.patrolTemplateIndex)
that.setData({pointList:pointList,data:res}) that.setData({pointList:pointList,data:res})
}else { }else {
wx.hideLoading(); wx.hideLoading();

Loading…
Cancel
Save