199 lines
4.0 KiB
JavaScript
199 lines
4.0 KiB
JavaScript
var util = require('../../utils/util.js')
|
|
// pages/observe/observedetail.js
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
|
|
|
|
data: {
|
|
serverUrl: getApp().globalData.serverUrl,
|
|
items: [
|
|
{ name: '1', value: '正在整改中'},
|
|
{ name: '2', value: '已整改完成' },
|
|
|
|
]
|
|
},
|
|
bindjcwtInput: function (e) {
|
|
this.data.jcwt = e.detail.value
|
|
},
|
|
bindzgqkInput: function (e) {
|
|
this.data.zgqk = e.detail.value
|
|
},
|
|
bindcfnrInput: function (e) {
|
|
this.data.cfnr = e.detail.value
|
|
},
|
|
radioChange: function (e) {
|
|
this.data.jczt = e.detail.value
|
|
},
|
|
|
|
submit: function () {
|
|
|
|
if (!this.data.jcwt) {
|
|
this.Tap1('请填写检查问题!')
|
|
}
|
|
else if (!this.data.zgqk) {
|
|
this.Tap1('请填写整改情况!')
|
|
}
|
|
else if (!this.data.jczt) {
|
|
this.Tap1('请选择检查状态!')
|
|
}
|
|
else {
|
|
|
|
this.addjob()
|
|
|
|
}
|
|
},
|
|
Tap1: function (x) {
|
|
wx.showModal({
|
|
title: "系统提示",
|
|
content: x,
|
|
showCancel: false,
|
|
confirmText: "确定"
|
|
})
|
|
},
|
|
addjob: function () {
|
|
|
|
var jobdata = {
|
|
checkquestion: this.data.jcwt,//检查问题
|
|
zgjg: this.data.zgqk,//整改情况
|
|
content: this.data.cfnr,//处罚内容
|
|
taskstate: this.data.jczt,//检查状态
|
|
participant: this.data.cjry,//处罚人
|
|
|
|
}
|
|
console.log(jobdata)
|
|
wx.showModal({
|
|
title: '系统提示',
|
|
content: '确认提交!',
|
|
confirmText: "确定",
|
|
cancelText: "取消",
|
|
success: (res)=> {
|
|
if (res.confirm) {
|
|
wx.showLoading({
|
|
title: '正在提交...',
|
|
})
|
|
wx.request({
|
|
url: getApp().globalData.serverUrl + 'api/checkproject?a=addjobwx&jobid=' + this.data.jobid,
|
|
header: {
|
|
'content-type': 'application/x-www-form-urlencoded', //
|
|
'Cookie': getApp().globalData.sessionId,
|
|
},
|
|
method: 'POST',
|
|
data:jobdata ,
|
|
success: res => {
|
|
if (res.statusCode === 200) {
|
|
wx.hideLoading();
|
|
wx.navigateBack()
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.getGcdetail(options.id);
|
|
this.setData({
|
|
|
|
jobid: options.id
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
let lst = getApp().globalData.selectPeopleList
|
|
let nst = []
|
|
let nst1 = []
|
|
if (lst) {
|
|
for (var i = 0; i < lst.length; i++) {
|
|
nst.push(lst[i]['name'])
|
|
nst1.push(lst[i]['id'])
|
|
}
|
|
this.setData({
|
|
cjryname: nst.join(','),
|
|
cjry: nst1.join(','),
|
|
cjrs: nst1.length
|
|
})
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
|
|
getGcdetail: function (id) {
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
}),
|
|
wx.request({
|
|
url: this.data.serverUrl + 'api/checkproject?a=checkjobdetail&id=' + id,
|
|
header: {
|
|
'content-type': 'application/json', // 默认值
|
|
'Cookie': getApp().globalData.sessionId,
|
|
},
|
|
data: {
|
|
},
|
|
success: res => {
|
|
wx.hideLoading();
|
|
console.log(res.data);
|
|
if (res.statusCode === 200) {
|
|
var data = res.data
|
|
//格式化观察信息
|
|
|
|
this.setData(data)
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
}) |