安虹睿
1 year ago
13 changed files with 1470 additions and 165 deletions
@ -0,0 +1,319 @@ |
|||||
|
import { |
||||
|
asyncRoutes, |
||||
|
constantRoutes |
||||
|
} from '@/router' |
||||
|
import Layout from '@/layout' |
||||
|
import { getDefinitionMenu } from '@/api/wms-auth' |
||||
|
import store from '@/store' |
||||
|
import router from '@/router' |
||||
|
|
||||
|
/** |
||||
|
* Use meta.role to determine if the current user has permission |
||||
|
* @param roles |
||||
|
* @param route |
||||
|
*/ |
||||
|
function hasPermission(roles, route) { |
||||
|
if (route.meta && route.meta.roles) { |
||||
|
if (route.meta.roles == "skip") { |
||||
|
return true |
||||
|
} else { |
||||
|
return roles.some(role => route.meta.roles.includes(role)) |
||||
|
} |
||||
|
} else { |
||||
|
return false |
||||
|
} |
||||
|
} |
||||
|
const filterAccessedRoutes = (items,indexVal,childrenIndex) => { |
||||
|
const route = JSON.parse(JSON.stringify(items)) |
||||
|
route.forEach((val, index) => { |
||||
|
// debugger;
|
||||
|
if(val.meta && val.meta.roles == "skip"){ |
||||
|
if (val.children && val.children.length != 0) { |
||||
|
filterAccessedRoutes(items[index-indexVal].children,childrenIndex) |
||||
|
} |
||||
|
if(items[index-indexVal].children && items[index-indexVal].children.length == 0){ |
||||
|
items.splice(index-indexVal, 1) |
||||
|
indexVal++ |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
indexVal = 0 |
||||
|
} |
||||
|
/** |
||||
|
* Filter asynchronous routing tables by recursion |
||||
|
* @param routes asyncRoutes |
||||
|
* @param roles |
||||
|
*/ |
||||
|
export function filterAsyncRoutes(routes, roles) { |
||||
|
const res = [] |
||||
|
routes.forEach(route => { |
||||
|
const tmp = { |
||||
|
...route |
||||
|
} |
||||
|
if (hasPermission(roles, tmp)) { |
||||
|
if (tmp.children) { |
||||
|
tmp.children = filterAsyncRoutes(tmp.children, roles) |
||||
|
} |
||||
|
res.push(tmp) |
||||
|
} |
||||
|
}) |
||||
|
return res |
||||
|
} |
||||
|
|
||||
|
const state = { |
||||
|
routes: [],//菜单
|
||||
|
// addRoutes: [],
|
||||
|
tablesName:null,//所有的表名
|
||||
|
abpIdentityName:null,//所有身份配置权限
|
||||
|
} |
||||
|
|
||||
|
const mutations = { |
||||
|
SET_ROUTES: (state, routes) => { |
||||
|
// state.addRoutes = routes
|
||||
|
state.routes = constantRoutes.concat(routes) |
||||
|
router.addRoutes(routes) |
||||
|
}, |
||||
|
SET_TABLESNAME: (state, data) => { |
||||
|
state.tablesName = data |
||||
|
}, |
||||
|
SET_AbpIdentity: (state, data) => { |
||||
|
state.abpIdentityName = data |
||||
|
} |
||||
|
} |
||||
|
/** |
||||
|
* 静态路由懒加载 |
||||
|
* @param view 格式必须为 xxx/xxx 开头不要加斜杠 |
||||
|
* @returns |
||||
|
*/ |
||||
|
export const loadView = (view) => { |
||||
|
return (resolve) => require([`@/views/menuList/${view}`], resolve) |
||||
|
} |
||||
|
|
||||
|
const AbpIdentity_mark = 'AbpIdentityMark' |
||||
|
/** |
||||
|
* 把从后端查询的菜单数据拼装成路由格式的数据 |
||||
|
* @param routes |
||||
|
* @param data 后端返回的菜单数据 |
||||
|
*/ |
||||
|
export function generaMenu(routes, data, first) { |
||||
|
// 不显示的菜单配置隐藏
|
||||
|
let _noShowMenus = localStorage.getItem('menuHiddenConfig').split(',') |
||||
|
data.forEach(item => { |
||||
|
let _item = { |
||||
|
path: '/'+item.name, |
||||
|
component: loadView(item.name), |
||||
|
hidden: _noShowMenus.indexOf(item.name) >= 0, // 状态为0的隐藏
|
||||
|
name: item.name, |
||||
|
// meta: item.meta
|
||||
|
meta: { |
||||
|
title: item.title, |
||||
|
icon: item.icon || 'svg_default', |
||||
|
roles: item.permission, |
||||
|
outerFirst:first |
||||
|
}, |
||||
|
} |
||||
|
let menu = _item |
||||
|
if(first && item.component == '@/layout'){ |
||||
|
menu = { |
||||
|
path: '/', |
||||
|
component: Layout, |
||||
|
redirect: '/' + item.name, |
||||
|
children: [], |
||||
|
} |
||||
|
menu.children = [] |
||||
|
menu.children.push(_item) |
||||
|
} |
||||
|
// 一级菜单 二级菜单 特定属性
|
||||
|
// if (item.component == '@/layout' || item.component == 'index') {
|
||||
|
// menu.alwaysShow = true
|
||||
|
// menu.redirect = 'noRedirect'
|
||||
|
// }
|
||||
|
// if (item.sort < 99) {
|
||||
|
// menu.level = 1
|
||||
|
// } else if (item.sort > 99 && item.sort < 9999) {
|
||||
|
// menu.level = 2
|
||||
|
// } else {
|
||||
|
// menu.level = 3
|
||||
|
// }
|
||||
|
// iframe页面处理
|
||||
|
// if (item.permission.indexOf('Report') > -1) {
|
||||
|
// // delete menu.component
|
||||
|
// menu.iframeComponent = item.component === '@/layout' ? Layout : loadView(item.component)
|
||||
|
// menu.hasOpen = false // 是否打开过,默认false
|
||||
|
// }
|
||||
|
if (item.children && item.children.length > 0) { |
||||
|
generaMenu(menu.children, item.children) |
||||
|
} |
||||
|
// if (item.permission == 'skip' && item.children.length == 0) {
|
||||
|
// }
|
||||
|
if(!routes)routes = [] |
||||
|
routes.push(menu) |
||||
|
}) |
||||
|
return routes |
||||
|
} |
||||
|
|
||||
|
// todo:接口返回的层级菜单,与查重后最终显示的菜单数组做查重及组合处理
|
||||
|
export function initTreeMenusHandle(tree, list,first) { |
||||
|
let _res = [] |
||||
|
tree.forEach(item=>{ |
||||
|
// 如果有身份权限的页面
|
||||
|
// if(state.abpIdentityName && state.abpIdentityName.length > 0){
|
||||
|
// // // 身份权限的页面(角色等)
|
||||
|
// if(item.name == '系统权限管理'){
|
||||
|
// let _name = item.name.slice(AbpIdentity_mark.length,item.name.length)
|
||||
|
// console.log(165,item.name,_name)
|
||||
|
// // item.title = store.getters.columZHList[_name] || _name
|
||||
|
// // if(first)item.component = '@/layout'
|
||||
|
// // if (item.children && item.children.length > 0) {
|
||||
|
// // item.children = initTreeMenusHandle(item.children,list)
|
||||
|
// // }
|
||||
|
// // _res.push(item)
|
||||
|
// }
|
||||
|
// }
|
||||
|
//配置权限的页面
|
||||
|
// else{
|
||||
|
if(list.indexOf(item.name) >= 0){ |
||||
|
item.title = store.getters.columZHList[item.name] || item.name |
||||
|
console.log(175,item.name,first) |
||||
|
if(first){ |
||||
|
// if(item.name == AbpIdentity_mark){
|
||||
|
// item.title = '系统权限管理'
|
||||
|
// }
|
||||
|
item.component = '@/layout' |
||||
|
} |
||||
|
if (item.children && item.children.length > 0) { |
||||
|
item.children = initTreeMenusHandle(item.children,list) |
||||
|
} |
||||
|
console.log(186,item) |
||||
|
_res.push(item) |
||||
|
} |
||||
|
// }
|
||||
|
}) |
||||
|
console.log(191,_res) |
||||
|
return _res |
||||
|
} |
||||
|
const actions = { |
||||
|
getApiColumnsNames({ |
||||
|
commit |
||||
|
}, userId) { |
||||
|
return new Promise(resolve => { |
||||
|
let accessedRoutes = asyncRoutes |
||||
|
// accessedRoutes = filterAsyncRoutes(asyncRoutes, roles)
|
||||
|
// let indexVal = 0
|
||||
|
// let childrenIndex = 0
|
||||
|
// filterAccessedRoutes(accessedRoutes,indexVal,childrenIndex)
|
||||
|
// commit('SET_ROUTES', accessedRoutes)
|
||||
|
// resolve(accessedRoutes)
|
||||
|
getDefinitionMenu(true).then(res => { |
||||
|
let _allConfig = res.auth.grantedPolicies;//所有配置
|
||||
|
let _menuList = []//接口获取所有的菜单
|
||||
|
let _AbpIdentity = []//接口获取所有的身份配置信息数据
|
||||
|
for(let item in _allConfig){ |
||||
|
let point_number = item.split('.').length - 1 |
||||
|
// 只选择配置项中的数据
|
||||
|
if(point_number == 1 && item.substring(0,item.indexOf('.')) == localStorage.getItem('appClientScope')){ |
||||
|
_menuList.push(item.substring(item.indexOf('.') + 1,item.length)) |
||||
|
} |
||||
|
// 身份配置信息数据(用户、角色)
|
||||
|
if(point_number == 1 && item.substring(0,item.indexOf('.')) == 'AbpIdentity'){ |
||||
|
_AbpIdentity.push(AbpIdentity_mark + item.substring(item.indexOf('.') + 1,item.length)) |
||||
|
} |
||||
|
} |
||||
|
// 存储所有的表名
|
||||
|
commit('SET_TABLESNAME', _menuList) |
||||
|
// 存储身份标识
|
||||
|
commit('SET_AbpIdentity', _AbpIdentity) |
||||
|
|
||||
|
// 数据模拟,todo-new:接口获取
|
||||
|
let _treeMenusAll = null//树形菜单
|
||||
|
_treeMenusAll = [ |
||||
|
{name:"aaaaaaa"}, |
||||
|
{name:"ExportCustomUserSetting" |
||||
|
// ,children:[
|
||||
|
// {name:'OutgoingDataHistory',children:[
|
||||
|
// {name:'IncomingData',children:[
|
||||
|
// {name:'OutgoingDataHistory'},
|
||||
|
// {name:'IncomingData'},
|
||||
|
// {name:'333333'},
|
||||
|
// ]},
|
||||
|
// {name:'eee1111-bbb',children:[
|
||||
|
// {name:'ExportCustomUserSetting'},
|
||||
|
// {name:'MessageReceive'},
|
||||
|
// ]},
|
||||
|
// ]},
|
||||
|
// {name:'eee222'},
|
||||
|
// {name:'eee333'},
|
||||
|
// {name:'eee444'},
|
||||
|
// {name:'eee555'},
|
||||
|
// ]
|
||||
|
}, |
||||
|
{name:"OutgoingDataHistory"}, |
||||
|
{name:"IncomingData"}, |
||||
|
{name:"IncomingDataHistory"}, |
||||
|
{name:"MesProductL7PartsNote"}, |
||||
|
{name:"MessageReceive"}, |
||||
|
{name:"OutgoingData"}, |
||||
|
{name:"AsnDet"}, |
||||
|
{name:"AsnMstr"}, |
||||
|
{name:"Bom"}, |
||||
|
{name:"CustPart"}, |
||||
|
{name:"Cust"}, |
||||
|
{name:"Inventory"}, |
||||
|
{name:"Loc"}, |
||||
|
{name:"Part"}, |
||||
|
{name:"PoDet"}, |
||||
|
{name:"PoMstr"}, |
||||
|
{name:"PrhHist"}, |
||||
|
{name:"ProdLine"}, |
||||
|
{name:"ReceiptDet"}, |
||||
|
{name:"ReceiptMstr"}, |
||||
|
{name:"ReturnDet"}, |
||||
|
{name:"ReturnMstr"}, |
||||
|
{name:"SodDet"}, |
||||
|
{name:"VendPart"}, |
||||
|
{name:"Vend"}, |
||||
|
] |
||||
|
|
||||
|
// 包含配置项中的业务菜单+身份权限菜单(角色用户等)
|
||||
|
// let _menuAndAbpList = [..._menuList,...[AbpIdentity_mark],..._AbpIdentity]
|
||||
|
let _menuAndAbpList = [..._menuList,..._AbpIdentity] |
||||
|
|
||||
|
let _initTreeMenus = [] |
||||
|
if(_treeMenusAll && _treeMenusAll.length > 0){ |
||||
|
_initTreeMenus = initTreeMenusHandle(_treeMenusAll,_menuAndAbpList,true) |
||||
|
}else{ |
||||
|
let _data = [] |
||||
|
if(_AbpIdentity && _AbpIdentity.length > 0){ |
||||
|
_data.push({name:AbpIdentity_mark,children:[]}) |
||||
|
} |
||||
|
for(let i in _menuAndAbpList){ |
||||
|
if(_menuAndAbpList[i].indexOf(AbpIdentity_mark) >= 0){ |
||||
|
_data[0].children.push({ name:_menuAndAbpList[i] }) |
||||
|
} |
||||
|
else{ |
||||
|
_data.push({name:_menuAndAbpList[i]}) |
||||
|
} |
||||
|
} |
||||
|
_initTreeMenus = initTreeMenusHandle(_data,[..._menuAndAbpList,...[AbpIdentity_mark]],true) |
||||
|
} |
||||
|
// 最后查重+层级查重后的菜单
|
||||
|
let _initEndMenus = generaMenu(asyncRoutes, _initTreeMenus,true) |
||||
|
let accessedRoutes = _initEndMenus |
||||
|
// let indexVal = 0
|
||||
|
// let childrenIndex = 0
|
||||
|
// filterAccessedRoutes(accessedRoutes,indexVal,childrenIndex)
|
||||
|
commit('SET_ROUTES', accessedRoutes) |
||||
|
resolve(accessedRoutes) |
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
} |
||||
|
|
||||
|
export default { |
||||
|
namespaced: true, |
||||
|
state, |
||||
|
mutations, |
||||
|
actions |
||||
|
} |
@ -0,0 +1,267 @@ |
|||||
|
import { |
||||
|
asyncRoutes, |
||||
|
constantRoutes |
||||
|
} from '@/router' |
||||
|
import Layout from '@/layout' |
||||
|
import { getDefinitionMenu } from '@/api/wms-auth' |
||||
|
import store from '@/store' |
||||
|
import router from '@/router' |
||||
|
|
||||
|
/** |
||||
|
* Use meta.role to determine if the current user has permission |
||||
|
* @param roles |
||||
|
* @param route |
||||
|
*/ |
||||
|
function hasPermission(roles, route) { |
||||
|
if (route.meta && route.meta.roles) { |
||||
|
if (route.meta.roles == "skip") { |
||||
|
return true |
||||
|
} else { |
||||
|
return roles.some(role => route.meta.roles.includes(role)) |
||||
|
} |
||||
|
} else { |
||||
|
return false |
||||
|
} |
||||
|
} |
||||
|
const filterAccessedRoutes = (items,indexVal,childrenIndex) => { |
||||
|
const route = JSON.parse(JSON.stringify(items)) |
||||
|
route.forEach((val, index) => { |
||||
|
// debugger;
|
||||
|
if(val.meta && val.meta.roles == "skip"){ |
||||
|
if (val.children && val.children.length != 0) { |
||||
|
filterAccessedRoutes(items[index-indexVal].children,childrenIndex) |
||||
|
} |
||||
|
if(items[index-indexVal].children && items[index-indexVal].children.length == 0){ |
||||
|
items.splice(index-indexVal, 1) |
||||
|
indexVal++ |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
indexVal = 0 |
||||
|
} |
||||
|
/** |
||||
|
* Filter asynchronous routing tables by recursion |
||||
|
* @param routes asyncRoutes |
||||
|
* @param roles |
||||
|
*/ |
||||
|
export function filterAsyncRoutes(routes, roles) { |
||||
|
const res = [] |
||||
|
routes.forEach(route => { |
||||
|
const tmp = { |
||||
|
...route |
||||
|
} |
||||
|
if (hasPermission(roles, tmp)) { |
||||
|
if (tmp.children) { |
||||
|
tmp.children = filterAsyncRoutes(tmp.children, roles) |
||||
|
} |
||||
|
res.push(tmp) |
||||
|
} |
||||
|
}) |
||||
|
return res |
||||
|
} |
||||
|
|
||||
|
const state = { |
||||
|
routes: [],//菜单
|
||||
|
addRoutes: [], |
||||
|
tablesName:null,//所有的表名
|
||||
|
} |
||||
|
|
||||
|
const mutations = { |
||||
|
SET_ROUTES: (state, routes) => { |
||||
|
state.addRoutes = routes |
||||
|
state.routes = constantRoutes.concat(routes) |
||||
|
router.addRoutes(routes) |
||||
|
}, |
||||
|
SET_TABLESNAME: (state, data) => { |
||||
|
state.tablesName = data |
||||
|
} |
||||
|
} |
||||
|
/** |
||||
|
* 静态路由懒加载 |
||||
|
* @param view 格式必须为 xxx/xxx 开头不要加斜杠 |
||||
|
* @returns |
||||
|
*/ |
||||
|
export const loadView = (view) => { |
||||
|
return (resolve) => require([`@/views/menuList/${view}`], resolve) |
||||
|
} |
||||
|
/** |
||||
|
* 把从后端查询的菜单数据拼装成路由格式的数据 |
||||
|
* @param routes |
||||
|
* @param data 后端返回的菜单数据 |
||||
|
*/ |
||||
|
export function generaMenu(routes, data, first) { |
||||
|
// 不显示的菜单配置隐藏
|
||||
|
let _noShowMenus = localStorage.getItem('menuHiddenConfig').split(',') |
||||
|
data.forEach(item => { |
||||
|
let _item = { |
||||
|
path: '/'+item.name, |
||||
|
component: loadView(item.name), |
||||
|
hidden: _noShowMenus.indexOf(item.name) >= 0, // 状态为0的隐藏
|
||||
|
name: item.name, |
||||
|
// meta: item.meta
|
||||
|
meta: { |
||||
|
title: item.title, |
||||
|
icon: item.icon || 'svg_default', |
||||
|
roles: item.permission, |
||||
|
outerFirst:first |
||||
|
}, |
||||
|
} |
||||
|
let menu = _item |
||||
|
if(first && item.component == '@/layout'){ |
||||
|
menu = { |
||||
|
path: '/', |
||||
|
component: Layout, |
||||
|
redirect: '/' + item.name, |
||||
|
children: [], |
||||
|
} |
||||
|
menu.children = [] |
||||
|
menu.children.push(_item) |
||||
|
} |
||||
|
// 一级菜单 二级菜单 特定属性
|
||||
|
// if (item.component == '@/layout' || item.component == 'index') {
|
||||
|
// menu.alwaysShow = true
|
||||
|
// menu.redirect = 'noRedirect'
|
||||
|
// }
|
||||
|
// if (item.sort < 99) {
|
||||
|
// menu.level = 1
|
||||
|
// } else if (item.sort > 99 && item.sort < 9999) {
|
||||
|
// menu.level = 2
|
||||
|
// } else {
|
||||
|
// menu.level = 3
|
||||
|
// }
|
||||
|
// iframe页面处理
|
||||
|
// if (item.permission.indexOf('Report') > -1) {
|
||||
|
// // delete menu.component
|
||||
|
// menu.iframeComponent = item.component === '@/layout' ? Layout : loadView(item.component)
|
||||
|
// menu.hasOpen = false // 是否打开过,默认false
|
||||
|
// }
|
||||
|
if (item.children && item.children.length > 0) { |
||||
|
generaMenu(menu.children, item.children) |
||||
|
} |
||||
|
// if (item.permission == 'skip' && item.children.length == 0) {
|
||||
|
// }
|
||||
|
routes.push(menu) |
||||
|
}) |
||||
|
return routes |
||||
|
} |
||||
|
|
||||
|
// todo:接口返回的层级菜单,与查重后最终显示的菜单数组做查重及组合处理
|
||||
|
export function initTreeMenusHandle(tree, list,first) { |
||||
|
let _res = [] |
||||
|
tree.forEach(item=>{ |
||||
|
if(list.indexOf(item.name) >= 0){ |
||||
|
item.title = store.getters.columZHList[item.name] || item.name |
||||
|
if(first)item.component = '@/layout' |
||||
|
if (item.children && item.children.length > 0) { |
||||
|
item.children = initTreeMenusHandle(item.children,list) |
||||
|
} |
||||
|
_res.push(item) |
||||
|
} |
||||
|
}) |
||||
|
return _res |
||||
|
} |
||||
|
const actions = { |
||||
|
getApiColumnsNames({ |
||||
|
commit |
||||
|
}, userId) { |
||||
|
return new Promise(resolve => { |
||||
|
let accessedRoutes = asyncRoutes |
||||
|
// accessedRoutes = filterAsyncRoutes(asyncRoutes, roles)
|
||||
|
// let indexVal = 0
|
||||
|
// let childrenIndex = 0
|
||||
|
// filterAccessedRoutes(accessedRoutes,indexVal,childrenIndex)
|
||||
|
// commit('SET_ROUTES', accessedRoutes)
|
||||
|
// resolve(accessedRoutes)
|
||||
|
getDefinitionMenu(true).then(res => { |
||||
|
let _allConfig = res.auth.grantedPolicies;//所有配置
|
||||
|
let _menuList = []//接口获取所有的菜单
|
||||
|
for(let item in _allConfig){ |
||||
|
let point_number = item.split('.').length - 1 |
||||
|
// 只选择配置项中的数据
|
||||
|
if(point_number == 1 && item.substring(0,item.indexOf('.')) == localStorage.getItem('appClientScope')){ |
||||
|
_menuList.push(item.substring(item.indexOf('.') + 1,item.length)) |
||||
|
} |
||||
|
} |
||||
|
// 存储所有的表名
|
||||
|
commit('SET_TABLESNAME', _menuList) |
||||
|
// 数据模拟,todo-new:接口获取
|
||||
|
let _treeMenusAll = null//树形菜单
|
||||
|
// _treeMenusAll = [
|
||||
|
// {name:"aaaaaaa"},
|
||||
|
// {name:"ExportCustomUserSetting"
|
||||
|
// // ,children:[
|
||||
|
// // {name:'OutgoingDataHistory',children:[
|
||||
|
// // {name:'IncomingData',children:[
|
||||
|
// // {name:'OutgoingDataHistory'},
|
||||
|
// // {name:'IncomingData'},
|
||||
|
// // {name:'333333'},
|
||||
|
// // ]},
|
||||
|
// // {name:'eee1111-bbb',children:[
|
||||
|
// // {name:'ExportCustomUserSetting'},
|
||||
|
// // {name:'MessageReceive'},
|
||||
|
// // ]},
|
||||
|
// // ]},
|
||||
|
// // {name:'eee222'},
|
||||
|
// // {name:'eee333'},
|
||||
|
// // {name:'eee444'},
|
||||
|
// // {name:'eee555'},
|
||||
|
// // ]
|
||||
|
// },
|
||||
|
// {name:"OutgoingDataHistory"},
|
||||
|
// {name:"IncomingData"},
|
||||
|
// {name:"IncomingDataHistory"},
|
||||
|
// {name:"MesProductL7PartsNote"},
|
||||
|
// {name:"MessageReceive"},
|
||||
|
// {name:"OutgoingData"},
|
||||
|
// {name:"AsnDet"},
|
||||
|
// {name:"AsnMstr"},
|
||||
|
// {name:"Bom"},
|
||||
|
// {name:"CustPart"},
|
||||
|
// {name:"Cust"},
|
||||
|
// {name:"Inventory"},
|
||||
|
// {name:"Loc"},
|
||||
|
// {name:"Part"},
|
||||
|
// {name:"PoDet"},
|
||||
|
// {name:"PoMstr"},
|
||||
|
// {name:"PrhHist"},
|
||||
|
// {name:"ProdLine"},
|
||||
|
// {name:"ReceiptDet"},
|
||||
|
// {name:"ReceiptMstr"},
|
||||
|
// {name:"ReturnDet"},
|
||||
|
// {name:"ReturnMstr"},
|
||||
|
// {name:"SodDet"},
|
||||
|
// {name:"VendPart"},
|
||||
|
// {name:"Vend"},
|
||||
|
// ]
|
||||
|
|
||||
|
let _initTreeMenus = [] |
||||
|
if(_treeMenusAll && _treeMenusAll.length > 0){ |
||||
|
_initTreeMenus = initTreeMenusHandle(_treeMenusAll,_menuList,true) |
||||
|
}else{ |
||||
|
let _data = [] |
||||
|
for(let i in _menuList){ |
||||
|
_data.push({name:_menuList[i]}) |
||||
|
} |
||||
|
_initTreeMenus = initTreeMenusHandle(_data,_menuList,true) |
||||
|
} |
||||
|
// 最后查重+层级查重后的菜单
|
||||
|
let _initEndMenus = generaMenu(asyncRoutes, _initTreeMenus,true) |
||||
|
let accessedRoutes = _initEndMenus |
||||
|
// let indexVal = 0
|
||||
|
// let childrenIndex = 0
|
||||
|
// filterAccessedRoutes(accessedRoutes,indexVal,childrenIndex)
|
||||
|
commit('SET_ROUTES', accessedRoutes) |
||||
|
resolve(accessedRoutes) |
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
} |
||||
|
|
||||
|
export default { |
||||
|
namespaced: true, |
||||
|
state, |
||||
|
mutations, |
||||
|
actions |
||||
|
} |
@ -0,0 +1,712 @@ |
|||||
|
<template> |
||||
|
<div class="appMainPage"> |
||||
|
<el-row :gutter="24"> |
||||
|
<el-col :md="16" style="margin-bottom: 10px"> |
||||
|
<div class="main"> |
||||
|
<div class="table-active"> |
||||
|
<div class="bttton-box"> |
||||
|
<el-button |
||||
|
type="primary" |
||||
|
icon="el-icon-plus" |
||||
|
@click="handleCreate" |
||||
|
size="mini" |
||||
|
v-permission="['AbpIdentity.Roles.Create']" |
||||
|
>创建角色</el-button |
||||
|
> |
||||
|
<el-button |
||||
|
type="success" |
||||
|
icon="el-icon-refresh" |
||||
|
@click.native.prevent="Createview" |
||||
|
size="mini" |
||||
|
>刷新</el-button |
||||
|
> |
||||
|
</div> |
||||
|
<div class="query-box"> |
||||
|
<!-- 搜索 --> |
||||
|
<searchNormal |
||||
|
ref="normalSearch_roleManage" |
||||
|
@searchNormalClick="filtrate" |
||||
|
@searchNormalClear="filtrate" |
||||
|
></searchNormal> |
||||
|
</div> |
||||
|
</div> |
||||
|
<el-table |
||||
|
v-loading="tableLoading" |
||||
|
:border="true" |
||||
|
ref="multipleTable" |
||||
|
:data="tableData" |
||||
|
height="calc(100vh - 265px)" |
||||
|
style="width: 100%" |
||||
|
@sort-change="sortChange" |
||||
|
@row-click="handleRowClick" |
||||
|
@selection-change="handleSelectionChange" |
||||
|
> |
||||
|
<el-table-column |
||||
|
prop="name" |
||||
|
label="角色名" |
||||
|
sortable="custom" |
||||
|
width="180" |
||||
|
align="left" |
||||
|
/> |
||||
|
<el-table-column |
||||
|
prop="extraProperties.Description" |
||||
|
label="角色描述" |
||||
|
align="left" |
||||
|
:show-overflow-tooltip="true" |
||||
|
/> |
||||
|
<el-table-column label="操作" align="center" width="150"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-button |
||||
|
type="text" |
||||
|
@click="Update(scope.row)" |
||||
|
v-permission="['AbpIdentity.Roles.Update']" |
||||
|
v-if="scope.row.name == 'admin' ? false : true" |
||||
|
>编辑</el-button |
||||
|
> |
||||
|
<el-button |
||||
|
type="text" |
||||
|
@click="Delete(scope.row)" |
||||
|
v-permission="['AbpIdentity.Roles.Delete']" |
||||
|
v-if="scope.row.name == 'admin' ? false : true" |
||||
|
style="color:red" |
||||
|
>删除</el-button |
||||
|
> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<!-- <el-table-column prop="address" label="创建时间" /> |
||||
|
<el-table-column prop="address" label="编辑" /> --> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
<div class="Footer"> |
||||
|
<el-pagination |
||||
|
background |
||||
|
@size-change="handleSizeChange" |
||||
|
@current-change="handleCurrentChange" |
||||
|
:current-page="queryInfo.currentPage" |
||||
|
:page-sizes="[10, 15, 20]" |
||||
|
:page-size="queryInfo.pagesize" |
||||
|
layout="total, sizes, prev, pager, next, jumper" |
||||
|
:total="total" |
||||
|
> |
||||
|
</el-pagination> |
||||
|
<el-button |
||||
|
type="primary" |
||||
|
size="mini" |
||||
|
style="margin-left: 10px; background-color: #409eff" |
||||
|
>确定</el-button |
||||
|
> |
||||
|
</div> |
||||
|
</el-col> |
||||
|
<el-col :md="8" v-permission="['AbpIdentity.Roles.Update']"> |
||||
|
<el-card class="box-card" shadow="never"> |
||||
|
<div slot="header" class="clearfix" style="height: 20px"> |
||||
|
<el-tooltip |
||||
|
class="item" |
||||
|
effect="dark" |
||||
|
content="选择指定角色的模块权限" |
||||
|
placement="top" |
||||
|
> |
||||
|
<span class="role-span">【{{name}}角色】模块权限</span> |
||||
|
</el-tooltip> |
||||
|
<el-button |
||||
|
:loading="savePerLoading" |
||||
|
:disabled="multipleSelection.length != 1" |
||||
|
icon="el-icon-check" |
||||
|
size="mini" |
||||
|
style="float: right; padding: 6px 9px" |
||||
|
type="primary" |
||||
|
@click="savePer" |
||||
|
>保存 |
||||
|
</el-button> |
||||
|
</div> |
||||
|
<el-tree |
||||
|
ref="tree" |
||||
|
v-loading="treeLoading" |
||||
|
:check-strictly="false" |
||||
|
:data="permissionsData" |
||||
|
:props="defaultProps" |
||||
|
show-checkbox |
||||
|
node-key="id" |
||||
|
class="permission-tree" |
||||
|
/> |
||||
|
</el-card> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-dialog |
||||
|
:title="formTitle" |
||||
|
:visible.sync="dialogVisible" |
||||
|
width="600px" |
||||
|
:close-on-click-modal="false" |
||||
|
> |
||||
|
<el-form |
||||
|
ref="form" |
||||
|
:model="form" |
||||
|
label-width="70px" |
||||
|
:rules="rules" |
||||
|
size="small" |
||||
|
:inline="true" |
||||
|
> |
||||
|
<el-form-item label="名称" prop="name"> |
||||
|
<el-input v-model="form.name" style="width: 380px" maxlength="23" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="描述"> |
||||
|
<el-input |
||||
|
type="textarea" |
||||
|
:rows="2" |
||||
|
placeholder="请输入描述信息" |
||||
|
style="width: 380px" |
||||
|
v-model="form.extraProperties.Description" |
||||
|
> |
||||
|
</el-input> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<div slot="footer" class="dialog-footer"> |
||||
|
<el-button @click="resetform">取 消</el-button> |
||||
|
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script> |
||||
|
import { |
||||
|
getPageListRoles, |
||||
|
getpermissionsRoles, |
||||
|
menuPermissions, |
||||
|
postCreateRoles, |
||||
|
postUpdateRoles, |
||||
|
postDeleteRoles, |
||||
|
putpermissionsRoles, |
||||
|
saveOrUpdateDescribe |
||||
|
} from "@/api/wms-auth"; |
||||
|
import permission from "@/utils/permission/index"; |
||||
|
import searchNormal from "@/components/searchNormal/index.vue" |
||||
|
export default { |
||||
|
directives: { permission }, |
||||
|
components:{ |
||||
|
searchNormal |
||||
|
}, |
||||
|
name:"AbpIdentityMarkRoles", |
||||
|
data() { |
||||
|
// 自定义验证 |
||||
|
return { |
||||
|
URL: 'identity/roles', |
||||
|
// 角色名称 |
||||
|
name: '', |
||||
|
//所有权限 |
||||
|
rolesAll: [], |
||||
|
//编辑弹出 |
||||
|
dialogVisible: false, |
||||
|
//创建与编辑判断 |
||||
|
isEdit: false, |
||||
|
//弹出title |
||||
|
formTitle: "", |
||||
|
//总条数 |
||||
|
total: 0, |
||||
|
//分页器 |
||||
|
queryInfo: { |
||||
|
//当前页数 |
||||
|
currentPage: 1, |
||||
|
//每页条数 |
||||
|
pagesize: 20, |
||||
|
Sorting: "", |
||||
|
}, |
||||
|
// Thecurrent: '', |
||||
|
//选择添加分组 |
||||
|
//筛选栏分组 |
||||
|
// value1: '', |
||||
|
//报表组 |
||||
|
// roleList: [], |
||||
|
//当前用户ID |
||||
|
usersId: "", |
||||
|
//编辑参数 |
||||
|
concurrencyStamp: "", |
||||
|
//新增参数 |
||||
|
form: { |
||||
|
name: "", |
||||
|
isDefault: true, |
||||
|
isPublic: true, |
||||
|
extraProperties: { |
||||
|
Description: "", |
||||
|
}, |
||||
|
}, |
||||
|
// 左侧table加载 |
||||
|
tableLoading:false, |
||||
|
//权限模板保存按钮加载 |
||||
|
savePerLoading: false, |
||||
|
//权限模板树形控件加载 |
||||
|
treeLoading: false, |
||||
|
//权限模板树形控件默认勾选的数组 |
||||
|
checkedPermission: [], |
||||
|
//权限模板树形结构渲染数据 |
||||
|
permissionsData: [], |
||||
|
defaultProps: { |
||||
|
children: "children", |
||||
|
label: "name", |
||||
|
}, |
||||
|
//渲染权限模板参数 |
||||
|
params: { |
||||
|
providerName: "R", |
||||
|
providerKey: "", |
||||
|
}, |
||||
|
//选择行数据 |
||||
|
multipleSelection: [], |
||||
|
//table渲染 |
||||
|
tableData: [], |
||||
|
rules: { |
||||
|
name: [ |
||||
|
{ required: true, trigger: "blur", message: "请输入姓名" }, |
||||
|
{ |
||||
|
min: 1, |
||||
|
max: 23, |
||||
|
message: "长度在 1 到 23 个字符", |
||||
|
trigger: "blur", |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
}; |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.pageList(); |
||||
|
}, |
||||
|
methods: { |
||||
|
//sort 按照排序字段(现在为数字) 默认sort |
||||
|
sortData(sort){ |
||||
|
return function(a,b){ |
||||
|
const val1 = a[sort]; |
||||
|
const val2 = b[sort]; |
||||
|
return val1 - val2; |
||||
|
} |
||||
|
}, |
||||
|
// 树状图格式化数据 |
||||
|
initTreeData(list,code = ""){ |
||||
|
const children = [] |
||||
|
// 对于list,每个元素.如果他的parentCode==code,他就是当前的children |
||||
|
list.forEach(item => { |
||||
|
if (item['parentCode'] == code) { |
||||
|
// children.push(item) |
||||
|
children.push( |
||||
|
{ |
||||
|
id: item.id, |
||||
|
displayName: item.permission, |
||||
|
name: item.name, |
||||
|
parentCode: item.parentCode, |
||||
|
code: item.code, |
||||
|
sort: item.sort, |
||||
|
children: [] |
||||
|
} |
||||
|
) |
||||
|
//排序 |
||||
|
children.find(findItem => findItem.id == item.id).children=this.initTreeData(list,item['code']).sort(this.sortData('sort')) |
||||
|
this.rolesAll.forEach(itemRes => { |
||||
|
if (item.permission == itemRes.name) { |
||||
|
if (itemRes.isGranted) { |
||||
|
this.checkedPermission.push(item.id); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
return children |
||||
|
}, |
||||
|
//请求数据渲染table |
||||
|
pageList(val) { |
||||
|
const data = { |
||||
|
Filter: val || '', |
||||
|
Sorting: this.queryInfo.Sorting, |
||||
|
SkipCount: (this.queryInfo.currentPage - 1) * this.queryInfo.pagesize, |
||||
|
MaxResultCount: this.queryInfo.pagesize, |
||||
|
}; |
||||
|
this.tableLoading = true |
||||
|
getPageListRoles(data).then((res) => { |
||||
|
this.total = res.totalCount; |
||||
|
this.tableData = res.items; |
||||
|
this.tableLoading = false |
||||
|
}).catch(err=>{ |
||||
|
console.log(err) |
||||
|
this.tableLoading = false |
||||
|
}) |
||||
|
}, |
||||
|
//排序 |
||||
|
sortChange(data) { |
||||
|
const { prop, order } = data; |
||||
|
if (!prop || !order) { |
||||
|
this.queryInfo.Sorting = ""; |
||||
|
this.handleFilter(); |
||||
|
return; |
||||
|
} |
||||
|
this.queryInfo.Sorting = prop + " " + order; |
||||
|
// alert(this.listQuery.Sorting) |
||||
|
this.handleFilter(); |
||||
|
}, |
||||
|
//排序触发页面更新 |
||||
|
handleFilter() { |
||||
|
this.queryInfo.currentPage = 1; |
||||
|
this.pageList(); |
||||
|
}, |
||||
|
//筛选 |
||||
|
filtrate(val) { |
||||
|
this.queryInfo.currentPage = 1; |
||||
|
this.pageList(val); |
||||
|
}, |
||||
|
//选择每页条数分页 |
||||
|
handleSizeChange(val) { |
||||
|
this.queryInfo.pagesize = val; |
||||
|
this.pageList(); |
||||
|
}, |
||||
|
//选择当前页分页 |
||||
|
handleCurrentChange(val) { |
||||
|
this.queryInfo.currentPage = val; |
||||
|
this.pageList(); |
||||
|
}, |
||||
|
//重置创建与编辑后的参数 |
||||
|
resetform() { |
||||
|
this.$refs.form.resetFields(); |
||||
|
this.dialogVisible = false; |
||||
|
this.form.name = ""; |
||||
|
this.form.extraProperties.Description = ""; |
||||
|
this.$refs.multipleTable.clearSelection(); |
||||
|
}, |
||||
|
//创建角色 |
||||
|
handleCreate() { |
||||
|
this.formTitle = "创建角色"; |
||||
|
this.dialogVisible = true; |
||||
|
this.isEdit = false; |
||||
|
}, |
||||
|
//刷新 |
||||
|
Createview() { |
||||
|
this.queryInfo.currentPage = 1; |
||||
|
this.queryInfo.Sorting = ""; |
||||
|
this.$refs.normalSearch_roleManage.searchNormalClear()//清空搜索 |
||||
|
this.$refs.multipleTable.clearSort(); |
||||
|
}, |
||||
|
//编辑默认参数 |
||||
|
Update(row) { |
||||
|
if (row) { |
||||
|
this.formTitle = "编辑角色"; |
||||
|
this.dialogVisible = true; |
||||
|
this.isEdit = true; |
||||
|
this.usersId = row.id; |
||||
|
this.form.name = row.name; |
||||
|
this.concurrencyStamp = row.concurrencyStamp; |
||||
|
this.form.extraProperties.Description = row.extraProperties.Description; |
||||
|
} |
||||
|
}, |
||||
|
//删除 |
||||
|
Delete(row) { |
||||
|
this.$confirm("此操作将永久删除该角色, 是否继续?", "提示", { |
||||
|
confirmButtonText: "确定", |
||||
|
cancelButtonText: "取消", |
||||
|
type: "warning", |
||||
|
}) |
||||
|
.then(() => { |
||||
|
if (this.tableData.length == 1) { |
||||
|
this.queryInfo.currentPage = this.queryInfo.currentPage - 1; |
||||
|
} |
||||
|
postDeleteRoles(row.id).then((res) => { |
||||
|
this.$successMsg("删除成功!"); |
||||
|
this.pageList(); |
||||
|
}); |
||||
|
}) |
||||
|
.catch(() => {}); |
||||
|
}, |
||||
|
//创建与编辑 |
||||
|
submitForm() { |
||||
|
this.$refs.form.validate((valid) => { |
||||
|
//创建报表组 |
||||
|
if (valid && !this.isEdit) { |
||||
|
postCreateRoles(this.form) |
||||
|
.then((res) => { |
||||
|
this.saveOrUpdateDescribe(res.id) |
||||
|
this.resetform(); |
||||
|
this.$successMsg("创建成功!"); |
||||
|
this.queryInfo.currentPage = 1; |
||||
|
this.pageList(); |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
this.resetform(); |
||||
|
}); |
||||
|
} else if (valid && this.isEdit) { |
||||
|
//编辑报表 |
||||
|
const data = JSON.parse(JSON.stringify(this.form)); |
||||
|
data.concurrencyStamp = this.concurrencyStamp; |
||||
|
postUpdateRoles(data, this.usersId) |
||||
|
.then((res) => { |
||||
|
this.$successMsg("编辑成功!"); |
||||
|
this.saveOrUpdateDescribe(this.usersId) |
||||
|
this.pageList(); |
||||
|
this.resetform(); |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
this.resetform(); |
||||
|
}); |
||||
|
} else { |
||||
|
this.$errorMsg("请按照提示继续输入!"); |
||||
|
return false; |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
// 描述特殊储存处理 |
||||
|
saveOrUpdateDescribe (id) { |
||||
|
saveOrUpdateDescribe({description:this.form.extraProperties.Description}, id).then(res => { |
||||
|
// console.log(res) |
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
|
handleSelectionChange(val) { |
||||
|
this.multipleSelection = val; |
||||
|
}, |
||||
|
//模板权限保存 |
||||
|
savePer() { |
||||
|
this.savePerLoading = true; |
||||
|
let params = {}; |
||||
|
let checkedKeys = this.$refs.tree.getCheckedKeys(); |
||||
|
params.permissions = []; |
||||
|
this.permissionsData.forEach((element) => { |
||||
|
element.children.forEach((item) => { |
||||
|
let perm = {}; |
||||
|
perm.name = item.displayName; |
||||
|
perm.isGranted = false; |
||||
|
if (checkedKeys.indexOf(item.id) > -1) { |
||||
|
perm.isGranted = true; |
||||
|
} |
||||
|
// 赋值节点下的增删改权限 |
||||
|
this.getZSG(item.displayName, params, perm.isGranted) |
||||
|
params.permissions.push(perm); |
||||
|
item.children.forEach((i) => { |
||||
|
let perm = {}; |
||||
|
perm.name = i.displayName; |
||||
|
perm.isGranted = false; |
||||
|
if (checkedKeys.indexOf(i.id) > -1) { |
||||
|
perm.isGranted = true; |
||||
|
} |
||||
|
// 赋值节点下的增删改权限 |
||||
|
this.getZSG(i.displayName, params, perm.isGranted) |
||||
|
params.permissions.push(perm); |
||||
|
}); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
params.permissions.forEach((item,index) => { |
||||
|
// 排除二级菜单 |
||||
|
if (item.name == 'skip') { |
||||
|
params.permissions.splice(index, 1) |
||||
|
} |
||||
|
|
||||
|
// 用户权限 | 角色权限 包含其子节点 创建,编辑,删除,更改 |
||||
|
if (item.name == 'AbpIdentity.Users' ) { |
||||
|
if (item.isGranted) { |
||||
|
params.permissions.push({ |
||||
|
isGranted: true, |
||||
|
name: 'AbpIdentity.Users.Create' |
||||
|
},{ |
||||
|
isGranted: true, |
||||
|
name: 'AbpIdentity.Users.Update' |
||||
|
},{ |
||||
|
isGranted: true, |
||||
|
name: 'AbpIdentity.Users.Delete' |
||||
|
},{ |
||||
|
isGranted: true, |
||||
|
name: 'AbpIdentity.Users.ManagePermissions' |
||||
|
}) |
||||
|
} else { |
||||
|
params.permissions.push({ |
||||
|
isGranted: false, |
||||
|
name: 'AbpIdentity.Users.Create' |
||||
|
},{ |
||||
|
isGranted: false, |
||||
|
name: 'AbpIdentity.Users.Update' |
||||
|
},{ |
||||
|
isGranted: false, |
||||
|
name: 'AbpIdentity.Users.Delete' |
||||
|
},{ |
||||
|
isGranted: false, |
||||
|
name: 'AbpIdentity.Users.ManagePermissions' |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
if (item.name == 'AbpIdentity.Roles' ) { |
||||
|
if (item.isGranted) { |
||||
|
params.permissions.push({ |
||||
|
isGranted: true, |
||||
|
name: 'AbpIdentity.Roles.Create' |
||||
|
},{ |
||||
|
isGranted: true, |
||||
|
name: 'AbpIdentity.Roles.Update' |
||||
|
},{ |
||||
|
isGranted: true, |
||||
|
name: 'AbpIdentity.Roles.Delete' |
||||
|
}) |
||||
|
} else { |
||||
|
params.permissions.push({ |
||||
|
isGranted: false, |
||||
|
name: 'AbpIdentity.Roles.Create' |
||||
|
},{ |
||||
|
isGranted: false, |
||||
|
name: 'AbpIdentity.Roles.Update' |
||||
|
},{ |
||||
|
isGranted: false, |
||||
|
name: 'AbpIdentity.Roles.Delete' |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
// 修改必备权限,否则菜单无法正常显示 ************************* |
||||
|
params.permissions.filter((item) => { |
||||
|
if (item.name == 'AbpIdentity.Roles.ManagePermissions' || item.name == 'Auth.UserMenu') { |
||||
|
item.isGranted = true |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
putpermissionsRoles( |
||||
|
"/permission-management/permissions?providerName=R&providerKey=" + |
||||
|
this.multipleSelection[0].name, |
||||
|
params |
||||
|
).then((response) => { |
||||
|
this.$notify({ |
||||
|
title: "成功", |
||||
|
message: "更新成功", |
||||
|
type: "success", |
||||
|
duration: 2000, |
||||
|
}); |
||||
|
this.savePerLoading = false; |
||||
|
}).catch(err=>{ |
||||
|
this.savePerLoading = false; |
||||
|
}); |
||||
|
}, |
||||
|
// 节点下的增删改权限 |
||||
|
getZSG(name,params,isGranted) { |
||||
|
if (name !== 'skip') { |
||||
|
this.rolesAll.forEach(item => { |
||||
|
if (item.parentName == name ) { |
||||
|
let perm = {} |
||||
|
perm.name = item.name |
||||
|
perm.isGranted = isGranted |
||||
|
params.permissions.push(perm) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
//点击table行渲染权限模板 |
||||
|
handleRowClick(row, column, event) { |
||||
|
let that = this |
||||
|
this.name = row.name |
||||
|
this.treeLoading = true; |
||||
|
// if (row.name == "admin") { |
||||
|
// this.$notify({ |
||||
|
// title: "提示", |
||||
|
// message: "不可更改超级管理员权限", |
||||
|
// type: "warning", |
||||
|
// duration: 2000, |
||||
|
// }); |
||||
|
// this.$refs.multipleTable.clearSelection(); |
||||
|
// this.permissionsData = []; |
||||
|
// this.checkedPermission = []; |
||||
|
// } else { |
||||
|
this.$refs.multipleTable.clearSelection(); |
||||
|
this.$refs.multipleTable.toggleRowSelection(row); |
||||
|
// } |
||||
|
|
||||
|
this.params.providerKey = row.name; |
||||
|
getpermissionsRoles(this.params).then((res) => { |
||||
|
this.rolesAll = [] |
||||
|
this.permissionsData = []; |
||||
|
this.checkedPermission = []; |
||||
|
// 根据前端菜单,进行重置分组 |
||||
|
res.groups.forEach(itemRes => { |
||||
|
itemRes.permissions.forEach(item => { |
||||
|
// if (item.displayName !== '创建' && item.displayName !== '编辑' && item.displayName !== '删除' && item.displayName !== '修改') { |
||||
|
this.rolesAll.push(item) |
||||
|
// } |
||||
|
}) |
||||
|
}) |
||||
|
let filters = [] |
||||
|
filters.push({ |
||||
|
logic: "And", |
||||
|
column: "portal", |
||||
|
action: "==", |
||||
|
value: "0" |
||||
|
}) |
||||
|
const data = { |
||||
|
condition: { |
||||
|
filters: filters |
||||
|
}, |
||||
|
Sorting: "", |
||||
|
SkipCount: 0, |
||||
|
MaxResultCount: 1000, |
||||
|
}; |
||||
|
menuPermissions(data).then((res) => { |
||||
|
let rs = that.initTreeData(res.items,'').sort(that.sortData('sort')) |
||||
|
rs.forEach(item => { |
||||
|
that.permissionsData.push(item); |
||||
|
}) |
||||
|
that.$nextTick(() => { |
||||
|
that.$refs.tree.setCheckedKeys(that.checkedPermission) |
||||
|
}) |
||||
|
// console.log('菜单树',that.permissionsData) |
||||
|
// console.log('拥有权限',that.checkedPermission) |
||||
|
// console.log('所有权限',that.rolesAll) |
||||
|
that.treeLoading = false; |
||||
|
}).catch((err)=>{ |
||||
|
that.treeLoading = false; |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
.appMainPage { |
||||
|
padding: 20px; |
||||
|
.main { |
||||
|
|
||||
|
.table-active { |
||||
|
display: flex; |
||||
|
flex-wrap: wrap; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
padding: 5px 0 15px 0; |
||||
|
|
||||
|
.bttton-box { |
||||
|
display: flex; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.el-table__body-wrapper { |
||||
|
tbody { |
||||
|
span { |
||||
|
cursor: pointer; |
||||
|
|
||||
|
&:hover { |
||||
|
color: #409eff; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.Footer { |
||||
|
padding: 25px 0; |
||||
|
display: flex; |
||||
|
justify-content: flex-end; |
||||
|
} |
||||
|
|
||||
|
::v-deep .el-dialog { |
||||
|
.el-dialog__header { |
||||
|
button { |
||||
|
display: none; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
.permission-tree{ |
||||
|
padding: 20px; |
||||
|
height: 690px; |
||||
|
overflow-y: auto; |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
|
|
@ -0,0 +1,19 @@ |
|||||
|
<template> |
||||
|
<div>AbpIdentityMarkUsers</div> |
||||
|
</template> |
||||
|
<script> |
||||
|
export default { |
||||
|
name:"AbpIdentityMarkUsers", |
||||
|
data() { |
||||
|
// 自定义验证 |
||||
|
return { |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
mounted() { |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
}, |
||||
|
}; |
||||
|
</script> |
Loading…
Reference in new issue