diff --git a/weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js b/weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js index 443473c..ecda7b2 100644 --- a/weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js +++ b/weapp/package/deviceBigdataGraph/statusDetail/statusDetail.js @@ -102,6 +102,8 @@ Page({ // 创建一个对象来存储每个pointId的最大inspectionTime const maxInspectionTimeByPointId = {}; const sevenDaysAgo = moment().subtract(7, 'days'); // 获取七天前的日期 + //把设备数据全部弄成未知状态 + const len=complexArray.map(item=>{return {id:item.id,name:item.name,status:'unknown'}})?.length // 过滤出近七天内的最新记录(同点位+同一天的最新记录) const latestRecords = patrolRecord.filter((record) => { const inspectionDate = moment(record.inspectionTime).format('YYYY-MM-DD'); @@ -117,7 +119,7 @@ Page({ }); }); //调用每天的函数处理每天的正常-异常-未知的个数 - const sevenDays= that.calculateDailyDeviceStatusCounts(latestRecords) + const sevenDays= that.calculateDailyDeviceStatusCounts(latestRecords,len) // 遍历数据并更新maxInspectionTimeByPointId patrolRecord.forEach((item) => { const {pointId,inspectionTime} = item; @@ -139,7 +141,7 @@ Page({ return false; }); //七天内最新的数据(正常) - const statusCounts =that.classifiedStatistics(filteredData) + const statusCounts =that.classifiedStatistics(filteredData,len) const {unknown,normal,abnormal}=statusCounts const deviceCount=complexArray.length that.setData({ @@ -159,10 +161,10 @@ Page({ }, //分类统计设备,异常-正常-未知个数 - classifiedStatistics:function(list){ + classifiedStatistics:function(list,len){ let normal = 0; let abnormal = 0; - let unknown = 0; + let unknown = len; list.forEach((item) => { const inspectContent = item.alarm ? (item?.points?.inspectContent || []) : []; if (inspectContent && inspectContent.length && Array.isArray(inspectContent)) { @@ -174,17 +176,20 @@ Page({ if (state === 6) { // 正常 normal += 1; + unknown-=1 } else if (state === 5) { // 未知 - unknown += 1; + // unknown += 1; } else { // 异常 abnormal += 1; + unknown-=1 } } } else { // 正常 normal += 1; + unknown-=1 } }); } @@ -192,7 +197,7 @@ Page({ return {normal,unknown,abnormal} }, //统计每天异常-正常-未知个数 - calculateDailyDeviceStatusCounts:function(data) { + calculateDailyDeviceStatusCounts:function(data,len) { const dateRange = [] const today = moment() for (let i = 6; i >= 0; i--) { @@ -203,7 +208,7 @@ Page({ dateRange.forEach((date) => { dailyCounts[date] = { normal: 0, - unknown: 0, + unknown: len, abnormal: 0 }; }); @@ -214,14 +219,15 @@ Page({ const status = item.patrolRecordIssueHandles.length ? item.patrolRecordIssueHandles[0].state : 6; if (status === 6) { dailyCounts[inspectionDate].normal += 1; + dailyCounts[inspectionDate].unknown -= 1; } else if (status === 5) { - dailyCounts[inspectionDate].unknown += 1; + // dailyCounts[inspectionDate].unknown += 1; } else { dailyCounts[inspectionDate].abnormal += 1; + dailyCounts[inspectionDate].unknown -= 1; } } }); - return dailyCounts; }, /** diff --git a/weapp/package/polling/polling.json b/weapp/package/polling/polling.json index 81cd545..d231825 100644 --- a/weapp/package/polling/polling.json +++ b/weapp/package/polling/polling.json @@ -10,7 +10,8 @@ "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", "van-dropdown-item": "@vant/weapp/dropdown-item/index", "van-datetime-picker": "@vant/weapp/datetime-picker/index", - "van-icon": "@vant/weapp/icon/index" + "van-icon": "@vant/weapp/icon/index", + "van-button": "@vant/weapp/button/index" } } \ No newline at end of file diff --git a/weapp/package/polling/polling.wxml b/weapp/package/polling/polling.wxml index b28b249..f397dd3 100644 --- a/weapp/package/polling/polling.wxml +++ b/weapp/package/polling/polling.wxml @@ -80,8 +80,8 @@ - - + + 主动上报 diff --git a/weapp/package/report/report.js b/weapp/package/report/report.js index 0ae857b..01a765a 100644 --- a/weapp/package/report/report.js +++ b/weapp/package/report/report.js @@ -84,6 +84,10 @@ Page({ structListIndex: event.detail.value, // isPlanState: true, pointList:[],//选择结构物后先置空先前的点位列表 + patrolTemplate:[], + inspectContentArr:[], + patrolTemplateIndex:undefined, + pointIndex:undefined }) const projectId=that.data?.structList[event.detail.value]?.id @@ -402,7 +406,9 @@ Page({ //巡检模板改变 patrolTemplateChange(e){ const that=this - that.getPatrolTemplate(that.data.patrolTemplate[e.detail.value].id,that.data.devicesList) + if(e.detail.value!=0){ + that.getPatrolTemplate(that.data.patrolTemplate[e.detail.value].id,that.data.devicesList) + } that.setData({ patrolTemplateIndex:e.detail.value }) diff --git a/weapp/package/report/report.wxml b/weapp/package/report/report.wxml index be0e088..f19fcd8 100644 --- a/weapp/package/report/report.wxml +++ b/weapp/package/report/report.wxml @@ -15,7 +15,7 @@ 当前点位: - + {{pointIndex||pointIndex==0?pointList[pointIndex].name:'请选择'}}