|
@@ -62,10 +62,12 @@ const DingDepartUser = {
|
|
this.$emit('input', value);
|
|
this.$emit('input', value);
|
|
},
|
|
},
|
|
// 格式化数据
|
|
// 格式化数据
|
|
- formatData(data,type){
|
|
|
|
|
|
+ formatData(data){
|
|
|
|
+ console.log(data)
|
|
const ret = []
|
|
const ret = []
|
|
data.map(item => {
|
|
data.map(item => {
|
|
- if(type == 'bm'){
|
|
|
|
|
|
+ // 部门
|
|
|
|
+ if(item.deptId){
|
|
const node = {
|
|
const node = {
|
|
title: item.name,
|
|
title: item.name,
|
|
id:item.deptId,
|
|
id:item.deptId,
|
|
@@ -74,19 +76,21 @@ const DingDepartUser = {
|
|
autoAddUser: item.autoAddUser,
|
|
autoAddUser: item.autoAddUser,
|
|
createDeptGroup: item.createDeptGroup,
|
|
createDeptGroup: item.createDeptGroup,
|
|
disableCheckbox: true,
|
|
disableCheckbox: true,
|
|
- checkable: false
|
|
|
|
|
|
+ checkable: false,
|
|
|
|
+ children: []
|
|
}
|
|
}
|
|
- if(item.deptUserList){
|
|
|
|
- node.children = this.formatData(item.deptUserList,'yg')
|
|
|
|
- }
|
|
|
|
- if(item.deptList){
|
|
|
|
- node.children = this.formatData(item.deptList,'bm')
|
|
|
|
|
|
+ if(item.deptUserList && item.deptList){
|
|
|
|
+ node.children = this.formatData(item.deptList.concat(item.deptUserList?item.deptUserList:[]))
|
|
|
|
+ }else if(item.deptUserList && !item.deptList){
|
|
|
|
+ node.children = this.formatData(item.deptUserList)
|
|
|
|
+ }else if(!item.deptUserList && item.deptList){
|
|
|
|
+ node.children = this.formatData(item.deptList)
|
|
}
|
|
}
|
|
ret.push(node)
|
|
ret.push(node)
|
|
}else{
|
|
}else{
|
|
ret.push({
|
|
ret.push({
|
|
title: item.name,
|
|
title: item.name,
|
|
- id: item.userid,
|
|
|
|
|
|
+ id: item.deptOrder,
|
|
value: item.userid,
|
|
value: item.userid,
|
|
pId: item.parentId,
|
|
pId: item.parentId,
|
|
avatar: item.avatar,
|
|
avatar: item.avatar,
|
|
@@ -98,16 +102,17 @@ const DingDepartUser = {
|
|
isLeaf: true
|
|
isLeaf: true
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
})
|
|
})
|
|
return ret
|
|
return ret
|
|
},
|
|
},
|
|
// 获取部门人员
|
|
// 获取部门人员
|
|
async genTreeNode() {
|
|
async genTreeNode() {
|
|
let ret = await getDingTalkAllDeptUser().then(res => res.data)
|
|
let ret = await getDingTalkAllDeptUser().then(res => res.data)
|
|
- console.log(ret)
|
|
|
|
const res1 = ret.deptList||[]
|
|
const res1 = ret.deptList||[]
|
|
const res2 = ret.deptUserList||[]
|
|
const res2 = ret.deptUserList||[]
|
|
- this.treeData = this.treeData.concat(this.formatData(res1,'bm')).concat(this.formatData(res2,'yg'));
|
|
|
|
|
|
+ this.treeData = this.treeData = this.formatData(res1.concat(res2));
|
|
|
|
+ console.log(this.treeData,'----')
|
|
},
|
|
},
|
|
// 更新人员数据
|
|
// 更新人员数据
|
|
updateDeptUser(){
|
|
updateDeptUser(){
|