From 96c84338a148b53bea0311ec4f220a3e2e922dd6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=98=AF=E5=B0=8F=E7=8E=8B=E5=91=80=5C24601?=
<819653817@qq.com>
Date: Mon, 20 May 2024 16:26:35 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9C=AA=E5=88=B7=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../InspectionReport/InspectionReport.js | 65 ++++++----
.../InspectionReport/InspectionReport.wxml | 4 +-
.../safetyinspection/safetyinspection.js | 116 ++++++++++--------
.../safetyinspection/safetyinspection.wxml | 8 +-
4 files changed, 116 insertions(+), 77 deletions(-)
diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
index 72747f7..e3e2874 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
+++ b/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: '', // 清空输入框的值
diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
index 2075d59..5c41e5e 100644
--- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
+++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
@@ -56,10 +56,10 @@
-
+
diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
index ca09625..51afc3e 100644
--- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
+++ b/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) {
diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
index 8728aa8..24665b1 100644
--- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
+++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
@@ -33,10 +33,10 @@
-
+
*
@@ -59,8 +59,8 @@
拟复查时间
-
- {{getData?getData:'请选择'}}
+
+ {{currentDate?currentDate:'请选择'}}