Browse Source

变为输入框

v4.3.1_xiaowang_bug
是小王呀\24601 1 year ago
parent
commit
16b3c98e8d
  1. 13
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
  2. 13
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml
  3. 6
      subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxss
  4. 33
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
  5. 13
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml
  6. 3
      subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss

13
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'

13
subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml

@ -51,18 +51,21 @@
<van-checkbox-group value="{{checkboxValue}}" bind:change="onChange" wx:if="{{checkboxOptions}}" >
<van-checkbox custom-class="group" name="{{item.id}}" wx:for="{{checkboxOptions}}">{{index + 1}}. {{item.hazardDesc}}</van-checkbox>
</van-checkbox-group>
<view class="addHiddenDangeList">
<text wx:for="{{addHiddenDangeList}}" wx:for-index="index" class="addHiddenDangeListText"
wx:for-item="item"> {{item.hazardDesc}}</text>
<view class="addHiddenDangeList" wx:for="{{addHiddenDangeList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<input class="addHiddenDangeListText"
value="{{item.hazardDesc}}"
data-index="{{index}}"
bindinput="onInputChange"
></input>
</view>
</view>
<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>
<view class="pitfall" wx:if="{{beforeFlag == 1}}">

6
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;

33
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({

13
subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml

@ -40,18 +40,21 @@
<van-checkbox-group value="{{checkboxValue}}" bind:change="onChange" wx:if="{{checkboxOptions}}" >
<van-checkbox custom-class="group" name="{{index}}" wx:for="{{checkboxOptions}}">{{index + 1}}. {{item.hazardDesc}}</van-checkbox>
</van-checkbox-group>
<view class="addHiddenDangeList">
<text wx:for="{{addHiddenDangeList}}" wx:for-index="index" class="addHiddenDangeListText"
wx:for-item="item"> {{item.hazardDesc}}</text>
<view class="addHiddenDangeList" wx:for="{{addHiddenDangeList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<input class="addHiddenDangeListText"
value="{{item.hazardDesc}}"
data-index="{{index}}"
bindinput="onInputChange"
></input>
</view>
</view>
<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" wx:if="{{checkResultFlagRouter == 1}}">
<text class="prosecutors_req">*</text>

3
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;

Loading…
Cancel
Save