|
|
@ -4,15 +4,13 @@ const App = getApp() |
|
|
|
import { |
|
|
|
showRecord,addRecord,inspectionStaff,securityCheckk |
|
|
|
} from "../../../../utils/api" |
|
|
|
|
|
|
|
import {timestampToTime} from "../../../../utils/index" |
|
|
|
const config = require('../../../../utils/config') |
|
|
|
Page({ |
|
|
|
/** |
|
|
|
* 页面的初始数据 |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
|
|
|
|
checkboxOptionsnumber:0, |
|
|
|
orgid:'', |
|
|
|
orgType:'', |
|
|
|
pageNo:'1', |
|
|
@ -21,7 +19,6 @@ Page({ |
|
|
|
imageUrls:[], |
|
|
|
remark:'',//备注
|
|
|
|
reviewTime:'', |
|
|
|
checkResultFlag:'', |
|
|
|
array: ['不合格', '合格'], // 选择器的数据源
|
|
|
|
arrlist:[], |
|
|
|
fileList: [], |
|
|
@ -37,21 +34,26 @@ Page({ |
|
|
|
uploadImageList: [],//图片上传的数组
|
|
|
|
imageId:1, |
|
|
|
addHiddenDangeList:[], |
|
|
|
currentDate:null, |
|
|
|
currentDate: new Date().getTime(), |
|
|
|
minDate: new Date(2020, 0, 1).getTime(), |
|
|
|
maxDate: new Date(2030, 11, 31).getTime(), |
|
|
|
showtime:false, |
|
|
|
checkResultFlag:null, |
|
|
|
checkResultFlagRouter:null, |
|
|
|
hazardStatus2:null |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad(options) { |
|
|
|
this.setData({ |
|
|
|
companyId: options.resiId, |
|
|
|
orgid:App.globalData.user.agencyId |
|
|
|
}) |
|
|
|
console.log(App.globalData) |
|
|
|
|
|
|
|
if(options){ |
|
|
|
this.setData({ |
|
|
|
companyId: options.resiId, |
|
|
|
orgid:App.globalData.user.agencyId, |
|
|
|
checkResultFlagRouter:options.flag, |
|
|
|
currentDateShow:timestampToTime(new Date().getTime(),1) |
|
|
|
}) |
|
|
|
} |
|
|
|
this.showRecordData() |
|
|
|
this.toOinspectionStaff() |
|
|
|
this.securityCheckk() |
|
|
@ -67,13 +69,9 @@ Page({ |
|
|
|
* 生命周期函数--监听页面显示 |
|
|
|
*/ |
|
|
|
onShow() { |
|
|
|
|
|
|
|
console.log(111111); |
|
|
|
debugger |
|
|
|
console.log(this.getCurrentDateTime()); |
|
|
|
this.setData({ |
|
|
|
currentDate:this.getCurrentDateTime() |
|
|
|
}) |
|
|
|
// this.setData({
|
|
|
|
// currentDate:this.getCurrentDateTime()
|
|
|
|
// })
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -118,7 +116,7 @@ Page({ |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
showTime(){ |
|
|
|
handelShowTime(){ |
|
|
|
this.setData({ |
|
|
|
showtime:true |
|
|
|
}) |
|
|
@ -138,6 +136,14 @@ Page({ |
|
|
|
checkboxValue:event.detail, |
|
|
|
}) |
|
|
|
}, |
|
|
|
handelConfirmDate(value){ |
|
|
|
this.setData({ |
|
|
|
showtime:false, |
|
|
|
currentDateShow:timestampToTime(value.detail,1), |
|
|
|
currentDate:value.detail |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
afterRead(event) { |
|
|
|
const { |
|
|
|
file |
|
|
@ -172,21 +178,34 @@ Page({ |
|
|
|
id: this.data.companyId |
|
|
|
} |
|
|
|
showRecord(parm).then(res => { |
|
|
|
console.log(res) |
|
|
|
res.data.forEach(item => { |
|
|
|
if (item.hiddenDangeList) { |
|
|
|
item.hiddenDangeList0 = []; |
|
|
|
item.hiddenDangeList1 = []; |
|
|
|
item.hiddenDangeList2 = []; |
|
|
|
item.hiddenDangeList.forEach(itemC => { |
|
|
|
if (itemC.hazardStatus === 0) { |
|
|
|
item.hiddenDangeList0.push(itemC); |
|
|
|
} else if (itemC.hazardStatus === 1) { |
|
|
|
item.hiddenDangeList1.push(itemC); |
|
|
|
}else if (itemC.hazardStatus === 2) { |
|
|
|
item.hiddenDangeList2.push(itemC); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
if(res.data[0].hiddenDangeList){ |
|
|
|
let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:1})); |
|
|
|
let checkboxOptionsnumber=checkboxOptions.length+1; |
|
|
|
console.log(checkboxOptionsnumber) |
|
|
|
this.setData({ |
|
|
|
checkboxOptions, |
|
|
|
checkboxOptionsnumber |
|
|
|
}) |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
showList:res.data |
|
|
|
}) |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
console.log(this.data.showList) |
|
|
|
console.log(this.data.showList,'seeeeee') |
|
|
|
}) |
|
|
|
}, |
|
|
|
toOinspectionStaff(){ |
|
|
@ -247,8 +266,6 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
newContent: e.detail.value |
|
|
|
}); |
|
|
|
console.log('添加后的数组:', this.data.newContent); |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
}, |
|
|
|
|
|
|
|
// 删除选中的图片
|
|
|
@ -262,6 +279,11 @@ Page({ |
|
|
|
uploadImageList: this.data.uploadImageList |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
changenewHazardStatus2(e){ |
|
|
|
this.setData({ |
|
|
|
hazardStatus2:e.detail.value |
|
|
|
}) |
|
|
|
}, |
|
|
|
getCurrentDateTime() { |
|
|
|
const now = new Date(); |
|
|
@ -271,15 +293,10 @@ Page({ |
|
|
|
const hours = now.getHours().toString().padStart(2, '0'); |
|
|
|
const minutes = now.getMinutes().toString().padStart(2, '0'); |
|
|
|
const seconds = now.getSeconds().toString().padStart(2, '0'); |
|
|
|
debugger |
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
|
|
|
}, |
|
|
|
|
|
|
|
handelClickSave(){ |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
console.log(this.data.newContent) |
|
|
|
console.log("zhixingle") |
|
|
|
console.log(this.data.newContent) |
|
|
|
if (this.data.newContent) { |
|
|
|
let newArr = this.data.addHiddenDangeList.concat({ |
|
|
|
hazardDesc: this.data.newContent, |
|
|
@ -306,13 +323,20 @@ handelClickSave(){ |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
if(this.data.checkResultFlag == 0 && !this.data.getData){ |
|
|
|
if(this.data.checkResultFlag == 0 && !this.data.currentDate){ |
|
|
|
wx.showToast({ |
|
|
|
title: '请选择拟复查时间', |
|
|
|
icon:'none' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
if(this.data.checkResultFlagRouter == 1 && !this.data.hazardStatus2){ |
|
|
|
wx.showToast({ |
|
|
|
title: '请填写整改要求', |
|
|
|
icon:'none' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
let hasHazardStatus1 = false; |
|
|
|
this.data.checkboxOptions.forEach(item => { |
|
|
@ -331,7 +355,6 @@ handelClickSave(){ |
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// console.log(checkbox)
|
|
|
|
console.log( "11",hasHazardStatus1) |
|
|
|
if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDangeList.length<1){ |
|
|
|
console.log("1111",hasHazardStatus1) |
|
|
|
wx.showToast({ |
|
|
@ -344,26 +367,23 @@ if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDan |
|
|
|
const hours = now.getHours().toString().padStart(2, '0'); |
|
|
|
const minutes = now.getMinutes().toString().padStart(2, '0'); |
|
|
|
const seconds = now.getSeconds().toString().padStart(2, '0'); |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
console.log(this.data.addHiddenDangeList) |
|
|
|
let form = { |
|
|
|
companyId:this.data.companyId, |
|
|
|
checkTime:this.getCurrentDateTime(), |
|
|
|
checkPersonsIdList:this.data.selectedOptions, |
|
|
|
checkResultFlag:this.data.checkResultFlag, |
|
|
|
reviewTime:this.data.getData, |
|
|
|
reviewTime:this.data.checkResultFlag === '1'?null:timestampToTime(this.data.currentDate,1), |
|
|
|
hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList), |
|
|
|
attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})), |
|
|
|
remark:this.data.remark, |
|
|
|
address:"" |
|
|
|
} |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
console.log(this.data.addHiddenDangeList) |
|
|
|
console.log(this.data.hiddenDangeList) |
|
|
|
if (!this.data.reviewTime) { |
|
|
|
form.reviewTime=null |
|
|
|
if(this.data.hazardStatus2){ |
|
|
|
form.hiddenDangeList.push({hazardDesc:this.data.hazardStatus2,hazardStatus:2}) |
|
|
|
} |
|
|
|
console.log(this.data.checkboxOptions.concat(this.data.addHiddenDangeList)) |
|
|
|
this.setData({ |
|
|
|
newContent:null |
|
|
|
}) |
|
|
|
addRecord(form).then(res => { |
|
|
|
if(res.code == 0){ |
|
|
|
wx.showToast({ |
|
|
|