选择部门组件优化

This commit is contained in:
liuye
2023-05-26 09:43:02 +08:00
parent ebf5c78721
commit 1c24282a3e
2 changed files with 6 additions and 3 deletions

View File

@@ -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'})