Browse Source

feat: 修复分组获取

zhangyuhan 4 months ago
parent
commit
8c42c0dd22
1 changed files with 28 additions and 0 deletions
  1. 28 0
      web_pc/src/views/equity/add.vue

+ 28 - 0
web_pc/src/views/equity/add.vue

@@ -223,8 +223,36 @@ export default {
 
       this.codes.nums = JSON.stringify(obj)
     },
+    getSendUserGroupName() {
+      if (!this.showConcertlabGroup) return
+      const tree = this.$refs.concertlabTree
+      let idArr = []
+      let nameArr = []
+      if (tree) {
+        const r = tree.getCheckedNodes()
+        // 遍历取最后一级(没children的那一级)
+        const lastLevel = r.filter(item => !item.children)
+        idArr = lastLevel.map(item => item.id)
+        nameArr = lastLevel.map(item => item.name)
+      }
+      this.codes.userGroupId = idArr
+      this.codes.userGroupName = nameArr
+      this.userFunc()
+    },
+    userFunc() {
+      if (this.codes.userGroupId.length == 0) {
+        this.showUser = true
+      } else {
+        this.showUser = false
+      }
+    },
     // 提交
     submit(name) {
+      try {
+        this.getSendUserGroupName()
+      } catch (error) {
+        console.log(error)
+      }
       this.$refs[name].validate((valid) => {
         if (valid && !this.goodShow) {
           this.isDisable = true