|
@@ -1,6 +1,13 @@
|
|
|
<template>
|
|
|
<view class="auth_page">
|
|
|
<view class="auth_list">
|
|
|
+ <view class="leve_0">
|
|
|
+ <view class="leve_1">
|
|
|
+ <label @click="checkAll()">
|
|
|
+ <checkbox :checked="checkedAll" /> {{checkedAll?'取消全部':'全部'}}
|
|
|
+ </label>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<view class="leve_0" v-if="authList.length" v-for="(item,index) in authList" :key="item.id">
|
|
|
<view class="leve_1">
|
|
|
<label @click="checkParent(item)">
|
|
@@ -29,7 +36,8 @@
|
|
|
menuData: {},
|
|
|
authList: [], // app 权限菜单
|
|
|
checkedIds: [[],[],[]], // 已选的ids
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ checkedAll: false
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -40,14 +48,15 @@
|
|
|
getMenuList({id: this.id}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.menuData = res.data
|
|
|
+ _this.authList = _this.menuData.allMenuList[0].children
|
|
|
if (_this.menuData.role&&_this.menuData.role.menuIds) {
|
|
|
const arr = _this.menuData.role.menuIds.split(',')
|
|
|
// 勾选已选的
|
|
|
_this.findLeaf(_this.menuData.allMenuList, arr)
|
|
|
- _this.getIds(_this.menuData.allMenuList[0].children,0)
|
|
|
+ _this.getIds(_this.authList,0)
|
|
|
+ // 是否全选
|
|
|
+ _this.checkedAll = arr.length == _this.authList.length
|
|
|
}
|
|
|
- // app 菜单
|
|
|
- _this.authList = _this.menuData.allMenuList[0].children
|
|
|
}
|
|
|
console.log(_this.menuData,'_this.menuData')
|
|
|
})
|
|
@@ -83,6 +92,13 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ // 全选
|
|
|
+ checkAll(){
|
|
|
+ this.authList.map(item => {
|
|
|
+ this.$set(item, 'checked', !this.checkedAll)
|
|
|
+ })
|
|
|
+ this.checkedAll = !this.checkedAll
|
|
|
+ },
|
|
|
// 选择一级菜单
|
|
|
checkParent(item){
|
|
|
console.log(item)
|
|
@@ -92,6 +108,9 @@
|
|
|
})
|
|
|
}
|
|
|
this.$set(item, 'checked', !item.checked)
|
|
|
+ // 是否全选
|
|
|
+ const checkNums = this.authList.filter(item => item.checked)
|
|
|
+ this.checkedAll = checkNums.length == this.authList.length
|
|
|
},
|
|
|
// 选择复选框
|
|
|
checkboxChange(e){
|