修复初始化加载人员的问题
This commit is contained in:
@@ -277,9 +277,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getTree()
|
||||
this.getList()
|
||||
|
||||
this.getTree().then(this.getList)
|
||||
if (this.value.length && this.isShowUser) {
|
||||
this.showUserList = JSON.parse(JSON.stringify(this.value.map(item => {
|
||||
return {
|
||||
@@ -434,42 +432,35 @@ export default {
|
||||
},
|
||||
|
||||
getList() {
|
||||
this.loading = true
|
||||
this.instance.post(this.action.users, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
departmentId: this.search.departmentId,
|
||||
listType: 0
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.list = res.data.records.filter(v => {
|
||||
return this.disabledList.indexOf(v.id) === -1
|
||||
}).map(v => {
|
||||
return {
|
||||
...v,
|
||||
isChecked: false
|
||||
}
|
||||
})
|
||||
this.search.total = res.data.total
|
||||
|
||||
if (!this.list.length) {
|
||||
this.isCheckAll = false
|
||||
if (!!this.search.departmentId) {
|
||||
this.loading = true
|
||||
this.instance.post(this.action.users, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
departmentId: this.search.departmentId,
|
||||
listType: 0
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.loading = false
|
||||
})
|
||||
} else {
|
||||
this.loading = false
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.list = res.data.records.filter(v => {
|
||||
return this.disabledList.indexOf(v.id) === -1
|
||||
}).map(v => {
|
||||
return {
|
||||
...v,
|
||||
isChecked: false
|
||||
}
|
||||
})
|
||||
this.search.total = res.data.total
|
||||
if (!this.list.length) {
|
||||
this.isCheckAll = false
|
||||
}
|
||||
}
|
||||
}).finally(() => this.loading = false)
|
||||
}
|
||||
},
|
||||
|
||||
getTree() {
|
||||
this.instance.post(this.action.tree, null, {
|
||||
return this.instance.post(this.action.tree, null, {
|
||||
params: {unitName: this.unitName}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
@@ -477,7 +468,7 @@ export default {
|
||||
this.unitList = this.$arr2tree(origin, {parent: "parentid"})
|
||||
const defaultRoot = this.unitList.at(0)?.id
|
||||
this.defaultExpanded = [defaultRoot].filter(Boolean) || []
|
||||
this.search.departmentId = defaultRoot
|
||||
return this.search.departmentId = defaultRoot
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user