Browse Source

列表未刷新

data-page-V4.3.1
是小王呀\24601 1 year ago
parent
commit
96c84338a1
  1. 65
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
  2. 4
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
  3. 116
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
  4. 8
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml

65
subpages/InspectionReport/pages/InspectionReport/InspectionReport.js

@ -122,6 +122,19 @@ Page({
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
submitBiao() {
console.log("zhixingle")
console.log(this.data.newContent)
if (this.data.newContent) {
let newArr = this.data.addHiddenDangeList.concat({
hazardDesc: this.data.newContent,
hazardStatus: 0
});
console.log(newArr)
this.setData({
addHiddenDangeList: newArr,
});
}
if(!this.data.companyId){
wx.showToast({
title: '请选择企业',
@ -150,8 +163,9 @@ Page({
})
return false
}
console.log( this.data.addHiddenDangeLis)
if(this.data.checkResultFlag == 0 && this.data.addHiddenDangeList){
console.log( this.data.addHiddenDangeList)
if(this.data.checkResultFlag == 0 && this.data.addHiddenDangeList.length<1){
wx.showToast({
title: '隐患明细最少输入一条',
icon:'none'
@ -162,7 +176,11 @@ 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');
console.log(this.data.getData)
let checkboxOptions =this.data.addHiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:2,requirements:this.data.hazardDesc2}));
this.setData({
addHiddenDangeList:checkboxOptions
})
console.log(this.data.addHiddenDangeList)
let form={ companyId: this.data.companyId,
checkTime: this.getCurrentDateTime(),
checkPersonsIdList: this.data.checkPersonsIdList,
@ -176,24 +194,25 @@ Page({
if (!this.data.reviewTime) {
form.reviewTime=null
}
addRecord(
form
).then(
res => {
if(res.code == 0){
wx.showToast({
title: '新增成功',
duration:2000,
success:function(){
setTimeout(()=>{
wx.navigateBack({
delta: 1
})
},2000)
}
})
}
});
console.log(form)
// addRecord(
// form
// ).then(
// res => {
// if(res.code == 0){
// wx.showToast({
// title: '新增成功',
// duration:2000,
// success:function(){
// setTimeout(()=>{
// wx.navigateBack({
// delta: 1
// })
// },2000)
// }
// })
// }
// });
},
@ -347,6 +366,7 @@ Page({
this.setData({
hazardDesc2: e.detail.value
});
console.log(this.data.hazardDesc2)
},
changenewContent(e){
this.setData({
@ -354,7 +374,8 @@ Page({
});
},
addAnother() {
let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 });
let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0, requirements:this.data.hazardDesc2});
console.log()
this.setData({
addHiddenDangeList: newArr,
newContent: '', // 清空输入框的值

4
subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml

@ -56,10 +56,10 @@
<view class="input1">
<input bindinput="changenewContent" type="text" value="{{newContent}}" placeholder=" 请输入" />
</view>
<view class="add" bind:tap="addAnother">
<!-- <view class="add" bind:tap="addAnother">
<image src="../../../../images/add.png" class="add_img"></image>
<text>再添加一条</text>
</view>
</view> -->
</view>

116
subpages/safetyinspection/pages/safetyinspection/safetyinspection.js

@ -37,7 +37,7 @@ Page({
uploadImageList: [],//图片上传的数组
imageId:1,
addHiddenDangeList:[],
currentDate: new Date().getTime(),
currentDate:null,
minDate: new Date(2020, 0, 1).getTime(),
maxDate: new Date(2030, 11, 31).getTime(),
showtime:false,
@ -55,6 +55,7 @@ Page({
this.showRecordData()
this.toOinspectionStaff()
this.securityCheckk()
},
/**
@ -66,14 +67,22 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
console.log(111111);
debugger
console.log(this.getCurrentDateTime());
this.setData({
currentDate:this.getCurrentDateTime()
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
this.setData({
currentDate:null
})
},
/**
@ -118,11 +127,13 @@ Page({
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,
})
@ -156,13 +167,14 @@ Page({
});
},
showRecordData() {
console.log("我执行了")
let parm = {
id: this.data.companyId
}
showRecord(parm).then(res => {
console.log(res)
if(res.data[0].hiddenDangeList){
let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:0}));
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({
@ -173,6 +185,7 @@ Page({
this.setData({
showList:res.data
})
console.log(this.data.checkboxOptions)
console.log(this.data.showList)
})
},
@ -234,32 +247,10 @@ Page({
this.setData({
newContent: e.detail.value
});
console.log('添加后的数组:', this.data.newContent);
console.log(this.data.checkboxOptions)
},
addAnother() {
if ( !this.data.newContent) {
wx.showModal({
title: '提示',
content: '输入不能为空',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}else{
let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 });
this.setData({
addHiddenDangeList: newArr,
newContent: '', // 清空输入框的值
});
console.log('添加后的数组:', this.data.addHiddenDangeList);
}
},
// 删除选中的图片
deleteImage(e) {
console.log(this.data.uploadImageList,'data中');
@ -280,10 +271,27 @@ 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,
hazardStatus: 0
});
console.log(newArr)
this.setData({
addHiddenDangeList: newArr,
});
}
console.log(this.data.checkboxOptions)
console.log(this.data.addHiddenDangeList)
if(this.data.selectedOptions.length === 0){
wx.showToast({
title: '请选择检查人员',
@ -298,14 +306,34 @@ handelClickSave(){
})
return false
}
if(this.data.checkResultFlag == 0 && !this.data.reviewTime){
if(this.data.checkResultFlag == 0 && !this.data.getData){
wx.showToast({
title: '请选择拟复查时间',
icon:'none'
})
return false
}
if(this.data.checkResultFlag == 0 && this.data.checkboxOptions.length<0){
console.log(this.data.checkboxOptions)
let hasHazardStatus1 = false;
this.data.checkboxOptions.forEach(item => {
if (item.hazardStatus === 0) {
hasHazardStatus1 = true;
// 如果找到了符合条件的元素,可以直接 return 结束循环
return;
}
});
// let checkbox = this.data.checkboxOptions.map(item => {
// // item.hazardStatus = 0;
// // return item;
// if (item.hazardStatus = 0) {
// return
// }
// });
// console.log(checkbox)
console.log( "11",hasHazardStatus1)
if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDangeList.length<1){
console.log("1111",hasHazardStatus1)
wx.showToast({
title: '请填写隐患明细',
icon:'none'
@ -316,17 +344,22 @@ handelClickSave(){
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.reviewTime} ${hours}:${minutes}:${seconds}`,
reviewTime:this.data.getData,
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
}
@ -506,22 +539,7 @@ pickerChange: function(e) {
checkResultFlag:e.detail.value,
checkResultFlagName:this.data.array[e.detail.value]
});
if (e.detail.value) {
console.log(this.data.checkboxOptions)
if (this.data.addHiddenDangeList && this.data.checkboxOptions.length<0) {
wx.showModal({
title: '提示',
content: '隐患最少输入一条',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
}
console.log(this.data.checkboxOptions)
},
pickerChange1: function(e) {
this.setData({
@ -552,7 +570,7 @@ onInput(event) {
this.setData({
getData:formattedDateTime
})
console.log(this.data.getData)
},
onConfirm(event) {

8
subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml

@ -33,10 +33,10 @@
<view class="input1">
<input bindinput="changenewContent" value="{{newContent}}" type="text" placeholder=" 请输入新的隐患信息" />
</view>
<view class="add" bind:tap="addAnother">
<!-- <view class="add" bind:tap="addAnother">
<image src="../../../../images/add.png" class="add_img"></image>
<text>再添加一条</text>
</view>
</view> -->
</view>
<view class="prosecutors" >
<text class="prosecutors_req">*</text>
@ -59,8 +59,8 @@
<view class="nes" bind:tap="showTime">
<view class="conclusion">
<text class="prosecutors_pre">拟复查时间</text>
<view class="{{getData?'prosecutors_name':'gray'}}">
{{getData?getData:'请选择'}}
<view class="{{currentDate?'prosecutors_name':'gray'}}">
{{currentDate?currentDate:'请选择'}}
</view>
<!-- <picker mode="date" class="prosecutors_name" bindchange="pickerChange1" value="{{reviewTime}}">
<view class="{{reviewTime?'':'gray'}}">

Loading…
Cancel
Save