Browse Source

bug修改

data-page-V4.3.1
是小王呀\24601 1 year ago
parent
commit
e79c92fc78
  1. 103
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
  2. 2
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
  3. 42
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
  4. 2
      subpages/securityCheck/pages/securityCheck.js

103
subpages/InspectionReport/pages/InspectionReport/InspectionReport.js

@ -91,19 +91,19 @@ Page({
showRecordData() { showRecordData() {
this.setData({ this.setData({
checkboxOptions:null checkboxOptions:[]
}) })
let parm = { let parm = {
id: this.data.companyId id: this.data.companyId
} }
showRecord(parm).then(res => { showRecord(parm).then(res => {
if(res.data[0].hiddenDangeList){ if(res.data[0].hiddenDangeList){
let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:0,id:item.id})); let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:0}));
this.setData({ this.setData({
checkboxOptions, checkboxOptions: checkboxOptions || [],
beforeFlag: res.data[0].checkResultFlag beforeFlag: res.data[0].checkResultFlag
}) })
console.log(this.data.checkboxOptions); console.log(this.data.beforeFlag);
} }
}) })
}, },
@ -146,55 +146,80 @@ Page({
}) })
return false return false
} }
if(this.data.checkResultFlag == 0 && this.data.checkboxValue.length<1&&!this.data.hazardDesc2){ if(this.data.checkResultFlag == 0 && this.data.checkboxValue.length<1&&!this.data.newContent){
wx.showToast({ wx.showToast({
title: '隐患明细最少输入一条', title: '隐患明细最少输入一条',
icon:'none' icon:'none'
}) })
return false return false
} }
this.data.checkboxOptions.forEach(item => { if (this.data.checkboxOptions) {
if(this.checkboxValue.findIndex(itemC=>itemC === item.value) == -1){ console.log(this.data.checkboxOptions)
item.hazardStatus = '1'; this.data.checkboxOptions.forEach(item => {
}else{ console.log(item)
item.hazardStatus = '0'; console.log(this.data.checkboxValue)
} if(this.data.checkboxValue.findIndex(itemC=>itemC === item.value) == -1){
}) item.hazardStatus = '1';
console.log(this.data.checkboxValue); }else{
console.log(this.data.checkboxOptions); item.hazardStatus = '0';
let form={ companyId: this.data.companyId, }
})
}
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.hazardDesc2) {
let newArr = this.data.addHiddenDangeList.concat({
hazardDesc: this.data.hazardDesc2,
hazardStatus: 2
});
console.log(newArr)
this.setData({
addHiddenDangeList: newArr,
});
}
let form={
companyId: this.data.companyId,
checkTime: this.getCurrentDateTime(), checkTime: this.getCurrentDateTime(),
checkPersonsIdList: this.data.checkPersonsIdList, checkPersonsIdList: this.data.checkPersonsIdList,
checkResultFlag: this.data.checkResultFlag, checkResultFlag: this.data.checkResultFlag,
reviewTime:this.data.getData, reviewTime:this.data.getData,
hiddenDangeList:null, hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList),
attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})), attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})),
remark: '', remark: this.data.remarks,
reviewAddress:this.data.addressContent reviewAddress:this.data.addressContent
} }
if (!this.data.reviewTime) { // if (!this.data.reviewTime) {
form.reviewTime=null // form.reviewTime=null
} // }
console.log(form) console.log(form)
// addRecord( addRecord(
// form form
// ).then( ).then(
// res => { res => {
// if(res.code == 0){ if(res.code == 0){
// wx.showToast({ wx.showToast({
// title: '新增成功', title: '新增成功',
// duration:2000, duration:2000,
// success:function(){ success:function(){
// setTimeout(()=>{ setTimeout(()=>{
// wx.navigateBack({ wx.navigateBack({
// delta: 1 delta: 1
// }) })
// },2000) },2000)
// } }
// }) })
// } }
// }); });
}, },

2
subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml

@ -67,7 +67,7 @@
<view class="pitfall" wx:if="{{beforeFlag == 1}}"> <view class="pitfall" wx:if="{{beforeFlag == 1}}">
<view class="prosecutors"> <view class="prosecutors">
<text class="prosecutors_req">*</text> <!-- <text class="prosecutors_req">*</text> -->
<view class="conclusion1"> <view class="conclusion1">
<text class="prosecutors_pre">整改要求</text> <text class="prosecutors_pre">整改要求</text>
</view> </view>

42
subpages/safetyinspection/pages/safetyinspection/safetyinspection.js

@ -40,7 +40,8 @@ Page({
showtime:false, showtime:false,
checkResultFlag:null, checkResultFlag:null,
checkResultFlagRouter:null, checkResultFlagRouter:null,
hazardStatus2:null hazardStatus2:null,
name:""
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
@ -48,6 +49,7 @@ Page({
onLoad(options) { onLoad(options) {
if(options){ if(options){
this.setData({ this.setData({
companyId: options.resiId, companyId: options.resiId,
orgid:App.globalData.user.agencyId, orgid:App.globalData.user.agencyId,
checkResultFlagRouter:options.flag, checkResultFlagRouter:options.flag,
@ -111,7 +113,10 @@ Page({
data data
}) => { }) => {
console.log(data) console.log(data)
var firstItem = data.list[0];
console.log(firstItem)
this.setData({ this.setData({
reviewAddress:firstItem.address,
companyList: data.list, companyList: data.list,
}); });
}); });
@ -173,7 +178,6 @@ Page({
}); });
}, },
showRecordData() { showRecordData() {
console.log("我执行了")
let parm = { let parm = {
id: this.data.companyId id: this.data.companyId
} }
@ -372,11 +376,11 @@ if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDan
checkTime:this.getCurrentDateTime(), checkTime:this.getCurrentDateTime(),
checkPersonsIdList:this.data.selectedOptions, checkPersonsIdList:this.data.selectedOptions,
checkResultFlag:this.data.checkResultFlag, checkResultFlag:this.data.checkResultFlag,
reviewTime:this.data.checkResultFlag === '1'?null:timestampToTime(this.data.currentDate,1), reviewTime:this.data.currentDateShow,
hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList), hiddenDangeList:this.data.checkboxOptions.concat(this.data.addHiddenDangeList),
attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})), attachmentUrls:this.data.uploadImageList.map(item=>({fileName:item.originFileName,attachmentUrl:item.ossUrl.url})),
remark:this.data.remark, remark:this.data.remark,
address:"" reviewAddress:""
} }
if(this.data.hazardStatus2){ if(this.data.hazardStatus2){
form.hiddenDangeList.push({hazardDesc:this.data.hazardStatus2,hazardStatus:2}) form.hiddenDangeList.push({hazardDesc:this.data.hazardStatus2,hazardStatus:2})
@ -384,21 +388,21 @@ if(this.data.checkResultFlag == 0 && !hasHazardStatus1 && this.data.addHiddenDan
this.setData({ this.setData({
newContent:null newContent:null
}) })
addRecord(form).then(res => { // addRecord(form).then(res => {
if(res.code == 0){ // if(res.code == 0){
wx.showToast({ // wx.showToast({
title: '新增成功', // title: '新增成功',
duration:2000, // duration:2000,
success:function(){ // success:function(){
setTimeout(()=>{ // setTimeout(()=>{
wx.navigateBack({ // wx.navigateBack({
delta: 1 // delta: 1
}) // })
},2000) // },2000)
} // }
}) // })
} // }
}) // })
console.log(form); console.log(form);
}, },
chooseImage() { chooseImage() {

2
subpages/securityCheck/pages/securityCheck.js

@ -175,7 +175,7 @@ onScrollToLower(e){
toDetails(e){ toDetails(e){
console.log(e) console.log(e)
wx.navigateTo({ wx.navigateTo({
url: `../../../subpages/safetyinspection/pages/safetyinspection/safetyinspection?resiId=${e.currentTarget.dataset.resiid}&flag=${e.currentTarget.dataset.flag}`, url: `../../../subpages/safetyinspection/pages/safetyinspection/safetyinspection?resiId=${e.currentTarget.dataset.resiid}&flag=${e.currentTarget.dataset.flag}&name=${e.currentTarget.dataset.name}`,
}) })
} }

Loading…
Cancel
Save