You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
4.7 KiB
165 lines
4.7 KiB
// miniprogram/subpages/organization/pages/organizationStree/organizationStree.js
|
|
import {getOrganizeList} from '../../../../api/organization'
|
|
Page({
|
|
data: {
|
|
isActive:0,
|
|
list:[],
|
|
deptKey:'0',
|
|
deptId:'',
|
|
rightId:'',
|
|
deptName:'',//部门名称
|
|
StreetNumber:'',//街道
|
|
communityTotal:'',//社区
|
|
gridTotal:'',//网格
|
|
/****右侧数据 *****/
|
|
rightdeptName:'',
|
|
rightcommunityTotal:'',//社区
|
|
rightgridTotal:'',//网格
|
|
rightposition:'',//领导职务
|
|
rightmasterOfficerName:'',//领导姓名
|
|
rightmobile:'',//电话
|
|
rightuserFace:'',
|
|
rightList:[],
|
|
loadVisible:false,
|
|
loadType:'more',
|
|
isShow:false,
|
|
isShowRight:true,
|
|
isSkipId:'',//是否是跳转的页面
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
async onLoad(options) {
|
|
if(options.id){
|
|
console.log('123有id')
|
|
this.setData({
|
|
isSkipId:options.id
|
|
})
|
|
}
|
|
await this.getOrganizeList()
|
|
this.setData({
|
|
deptKey:'1'
|
|
})
|
|
await this.getRightOrganizeList()
|
|
},
|
|
trigger(e:any){
|
|
this.setData({
|
|
isActive:e.currentTarget.dataset.index,
|
|
rightId:e.currentTarget.dataset.deptid,
|
|
deptKey:'1',
|
|
rightList:[],
|
|
isShowRight:false,
|
|
})
|
|
wx.showLoading({
|
|
title: '加载中', //提示的内容,
|
|
mask: true, //显示透明蒙层,防止触摸穿透,
|
|
});
|
|
this.getRightOrganizeList()
|
|
},
|
|
goCall(){
|
|
wx.showModal({
|
|
title: '拨打电话',
|
|
content: `您确定拨打${this.data.rightmobile}`,
|
|
cancelColor:'#29B9A5',
|
|
confirmColor:'#29B9A5',
|
|
success: (res)=> {
|
|
if (res.confirm) {
|
|
console.log('用户点击确定')
|
|
wx.makePhoneCall({
|
|
phoneNumber: this.data.rightmobile
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消')
|
|
}
|
|
}
|
|
})
|
|
},
|
|
goUnfoldIndex(e:any){
|
|
wx.navigateTo({
|
|
url: `/subpages/organization/pages/streeUnfold/streeUnfold?communityId=${e.currentTarget.dataset.id}`
|
|
});
|
|
},
|
|
/****获得组织接口列表 ***/
|
|
async getOrganizeList(){
|
|
this.setData({
|
|
loadVisible:true,
|
|
})
|
|
|
|
let obj = {
|
|
deptKey:this.data.deptKey,
|
|
deptId:this.data.deptId
|
|
}
|
|
try{
|
|
let res:any = await getOrganizeList(obj)
|
|
this.setData({
|
|
list:res.data.childDeptList,
|
|
deptName:res.data.deptTotal.deptName,
|
|
StreetNumber:res.data.deptTotal.streetTotal,
|
|
communityTotal:res.data.deptTotal.communityTotal,
|
|
gridTotal:res.data.deptTotal.gridTotal,
|
|
rightId:res.data.childDeptList[0].deptId,
|
|
})
|
|
/****页面跳转 *****/
|
|
if(this.data.isSkipId !==''){
|
|
this.data.list.forEach((element:any,index:number)=>{
|
|
if(this.data.isSkipId == element.deptId){
|
|
this.setData({
|
|
isActive:index
|
|
})
|
|
}
|
|
})
|
|
this.setData({
|
|
rightId:this.data.isSkipId,
|
|
deptKey:'1',
|
|
rightList:[],
|
|
isShowRight:false,
|
|
})
|
|
// wx.showLoading({
|
|
// title: '加载中', //提示的内容,
|
|
// mask: true, //显示透明蒙层,防止触摸穿透,
|
|
// });
|
|
this.getRightOrganizeList()
|
|
}
|
|
console.log('res',res)
|
|
}catch{
|
|
this.setData({
|
|
loadVisible:false,
|
|
})
|
|
}
|
|
|
|
},
|
|
/****获取右侧信息 *****/
|
|
async getRightOrganizeList(){
|
|
let obj = {
|
|
deptKey:this.data.deptKey,
|
|
deptId:this.data.rightId
|
|
}
|
|
try{
|
|
let res:any = await getOrganizeList(obj)
|
|
this.setData({
|
|
rightdeptName:res.data.deptTotal.deptName,
|
|
rightcommunityTotal:res.data.deptTotal.communityTotal,
|
|
rightgridTotal:res.data.deptTotal.gridTotal,
|
|
rightmasterOfficerName:res.data.deptTotal.masterOfficerName,
|
|
rightposition:res.data.deptTotal.position,
|
|
rightmobile:res.data.deptTotal.mobile,
|
|
rightuserFace:res.data.deptTotal.userFace,
|
|
rightList:res.data.childDeptList
|
|
})
|
|
this.setData({
|
|
loadVisible:false,
|
|
isShow:true,
|
|
isShowRight:true
|
|
})
|
|
wx.hideLoading();
|
|
console.log('res',res)
|
|
}catch{
|
|
this.setData({
|
|
loadVisible:false,
|
|
})
|
|
wx.hideLoading();
|
|
}
|
|
|
|
},
|
|
})
|