From d35cfc71bc29a4334e45c5461654fc6de4e9b553 Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Fri, 24 May 2024 14:53:36 +0800 Subject: [PATCH] =?UTF-8?q?bug=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safetyinspection/safetyinspection.js | 9 +- subpages/securityCheck/pages/securityCheck.js | 99 +++++++++++-------- .../securityCheck/pages/securityCheck.wxml | 24 +++-- 3 files changed, 76 insertions(+), 56 deletions(-) diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js index 7df6094..f0e6270 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js @@ -351,14 +351,7 @@ handelClickSave(){ } }); - // let checkbox = this.data.checkboxOptions.map(item => { - // // item.hazardStatus = 0; - // // return item; - // if (item.hazardStatus = 0) { - // return - // } - // }); - // console.log(checkbox) + if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDangeList.length<1){ console.log("1111",hasHazardStatus1) wx.showToast({ diff --git a/subpages/securityCheck/pages/securityCheck.js b/subpages/securityCheck/pages/securityCheck.js index 7cde803..b44fe9b 100644 --- a/subpages/securityCheck/pages/securityCheck.js +++ b/subpages/securityCheck/pages/securityCheck.js @@ -20,7 +20,6 @@ Page({ }, onLoad(options) { - this.getList() }, handleTap() { @@ -32,7 +31,6 @@ Page({ onScrollToLower(e){ - console.log('gundaodi') if (this.data.loadMoreType === 'more') { this.setData({ loadMoreVisible: true, @@ -41,47 +39,60 @@ onScrollToLower(e){ this.getList() } }, - getList() { +getList() { + this.setData({ + loadMoreVisible: true, + nodata: false, + loadMoreType: "more", + }); + + securityCheckk({ + pageNo: this.data.pageNo, + pageSize: this.data.pageSize, + checkResultFlag: this.data.checkResultFlag + }).then(({ data }) => { + data.list.forEach(item => { + if (item.hiddenDangeList) { + if (item.hiddenDangeList.findIndex(itemC => itemC.hazardStatus === 2) === -1) { + item.status = true; + item.hiddenDangeList0 = item.hiddenDangeList.filter(itemC => itemC.hazardStatus === 0); + item.hiddenDangeList1 = item.hiddenDangeList.filter(itemC => itemC.hazardStatus === 1); + } else { + item.status = false; + item.hiddenDangeList0 = item.hiddenDangeList.filter(itemC => itemC.hazardStatus === 0); + item.hiddenDangeList2 = item.hiddenDangeList.filter(itemC => itemC.hazardStatus === 2); + } + } + }); + console.log(data.list); + + + if (this.data.flag0Array.length === 0) { this.setData({ - loadMoreVisible: true, - nodata: false, - loadMoreType: "more", - }) - securityCheckk({ - pageNo: this.data.pageNo, - pageSize: this.data.pageSize, - checkResultFlag:this.data.checkResultFlag - }).then(({data}) => { - // this.setData({ - // marsi: data.list, - // total: data.total - // }) - // this.memem(); - this.setData({ - loadMoreType: data.list.length === this.data.pageSize ? 'more' : 'none', - flag0Array: this.data.flag0Array.concat(data.list).filter(item => item.checkResultFlag === 0 || item.checkResultFlag == null), - flag1Array: this.data.flag1Array.concat(data.list).filter(item => item.checkResultFlag === 1) - }) - if (this.data.flag0Array.length == 0) { - this.setData({ - loadMoreVisible: false, - nodata: true - }) - } - if (this.data.flag1Array.length == 0) { - this.setData({ - loadMoreVisible: false, - nodata: true - }) - } - }).catch(err=>{ - console.log(err); - this.setData({ - loadMoreVisible: false, - nodata: true, - }) - }) - }, + loadMoreVisible: false, + nodata: true + }); + } + if (this.data.flag1Array.length === 0) { + this.setData({ + loadMoreVisible: false, + nodata: true + }); + } + this.setData({ + loadMoreType: data.list.length === this.data.pageSize ? 'more' : 'none', + flag0Array: this.data.flag0Array.concat(data.list.filter(item => item.checkResultFlag === 0 || item.checkResultFlag == null)), + flag1Array: this.data.flag1Array.concat(data.list.filter(item => item.checkResultFlag === 1)), + }); + }).catch(err => { + console.log(err); + this.setData({ + loadMoreVisible: false, + nodata: true, + }); + }); +}, + memem() { this.setData({ flag0Array: this.data.marsi.filter(item => item.checkResultFlag === 0 || item.checkResultFlag == null), @@ -132,6 +143,10 @@ onScrollToLower(e){ * 生命周期函数--监听页面显示 */ onShow() { + this.setData({ + flag0Array:[], + flag1Array:[] + }) this.getList() }, diff --git a/subpages/securityCheck/pages/securityCheck.wxml b/subpages/securityCheck/pages/securityCheck.wxml index 5091305..19f4a9f 100644 --- a/subpages/securityCheck/pages/securityCheck.wxml +++ b/subpages/securityCheck/pages/securityCheck.wxml @@ -17,9 +17,21 @@ {{item.name}} 检查时间: {{item.orderDate}} 检查人员: {{item.checkPersons}} - 隐患明细: - {{item.hazardDesc}} - 拟复查时间: {{item.reviewTime}} + {{item.status?'未整改隐患':'隐患明细'}}: + {{index+1}}.{{item.hazardDesc}} + + + + 整改要求:{{item.hazardDesc}} + + + + + 已整改隐患:{{indexC+1}}.{{item.hazardDesc}} + + + 已整改隐患:-- + 拟复查时间: {{item.reviewTime}} @@ -36,9 +48,9 @@ {{item.name}} 检查时间: {{item.orderDate}} 检查人员: {{item.checkPersons}} - 隐患明细: - {{item.hazardDesc}} - 拟复查时间: {{item.reviewTime}} + 检查结论: 合格 + + 合格时间: {{item.reviewTime}}