From 16b3c98e8d17ef07ceb7fc4fba4b8954937dde11 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, 24 May 2024 17:47:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E4=B8=BA=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InspectionReport/InspectionReport.js | 13 ++++++-- .../InspectionReport/InspectionReport.wxml | 13 +++++--- .../InspectionReport/InspectionReport.wxss | 6 +++- .../safetyinspection/safetyinspection.js | 33 +++++++++++++++++++ .../safetyinspection/safetyinspection.wxml | 13 +++++--- .../safetyinspection/safetyinspection.wxss | 3 ++ 6 files changed, 68 insertions(+), 13 deletions(-) diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js index 3a340ba..b8fd705 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js @@ -88,7 +88,16 @@ Page({ showtime:true }) }, - + onInputChange(e){ + const index = e.currentTarget.dataset.index; + const value = e.detail.value; + let addHiddenDangeList = this.data.addHiddenDangeList; + addHiddenDangeList[index].hazardDesc = value; + this.setData({ + addHiddenDangeList: addHiddenDangeList + }); + console.log(this.data.addHiddenDangeList); + }, showRecordData() { this.setData({ checkboxOptions:[] @@ -147,7 +156,7 @@ Page({ return false } - if(this.data.checkResultFlag == 0 && this.data.checkboxValue.length<1&&!this.data.newContent){ + if(this.data.checkResultFlag == 0 && this.data.checkboxValue.length<1&&!this.data.addHiddenDangeList<1){ wx.showToast({ title: '隐患明细最少输入一条', icon:'none' diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml index b18253b..b2cfac6 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml @@ -51,18 +51,21 @@ {{index + 1}}. {{item.hazardDesc}} - - {{item.hazardDesc}} + + - + diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss index 596198b..835531d 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss @@ -293,10 +293,14 @@ page { .addHiddenDangeList{ display: flex; flex-direction: column; - margin-left: 70rpx; + margin-left: 60rpx; } .addHiddenDangeListText { margin-bottom: 20rpx; +margin-top: 10rpx; +background-color: #f7f7f7; +width: 550rpx; +height: 60rpx; } .group{ margin-top: 20rpx; diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js index f0e6270..2e4e051 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js @@ -121,6 +121,16 @@ Page({ }); }); }, + onInputChange(e){ + const index = e.currentTarget.dataset.index; + const value = e.detail.value; + let addHiddenDangeList = this.data.addHiddenDangeList; + addHiddenDangeList[index].hazardDesc = value; + this.setData({ + addHiddenDangeList: addHiddenDangeList + }); + console.log(this.data.addHiddenDangeList); + }, handelShowTime(){ this.setData({ showtime:true @@ -398,6 +408,29 @@ addRecord(form).then(res => { }) console.log(form); }, +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); + + } +}, chooseImage() { if (this.data.uploadImageList.length > 3) { wx.showToast({ diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml index 143b113..9d25236 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml @@ -40,18 +40,21 @@ {{index + 1}}. {{item.hazardDesc}} - - {{item.hazardDesc}} + + - + * diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss index c76320a..bf8ad3f 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss @@ -431,6 +431,9 @@ margin-bottom: 20rpx; } .addHiddenDangeListText { margin-bottom: 20rpx; +background-color: #f7f7f7; +width: 500rpx; +height: 60rpx; } .field-text{ width: 61rpx;