浏览代码

配置商家权限时,支持全选、取消全选

cxmo 1 年之前
父节点
当前提交
98a60f5966
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      src/views/business_ETA_manage/businessAuth.vue

+ 13 - 1
src/views/business_ETA_manage/businessAuth.vue

@@ -8,6 +8,7 @@
             </div>
         </div>
         <div class="auth-wrap">
+            <el-checkbox v-model="checkAll" style="margin-bottom: 20px;">全选</el-checkbox>
             <el-tree 
                 v-loading="treeLoading"
                 ref="checkboxTree"
@@ -29,9 +30,20 @@ export default {
         return {
             authList:[],
             defaultCheckedKeys:[],
-            treeLoading:false
+            treeLoading:false,
+            checkAll:false
         };
     },
+    watch:{
+        checkAll(newVal){
+            if(newVal){
+                const topLevelNodes = this.authList.map(i=>i.MenuId)
+                this.$refs.checkboxTree.setCheckedKeys(topLevelNodes)
+            }else{
+                this.$refs.checkboxTree.setCheckedKeys([])
+            }
+        }
+    },
     methods: {
         getBusinessAuthList(){
             const EtaBusinessId = this.$route.query.id