// pages/problemList/problemList.js
|
import { CheckEdit, GetQuList, Delete, TOperation } from '../../utils/network'
|
Page({
|
|
/**
|
* 页面的初始数据
|
*/
|
data: {
|
listdata: [],
|
active: 0,
|
isadmin: true,
|
bohui:true,
|
show:false,
|
text:'',
|
itemId:'',
|
daiPaiDanNum:'',//待派单数量
|
daiZhengGaiNum:'',//待整改数量
|
zhengGaiZhongNum:'',//整改中数量
|
daiShenHeNum:'',//待审核数量
|
zhengGaiWanChengNum:'',//整改完成数量
|
role:'',//整改完成数量
|
},
|
|
// 详情展示
|
toxiangqin(e){
|
console.log(e.target.dataset.id)
|
var id = e.target.dataset.id
|
wx.navigateTo({
|
url: '/pages/xiangqing/xiangqing?id=' + id,
|
})
|
},
|
/**
|
* 生命周期函数--监听页面加载
|
*/
|
onLoad: function (options) {
|
var role = wx.getStorageSync('user').RoleValue
|
this.setData({
|
role:role
|
})
|
// console.log(role)
|
if (role === 1) {
|
this.setData({
|
isadmin: true
|
})
|
} else {
|
this.setData({
|
isadmin: false
|
})
|
}
|
wx.showLoading({
|
title: '加载中',
|
})
|
// getlist
|
GetQuList(0).then((res) => {
|
if (res.data.TimeOutFlag){
|
wx.removeStorage({
|
key: 'user',
|
success() {
|
wx.setStorageSync('token', '')
|
wx.redirectTo({
|
url: '/pages/login/logn',
|
})
|
}
|
})
|
wx.showToast({
|
title: '登录超时,您已下线',
|
})
|
|
} else {
|
console.log(res.data.Data)
|
this.setData({
|
listdata: res.data.Data
|
})
|
wx.hideLoading()
|
}
|
|
}).catch((err)=>{
|
console.log(err)
|
})
|
},
|
// 通过
|
pass(e) {
|
this.setData({
|
bohui:false,
|
show:true,
|
itemId:e.currentTarget.dataset.id
|
})
|
// var data = {
|
// _RoleValue: wx.getStorageSync('user').RoleValue,
|
// _pk_User: wx.getStorageSync('user').pk_User,
|
// _pk_Examine: e.currentTarget.dataset.id,
|
// Tag: 2,
|
// }
|
// wx.showLoading({
|
// title: '加载中',
|
// })
|
// TOperation(data).then((res) => {
|
// if (res.data.Data) {
|
// GetQuList(3).then((res) => {
|
// this.setData({
|
// listdata: res.data.Data
|
// })
|
// wx.hideLoading()
|
// wx.showToast({
|
// title: '完成',
|
// })
|
// })
|
// }
|
// })
|
},
|
// 驳回
|
bohui(e) {
|
this.setData({
|
bohui:true,
|
show:true,
|
itemId:e.currentTarget.dataset.id
|
})
|
// var data = {
|
// _RoleValue: wx.getStorageSync('user').RoleValue,
|
// _pk_User: wx.getStorageSync('user').pk_User,
|
// _pk_Examine: e.currentTarget.dataset.id,
|
// Tag: 1,
|
// }
|
// wx.showLoading({
|
// title: '加载中',
|
// })
|
// TOperation(data).then((res) => {
|
// if (res.data.Data) {
|
// GetQuList(3).then((res) => {
|
// this.setData({
|
// listdata: res.data.Data
|
// })
|
// wx.hideLoading()
|
// wx.showToast({
|
// title: '完成',
|
// })
|
// })
|
// }
|
// })
|
},
|
textinput(e) {
|
this.setData({
|
text: e.detail.value
|
})
|
},
|
remove(){
|
this.setData({
|
bohui:'',
|
show:false,
|
text:'',
|
itemId:''
|
})
|
},
|
replyes(){
|
// console.log(this.data.text)
|
if(this.data.bohui){
|
var data = {
|
_RoleValue: wx.getStorageSync('user').RoleValue,
|
_pk_User: wx.getStorageSync('user').pk_User,
|
_pk_Examine: this.data.itemId,
|
Tag: 1,
|
_Reject_Question:this.data.text
|
}
|
|
wx.showLoading({
|
title: '加载中',
|
})
|
TOperation(data).then((res) => {
|
console.log(res.data)
|
this.remove()
|
if (res.data.Data) {
|
GetQuList(3).then((res) => {
|
this.setData({
|
listdata: res.data.Data
|
})
|
wx.hideLoading()
|
wx.showToast({
|
title: '完成',
|
})
|
})
|
}
|
})
|
} else {
|
var data = {
|
_RoleValue: wx.getStorageSync('user').RoleValue,
|
_pk_User: wx.getStorageSync('user').pk_User,
|
_pk_Examine: this.data.itemId,
|
Tag: 2,
|
_Approve_QuestionInfo:this.data.text
|
}
|
wx.showLoading({
|
title: '加载中',
|
})
|
TOperation(data).then((res) => {
|
this.remove()
|
if (res.data.Data) {
|
GetQuList(3).then((res) => {
|
this.setData({
|
listdata: res.data.Data
|
})
|
wx.hideLoading()
|
wx.showToast({
|
title: '完成',
|
})
|
})
|
}
|
})
|
}
|
},
|
// 撤回
|
chehui(e) {
|
var data = {
|
_RoleValue: wx.getStorageSync('user').RoleValue,
|
_pk_User: wx.getStorageSync('user').pk_User,
|
_pk_Examine: e.currentTarget.dataset.id,
|
Tag: 3,
|
}
|
wx.showLoading({
|
title: '加载中',
|
})
|
TOperation(data).then((res) => {
|
if (res.data.Data) {
|
GetQuList(4).then((res) => {
|
this.setData({
|
listdata: res.data.Data
|
})
|
wx.hideLoading()
|
wx.showToast({
|
title: '完成',
|
})
|
})
|
}
|
})
|
},
|
//历史流程
|
history(e) {
|
var id = e.currentTarget.dataset.id
|
// console.log(id)
|
wx.navigateTo({
|
url: '/pages/history/hisstory?id=' + id,
|
})
|
},
|
// 图片预览
|
imgYu(e) {
|
// console.log(e.currentTarget.dataset.img)
|
const imgurl = e.currentTarget.dataset.img
|
wx.previewImage({
|
current: imgurl,
|
urls: [imgurl],
|
})
|
},
|
// 选中状态
|
click(e) {
|
wx.showLoading({
|
title: '加载中',
|
})
|
console.log(1111111,e.detail.index)
|
var id = e.detail.index
|
this.setData({
|
active: id
|
})
|
GetQuList(id).then((res) => {
|
console.log(res.data)
|
this.setData({
|
listdata: res.data.Data
|
})
|
wx.hideLoading()
|
})
|
},
|
// 转发中枢
|
zhuanFa(e) {
|
wx.request({
|
url: 'http://101.133.134.71:9002/TOperation/Post',
|
method: "POST",
|
header: { "content-type": "application/x-www-form-urlencoded" },
|
data: {
|
_RoleValue: wx.getStorageSync('user').RoleValue,
|
_pk_User: wx.getStorageSync('user').pk_User,
|
_pk_Examine: e.currentTarget.dataset.id,
|
Tag: e.currentTarget.dataset.tag
|
},
|
success(res) {
|
console.log(res)
|
if (res.data.Check){
|
|
}else{
|
|
}
|
},
|
fail(err) {
|
|
}
|
})
|
},
|
// 中枢退回
|
tuiHui(e) {
|
console.log(e.currentTarget.dataset.id)
|
var id = e.currentTarget.dataset.id * 1
|
CheckEdit(id).then((res) => {
|
res.data.Data.id = id
|
console.log(res.data.Data)
|
wx.navigateTo({
|
url: '/pages/paiDan/paiDan?data=' + JSON.stringify(res.data.Data),
|
})
|
}).catch((err) => {
|
console.log(err)
|
})
|
// wx.navigateTo({
|
// url: '/pages/aditReport/adit?data='+e.currentTarget.dataset.id,
|
// })
|
},
|
// 派单
|
paiDan(e) {
|
console.log(e.currentTarget.dataset.id)
|
var id = e.currentTarget.dataset.id * 1
|
CheckEdit(id).then((res) => {
|
res.data.Data.id = id
|
console.log(res.data.Data)
|
wx.navigateTo({
|
url: '/pages/paiDan/paiDan?data=' + JSON.stringify(res.data.Data),
|
})
|
}).catch((err) => {
|
console.log(err)
|
})
|
// wx.navigateTo({
|
// url: '/pages/aditReport/adit?data='+e.currentTarget.dataset.id,
|
// })
|
},
|
// 修改
|
adit(e) {
|
console.log(e.currentTarget.dataset.id)
|
var id = e.currentTarget.dataset.id * 1
|
CheckEdit(id).then((res) => {
|
res.data.Data.id = id
|
console.log(res.data.Data)
|
wx.navigateTo({
|
url: '/pages/aditReport/adit?data=' + JSON.stringify(res.data.Data),
|
})
|
}).catch((err) => {
|
console.log(err)
|
})
|
// wx.navigateTo({
|
// url: '/pages/aditReport/adit?data='+e.currentTarget.dataset.id,
|
// })
|
},
|
// 删除
|
del(e) {
|
// console.log(e.currentTarget.dataset.id)
|
wx.showModal({
|
title: '删除',
|
content: '确定要删除此上报问题?',
|
success: (res) => {
|
if (res.confirm) {
|
// console.log('用户点击了确定')
|
Delete(e.currentTarget.dataset.id).then((res) => {
|
if (res.data.Data === 1) {
|
wx.showLoading({
|
title: '加载中',
|
})
|
GetQuList(this.data.active).then((res) => {
|
this.setData({
|
listdata: res.data.Data
|
})
|
wx.hideLoading()
|
})
|
} else { }
|
})
|
} else if (res.cancel) {
|
|
}
|
}
|
})
|
},
|
|
//
|
imgOnLoad(e){
|
// console.log(e.currentTarget.dataset.index)
|
// console.log(e.currentTarget.dataset)
|
this.data.listdata[e.currentTarget.dataset.index].loading = true
|
var l = this.data.listdata
|
this.setData({
|
listdata:l
|
})
|
},
|
/**
|
* 生命周期函数--监听页面初次渲染完成
|
*/
|
onReady: function () {
|
|
},
|
|
/**
|
* 生命周期函数--监听页面显示
|
*/
|
onShow: function () {
|
wx.showLoading({
|
title: '加载中',
|
})
|
GetQuList(this.data.active).then((res) => {
|
this.setData({
|
listdata:[]
|
})
|
this.setData({
|
listdata: res.data.Data
|
})
|
wx.hideLoading()
|
}).catch(res=>{})
|
GetQuList(0).then((res) => {
|
this.setData({
|
daiPaiDanNum:res.data.Data.length === 0?0:res.data.Data.length
|
})
|
})
|
GetQuList(1).then((res) => {
|
this.setData({
|
daiZhengGaiNum:res.data.Data.length === 0?0:res.data.Data.length
|
})
|
})
|
GetQuList(2).then((res) => {
|
this.setData({
|
zhengGaiZhongNum:res.data.Data.length === 0?0:res.data.Data.length
|
})
|
})
|
GetQuList(3).then((res) => {
|
this.setData({
|
daiShenHeNum:res.data.Data.length === 0?0:res.data.Data.length
|
})
|
})
|
GetQuList(4).then((res) => {
|
this.setData({
|
zhengGaiWanChengNum:res.data.Data.length === 0?0:res.data.Data.length
|
})
|
})
|
},
|
|
/**
|
* 生命周期函数--监听页面隐藏
|
*/
|
onHide: function () {
|
|
},
|
|
/**
|
* 生命周期函数--监听页面卸载
|
*/
|
onUnload: function () {
|
// console.log(111111111)
|
wx.switchTab({
|
url: '/pages/home/home',
|
})
|
},
|
|
/**
|
* 页面相关事件处理函数--监听用户下拉动作
|
*/
|
onPullDownRefresh: function () {
|
|
},
|
|
/**
|
* 页面上拉触底事件的处理函数
|
*/
|
onReachBottom: function () {
|
|
},
|
|
/**
|
* 用户点击右上角分享
|
*/
|
onShareAppMessage: function () {
|
|
}
|
})
|