|
|
|
@ -49,12 +49,12 @@ Page({ |
|
|
|
onLoad(options) { |
|
|
|
if(options){ |
|
|
|
this.setData({ |
|
|
|
|
|
|
|
companyId: options.resiId, |
|
|
|
orgid:App.globalData.user.agencyId, |
|
|
|
checkResultFlagRouter:options.flag, |
|
|
|
|
|
|
|
}) |
|
|
|
console.log(options.resiId,App.globalData.user.agencyId,options.flag) |
|
|
|
} |
|
|
|
this.showRecordData() |
|
|
|
this.toOinspectionStaff() |
|
|
|
@ -112,9 +112,7 @@ Page({ |
|
|
|
}).then(({ |
|
|
|
data |
|
|
|
}) => { |
|
|
|
console.log(data) |
|
|
|
var firstItem = data.list[0]; |
|
|
|
console.log(firstItem) |
|
|
|
this.setData({ |
|
|
|
reviewAddress:firstItem.address, |
|
|
|
companyList: data.list, |
|
|
|
@ -129,7 +127,6 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
addHiddenDangeList: addHiddenDangeList |
|
|
|
}); |
|
|
|
console.log(this.data.addHiddenDangeList); |
|
|
|
}, |
|
|
|
handelShowTime(){ |
|
|
|
this.setData({ |
|
|
|
@ -137,16 +134,13 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
onChange(event) { |
|
|
|
console.log(event.detail); |
|
|
|
this.data.checkboxOptions.forEach((item,index)=>{ |
|
|
|
if(event.detail.findIndex(item=>item==index) != -1){ |
|
|
|
console.log("我被选中了") |
|
|
|
item.hazardStatus = 0 |
|
|
|
}else{ |
|
|
|
item.hazardStatus = 1 |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
this.setData({ |
|
|
|
checkboxValue:event.detail, |
|
|
|
}) |
|
|
|
@ -163,7 +157,6 @@ Page({ |
|
|
|
const { |
|
|
|
file |
|
|
|
} = event.detail; |
|
|
|
console.log(file) |
|
|
|
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
|
|
|
wx.uploadFile({ |
|
|
|
url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
|
|
|
|
@ -198,6 +191,7 @@ Page({ |
|
|
|
item.hiddenDangeList0 = []; |
|
|
|
item.hiddenDangeList1 = []; |
|
|
|
item.hiddenDangeList2 = []; |
|
|
|
item.hiddenDangeList3 = []; |
|
|
|
item.hiddenDangeList.forEach(itemC => { |
|
|
|
if (itemC.hazardStatus === 0) { |
|
|
|
item.hiddenDangeList0.push(itemC); |
|
|
|
@ -219,8 +213,6 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
showList:res.data |
|
|
|
}) |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
console.log(this.data.showList,'seeeeee') |
|
|
|
}) |
|
|
|
}, |
|
|
|
toOinspectionStaff(){ |
|
|
|
@ -231,7 +223,6 @@ Page({ |
|
|
|
pageSize:100 |
|
|
|
} |
|
|
|
inspectionStaff(parm).then(res=>{ |
|
|
|
console.log(res.data.staffList) |
|
|
|
this.setData({ |
|
|
|
arr:res.data.staffList |
|
|
|
}) |
|
|
|
@ -256,26 +247,18 @@ Page({ |
|
|
|
}); // 关闭弹出层
|
|
|
|
}, |
|
|
|
onChange1(event) { |
|
|
|
console.log(event) |
|
|
|
this.setData({ |
|
|
|
selectedOptions: event.detail |
|
|
|
}); |
|
|
|
console.log(this.data.selectedOptions) |
|
|
|
}, |
|
|
|
confirmSelection() { |
|
|
|
// 点击确定按钮后触发,处理选中的复选框项
|
|
|
|
console.log("选中的项:", this.data.selectedOptions); |
|
|
|
console.log(this.data.arr) |
|
|
|
console.log(this.data.arr.filter(item => this.data.selectedOptions.includes(item.staffId)).map(item => item.name)); |
|
|
|
console.log(this.data.arr.filter(item => this.data.selectedOptions.includes(item.value))); |
|
|
|
const selectedName = this.data.arr.filter(item => this.data.selectedOptions.includes(item.staffId)).map(item => item.name); |
|
|
|
console.log("选中的名称:", selectedName); |
|
|
|
this.setData({ |
|
|
|
showPopup: false, |
|
|
|
selectedNames:selectedName |
|
|
|
|
|
|
|
}); // 关闭弹出层
|
|
|
|
console.log(this.data.selectedNames) |
|
|
|
}, |
|
|
|
changenewContent(e){ |
|
|
|
this.setData({ |
|
|
|
@ -285,8 +268,6 @@ Page({ |
|
|
|
|
|
|
|
// 删除选中的图片
|
|
|
|
deleteImage(e) { |
|
|
|
console.log(this.data.uploadImageList,'data中'); |
|
|
|
console.log(e.currentTarget.dataset.imageid,'图片Id'); |
|
|
|
const index = this.data.uploadImageList.findIndex(item => item.imageId === e.currentTarget.dataset.imageid) |
|
|
|
if (index > -1) { |
|
|
|
this.data.uploadImageList.splice(index, 1) |
|
|
|
@ -312,9 +293,6 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
handelClickSave(){ |
|
|
|
|
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
console.log(this.data.addHiddenDangeList) |
|
|
|
if(this.data.selectedOptions.length === 0){ |
|
|
|
wx.showToast({ |
|
|
|
title: '请选择检查人员', |
|
|
|
@ -343,7 +321,6 @@ handelClickSave(){ |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
let hasHazardStatus1 = false; |
|
|
|
this.data.checkboxOptions.forEach(item => { |
|
|
|
if (item.hazardStatus === 0) { |
|
|
|
@ -355,7 +332,6 @@ handelClickSave(){ |
|
|
|
}); |
|
|
|
|
|
|
|
if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDangeList.length<1&&!this.data.newContent){ |
|
|
|
console.log("1111",hasHazardStatus1) |
|
|
|
wx.showToast({ |
|
|
|
title: '请填写隐患明细', |
|
|
|
icon:'none' |
|
|
|
@ -367,7 +343,6 @@ if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDan |
|
|
|
hazardDesc: this.data.newContent, |
|
|
|
hazardStatus: 0 |
|
|
|
}); |
|
|
|
console.log(newArr) |
|
|
|
this.setData({ |
|
|
|
addHiddenDangeList: newArr, |
|
|
|
}); |
|
|
|
@ -393,7 +368,6 @@ if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDan |
|
|
|
this.setData({ |
|
|
|
newContent:null |
|
|
|
}) |
|
|
|
console.log(form); |
|
|
|
addRecord(form).then(res => { |
|
|
|
if(res.code == 0){ |
|
|
|
wx.showToast({ |
|
|
|
@ -409,7 +383,6 @@ addRecord(form).then(res => { |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log(form); |
|
|
|
}, |
|
|
|
addAnother() { |
|
|
|
if ( !this.data.newContent) { |
|
|
|
@ -418,9 +391,7 @@ addAnother() { |
|
|
|
content: '输入不能为空', |
|
|
|
success (res) { |
|
|
|
if (res.confirm) { |
|
|
|
console.log('用户点击确定') |
|
|
|
} else if (res.cancel) { |
|
|
|
console.log('用户点击取消') |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
@ -430,7 +401,6 @@ addAnother() { |
|
|
|
addHiddenDangeList: newArr, |
|
|
|
newContent: '', // 清空输入框的值
|
|
|
|
}); |
|
|
|
console.log('添加后的数组:', this.data.addHiddenDangeList); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
@ -456,7 +426,6 @@ chooseImage() { |
|
|
|
sizeType: ['original', 'compressed'], |
|
|
|
sourceType: ['camera'], |
|
|
|
success(res) { |
|
|
|
console.log(res); |
|
|
|
let deleteLength = _this.data.uploadImageList.length |
|
|
|
const uploadImageList = [..._this.data.uploadImageList] |
|
|
|
if (res.tempFiles[0].size <= 5 * 1024 * 1024) { |
|
|
|
@ -518,7 +487,6 @@ chooseImage() { |
|
|
|
type:'image', |
|
|
|
sourceType: ['album'], |
|
|
|
success(res) { |
|
|
|
console.log(res,'图片上传的res'); |
|
|
|
let deleteLength = _this.data.uploadImageList.length |
|
|
|
const uploadImageList = [] |
|
|
|
const endIndex = _this.data.uploadImageList.length |
|
|
|
@ -558,7 +526,6 @@ chooseImage() { |
|
|
|
uploadImageList: _this.data.uploadImageList |
|
|
|
}) |
|
|
|
} else { |
|
|
|
console.log(uploadImageList,'see'); |
|
|
|
uploadImageList[index].uploaded = true |
|
|
|
uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data |
|
|
|
_this.data.uploadImageList = _this.data.uploadImageList.slice(0, endIndex) |
|
|
|
@ -587,12 +554,10 @@ chooseImage() { |
|
|
|
}) |
|
|
|
}, |
|
|
|
pickerChange: function(e) { |
|
|
|
console.log(e.detail.value); |
|
|
|
this.setData({ |
|
|
|
checkResultFlag:e.detail.value, |
|
|
|
checkResultFlagName:this.data.array[e.detail.value] |
|
|
|
}); |
|
|
|
console.log(this.data.checkboxOptions) |
|
|
|
}, |
|
|
|
pickerChange1: function(e) { |
|
|
|
this.setData({ |
|
|
|
@ -603,8 +568,6 @@ bindRemarkInput(e){ |
|
|
|
this.setData({ |
|
|
|
remark: e.detail.value |
|
|
|
}); |
|
|
|
console.log(this.data.remark) |
|
|
|
console.log(this.data.remark) |
|
|
|
}, |
|
|
|
closePopup() { |
|
|
|
this.setData({ showPopup: false }); |
|
|
|
@ -619,11 +582,9 @@ onInput(event) { |
|
|
|
var minute = ("0" + date.getMinutes()).slice(-2); |
|
|
|
var second = ("0" + date.getSeconds()).slice(-2); |
|
|
|
var formattedDateTime = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second; |
|
|
|
console.log(formattedDateTime); |
|
|
|
this.setData({ |
|
|
|
getData:formattedDateTime |
|
|
|
}) |
|
|
|
console.log(this.data.getData) |
|
|
|
}, |
|
|
|
|
|
|
|
onConfirm(event) { |
|
|
|
@ -632,7 +593,6 @@ onConfirm(event) { |
|
|
|
currentDate: value, |
|
|
|
showtime: false |
|
|
|
}); |
|
|
|
console.log('选中的日期时间:', new Date(value)); |
|
|
|
}, |
|
|
|
|
|
|
|
onCancel() { |
|
|
|
|