From e4210b859e2feb04821f63a141aee4b3dbd45326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Thu, 26 Oct 2023 15:56:00 +0800 Subject: [PATCH] feat:fix bugs --- weapp/package/subSystem/subSystem.js | 40 ++++++++++++++++------------ 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/weapp/package/subSystem/subSystem.js b/weapp/package/subSystem/subSystem.js index 7376d98..b553893 100644 --- a/weapp/package/subSystem/subSystem.js +++ b/weapp/package/subSystem/subSystem.js @@ -163,15 +163,17 @@ Page({ const device = content.deviceId; content.checkItems.forEach(checkItem => { const level = checkItem.level; - if (!deviceLevelStatistics[device]) { - // 如果设备不存在于统计对象中,初始化 - deviceLevelStatistics[device] = { - deviceName: content.deviceName, // 可能需要设备名称 - level: level - }; - } else { - // 如果设备已存在于统计对象中,比较level并更新为最低的level - deviceLevelStatistics[device].level = levelValues[level] < levelValues[deviceLevelStatistics[device].level] ? level : deviceLevelStatistics[device].level; + if(!checkItem.isNormal){ + if (!deviceLevelStatistics[device]) { + // 如果设备不存在于统计对象中,初始化 + deviceLevelStatistics[device] = { + deviceName: content.deviceName, // 可能需要设备名称 + level: level + }; + } else { + // 如果设备已存在于统计对象中,比较level并更新为最低的level + deviceLevelStatistics[device].level = levelValues[level] < levelValues[deviceLevelStatistics[device].level] ? level : deviceLevelStatistics[device].level; + } } }) }) @@ -193,15 +195,19 @@ Page({ currentPatrolCount: res.length, questions:totalValue, formatter: function (e) { - filteredData?.map(i => { - if (moment(i.inspectionTime).format('YYYY-MM-DD') == moment(e.date).format('YYYY-MM-DD')) { - if (i.patrolRecordIssueHandles.length == 0) { - e.bottomInfo = '.'; e.className = 'greenClass' - } else if (i.patrolRecordIssueHandles.length && i?.patrolRecordIssueHandles[0]?.yanshoushijian && parseInt(moment(i?.patrolRecordIssueHandles[0]?.yanshoushijian).format('YYYYMMDD')) === parseInt(moment().format('YYYYMMDD'))) { - e.bottomInfo = '.'; e.className = 'yellowClass' - } + let allRecordsAreClean=false + // console.log('filter',filteredData) + const currentDate = moment(e.date).format('YYYY-MM-DD'); + const rs= filteredData.filter(item=>currentDate===moment(item.inspectionTime).format('YYYY-MM-DD')) + if(rs&&rs.length){ + if(rs.some(item=>item.patrolRecordIssueHandles.length>0)){ + e.bottomInfo = '.'; + e.className = 'yellowClass'; + }else{ + e.bottomInfo = '.'; + e.className = 'greenClass'; } - }) + } return e } })