Browse Source

菜单配置封装及优化

noToken
安虹睿 1 year ago
parent
commit
1d6580a0c4
  1. 1
      PC/InterFace.Dash/public/config.js
  2. 2
      PC/InterFace.Dash/src/App.vue
  3. 107
      PC/InterFace.Dash/src/store/modules/permission.js

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

@ -8,3 +8,4 @@ window.SITE_CONFIG['isAutoLogin'] = true
window.SITE_CONFIG['isSinglePage'] = false window.SITE_CONFIG['isSinglePage'] = false
window.SITE_CONFIG['userNameOrEmailAddress'] = 'admin' window.SITE_CONFIG['userNameOrEmailAddress'] = 'admin'
window.SITE_CONFIG['client_secret'] = '1q2w3E*' window.SITE_CONFIG['client_secret'] = '1q2w3E*'
window.SITE_CONFIG['menuHiddenConfig'] = ['AsnDet','PoDet','ReceiptDet','ReturnDet','SodDet']

2
PC/InterFace.Dash/src/App.vue

@ -15,6 +15,8 @@ localStorage.setItem('isAutoLogin',window.SITE_CONFIG['isAutoLogin'])
localStorage.setItem('isSinglePage',window.SITE_CONFIG['isSinglePage']) localStorage.setItem('isSinglePage',window.SITE_CONFIG['isSinglePage'])
localStorage.setItem('userNameOrEmailAddress',window.SITE_CONFIG['userNameOrEmailAddress']) localStorage.setItem('userNameOrEmailAddress',window.SITE_CONFIG['userNameOrEmailAddress'])
localStorage.setItem('client_secret',window.SITE_CONFIG['client_secret']) localStorage.setItem('client_secret',window.SITE_CONFIG['client_secret'])
localStorage.setItem('menuHiddenConfig',window.SITE_CONFIG['menuHiddenConfig'])
// localStorage.setItem('user',window.SITE_CONFIG['user']) // localStorage.setItem('user',window.SITE_CONFIG['user'])
// localStorage.setItem('print',window.SITE_CONFIG['print']) // localStorage.setItem('print',window.SITE_CONFIG['print'])
// localStorage.setItem('warehouseCode',window.SITE_CONFIG['warehouseCode']) // localStorage.setItem('warehouseCode',window.SITE_CONFIG['warehouseCode'])

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

@ -178,63 +178,70 @@ const actions = {
_menuList.push(item.substring(item.indexOf('.') + 1,item.length)) _menuList.push(item.substring(item.indexOf('.') + 1,item.length))
} }
} }
let _noShowMenus = ['Z.AsnDet']//不显示的菜单 // todo-new:接口获取 接口没有走配置文件
let _noShowMenus = null//不显示的菜单
_noShowMenus = localStorage.getItem('menuHiddenConfig').split(',')
// 去掉不显示的菜单后全部显示的菜单 // 去掉不显示的菜单后全部显示的菜单
let _showMenus = _menuList.filter(item1 => !_noShowMenus.some(item2 => item2 === item1)) let _showMenus = _noShowMenus && _noShowMenus.length > 0 ? _menuList.filter(item1 => !_noShowMenus.some(item2 => item2 === item1)) : _menuList
// 数据模拟,todo:接口获取 // 数据模拟,todo-new:接口获取
let _treeMenusAll = [ let _treeMenusAll = null//树形菜单
{name:"aaaaaaa"}, // _treeMenusAll = [
{name:"ExportCustomUserSetting" // {name:"aaaaaaa"},
// ,children:[ // {name:"ExportCustomUserSetting"
// {name:'OutgoingDataHistory',children:[ // // ,children:[
// {name:'IncomingData',children:[ // // {name:'OutgoingDataHistory',children:[
// {name:'OutgoingDataHistory'}, // // {name:'IncomingData',children:[
// {name:'IncomingData'}, // // {name:'OutgoingDataHistory'},
// {name:'333333'}, // // {name:'IncomingData'},
// ]}, // // {name:'333333'},
// {name:'eee1111-bbb',children:[ // // ]},
// {name:'ExportCustomUserSetting'}, // // {name:'eee1111-bbb',children:[
// {name:'MessageReceive'}, // // {name:'ExportCustomUserSetting'},
// ]}, // // {name:'MessageReceive'},
// ]}, // // ]},
// {name:'eee222'}, // // ]},
// {name:'eee333'}, // // {name:'eee222'},
// {name:'eee444'}, // // {name:'eee333'},
// {name:'eee555'}, // // {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"},
// ] // ]
},
{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 = [] let _initTreeMenus = []
if(_treeMenusAll && _treeMenusAll.length > 0){ if(_treeMenusAll && _treeMenusAll.length > 0){
_initTreeMenus = initTreeMenusHandle(_treeMenusAll,_showMenus,_zh,true) _initTreeMenus = initTreeMenusHandle(_treeMenusAll,_showMenus,_zh,true)
}else{ }else{
_initTreeMenus = _showMenus let _data = []
for(let i in _showMenus){
_data.push({name:_showMenus[i]})
}
_initTreeMenus = initTreeMenusHandle(_data,_showMenus,_zh,true)
} }
// 最后查重+层级查重后的菜单 // 最后查重+层级查重后的菜单
let _initEndMenus = generaMenu(asyncRoutes, _initTreeMenus,true) let _initEndMenus = generaMenu(asyncRoutes, _initTreeMenus,true)

Loading…
Cancel
Save