wxml------
{{(index+1)+’、’+item.contentInfo}}
{{itemT.name}}
*
异常描述
处理情况
提交
wxss------------------------
.resultItem {
background: #fff;
margin-top: 20rpx;
padding-top: 30rpx;
}
.plareptit {
height: 44rpx;
font-size: 32rpx;
font-weight: 700;
color: #333;
line-height: 44rpx;
margin-left: 30rpx;
}
/* .margintop{
margin-top:40rpx;
} */
.mrhandle {
display: grid;
width: 100%;
height: 100rpx;
background: #fff;
grid-template-columns: 408rpx auto;
}
.mshandimg {
width: 36rpx;
height: 36rpx;
margin-top: 34rpx;
}
.pre {
margin-left: 72rpx;
}
.mshandlside {
display: grid;
grid-template-columns: 36rpx auto;
}
.mshandtxt {
display: inline-block;
/* margin-top:30rpx; */
height: 100rpx;
line-height: 100rpx;
margin-left: 28rpx;
}
.suppletit {
height: 40rpx;
font-size: 28rpx;
font-weight: 400;
color: #a1a0a7;
line-height: 40rpx;
}
.star {
display: inline-block;
width: 10rpx;
color: #f00;
}
.srsupple {
padding-bottom: 30rpx;
}
.suppleA {
margin-left: 72rpx;
}
.suppleB {
margin-left: 82rpx;
margin-top: 18rpx;
}
.describeArea {
box-sizing: border-box;
display: block;
width: 646rpx;
height: 194rpx;
border: 2rpx solid #dcdcdc;
padding-top: 10rpx;
padding-left: 20rpx;
border-radius: 8rpx;
margin: 0 auto;
margin-top: 10rpx;
font-size: 30rpx;
line-height: 42rpx;
color: #333;
}
.describeAreaHolder {
color: #a7a7a7;
font-size: 28rpx;
line-height: 40rpx;
}
.send {
margin: 0 auto;
margin-top: 30rpx;
margin-bottom: 30rpx;
width: 686rpx;
height: 76rpx;
background: linear-gradient(310deg, rgba(255, 198, 132, 1) 0%, rgba(255, 136, 0, 1) 100%);
border-radius: 8rpx;
line-height: 76rpx;
font-size: 32rpx;
color: #fff;
text-align: center;
}
js-----------------------
// pages/ceshi/ceshi.js
const app = getApp()
Page({
/**
- 页面的初始数据
*/
data: {
questarray: [{
taskContentId: 500,
contentInfo: “用火有误违章”,
contentStatus: 0,
checkInfo: null,
handleWay: null,
array: [{
name: ‘正常’,
checked: true
},
{
name: ‘异常’,
checked: false
}
]
},
{
taskContentId: 500,
contentInfo: “用火有误违章”,
contentStatus: 0,
checkInfo: null,
handleWay: null,
array: [{
name: ‘正常’,
checked: true
},
{
name: ‘异常’,
checked: false
}
]
}
],
reArray:{
taskPostionId:0,
taskId:9
}
},
/**
- 生命周期函数–监听页面加载
*/
onLoad: function(options) {
},
check: function(e) {
let index1 = e.currentTarget.dataset.num //第一层循环
let index2 = e.currentTarget.dataset.index //第二层循环
// let questarray = this.data.questarray
if (index2 == 1 && this.data.questarray[index1].array[1].checked == true) {
this.data.questarray[index1].array[1].checked = false
this.data.questarray[index1].array[0].checked = true
} else
if (index2 == 1 && this.data.questarray[index1].array[1].checked == false) {
this.data.questarray[index1].array[1].checked = true
this.data.questarray[index1].array[0].checked = false
} else
if (index2 == 0 && this.data.questarray[index1].array[0].checked == true) {
this.data.questarray[index1].array[0].checked = false
this.data.questarray[index1].array[1].checked = true
} else
if (index2 == 0 && this.data.questarray[index1].array[0].checked == false) {
this.data.questarray[index1].array[0].checked = true
this.data.questarray[index1].array[1].checked = false
}
console.log(this.data.questarray[index1].array[0].checked, this.data.questarray[index1].array[1].checked)
this.setData({
questarray: this.data.questarray
})
},
checkInfo: function(e) {
let index1 = e.currentTarget.dataset.num
let txt = e.detail.value
this.data.questarray[index1].checkInfo = txt
this.setData({
questarray: this.data.questarray
})
},
handleWay: function(e) {
let index1 = e.currentTarget.dataset.num
let txt = e.detail.value
this.data.questarray[index1].handleWay = txt
this.setData({
questarray: this.data.questarray
})
},
up_submit: function () {
// 提交
let that = this
console.log(that.data.reArray)
let uparray = that.data.questarray
var patrolTaskContentDatas = []
for (var i = 0; i < uparray.length; i++) {
console.log(uparray[i].array[1].checked, uparray[i].checkInfo)
if (uparray[i].array[1].checked == true) {
if (uparray[i].checkInfo == null || uparray[i].checkInfo == ‘’) {
wx.showToast({
title: ‘请填写第’ + (i + 1) + ‘项的异常描述信息’,
icon: ‘none’
})
return
} else if (uparray[i].handleWay == null || uparray[i].handleWay == ‘’) {
wx.showToast({
title: ‘请填写第’ + (i + 1) + ‘项的处理情况信息’,
icon: ‘none’
})
return
}
} else if (uparray[i].array[1].checked == false) {
uparray[i].checkInfo = ‘’
uparray[i].handleWay = ‘’
}
if (uparray[i].array[1].checked == true) {
var contentStatus = 2
} else {
contentStatus = 1
}
patrolTaskContentDatas.push({
taskPostitionId: parseInt(that.data.reArray.taskPostionId),
taskContentId: uparray[i].taskContentId,
checkInfo: uparray[i].checkInfo,
handleWay: uparray[i].handleWay,
taskId: parseInt(that.data.reArray.taskId),
contentStatus: parseInt(contentStatus)
})
}
let data = {
patrolTaskContentDatas: patrolTaskContentDatas
}
wx.showModal({
showCancel: true,
title: '提示',
content: '确定提交信息吗',
cancelText: '取消',
confirmText: '确定',
confirmColor: '#ff8800',
success(res) {
if (res.confirm) {
// network.Post('/patrol/task/sp/update/build/task', data).then(function (res) {
// wx.navigateTo({
// url: '/pages/routine/routine?type=' + app.globalData.routetype + '&id=' + app.globalData.routeid
// })
// })
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
/**
- 生命周期函数–监听页面初次渲染完成
*/
onReady: function() {
},
/**
- 生命周期函数–监听页面显示
*/
onShow: function() {
},
/**
- 生命周期函数–监听页面隐藏
*/
onHide: function() {
},
/**
- 生命周期函数–监听页面卸载
*/
onUnload: function() {
},
/**
- 页面相关事件处理函数–监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
- 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
- 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})