epmet 工作端 小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
4.6 KiB

// subpages/securityCheck/securityCheck.js
import {securityCheckk} from "../../../utils/api";
Page({
data: {
active:0,
pageNo: 1,
pageSize:20,
id: 0,
marsi:[
//
],
flag0Array:[],
flag1Array:[],
checkResultFlag:0,
lowerThreshold:'5',
loadMoreVisible:false,
loadMoreType: "none",
nodata:false,
},
onLoad(options) {
},
handleTap() {
console.log('Movable view clicked');
wx.navigateTo({
url: '/subpages/InspectionReport/pages/InspectionReport/InspectionReport'
})
},
onScrollToLower(e){
if (this.data.loadMoreType === 'more') {
this.setData({
loadMoreVisible: true,
})
this.data.pageNo += 1
this.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 => {
console.log(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: false,
nodata: true
});
}
console.log(this.data.flag1Array);
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),
flag1Array: this.data.marsi.filter(item => item.checkResultFlag === 1)
});
},
handelTab(e){
console.log(e);
this.setData({
setlectVal :e.currentTarget.dataset.value
})
},
toggleColor(e) {
console.log(e.detail.index);
const let1 =e.detail.index
if (e.detail.index==0) {
this.setData({
checkResultFlag:let1,
flag0Array:[],
flag1Array:[]
})
this.getList()
console.log(this.data.checkResultFlag);
}
else{
this.setData({
checkResultFlag:let1
})
this.getList()
console.log(this.data.checkResultFlag);
}
this.setData({
active:let1
})
},
qualifed(){
wx.navigateTo({
url: '../../subpages/qualified/qualified'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.setData({
flag0Array:[],
flag1Array:[]
})
this.getList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
toAddEnterprise(){
wx.navigateTo({
url: '../../../subpages/InspectionReport/pages/InspectionReport/InspectionReport',
})
},
toDetails(e){
console.log(e)
wx.navigateTo({
url: `../../../subpages/safetyinspection/pages/safetyinspection/safetyinspection?resiId=${e.currentTarget.dataset.resiid}&flag=${e.currentTarget.dataset.flag}&name=${e.currentTarget.dataset.name}`,
})
}
})