|
@@ -1,4 +1,4 @@
|
|
-import { getDingTalkDepartmentList, queryDingTalkDeptUser } from '@/api/expenseManagement'
|
|
|
|
|
|
+import { getDingTalkAllDeptUser, refashDingTalkAllDeptUser } from '@/api/expenseManagement'
|
|
const DingDepartUser = {
|
|
const DingDepartUser = {
|
|
template: `
|
|
template: `
|
|
<a-tree-select
|
|
<a-tree-select
|
|
@@ -8,7 +8,6 @@ const DingDepartUser = {
|
|
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
|
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
|
:tree-data="treeData"
|
|
:tree-data="treeData"
|
|
:placeholder="placeholder"
|
|
:placeholder="placeholder"
|
|
- :load-data="onLoadData"
|
|
|
|
multiple
|
|
multiple
|
|
treeCheckable
|
|
treeCheckable
|
|
:treeCheckStrictly="true"
|
|
:treeCheckStrictly="true"
|
|
@@ -39,7 +38,7 @@ const DingDepartUser = {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- this.genTreeNode(1)
|
|
|
|
|
|
+ this.genTreeNode()
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
value(newValue, oldValue) {
|
|
value(newValue, oldValue) {
|
|
@@ -63,7 +62,7 @@ const DingDepartUser = {
|
|
const ret = []
|
|
const ret = []
|
|
data.map(item => {
|
|
data.map(item => {
|
|
if(type == 'bm'){
|
|
if(type == 'bm'){
|
|
- ret.push({
|
|
|
|
|
|
+ const node = {
|
|
title: item.name,
|
|
title: item.name,
|
|
id:item.deptId,
|
|
id:item.deptId,
|
|
value: item.deptId,
|
|
value: item.deptId,
|
|
@@ -72,7 +71,11 @@ const DingDepartUser = {
|
|
createDeptGroup: item.createDeptGroup,
|
|
createDeptGroup: item.createDeptGroup,
|
|
disableCheckbox: true,
|
|
disableCheckbox: true,
|
|
checkable: false
|
|
checkable: false
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ if(item.deptUserList||item.deptList){
|
|
|
|
+ node.children = this.formatData(item.deptUserList||item.deptList,item.deptList?'bm':'yg')
|
|
|
|
+ }
|
|
|
|
+ ret.push(node)
|
|
}else{
|
|
}else{
|
|
ret.push({
|
|
ret.push({
|
|
title: item.name,
|
|
title: item.name,
|
|
@@ -91,29 +94,22 @@ const DingDepartUser = {
|
|
})
|
|
})
|
|
return ret
|
|
return ret
|
|
},
|
|
},
|
|
- // 获取部门
|
|
|
|
- genTreeNode(parentId, isLeaf = false) {
|
|
|
|
- Promise.all([
|
|
|
|
- getDingTalkDepartmentList({deptId:parentId}),
|
|
|
|
- queryDingTalkDeptUser({deptId:parentId,pageNo:1,pageSize:10})
|
|
|
|
- ]).then(res => {
|
|
|
|
- const res1 = res[0].data||[]
|
|
|
|
- const res2 = res[1].data||[]
|
|
|
|
- this.treeData = this.treeData.concat(this.formatData(res1,'bm')).concat(this.formatData(res2,'yg'));
|
|
|
|
- if(res1.length==0&&res2.length==0){
|
|
|
|
- this.$message.info("没有下一级了")
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- onLoadData(treeNode) {
|
|
|
|
- return new Promise(resolve => {
|
|
|
|
- const { value } = treeNode.dataRef;
|
|
|
|
- this.genTreeNode(value)
|
|
|
|
- setTimeout(()=>{
|
|
|
|
- resolve();
|
|
|
|
- },1000)
|
|
|
|
- });
|
|
|
|
|
|
+ // 获取部门人员
|
|
|
|
+ async genTreeNode() {
|
|
|
|
+ let ret = await getDingTalkAllDeptUser().then(res => res.data)
|
|
|
|
+ const res1 = ret.deptList||[]
|
|
|
|
+ const res2 = ret.deptUserList||[]
|
|
|
|
+ this.treeData = this.treeData.concat(this.formatData(res1,'bm')).concat(this.formatData(res2,'yg'));
|
|
},
|
|
},
|
|
|
|
+ // 更新人员数据
|
|
|
|
+ updateDeptUser(){
|
|
|
|
+ refashDingTalkAllDeptUser().then(res => {
|
|
|
|
+ this.$message.info(res.message)
|
|
|
|
+ if(res.status == 200){
|
|
|
|
+ this.genTreeNode()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
|