jhwxapp/miniprogram/pageage/project_problemmodify/quality/info/index.js

195 lines
4.0 KiB
JavaScript

// pageage/project_checking/info/index.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
id:"",
infoData:{},
imgs:[],
loadShow:false,
auditInfo:{},
auditImgs:[],
loginName:"",
showDel:false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let {id} = options
//获取缓存数据
wx.getStorage({
key: 'userinfo',
success:res=>{
this.setData({
id,
loginName:res.data.loginName
})
this.getInfo();
this.getAuditinfo();
}
})
},
/**
* 获取安全检查详情信息
*
*/
getInfo(){
let {id} = this.data
let that = this
wx.request({
url: app.globalData.reqUrl+'/wechat/projectProblemmodify/info',
method:"get",
data:{
id:id
},
success(res){
res = res.data
if(res.code == 200){
let urls = [];
res.data.smarkUrl.split(',').forEach(element => {
urls.push(element+'.min.jpg');
});
that.setData({
infoData:res.data,
imgs:urls,
loadShow:false
})
//判断当前能否删除
if(res.data.checkState!=4 && res.data.createUser==that.data.loginName){
that.setData({
showDel:true
})
}
}
}
})
},
getAuditinfo(){
let {id} = this.data
let that = this
wx.request({
url: app.globalData.reqUrl+'/wechat/projectProblemmodify/queryAuditInfo',
method:"get",
data:{
id:id
},
success(res){
res = res.data
if(res.code == 200 && res.data){
let urls = [];
res.data.fileUrls.split(',').forEach(element => {
urls.push(element+'.min.jpg');
});
that.setData({
auditInfo:res.data,
auditImgs:urls
})
}
}
})
},
onDelete(){
//弹出确认
let that = this
wx.showModal({
title: '提示',
content: '是否确定撤回删除此条数据?',
success: function (sm) {
if (sm.confirm) {
// 用户点击了确定 可以调用了
that.deleteData();
} else if (sm.cancel) {
console.log('用户点击取消');
}
}
})
},
deleteData(){
let {id} = this.data
wx.request({
url: app.globalData.reqUrl+'/wechat/projectProblemmodify/removeSafety',
data:{
id:id
},
method:"get",
success(res){
app.toast("删除成功!")
wx.navigateTo({
url: `../list/index`,
})
}
})
},
//打开放大的图片
enlargeImage(e){
this.setData({
imgUrl:e.currentTarget.dataset.url,
imgShow:true
})
},
//关闭放大的图片
closeImages(){
this.setData({
imgShow:false
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})