jhwxapp/miniprogram/pageage/safetyManagement/problemRectification/index.js

226 lines
5.7 KiB
JavaScript
Raw Permalink Normal View History

2023-08-10 01:21:29 +08:00
// pageage/safetyManagement/problemRectification/index.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
id:"",
projectId:"",
loginName:"",
userName:"",
//检查类型名称
checkTypeName:"",
//检查部位名称
checkSiteName:"",
//检查时间
checkTime:"",
//检查限制时间
checkImposeTime:"",
rectifySituation:"",
// state 0 待我整改 1 我已整改 2 无需整改
problemData:[],
loadShow:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let {id,projectId,checkType,checkpoint,rectify_time,inspect_time} = options
console.log(inspect_time);
//获取缓存数据
wx.getStorage({
key: 'userinfo',
success:res=>{
this.setData({
id,
projectId,
checkType,checkpoint,rectify_time,inspect_time,
loginName:res.data.loginName,
userName:res.data.userName
})
this.getSafetCheckDetailsInfo();
}
})
},
/**
* 获取安全检查详情信息
*
*/
getSafetCheckDetailsInfo(){
let {id,checkType,checkpoint,rectify_time,inspect_time} = this.data
let that = this
wx.request({
url: app.globalData.szhUrl+'/api/check/getCheckDetailList',
method:"get",
data:{
info_id:id
},
success(res){
res = res.data
console.log(res);
//let {id,projectId,checkImposeTime,checkSiteName,checkTime,checkTypeName,result} = res.data.saftCheckIssue
if(res.code == 200){
let problemDataTemp = []
let result = res.data;
result.forEach((item,index)=>{
let rectify_front = []
let rectify_photo = []
rectify_front.push({url:item.imageList[0].photo_url});
rectify_photo.push({url:item.imageList[1].photo_url});
// item.beforeCheckUrl.split(",").forEach(item=>{
// rectify_front.push({url:item})
// })
// if(item.finishList.length > 0){
// item.finishList[0].afterCheckUrl.split(",").forEach(item=>{
// rectify_photo.push({url:item})
// })
// }
problemDataTemp.push({
title:'问题'+(index+1),
overall_state:false,
state:item.rectification_situation?1:0,
existing_problems:item.existing_problems,
rectify_person:item.responsible_person,
//rectifyuserId:item.checkUserId,
rectify_front,
rectifyloginName:item.responsible_person,
rectify_situation:item.rectification_situation,
rectify_time:item.rectification_time,
rectify_photo,
issueId:id,
issueItemId:item.id
})
})
console.log(that.data.checkTypeName);
that.setData({
//检查类型名称
checkTypeName:checkType,
//检查部位名称
checkSiteName:checkpoint,
//检查时间
checkTime:inspect_time,
//检查限制时间
checkImposeTime:rectify_time,
//问题列表
problemData:problemDataTemp
})
that.setData({
loadShow:false
})
}
}
})
},
//问题展开
onExpandDetails(e){
var index = e.currentTarget.dataset.index
var data = this.data.problemData
if(data[index].overall_state == false){
data[index].overall_state = true
}else{
data[index].overall_state = false
}
this.setData({
problemData:data
})
},
//list 问题整改按钮
onProblemRectification(e){
var index = e.currentTarget.dataset.index
var data = this.data.problemData
data[index].problem_btn = true
this.setData({
problemData:data
})
},
//list 整改情况 填写
onRectificationSituation(e){
var index = e.currentTarget.dataset.index
var data = this.data.problemData
data[index].rectify_situation = e.detail.value
this.setData({
problemData:data
})
},
//list 取消按钮
onCancellation(e){
var index = e.currentTarget.dataset.index
var data = this.data.problemData
data[index].problem_btn = false
this.setData({
problemData:data
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})