From 436ec9663f923880b2fb2d28bf1d324b6b5c26b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Fri, 27 Oct 2023 19:38:38 +0800 Subject: [PATCH] feat:fix bugs --- .../deviceBigdataGraph/deviceBigdataGraph.js | 5 +++-- .../statusDetail/statusDetail.js | 4 +++- weapp/package/report/report.js | 14 ++++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/weapp/package/deviceBigdataGraph/deviceBigdataGraph.js b/weapp/package/deviceBigdataGraph/deviceBigdataGraph.js index 19adc3a..adeab48 100644 --- a/weapp/package/deviceBigdataGraph/deviceBigdataGraph.js +++ b/weapp/package/deviceBigdataGraph/deviceBigdataGraph.js @@ -148,7 +148,6 @@ Page({ maxInspectionTimeByPointId[pointId] = inspectionTime; } }); - console.log('maxInspectionTimeByPointId',maxInspectionTimeByPointId) // 过滤数据以获取相同pointId中inspectionTime最大的记录 const filteredData = res.filter((item) => { const {pointId,inspectionTime} = item; @@ -158,7 +157,7 @@ Page({ const devices=that.data.deviceList.map(item=>{return {id:item.id,name:item.name,status:'unknown'}}) filteredData.forEach((item) => { const inspectContent =item.alarm?(item?.points?.inspectContent || []):[]; - if (inspectContent && inspectContent.length&&Array.isArray(inspectContent)) { + if (inspectContent && inspectContent.length&&Array.isArray(inspectContent)&&inspectContent.some(o=>o.deviceId)) { inspectContent.forEach((p) => { // 如果设备有报警 if (p.alarm) { @@ -180,6 +179,8 @@ Page({ normal += 1; } }); + }else{ + unknown += 1; } }); //更新devices diff --git a/weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js b/weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js index 3c41878..e56dfe2 100644 --- a/weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js +++ b/weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js @@ -167,7 +167,7 @@ Page({ let unknown = len; list.forEach((item) => { const inspectContent = item.alarm ? (item?.points?.inspectContent || []) : []; - if (inspectContent && inspectContent.length && Array.isArray(inspectContent)) { + if (inspectContent && inspectContent.length && Array.isArray(inspectContent)&&inspectContent.some(o=>o.deviceId)) { inspectContent.forEach((p) => { // 如果设备有报警 if (p.alarm) { @@ -192,6 +192,8 @@ Page({ unknown-=1 } }); + }else{ + } }); console.log('sssss',normal,unknown,abnormal) diff --git a/weapp/package/report/report.js b/weapp/package/report/report.js index 01a765a..1626dff 100644 --- a/weapp/package/report/report.js +++ b/weapp/package/report/report.js @@ -61,7 +61,8 @@ Page({ inspectContentArr:[], pointIndex:e.detail.value, 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:[] }) }, // 预览图片 @@ -406,12 +407,13 @@ Page({ //巡检模板改变 patrolTemplateChange(e){ const that=this - if(e.detail.value!=0){ + that.getPatrolTemplate(that.data.patrolTemplate[e.detail.value].id,that.data.devicesList) - } - that.setData({ - patrolTemplateIndex:e.detail.value - }) + that.setData({ + patrolTemplateIndex:e.detail.value + }) + + }, bindShowMsg() { this.setData({