jhwxapp/miniprogram/pages/gengduogongneng/index.js

193 lines
4.4 KiB
JavaScript

// pages/gengduogongneng/index.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
active:4,
projectId:'',
projectName:'' ,
loginName:'',
remark:'',
roleId:'',
roleName:'',
menuList:[],
initData:{},
hiddenn:true,
todoDB:0,
lzyjDB:0,
approveDB:0,
ad:0,
td:0,
aq:0,
},
//项目切换 返回值
onProjectSelect(e){
let projectId = e.detail.id;
let projectName = e.detail.text;
app.globalData.projectId = projectId;
app.globalData.projectName = projectName;
this.onLoad();
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
//获取缓存数据
wx.getStorage({
key: 'userinfo',
success:function(res){
that.setData({
roleId:res.data.roleId,
roleName:res.data.roleName,
remark:res.data.remark,
loginName:res.data.loginName,
projectId:app.globalData.projectId,
projectName:app.globalData.projectName,
initData:{text:app.globalData.projectName,id:app.globalData.projectId}
})
that.selectMenuList(res.data.loginName);
that.awaitTask(res.data.minRoleId,res.data.deptId,res.data.loginName,res.data.userId);
}
})
},
selectMenuList:function(loginName){
var that = this;
wx.request({
url: app.globalData.reqUrl+'/wechat/selectRoleMenuList',
data:{
username:loginName,
type:"gdgn"
},
method:"get",
success:function(res){
res=res.data;
if(res.code =='200'){
that.setData({
menuList:res.data
})
}
}
})
},
goMenu:function(event){
let id = event.currentTarget.dataset.id;
if(id == 'CLSSQE'){
//材料实收确认
wx.getStorage({
key: 'userinfo',
success:function(res){
wx.navigateToMiniProgram({
appId: 'wxc44b5d588f599758',
path: `pages/tabbar/order-new/index?type=0&szhUserId=${res.data.userId}&szhUserName=${res.data.loginName}`
})
}
})
// wx.navigateToMiniProgram({
// appId: 'wx7c39a25db91228f7',
// path: 'pages/tabbar/order-new/index?type=0'
// })
}else if(id == 'LSRYSH'){
//临时人员审核
wx.navigateTo({
url: '../temporaryToExamine/index',
})
}else if(id == 'FQJPYS'){
//发起举牌验收
wx.navigateTo({
url: '../check_accept_initiate/index',
})
}else if(id == 'TJJPYS'){
//提交举牌验收
wx.navigateTo({
url: '../check_accept_list/index',
})
}else{
wx.setStorageSync('nav-menu', "gd");
wx.redirectTo({
url: event.currentTarget.dataset.url
})
}
},
// 底部导航
onChange(event) {
// event.detail 的值为当前选中项的索引
this.setData({ active: event.detail });
},
//跳转到项目概况页面
XMGK:function(){
wx.redirectTo({
url: '../xiangmugaikuang/index'
})
},
//跳转到安全管理
AQGL:function(){
wx.redirectTo({
url:'../safety_manage/index'
})
},
//跳转到质量管理
ZLGL:function(){
wx.redirectTo({
url:'../quality_manage/index'
})
},
//跳转到进度管理
JDGL2:function(){
//app.toast("敬请期待!");
wx.redirectTo({
url:'../../pageage/project_schedule/list/index'
})
},
//返回到工程列表页面
goGCLB:function(){
wx.redirectTo({
url: '../xiangmugaikuang/index'
})
},
//查询当前登录人的代办任务
awaitTask(minRoleId,deptId,loginName,userId) {
let param = {
"businessKey":app.globalData.projectId,
"nowRole":minRoleId,
"nowDept":deptId,
"nowUserName":loginName,
"nowUser":userId,
"activeName":"await"
}
var that = this;
wx.request({
url: app.globalData.reqUrl + '/wechat/flowTask/myAwaitFlowTaskListCount',
data:param,
method: "post",
success: function (res) {
res = res.data;
if(res.code=="200"){
that.setData({
todoDB:res.data.todo,
lzyjDB:res.data.approveLZYJ,
td:res.data.todo,
ad:res.data.approve+res.data.zlCount,
aq:res.data.aqCount,
})
}
}
})
},
})