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.
142 lines
3.5 KiB
142 lines
3.5 KiB
import { getOrganizeList, getGridMobileList } from '../../../../api/organization'
|
|
Page({
|
|
data: {
|
|
isActive: 0,
|
|
leftList: [],
|
|
deptKey: '3',
|
|
id: '',
|
|
rightList: [],
|
|
deptName: '',
|
|
officerTotal: '',
|
|
callNumber: '',
|
|
leftId: '',
|
|
/****上面数据 *****/
|
|
topdeptName: '',
|
|
topcommunityTotal: '',//社区
|
|
topgridTotal: '',//网格
|
|
topposition: '',//领导职务
|
|
topmasterOfficerName: '',//领导姓名
|
|
topmobile: '',//电话
|
|
topuserFace: '',
|
|
loadVisible: false,
|
|
loadType: 'more',
|
|
isShow: false,
|
|
isShowRight:true
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
async onLoad(options) {
|
|
this.setData({
|
|
leftId: options.communityId
|
|
})
|
|
await this.getOrganizeList() //获取左侧的列表
|
|
await this.getGridMobileList()
|
|
},
|
|
trigger(e: any) {
|
|
this.setData({
|
|
isActive: e.currentTarget.dataset.index,
|
|
id: e.currentTarget.dataset.deptid,
|
|
isShowRight:false
|
|
})
|
|
wx.showLoading({
|
|
title: '加载中', //提示的内容,
|
|
mask: true, //显示透明蒙层,防止触摸穿透,
|
|
});
|
|
this.getGridMobileList()
|
|
},
|
|
goCall(e: any) {
|
|
this.setData({
|
|
callNumber: e.currentTarget.dataset.number
|
|
})
|
|
wx.showModal({
|
|
title: '拨打电话',
|
|
content: `您确定拨打${this.data.callNumber}`,
|
|
cancelColor: '#29B9A5',
|
|
confirmColor: '#29B9A5',
|
|
success:(res) =>{
|
|
if (res.confirm) {
|
|
console.log('用户点击确定')
|
|
wx.makePhoneCall({
|
|
phoneNumber: this.data.callNumber
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消')
|
|
}
|
|
}
|
|
})
|
|
},
|
|
goCallLeader() {
|
|
wx.showModal({
|
|
title: '拨打电话',
|
|
content: `您确定拨打${this.data.topmobile}`,
|
|
cancelColor: '#29B9A5',
|
|
confirmColor: '#29B9A5',
|
|
success:(res)=> {
|
|
if (res.confirm) {
|
|
console.log('用户点击确定')
|
|
wx.makePhoneCall({
|
|
phoneNumber: this.data.topmobile
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消')
|
|
}
|
|
}
|
|
})
|
|
},
|
|
/******获取联系人****/
|
|
async getGridMobileList() {
|
|
let obj = {
|
|
deptKey: this.data.deptKey,
|
|
deptId: this.data.id
|
|
}
|
|
try {
|
|
let res: any = await getGridMobileList(obj)
|
|
this.setData({
|
|
rightList: res.data.childOfficerList,
|
|
deptName: res.data.deptName,
|
|
officerTotal: res.data.officerTotal
|
|
})
|
|
this.setData({
|
|
loadVisible:false,
|
|
isShow:true,
|
|
isShowRight:true
|
|
})
|
|
wx.hideLoading();
|
|
} catch{
|
|
this.setData({
|
|
loadVisible:false,
|
|
})
|
|
wx.hideLoading();
|
|
}
|
|
},
|
|
async getOrganizeList() {
|
|
this.setData({
|
|
loadVisible: true,
|
|
})
|
|
let obj = {
|
|
deptKey: '2',
|
|
deptId: this.data.leftId
|
|
}
|
|
try {
|
|
let res: any = await getOrganizeList(obj)
|
|
this.setData({
|
|
topdeptName: res.data.deptTotal.deptName,
|
|
topcommunityTotal: res.data.deptTotal.communityTotal,
|
|
topgridTotal: res.data.deptTotal.gridTotal,
|
|
topmasterOfficerName: res.data.deptTotal.masterOfficerName,
|
|
topposition: res.data.deptTotal.position,
|
|
topmobile: res.data.deptTotal.mobile,
|
|
topuserFace: res.data.deptTotal.userFace,
|
|
leftList: res.data.childDeptList,
|
|
id: res.data.childDeptList[0].deptId
|
|
})
|
|
} catch{
|
|
this.setData({
|
|
loadVisible: false,
|
|
})
|
|
}
|
|
|
|
}
|
|
})
|