Browse Source

菜单配置封装及优化

master
安虹睿 1 year ago
parent
commit
1c1c03c835
  1. 2
      Code/Fe/public/config.js
  2. 2
      Code/Fe/src/App.vue
  3. 107
      Code/Fe/src/store/modules/permission.js

2
Code/Fe/public/config.js

@ -7,6 +7,8 @@ window.SITE_CONFIG['isAutoLogin'] = false
window.SITE_CONFIG['isSinglePage'] = false
window.SITE_CONFIG['userNameOrEmailAddress'] = 'admin'
window.SITE_CONFIG['client_secret'] = '1q2w3E*'
window.SITE_CONFIG['menuHiddenConfig'] = ['AsnDet','PoDet','ReceiptDet','ReturnDet','SodDet']
// window.SITE_CONFIG['user'] = 'http://dev.ccwin-in.com:60069/api'
// // window.SITE_CONFIG['print'] = 'print'21384
// window.SITE_CONFIG['print'] = 'http://dev.ccwin-in.com:60074'

2
Code/Fe/src/App.vue

@ -15,6 +15,8 @@ localStorage.setItem('isAutoLogin',window.SITE_CONFIG['isAutoLogin'])
localStorage.setItem('isSinglePage',window.SITE_CONFIG['isSinglePage'])
localStorage.setItem('userNameOrEmailAddress',window.SITE_CONFIG['userNameOrEmailAddress'])
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('print',window.SITE_CONFIG['print'])
// localStorage.setItem('warehouseCode',window.SITE_CONFIG['warehouseCode'])

107
Code/Fe/src/store/modules/permission.js

@ -178,63 +178,70 @@ const actions = {
_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))
// 数据模拟,todo:接口获取
let _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'},
let _showMenus = _noShowMenus && _noShowMenus.length > 0 ? _menuList.filter(item1 => !_noShowMenus.some(item2 => item2 === item1)) : _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"},
// ]
},
{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,_showMenus,_zh,true)
}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)

Loading…
Cancel
Save