From b090a02988f1b920f85ba2bb56b748249c7a7283 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: Fri, 17 May 2024 10:47:12 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=A4=87=E6=B3=A8=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E9=BD=90=EF=BC=8C=20=E5=B7=A1=E6=9F=A5=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=96=B0=E9=9A=90=E6=82=A3=E6=B7=BB=E5=8A=A0=E5=90=8E=EF=BC=8C?= =?UTF-8?q?input=E4=B8=8D=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InspectionReport/pages/InspectionReport/InspectionReport.js | 2 +- .../pages/InspectionReport/InspectionReport.wxss | 1 - .../pages/safetyinspection/safetyinspection.wxml | 2 +- .../pages/safetyinspection/safetyinspection.wxss | 1 + 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js index 1c79c01..96809f5 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js @@ -300,7 +300,7 @@ Page({ }); }, addAnother() { - let newValue = this.data.arr1.length + 1; // 根据数组长度确定新值 + let newValue = this.data.arr1.length + 1; // 根据addAnother数组长度确定新值 let newArr = this.data.arr1.concat({ value: newValue.toString(), name: this.data.hazardDesc diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss index fedec8a..f5bb206 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss @@ -110,7 +110,6 @@ page { display: flex; flex-direction: column; margin: 20rpx; - padding-left: 40rpx; } .image1{ margin-top: 20rpx; diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml index 2355ea5..f2f9bb3 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml @@ -32,7 +32,7 @@ - + diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss index bd670fc..c76320a 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss @@ -134,6 +134,7 @@ page { display: flex; flex-direction: column; margin: 20rpx; + padding-left: 40rpx; } .image1{ margin-top: 20rpx; From e65e30a7d79ca7e66f463f311549373ccd99f0a1 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: Fri, 17 May 2024 10:57:20 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=90=88=E6=A0=BC=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/safetyinspection/safetyinspection.js | 3 +++ .../pages/safetyinspection/safetyinspection.wxml | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js index 8bd8fa4..a612a8a 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js @@ -303,6 +303,9 @@ handelClickSave(){ remark:this.data.remark, address:"" } + if (!this.data.reviewTime) { + form.reviewTime=null + } console.log(this.data.checkboxOptions.concat(this.data.addHiddenDangeList)) addRecord(form).then(res => { if(res.code == 0){ diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml index f2f9bb3..ac32554 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml @@ -27,8 +27,7 @@ {{index + checkboxOptionsnumber -}}. {{item.hazardDesc}} + wx:for-item="item"> {{item.hazardDesc}} From 881c07d679cfa696922997476bd1298c64d00d59 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: Fri, 17 May 2024 18:40:10 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=B7=A1=E6=9F=A5=E4=B8=8A=E6=8A=A5-?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=90=8E=E8=BF=94=E5=9B=9E=E5=AE=89=E6=A3=80?= =?UTF-8?q?=E5=B7=A1=E6=9F=A5=E5=88=97=E8=A1=A8=EF=BC=8C=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9C=AA=E5=88=B7=E6=96=B0=E5=B7=A1=E6=9F=A5=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=8B=9F=E5=A4=8D=E6=9F=A5=E6=97=B6=E9=97=B4=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E6=9C=9F=EF=BC=8C=E4=BD=86=E6=98=AF=E5=B7=A1?= =?UTF-8?q?=E6=9F=A5=E8=AE=B0=E5=BD=95=E4=B8=AD=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E6=98=AF=E5=88=B0=E5=85=B7=E4=BD=93=E6=97=B6=E5=88=86=E7=A7=92?= =?UTF-8?q?=EF=BC=8C=E9=80=89=E6=8B=A9=E6=97=B6=E4=B9=9F=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E6=98=AF=E9=80=89=E6=8B=A9=E5=85=B7=E4=BD=93=E6=97=B6=E5=88=86?= =?UTF-8?q?=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InspectionReport/InspectionReport.js | 126 ++++++++++++++---- .../InspectionReport/InspectionReport.json | 3 +- .../InspectionReport/InspectionReport.wxml | 49 +++++-- .../InspectionReport/InspectionReport.wxss | 8 ++ .../safetyinspection/safetyinspection.js | 94 +++++++++++-- .../safetyinspection/safetyinspection.json | 4 +- .../safetyinspection/safetyinspection.wxml | 37 ++++- 7 files changed, 266 insertions(+), 55 deletions(-) diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js index 96809f5..098a458 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js @@ -8,13 +8,17 @@ const App = getApp() import { addRecord, securityCheckk, - inspectionStaff + inspectionStaff, + showRecord } from "../../../../utils/api" Page({ /** * 页面的初始数据 */ data: { + showtime:false, + checkboxOptions:[], + checkboxOptionsnumber:0, hiddenDangeList: [], newObj:[], addRecord: [], @@ -58,6 +62,12 @@ Page({ imageId: 1, arr: [], arr1: [], + addHiddenDangeList:[], + checkboxValue:[], + newContent:'', + currentDate: new Date().getTime(), + minDate: new Date(2020, 0, 1).getTime(), + maxDate: new Date(2030, 11, 31).getTime() }, /** * 生命周期函数--监听页面加载 @@ -71,6 +81,35 @@ Page({ }) this.reverseLocation() this.getList() + + }, + showTime(){ + this.setData({ + showtime:true + }) + }, + + showRecordData() { + console.log(this.data.companyId) + 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 checkboxOptionsnumber=checkboxOptions.length+1; + console.log(checkboxOptionsnumber) + this.setData({ + checkboxOptions, + checkboxOptionsnumber + }) + } + this.setData({ + showList:res.data + }) + console.log(this.data.showList) + }) }, getCurrentDateTime() { const now = new Date(); @@ -104,7 +143,7 @@ Page({ }) return false } - if(this.data.checkResultFlag == 0 && !this.data.reviewTime){ + if(this.data.checkResultFlag == 0 && !this.data.getData){ wx.showToast({ title: '请选择拟复查时间', icon:'none' @@ -122,17 +161,23 @@ 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'); - addRecord({ - companyId: this.data.companyId, + console.log(this.data.getData) + let form={ companyId: this.data.companyId, checkTime: this.getCurrentDateTime(), checkPersonsIdList: this.data.checkPersonsIdList, checkResultFlag: this.data.checkResultFlag, - reviewTime:`${this.data.reviewTime} ${hours}:${minutes}:${seconds}`, - hiddenDangeList:[...this.data.hiddenDangeList,{hazardStatus:2,hazardDesc:this.data.hazardDesc2}] , + 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: '', reviewAddress:this.data.addressContent - }).then( + } + if (!this.data.reviewTime) { + form.reviewTime=null + } + addRecord( + form + ).then( res => { if(res.code == 0){ wx.showToast({ @@ -158,7 +203,7 @@ Page({ }).then(({ data }) => { - console.log(data) + console.log(data.list) this.setData({ companyList: data.list, }); @@ -266,6 +311,9 @@ Page({ selectedNames: names, checkPersonsIdList:this.data.selectedOptions }); // 关闭弹出层 + }, + onCloseTime(){ + }, onChange1(event) { console.log(event) @@ -299,27 +347,18 @@ Page({ hazardDesc2: e.detail.value }); }, - addAnother() { - let newValue = this.data.arr1.length + 1; // 根据addAnother数组长度确定新值 - let newArr = this.data.arr1.concat({ - value: newValue.toString(), - name: this.data.hazardDesc - }); + changenewContent(e){ this.setData({ - arr1: newArr, - hazardDesc: '', // 清空输入框的值 + newContent: e.detail.value }); - const nameArray = this.data.arr1.map(item => item.name); - nameArray.forEach(value => { - // 创建一个新的对象,设置 hazardDesc 属性为当前值 - this.data.newObj = { - hazardStatus: '0', // 如果需要同时设置 hazardStatus 属性,可以在这里进行设置 - hazardDesc: value - }; - }); - - this.data.hiddenDangeList.push(this.data.newObj); - console.log(this.data.hiddenDangeList) + }, + addAnother() { + let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 }); + this.setData({ + addHiddenDangeList: newArr, + newContent: '', // 清空输入框的值 + }); + console.log('添加后的数组:', this.data.addHiddenDangeList); }, pickerChange: function (e) { this.setData({ @@ -343,6 +382,7 @@ Page({ gridNName: this.data.companyList[e.detail.value].name, companyId:this.data.companyList[e.detail.value].id }); + this.showRecordData() }, bindRemarkInput(e) { this.setData({ @@ -598,4 +638,36 @@ Page({ } }) }, + closePopup() { + this.setData({ showPopup: false }); + }, + + onInput(event) { + var date = new Date(event.detail); + var year = date.getFullYear(); + var month = ("0" + (date.getMonth() + 1)).slice(-2); + var day = ("0" + date.getDate()).slice(-2); + var hour = ("0" + date.getHours()).slice(-2); + 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 + }) + + }, + + onConfirm(event) { + const { value } = event.detail; + this.setData({ + currentDate: value, + showtime: false + }); + console.log('选中的日期时间:', new Date(value)); + }, + + onCancel() { + this.setData({ showtime: false }); + } }) \ No newline at end of file diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.json b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.json index 3e0357b..2068200 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.json +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.json @@ -8,6 +8,7 @@ "van-checkbox": "@vant/weapp/checkbox/index", "van-checkbox-group": "@vant/weapp/checkbox-group/index", "van-popup": "@vant/weapp/popup/index", - "van-picker": "@vant/weapp/picker/index" + "van-picker": "@vant/weapp/picker/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index" } } \ No newline at end of file diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml index 57202fb..2075d59 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml @@ -48,12 +48,13 @@ - - {{item.name}} - + + {{index+1}}.{{item.hazardDesc}} + - + @@ -97,14 +98,18 @@ * - + 拟复查时间 - + + {{getData?getData:'请选择'}} + + + @@ -151,5 +156,33 @@ - + + + + + diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss index f5bb206..596198b 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss @@ -290,6 +290,14 @@ page { margin-left: 50rpx; margin-bottom: 20rpx; } +.addHiddenDangeList{ + display: flex; + flex-direction: column; + margin-left: 70rpx; +} +.addHiddenDangeListText { +margin-bottom: 20rpx; +} .group{ margin-top: 20rpx; } diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js index a612a8a..ca09625 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js @@ -11,6 +11,7 @@ Page({ * 页面的初始数据 */ data: { + checkboxOptionsnumber:0, orgid:'', orgType:'', @@ -35,7 +36,11 @@ Page({ checkboxValue:[], uploadImageList: [],//图片上传的数组 imageId:1, - addHiddenDangeList:[] + addHiddenDangeList:[], + currentDate: new Date().getTime(), + minDate: new Date(2020, 0, 1).getTime(), + maxDate: new Date(2030, 11, 31).getTime(), + showtime:false, }, /** * 生命周期函数--监听页面加载 @@ -104,13 +109,18 @@ Page({ }); }); }, + showTime(){ + this.setData({ + showtime:true + }) +}, onChange(event) { console.log(event.detail); this.data.checkboxOptions.forEach((item,index)=>{ if(event.detail.findIndex(item=>item==index) != -1){ - item.hazardStatus = 1 - }else{ item.hazardStatus = 0 + }else{ + item.hazardStatus = 1 } }) this.setData({ @@ -182,7 +192,6 @@ Page({ }) }, - showPopup() { this.setData({ showPopup: true }); // 点击按钮显示弹出层 }, @@ -227,12 +236,28 @@ Page({ }); }, addAnother() { - let newArr = this.data.addHiddenDangeList.concat({ hazardDesc: this.data.newContent, hazardStatus: 0 }); - this.setData({ - addHiddenDangeList: newArr, - newContent: '', // 清空输入框的值 - }); - console.log('添加后的数组:', this.data.addHiddenDangeList); + 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); + + } + }, // 删除选中的图片 @@ -287,7 +312,6 @@ handelClickSave(){ }) return false } - const now = new Date(); const hours = now.getHours().toString().padStart(2, '0'); const minutes = now.getMinutes().toString().padStart(2, '0'); @@ -482,6 +506,22 @@ 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('用户点击取消') + } + } + }) + } + } }, pickerChange1: function(e) { this.setData({ @@ -495,6 +535,38 @@ bindRemarkInput(e){ console.log(this.data.remark) console.log(this.data.remark) }, +closePopup() { + this.setData({ showPopup: false }); +}, + +onInput(event) { + var date = new Date(event.detail); + var year = date.getFullYear(); + var month = ("0" + (date.getMonth() + 1)).slice(-2); + var day = ("0" + date.getDate()).slice(-2); + var hour = ("0" + date.getHours()).slice(-2); + 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 + }) + +}, + +onConfirm(event) { + const { value } = event.detail; + this.setData({ + currentDate: value, + showtime: false + }); + console.log('选中的日期时间:', new Date(value)); +}, + +onCancel() { + this.setData({ showtime: false }); +} }) diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json index 8ecdb53..1e8e5bc 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json @@ -7,7 +7,9 @@ "van-uploader": "@vant/weapp/uploader/index", "van-popup": "@vant/weapp/popup/index", "van-picker": "@vant/weapp/picker/index", - "wux-actionsheet": "../../../../components/dist/actionsheet/index" + "wux-actionsheet": "../../../../components/dist/actionsheet/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index" + }, "permissions": { "scope.record": true diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml index ac32554..8728aa8 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml @@ -56,14 +56,17 @@ * - + 拟复查时间 - + + {{getData?getData:'请选择'}} + + @@ -117,14 +120,14 @@ {{item.checkResultFlag == 1?'合格':'不合格'}} - 隐患明细: - {{index + 1}}. {{item.hazardDesc}} + {{index==0?'未整改隐患: ':'隐患明细:'}} + {{index + 1}}.{{item.hazardDesc}} - + 整改要求: {{item.hazardStatus}} - + 拟复查时间: {{item.reviewTime}} @@ -162,3 +165,23 @@ + + + + + + \ No newline at end of file From b661b3f306ff95957e44be29f67e5dc1212d2645 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 09:27:49 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=B8=8D=E5=90=88=E6=A0=BC=E9=9A=90?= =?UTF-8?q?=E6=82=A3=E6=98=8E=E7=BB=86=E6=9C=80=E5=B0=91=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E4=B8=80=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/InspectionReport/InspectionReport.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js index 098a458..9759e34 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js @@ -150,7 +150,8 @@ Page({ }) return false } - if(this.data.checkResultFlag == 0 && this.data.hiddenDangeList.length<0){ + console.log( this.data.addHiddenDangeLis) + if(this.data.checkResultFlag == 0 && this.data.addHiddenDangeList){ wx.showToast({ title: '请填写隐患明细', icon:'none' From d0266838cc483aa1b3a197911b012813b400a777 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 09:32:12 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=B8=8D=E5=90=88=E6=A0=BC=E8=A6=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=AD=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InspectionReport/pages/InspectionReport/InspectionReport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js index 9759e34..72747f7 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js @@ -153,7 +153,7 @@ Page({ console.log( this.data.addHiddenDangeLis) if(this.data.checkResultFlag == 0 && this.data.addHiddenDangeList){ wx.showToast({ - title: '请填写隐患明细', + title: '隐患明细最少输入一条', icon:'none' }) return false 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 6/9] =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9C=AA=E5=88=B7?= =?UTF-8?q?=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:'请选择'}} - - + - + * + 整改要求 - - - - + + + + @@ -138,7 +137,7 @@ 备注 -