Browse Source

版本暂存:权限到按钮级别+菜单递归+首页菜单递归

faster_AG_grid
安虹睿 1 year ago
parent
commit
5aa469cc09
  1. 3
      PC/InterFace.Dash/public/config.js
  2. 1
      PC/InterFace.Dash/src/components/currenButton/innerButton.vue
  3. 2
      PC/InterFace.Dash/src/components/tablePagination/index.vue
  4. 16
      PC/InterFace.Dash/src/permission.js
  5. 36
      PC/InterFace.Dash/src/router/index.js
  6. 5
      PC/InterFace.Dash/src/store/getters.js
  7. 319
      PC/InterFace.Dash/src/store/modules/permission copy.js
  8. 198
      PC/InterFace.Dash/src/store/modules/permission.js
  9. 267
      PC/InterFace.Dash/src/store/modules/permission_old.js
  10. 23
      PC/InterFace.Dash/src/store/modules/user.js
  11. 30
      PC/InterFace.Dash/src/views/dashboard/index.vue
  12. 712
      PC/InterFace.Dash/src/views/menuList/AbpIdentityMarkRoles.vue
  13. 19
      PC/InterFace.Dash/src/views/menuList/AbpIdentityMarkUsers.vue

3
PC/InterFace.Dash/public/config.js

@ -17,7 +17,8 @@ window.SITE_CONFIG['appClientScope'] = 'Z'
window.SITE_CONFIG['browserTitle'] = '接口看板-QAD&WMS' window.SITE_CONFIG['browserTitle'] = '接口看板-QAD&WMS'
// 隐藏的页面 // 隐藏的页面
window.SITE_CONFIG['menuHiddenConfig'] = [ window.SITE_CONFIG['menuHiddenConfig'] = [
'AsnDet','PoDet','ReceiptDet','ReturnDet' 'AsnDet','PoDet','ReceiptDet','ReturnDet',
// 'AbpIdentityMarkUsers'
] ]
// window.SITE_CONFIG['isAutoLogin'] = true // window.SITE_CONFIG['isAutoLogin'] = true

1
PC/InterFace.Dash/src/components/currenButton/innerButton.vue

@ -16,6 +16,7 @@
}" }"
:class="item.class" :class="item.class"
@click="tableButtonClick(item.name,item)" @click="tableButtonClick(item.name,item)"
v-permission="item.permission"
>{{ item.label }}</el-button> >{{ item.label }}</el-button>
<!-- v-permission="item.permission" --> <!-- v-permission="item.permission" -->
</div> </div>

2
PC/InterFace.Dash/src/components/tablePagination/index.vue

@ -97,7 +97,7 @@ export default {
noUsePermissionBtn:{ noUsePermissionBtn:{
type: Array, type: Array,
default: () => { default: () => {
return ['refresh','field'] return ['refresh','field','export','filter']//
} }
}, },
rowMaxHeight:{ rowMaxHeight:{

16
PC/InterFace.Dash/src/permission.js

@ -38,10 +38,10 @@ const toPageInit = async (to, from, next) => {
toNextHandle(to, from, next) toNextHandle(to, from, next)
}) })
.catch(()=>{ .catch(()=>{
// todo:接口恢复后更改 // todo-fast:接口恢复后更改
// toNextHandle(to, from, next) toNextHandle(to, from, next)
Message.error(noUserMsg) // Message.error(noUserMsg)
pageToLogin(to, from, next) // pageToLogin(to, from, next)
}) })
return return
} }
@ -112,10 +112,10 @@ router.beforeEach(async (to, from, next) => {
toPageInit(to, from, next) toPageInit(to, from, next)
}) })
.catch(()=>{ .catch(()=>{
// todo:接口恢复后更改 // todo-fast:接口恢复后更改
// toNextHandle(to, from, next) toNextHandle(to, from, next)
Message.error(noUserMsg) // Message.error(noUserMsg)
pageToLogin(to, from, next) // pageToLogin(to, from, next)
}) })
}else{ }else{
console.log('没有token,不是登录页,不是自动登录,pageToLogin') console.log('没有token,不是登录页,不是自动登录,pageToLogin')

36
PC/InterFace.Dash/src/router/index.js

@ -96,24 +96,24 @@ export let constantRoutes = [
} }
}] }]
}, },
{ // {
path: '/', // path: '/',
component: Layout, // component: Layout,
redirect: '/RoleManage', // redirect: '/RoleManage',
hidden: true, // hidden: true,
children: [{ // children: [{
path: 'RoleManage', // path: 'RoleManage',
component: () => import('@/views/systemManage/RoleManage'), // component: () => import('@/views/systemManage/RoleManage'),
name: 'RoleManage', // name: 'RoleManage',
meta: { // meta: {
keepAlive : true, // keepAlive : true,
title: 'RoleManage', // title: 'RoleManage',
icon: 'svg_dashboard', // icon: 'svg_dashboard',
outerFirst:true // outerFirst:true
// affix: true // // affix: true
} // }
}] // }]
}, // },
] ]
/** /**

5
PC/InterFace.Dash/src/store/getters.js

@ -7,9 +7,10 @@ const getters = {
cachedViews: state => state.tagsView.cachedViews, cachedViews: state => state.tagsView.cachedViews,
token: state => state.user.token, token: state => state.user.token,
introduction: state => state.user.introduction, introduction: state => state.user.introduction,
roles: state => state.user.roles, roles: state => state.permission.roles,//当前用户权限
currentUserInfo: state => state.user.userInfo,//当前用户信息 currentUserInfo: state => state.user.userInfo,//当前用户信息
permission_routes: state => state.permission.routes,//接口获取的菜单 permission_routes: state => state.permission.routes,//全部菜单
addRoutes:state => state.permission.addRoutes,//非项目内固定的路由(接口获取的)
tablesName:state => state.permission.tablesName,//接口获取所有的表名 tablesName:state => state.permission.tablesName,//接口获取所有的表名
errorLogs: state => state.errorLog.logs, errorLogs: state => state.errorLog.logs,
enumList: state => state.definition.enumList,//接口获取的枚举 enumList: state => state.definition.enumList,//接口获取的枚举

319
PC/InterFace.Dash/src/store/modules/permission copy.js

@ -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
}

198
PC/InterFace.Dash/src/store/modules/permission.js

@ -7,61 +7,12 @@ import { getDefinitionMenu } from '@/api/wms-auth'
import store from '@/store' import store from '@/store'
import router from '@/router' import router from '@/router'
/** // 身份权限的页面标识(角色等)
* Use meta.role to determine if the current user has permission const AbpIdentity_mark = 'AbpIdentityMark'
* @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 = { const state = {
routes: [],//菜单 routes: [],//菜单
roles: [],//当前用户权限
addRoutes: [], addRoutes: [],
tablesName:null,//所有的表名 tablesName:null,//所有的表名
} }
@ -72,8 +23,15 @@ const mutations = {
state.routes = constantRoutes.concat(routes) state.routes = constantRoutes.concat(routes)
router.addRoutes(routes) router.addRoutes(routes)
}, },
// 设置权限(v-permission)
SET_ROLES: (state, roles) => {
state.roles = roles
},
SET_TABLESNAME: (state, data) => { SET_TABLESNAME: (state, data) => {
state.tablesName = data state.tablesName = data
},
SET_AbpIdentity: (state, data) => {
state.abpIdentityName = data
} }
} }
/** /**
@ -94,28 +52,27 @@ export function generaMenu(routes, data, first) {
let _noShowMenus = localStorage.getItem('menuHiddenConfig').split(',') let _noShowMenus = localStorage.getItem('menuHiddenConfig').split(',')
data.forEach(item => { data.forEach(item => {
let _item = { let _item = {
path: '/'+item.name, path: item.path,
component: loadView(item.name), component: loadView(item.name),
hidden: _noShowMenus.indexOf(item.name) >= 0, // 状态为0的隐藏 hidden: _noShowMenus.indexOf(item.name) >= 0, // 状态为0的隐藏
name: item.name, name: item.name,
// meta: item.meta meta: item.meta
meta: {
title: item.title,
icon: item.icon || 'svg_default',
roles: item.permission,
outerFirst:first
},
} }
let menu = _item let menu = _item
if(first && item.component == '@/layout'){ // if(first && item.component == '@/layout'){
if(first){
menu = { menu = {
path: '/', path: '/',
component: Layout, component: Layout,
redirect: '/' + item.name, redirect: '/' + item.name,
children: [], // redirect: 'noRedirect',
}
if(item.children && item.children.length > 0){
menu.meta=item.meta
}else{
menu.children = []
menu.children.push(_item)
} }
menu.children = []
menu.children.push(_item)
} }
// 一级菜单 二级菜单 特定属性 // 一级菜单 二级菜单 特定属性
// if (item.component == '@/layout' || item.component == 'index') { // if (item.component == '@/layout' || item.component == 'index') {
@ -136,6 +93,7 @@ export function generaMenu(routes, data, first) {
// menu.hasOpen = false // 是否打开过,默认false // menu.hasOpen = false // 是否打开过,默认false
// } // }
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
if(!menu.children)menu.children = []
generaMenu(menu.children, item.children) generaMenu(menu.children, item.children)
} }
// if (item.permission == 'skip' && item.children.length == 0) { // if (item.permission == 'skip' && item.children.length == 0) {
@ -149,9 +107,25 @@ export function generaMenu(routes, data, first) {
export function initTreeMenusHandle(tree, list,first) { export function initTreeMenusHandle(tree, list,first) {
let _res = [] let _res = []
tree.forEach(item=>{ tree.forEach(item=>{
if(list.indexOf(item.name) >= 0){ if(list.indexOf(item.name) >= 0 || item.name.indexOf(AbpIdentity_mark) >= 0){
item.title = store.getters.columZHList[item.name] || item.name if(item.name.indexOf(AbpIdentity_mark) >= 0){
if(first)item.component = '@/layout' if(item.name == AbpIdentity_mark){
item.title = '系统设置管理'
}else{
let _name = item.name.substring(AbpIdentity_mark.length,item.name.length)
item.title = store.getters.columZHList[_name] || _name
}
}else{
item.title = store.getters.columZHList[item.name] || item.name
}
item.path = '/'+item.name
item.meta={
title: item.title,
icon: item.icon || 'svg_default',
// roles: item.permission,
outerFirst:first
}
// if(first)item.component = '@/layout'
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
item.children = initTreeMenusHandle(item.children,list) item.children = initTreeMenusHandle(item.children,list)
} }
@ -161,55 +135,66 @@ export function initTreeMenusHandle(tree, list,first) {
return _res return _res
} }
const actions = { const actions = {
// 设置权限
setUserRoles({commit},data){
commit('SET_ROLES', data)
},
getApiColumnsNames({ getApiColumnsNames({
commit commit
}, userId) { }, userId) {
return new Promise(resolve => { 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 => { getDefinitionMenu(true).then(res => {
let roles_arr = []
for(let r in res.auth.grantedPolicies){
if(res.auth.grantedPolicies[r])roles_arr.push(r)
}
commit('SET_ROLES', roles_arr)
let _allConfig = res.auth.grantedPolicies;//所有配置 let _allConfig = res.auth.grantedPolicies;//所有配置
let _menuList = []//接口获取所有的菜单 let _menuList = []//接口获取所有的菜单
let _AbpIdentity = []//接口获取所有的身份配置信息数据
for(let item in _allConfig){ for(let item in _allConfig){
let point_number = item.split('.').length - 1 let point_number = item.split('.').length - 1
// 只选择配置项中的数据 // 只选择配置项中的数据
if(point_number == 1 && item.substring(0,item.indexOf('.')) == localStorage.getItem('appClientScope')){ if(point_number == 1 && item.substring(0,item.indexOf('.')) == localStorage.getItem('appClientScope')){
_menuList.push(item.substring(item.indexOf('.') + 1,item.length)) _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_TABLESNAME', _menuList)
// 存储身份标识
commit('SET_AbpIdentity', _AbpIdentity)
// 数据模拟,todo-new:接口获取 // 数据模拟,todo-new:接口获取
let _treeMenusAll = null//树形菜单 let _treeMenusAll = null//树形菜单
// _treeMenusAll = [ // _treeMenusAll = [
// {name:"aaaaaaa"}, // {name:"aaaaaaa"},
// {name:"ExportCustomUserSetting" // {
// // ,children:[ // name:"ExportCustomUserSetting1",
// // {name:'OutgoingDataHistory',children:[ // children:[
// // {name:'IncomingData',children:[ // {name:'ExportCustomUserSetting'},
// // {name:'OutgoingDataHistory'}, // {name:'OutgoingDataHistory'
// // {name:'IncomingData'}, // ,children:[
// // {name:'333333'}, // {name:"OutgoingDataHistory"},
// // ]}, // {name:'IncomingData',children:[
// // {name:'eee1111-bbb',children:[ // {name:'IncomingDataHistory'},
// // {name:'ExportCustomUserSetting'}, // {name:'IncomingData'},
// // {name:'MessageReceive'}, // {name:'333333'},
// // ]}, // ]},
// // ]}, // {name:'eee1111-bbb',children:[
// // {name:'eee222'}, // {name:'IncomingDataHistory'},
// // {name:'eee333'}, // {name:'MessageReceive'},
// // {name:'eee444'}, // ]},
// // {name:'eee555'}, // ]},
// // ] // {name:'eee222'},
// {name:'eee333'},
// {name:'eee444'},
// {name:'eee555'},
// ]
// }, // },
// {name:"OutgoingDataHistory"},
// {name:"IncomingData"},
// {name:"IncomingDataHistory"},
// {name:"MesProductL7PartsNote"}, // {name:"MesProductL7PartsNote"},
// {name:"MessageReceive"}, // {name:"MessageReceive"},
// {name:"OutgoingData"}, // {name:"OutgoingData"},
@ -234,22 +219,29 @@ const actions = {
// {name:"Vend"}, // {name:"Vend"},
// ] // ]
let _initTreeMenus = [] let _menuAndAbpList = [..._menuList,..._AbpIdentity]// 包含配置项中的业务菜单+身份权限菜单(角色用户等)
let _initTreeMenus = []//转义为树状结构
if(_treeMenusAll && _treeMenusAll.length > 0){ if(_treeMenusAll && _treeMenusAll.length > 0){
_initTreeMenus = initTreeMenusHandle(_treeMenusAll,_menuList,true) _initTreeMenus = initTreeMenusHandle(_treeMenusAll,_menuAndAbpList,true)
}else{ }else{
let _data = [] let _data = []
for(let i in _menuList){ // 自定义系统设置管理分级
_data.push({name:_menuList[i]}) 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,_menuList,true) _initTreeMenus = initTreeMenusHandle(_data,_menuAndAbpList,true)
} }
// 最后查重+层级查重后的菜单 // 最后查重+层级查重后的菜单
let _initEndMenus = generaMenu(asyncRoutes, _initTreeMenus,true) let _initEndMenus = generaMenu(asyncRoutes, _initTreeMenus,true)
let accessedRoutes = _initEndMenus let accessedRoutes = _initEndMenus
// let indexVal = 0
// let childrenIndex = 0
// filterAccessedRoutes(accessedRoutes,indexVal,childrenIndex)
commit('SET_ROUTES', accessedRoutes) commit('SET_ROUTES', accessedRoutes)
resolve(accessedRoutes) resolve(accessedRoutes)
}).catch(err => { }).catch(err => {

267
PC/InterFace.Dash/src/store/modules/permission_old.js

@ -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
}

23
PC/InterFace.Dash/src/store/modules/user.js

@ -17,7 +17,6 @@ import store from '@/store'
const state = { const state = {
token: getToken(), token: getToken(),
introduction: '', introduction: '',
roles: [],
userInfo:null userInfo:null
} }
@ -28,16 +27,6 @@ const mutations = {
SET_INTRODUCTION: (state, introduction) => { SET_INTRODUCTION: (state, introduction) => {
state.introduction = introduction state.introduction = introduction
}, },
// 设置权限(v-permission)
SET_ROLES: (state, roles) => {
let _roles = [
'IncomingDataHistory.filter',
'IncomingData.export',
'MesProductL7PartsNote.filter',
'MesProductL7PartsNote.export'
]
state.roles = _roles
},
SET_USERINFO: (state, data) => { SET_USERINFO: (state, data) => {
state.userInfo = data state.userInfo = data
} }
@ -119,9 +108,10 @@ const actions = {
dispatch dispatch
}) { }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout().then(() => { // todo-fast:退出登录接口好使后,打开logout
// logout().then(() => {
commit('SET_TOKEN', '') commit('SET_TOKEN', '')
commit('SET_ROLES', []) dispatch('permission/setUserRoles',[])
removeToken() removeToken()
resetRouter() resetRouter()
// reset visited views and cached views // reset visited views and cached views
@ -132,9 +122,9 @@ const actions = {
resolve() resolve()
// 防止路由叠加 // 防止路由叠加
location.reload() location.reload()
}).catch(error => { // }).catch(error => {
reject(error) // reject(error)
}) // })
}) })
}, },
@ -158,7 +148,6 @@ const actions = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getUsersByUserName(username).then(res=>{ getUsersByUserName(username).then(res=>{
if(res && JSON.stringify(res).length > 0){ if(res && JSON.stringify(res).length > 0){
// commit('SET_ROLES', res)
commit('SET_USERINFO', res) commit('SET_USERINFO', res)
resolve(res) resolve(res)
}else{ }else{

30
PC/InterFace.Dash/src/views/dashboard/index.vue

@ -27,24 +27,28 @@ export default {
]) ])
}, },
mounted(){ mounted(){
this.initData(this.permission_routes) let _menus = JSON.parse(JSON.stringify(this.permission_routes))
let _showList = _menus.filter(item=>{
return !item.hidden
})
this.navList = this.initData(_showList,true)
}, },
methods:{ methods:{
initData(data){ initData(data,first){
let _list = []
data.forEach(item => { data.forEach(item => {
if(!item.hidden && item.path !== '/' && item.meta) { //
let _item = { if(item.meta){
title:item.meta.title, item.title = item.meta.title
name:item.name, _list.push(item)
path:item.path,
children:item.children
}
this.navList.push(_item)
} }
if(!item.hidden && item.children){ //
this.initData(item.children) else{
_list.push(item.children[0])
} }
}) if(item.children)item.children = this.initData(item.children)
});
return _list
}, },
goPage(item){ goPage(item){
this.$router.push({name: item.name}) this.$router.push({name: item.name})

712
PC/InterFace.Dash/src/views/menuList/AbpIdentityMarkRoles.vue

@ -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>

19
PC/InterFace.Dash/src/views/menuList/AbpIdentityMarkUsers.vue

@ -0,0 +1,19 @@
<template>
<div>AbpIdentityMarkUsers</div>
</template>
<script>
export default {
name:"AbpIdentityMarkUsers",
data() {
//
return {
};
},
mounted() {
},
methods: {
},
};
</script>
Loading…
Cancel
Save