选择部门组件优化
This commit is contained in:
@@ -50,9 +50,11 @@ export default {
|
||||
...mapState(['user']),
|
||||
isSingle: v => !!v.$route.query.single,
|
||||
nodeKey: v => v.$route.query.nodeKey || "idNumber",
|
||||
isRequire: v => v.$route.query.isRequire || 1
|
||||
isRequire: v => v.$route.query.isRequire || 1,
|
||||
isAuth: v => !!v.$route.query.isAuth, //是否只能选择自己当前部门及以下
|
||||
},
|
||||
onLoad(query) {
|
||||
console.log(query)
|
||||
if (query.selected) {
|
||||
this.selected = query.selected?.split(",").map(e => Number(e)) || []
|
||||
}
|
||||
@@ -60,7 +62,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.$http.post(`/app/wxcp/wxdepartment/listAll?name=${this.name}`).then(res => {
|
||||
var url = this.isAuth ? `/app/wxcp/wxdepartment/listByUser?name=${this.name}` : `/app/wxcp/wxdepartment/listAll?name=${this.name}`
|
||||
this.$http.post(url).then(res => {
|
||||
if (res?.data) {
|
||||
res.data.forEach(e => e.isCheck = this.selected.includes(e[this.nodeKey]))
|
||||
this.depts = new this.$tree(res.data, {parent: 'parentid'})
|
||||
|
||||
Reference in New Issue
Block a user