Commit f093fab9 authored by 黄奎's avatar 黄奎

权限修改

parent d1c0e580
......@@ -23,13 +23,16 @@
height: 250px;
overflow: auto;
}
.role-form li{
list-style-type:none
.role-form li {
list-style-type: none
}
.role_TreeList ul{
.role_TreeList ul {
margin-left: 10px;
padding: 0;
}
/*.role-form .role_TreeList::-webkit-scrollbar {*/
/* width: 3px;*/
/* height: 3px;*/
......@@ -59,7 +62,8 @@
line-height: 38px;
cursor: pointer;
}
.role-form .q-checkbox--dense span{
.role-form .q-checkbox--dense span {
width: 0px;
}
......@@ -151,7 +155,7 @@
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-lg text-dark-6">
<span class="role_Line"></span>角色信息</div>
<span class="role_Line"></span>角色信息</div>
<div class="row wrap">
<q-input filled stack-label maxlength="50" :dense="false" v-model="objOption.RoleName" ref="RoleName"
class="col-6 q-pr-lg q-pb-lg" label="角色名称" :rules="[val => !!val || '请填写角色名称']" />
......@@ -169,27 +173,33 @@
<div class="role_MenuList">
<span @click="getItem(item,index)" :class="{'checkedRole':index==checkedIndex}"
v-for="(item,index) in AuthMenuList" :key="index">{{item.MenuName}}
<q-checkbox v-model="item.IsChecked" dense color="red" size="30px" style="margin-bottom: 2px" @input="onecheck(index)"></q-checkbox>
<q-checkbox v-model="item.IsChecked" dense color="red" size="30px" style="margin-bottom: 2px"
@input="onecheck(index)"></q-checkbox>
</span>
</div>
<div class="Item_Main">
<div class="role_ItemList" v-for="(subItem,subIndex) in SubMenuList">
<div class="role_SecondItem">
<span>{{subItem.MenuName}}</span>
<q-checkbox v-model="subItem.IsChecked" @input="twocheck(subIndex)"/>
<q-checkbox v-model="subItem.IsChecked" @input="twocheck(subIndex)" />
</div>
<div class="role_TreeList">
<ul>
<li v-for="(x,j) in subItem.SubList">
<span style="width: 15px;display: inline-block" @click="x.showChildren=!x.showChildren,$forceUpdate()">
<i class="iconfont icon-sanjiaoxing-you" v-if="x.showChildren==false && x.SubList.length>0" style="font-size: 5px;color: #DDDEE0"></i>
<i class="iconfont icon-sanjiaoxingx" v-if="x.showChildren==true && x.SubList.length>0" style="font-size: 5px;color: #DDDEE0" ></i>
<span style="width: 15px;display: inline-block"
@click="x.showChildren=!x.showChildren,$forceUpdate()">
<i class="iconfont icon-sanjiaoxing-you" v-if="x.showChildren==false && x.SubList.length>0"
style="font-size: 5px;color: #DDDEE0"></i>
<i class="iconfont icon-sanjiaoxingx" v-if="x.showChildren==true && x.SubList.length>0"
style="font-size: 5px;color: #DDDEE0"></i>
</span>
<q-checkbox v-model="x.IsChecked" size="30px" style="margin-bottom: 2px" @input="threecheck(subIndex,j)"></q-checkbox>
<span >{{x.MenuName}}</span>
<q-checkbox v-model="x.IsChecked" size="30px" style="margin-bottom: 2px"
@input="threecheck(subIndex,j)"></q-checkbox>
<span>{{x.MenuName}}</span>
<ul v-if="x.SubList.length>0&& x.showChildren==true" style="margin-left: 35px">
<li v-for="(a,b) in x.SubList">
<q-checkbox v-model="a.IsChecked" size="30px" style="margin-bottom: 2px" @input="fourcheck(subIndex,j,b)"></q-checkbox>
<q-checkbox v-model="a.IsChecked" size="30px" style="margin-bottom: 2px"
@input="fourcheck(subIndex,j,b)"></q-checkbox>
<span>{{a.MenuName}}</span>
</li>
</ul>
......@@ -273,7 +283,7 @@
//获取权限
queryRolePermission() {
var qMsg = {
RoleId: this.saveObj&& this.saveObj.RoleId?this.saveObj.RoleId:0
RoleId: this.saveObj && this.saveObj.RoleId ? this.saveObj.RoleId : 0
};
GetRolePermission(qMsg).then(res => {
if (res.Code == 1) {
......@@ -281,13 +291,13 @@
if (this.AuthMenuList.length > 0) {
this.SubMenuList = this.AuthMenuList[0].SubList;
}
this.AuthMenuList.forEach(x=>{
if(x.SubList.length>0){
x.SubList.forEach(j=>{
if(j.SubList.length>0){
j.SubList.forEach(k=>{
if(k.SubList.length>0){
k.showChildren=false
this.AuthMenuList.forEach(x => {
if (x.SubList.length > 0) {
x.SubList.forEach(j => {
if (j.SubList.length > 0) {
j.SubList.forEach(k => {
if (k.SubList.length > 0) {
k.showChildren = false
}
})
}
......@@ -319,17 +329,17 @@
this.objOption.Status = 0;
}
},
onecommon(AuthMenuList,checkedIndex,type){
if(AuthMenuList[checkedIndex].SubList.length>0){
AuthMenuList[checkedIndex].SubList.forEach((x,xa)=>{
x.IsChecked=type;
if(AuthMenuList[checkedIndex].SubList[xa].SubList.length>0){
AuthMenuList[checkedIndex].SubList[xa].SubList.forEach((j,ja)=>{
j.IsChecked=type
onecommon(AuthMenuList, checkedIndex, type) {
if (AuthMenuList[checkedIndex].SubList.length > 0) {
AuthMenuList[checkedIndex].SubList.forEach((x, xa) => {
x.IsChecked = type;
if (AuthMenuList[checkedIndex].SubList[xa].SubList.length > 0) {
AuthMenuList[checkedIndex].SubList[xa].SubList.forEach((j, ja) => {
j.IsChecked = type
let threesub = AuthMenuList[checkedIndex].SubList[xa].SubList[ja].SubList
if(threesub.length>0){
threesub.forEach((k,ka)=>{
k.IsChecked=type
if (threesub.length > 0) {
threesub.forEach((k, ka) => {
k.IsChecked = type
})
}
})
......@@ -337,124 +347,124 @@
})
}
},
onecheck(index){//第1级的操作
let AuthMenuList = this.AuthMenuList;//全部数据
let checkedIndex = index;//当前选择
if(AuthMenuList[checkedIndex].IsChecked==true){
this.onecommon(AuthMenuList,checkedIndex,true)
}else {
this.onecommon(AuthMenuList,checkedIndex,false)
onecheck(index) { //第1级的操作
let AuthMenuList = this.AuthMenuList; //全部数据
let checkedIndex = index; //当前选择
if (AuthMenuList[checkedIndex].IsChecked == true) {
this.onecommon(AuthMenuList, checkedIndex, true)
} else {
this.onecommon(AuthMenuList, checkedIndex, false)
}
this.AuthMenuList = AuthMenuList;
},
twocommon(AuthMenuList,twoiIsChecked,type){
if(twoiIsChecked.SubList.length>0){
twoiIsChecked.SubList.forEach((x,xa)=>{
x.IsChecked=type;
let trsub = twoiIsChecked.SubList[xa].SubList
if(trsub.length>0){
trsub.forEach((j,ja)=>{
j.IsChecked=type
twocommon(AuthMenuList, twoiIsChecked, type) {
if (twoiIsChecked.SubList.length > 0) {
twoiIsChecked.SubList.forEach((x, xa) => {
x.IsChecked = type;
let trsub = twoiIsChecked.SubList[xa].SubList
if (trsub.length > 0) {
trsub.forEach((j, ja) => {
j.IsChecked = type
})
}
})
}
},
twocheck(twoindex){//第2级的操作
let AuthMenuList = this.AuthMenuList;//全部数据
let checkedIndex = this.checkedIndex;//当前选择
twocheck(twoindex) { //第2级的操作
let AuthMenuList = this.AuthMenuList; //全部数据
let checkedIndex = this.checkedIndex; //当前选择
let twoiIsChecked = AuthMenuList[checkedIndex].SubList[twoindex]
if(twoiIsChecked.IsChecked==true){
this.twocommon(AuthMenuList,twoiIsChecked,true)
AuthMenuList[checkedIndex].IsChecked=true
}else {
this.twocommon(AuthMenuList,twoiIsChecked,false)
if (twoiIsChecked.IsChecked == true) {
this.twocommon(AuthMenuList, twoiIsChecked, true)
AuthMenuList[checkedIndex].IsChecked = true
} else {
this.twocommon(AuthMenuList, twoiIsChecked, false)
let type = false
AuthMenuList[checkedIndex].SubList.forEach(x=>{
if(x.IsChecked==true){
type=true
AuthMenuList[checkedIndex].SubList.forEach(x => {
if (x.IsChecked == true) {
type = true
}
})
if(type==false){
AuthMenuList[checkedIndex].IsChecked=false
if (type == false) {
AuthMenuList[checkedIndex].IsChecked = false
}
}
},
threecheck(twoindex,threeindex){//第3级的操作
let AuthMenuList = this.AuthMenuList;//全部数据
let checkedIndex = this.checkedIndex;//当前选择
threecheck(twoindex, threeindex) { //第3级的操作
let AuthMenuList = this.AuthMenuList; //全部数据
let checkedIndex = this.checkedIndex; //当前选择
let threeIsChecked = AuthMenuList[checkedIndex].SubList[twoindex].SubList[threeindex];
if(threeIsChecked.IsChecked == true){
if(threeIsChecked.SubList.length>0){
threeIsChecked.SubList.forEach(x=>{ //下级处理
if (threeIsChecked.IsChecked == true) {
if (threeIsChecked.SubList.length > 0) {
threeIsChecked.SubList.forEach(x => { //下级处理
x.IsChecked = true
})
}
//上级处理
AuthMenuList[checkedIndex].IsChecked=true;
AuthMenuList[checkedIndex].SubList[twoindex].IsChecked=true;
}else {
if(threeIsChecked.SubList.length>0){
threeIsChecked.SubList.forEach(x=>{
AuthMenuList[checkedIndex].IsChecked = true;
AuthMenuList[checkedIndex].SubList[twoindex].IsChecked = true;
} else {
if (threeIsChecked.SubList.length > 0) {
threeIsChecked.SubList.forEach(x => {
x.IsChecked = false
})
}
let type2 = false; //找第三级有选择的内容
AuthMenuList[checkedIndex].SubList[twoindex].SubList.forEach(x=>{
if(x.IsChecked==true){
type2=true
AuthMenuList[checkedIndex].SubList[twoindex].SubList.forEach(x => {
if (x.IsChecked == true) {
type2 = true
}
})
if(type2==false){
AuthMenuList[checkedIndex].SubList[twoindex].IsChecked=false
if (type2 == false) {
AuthMenuList[checkedIndex].SubList[twoindex].IsChecked = false
}
let type = false//找第二级有选择的内容
AuthMenuList[checkedIndex].SubList.forEach(x=>{
if(x.IsChecked==true){
type=true
let type = false //找第二级有选择的内容
AuthMenuList[checkedIndex].SubList.forEach(x => {
if (x.IsChecked == true) {
type = true
}
})
if(type==false){
AuthMenuList[checkedIndex].IsChecked=false
if (type == false) {
AuthMenuList[checkedIndex].IsChecked = false
}
}
},
fourcheck(twoindex,threeindex,fourindex){//第4级的操作
let AuthMenuList = this.AuthMenuList;//全部数据
let checkedIndex = this.checkedIndex;//当前选择
fourcheck(twoindex, threeindex, fourindex) { //第4级的操作
let AuthMenuList = this.AuthMenuList; //全部数据
let checkedIndex = this.checkedIndex; //当前选择
let threeIsChecked = AuthMenuList[checkedIndex].SubList[twoindex].SubList[threeindex].SubList[fourindex];
if(threeIsChecked.IsChecked==true){
if (threeIsChecked.IsChecked == true) {
//上级处理
AuthMenuList[checkedIndex].IsChecked=true;
AuthMenuList[checkedIndex].SubList[twoindex].IsChecked=true;
AuthMenuList[checkedIndex].SubList[twoindex].SubList[threeindex].IsChecked=true;
}else {
AuthMenuList[checkedIndex].IsChecked = true;
AuthMenuList[checkedIndex].SubList[twoindex].IsChecked = true;
AuthMenuList[checkedIndex].SubList[twoindex].SubList[threeindex].IsChecked = true;
} else {
let type3 = false; //找第四级有选择的内容
AuthMenuList[checkedIndex].SubList[twoindex].SubList[threeindex].SubList.forEach(x=>{
if(x.IsChecked==true){
type3=true
AuthMenuList[checkedIndex].SubList[twoindex].SubList[threeindex].SubList.forEach(x => {
if (x.IsChecked == true) {
type3 = true
}
})
if(type3==false){
AuthMenuList[checkedIndex].SubList[twoindex].SubList[threeindex].IsChecked=false
if (type3 == false) {
AuthMenuList[checkedIndex].SubList[twoindex].SubList[threeindex].IsChecked = false
}
let type2 = false; //找第三级有选择的内容
AuthMenuList[checkedIndex].SubList[twoindex].SubList.forEach(x=>{
if(x.IsChecked==true){
type2=true
AuthMenuList[checkedIndex].SubList[twoindex].SubList.forEach(x => {
if (x.IsChecked == true) {
type2 = true
}
})
if(type2==false){
AuthMenuList[checkedIndex].SubList[twoindex].IsChecked=false
if (type2 == false) {
AuthMenuList[checkedIndex].SubList[twoindex].IsChecked = false
}
let type = false//找第二级有选择的内容
AuthMenuList[checkedIndex].SubList.forEach(x=>{
if(x.IsChecked==true){
type=true
let type = false //找第二级有选择的内容
AuthMenuList[checkedIndex].SubList.forEach(x => {
if (x.IsChecked == true) {
type = true
}
})
if(type==false){
AuthMenuList[checkedIndex].IsChecked=false
if (type == false) {
AuthMenuList[checkedIndex].IsChecked = false
}
}
},
......@@ -484,21 +494,42 @@
if (item.SubList && item.SubList.length > 0) {
item.SubList.forEach(secondItem => {
if (secondItem.IsChecked) {
rolePermissionList.push({
ID: 0,
Role_Id: this.objOption.RoleId,
Menu_Id: secondItem.MenuId
});
//系统菜单
if (secondItem.MenuType == 1) {
rolePermissionList.push({
ID: 0,
Role_Id: this.objOption.RoleId,
Menu_Id: secondItem.MenuId
});
} //功能菜单
else if (secondItem.MenuType == 2) {
roleFunctionList.push({
ID: 0,
Role_Id: this.objOption.RoleId,
Action_Id: secondItem.MenuId
});
}
}
//三级菜单权限
if (secondItem.SubList && secondItem.SubList.length > 0) {
secondItem.SubList.forEach(thirdItem => {
if (thirdItem.IsChecked) {
rolePermissionList.push({
ID: 0,
Role_Id: this.objOption.RoleId,
Menu_Id: thirdItem.MenuId
});
//系统菜单
if (thirdItem.MenuType == 1) {
rolePermissionList.push({
ID: 0,
Role_Id: this.objOption.RoleId,
Menu_Id: thirdItem.MenuId
});
}
//功能菜单
else if (thirdItem.MenuType == 2) {
roleFunctionList.push({
ID: 0,
Role_Id: this.objOption.RoleId,
Action_Id: thirdItem.MenuId
});
}
}
//四级--功能权限
if (thirdItem.SubList && thirdItem.SubList.length > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment