Commit f093fab9 authored by 黄奎's avatar 黄奎

权限修改

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