mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-12 22:29:59 +08:00
change client ID to role Uuid and organization ID to organization Uuid (#538)
Co-authored-by: elsiosanchez <elsiosanches@gmial.com>
This commit is contained in:
parent
5c6712ca54
commit
dd3a2eea2a
@ -7,8 +7,8 @@ import Layout from '@/layout'
|
|||||||
// Get Menu from server
|
// Get Menu from server
|
||||||
export function loadMainMenu({
|
export function loadMainMenu({
|
||||||
sessionUuid,
|
sessionUuid,
|
||||||
clientId = 0,
|
roleUuid = 0,
|
||||||
organizationId = 0
|
organizationUuid = 0
|
||||||
}) {
|
}) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
requestMenu({
|
requestMenu({
|
||||||
@ -19,8 +19,8 @@ export function loadMainMenu({
|
|||||||
menuResponse.childs.forEach(menuElement => {
|
menuResponse.childs.forEach(menuElement => {
|
||||||
const optionMenu = getRouteFromMenuItem({
|
const optionMenu = getRouteFromMenuItem({
|
||||||
menu: menuElement,
|
menu: menuElement,
|
||||||
clientId,
|
roleUuid,
|
||||||
organizationId
|
organizationUuid
|
||||||
})
|
})
|
||||||
|
|
||||||
if (optionMenu.meta.isSummary) {
|
if (optionMenu.meta.isSummary) {
|
||||||
@ -28,8 +28,8 @@ export function loadMainMenu({
|
|||||||
const childsSumaryConverted = getChildFromAction({
|
const childsSumaryConverted = getChildFromAction({
|
||||||
menu,
|
menu,
|
||||||
index: 0,
|
index: 0,
|
||||||
clientId,
|
roleUuid,
|
||||||
organizationId
|
organizationUuid
|
||||||
})
|
})
|
||||||
optionMenu.children.push(childsSumaryConverted)
|
optionMenu.children.push(childsSumaryConverted)
|
||||||
optionMenu.children[0].meta.childs.push(childsSumaryConverted)
|
optionMenu.children[0].meta.childs.push(childsSumaryConverted)
|
||||||
@ -39,8 +39,8 @@ export function loadMainMenu({
|
|||||||
const childsConverted = getChildFromAction({
|
const childsConverted = getChildFromAction({
|
||||||
menu: menuElement,
|
menu: menuElement,
|
||||||
index: undefined,
|
index: undefined,
|
||||||
clientId,
|
roleUuid,
|
||||||
organizationId
|
organizationUuid
|
||||||
})
|
})
|
||||||
|
|
||||||
optionMenu.children.push(childsConverted)
|
optionMenu.children.push(childsConverted)
|
||||||
@ -60,15 +60,15 @@ export function loadMainMenu({
|
|||||||
* Get Only Child
|
* Get Only Child
|
||||||
* @param {object} menu
|
* @param {object} menu
|
||||||
* @param {number} index
|
* @param {number} index
|
||||||
* @param {number} clientId
|
* @param {number} roleUuid
|
||||||
* @param {number} organizationId
|
* @param {number} organizationUuid
|
||||||
*/
|
*/
|
||||||
function getChildFromAction({ menu, index, clientId, organizationId }) {
|
function getChildFromAction({ menu, index, roleUuid, organizationUuid }) {
|
||||||
const { component, icon, name, isIndex } = convertAction(menu.action)
|
const { component, icon, name, isIndex } = convertAction(menu.action)
|
||||||
const routeIdentifier = name + '/' + menu.id
|
const routeIdentifier = name + '/' + menu.id
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
path: '/' + clientId + '/' + organizationId + '/' + routeIdentifier,
|
path: '/' + roleUuid + '/' + organizationUuid + '/' + routeIdentifier,
|
||||||
component,
|
component,
|
||||||
name: menu.uuid,
|
name: menu.uuid,
|
||||||
hidden: index > 0,
|
hidden: index > 0,
|
||||||
@ -97,8 +97,8 @@ function getChildFromAction({ menu, index, clientId, organizationId }) {
|
|||||||
const menuConverted = getChildFromAction({
|
const menuConverted = getChildFromAction({
|
||||||
menu: child,
|
menu: child,
|
||||||
index: 1,
|
index: 1,
|
||||||
clientId,
|
roleUuid,
|
||||||
organizationId
|
organizationUuid
|
||||||
})
|
})
|
||||||
option.children.push(menuConverted)
|
option.children.push(menuConverted)
|
||||||
option.meta.childs.push(menuConverted)
|
option.meta.childs.push(menuConverted)
|
||||||
@ -110,15 +110,16 @@ function getChildFromAction({ menu, index, clientId, organizationId }) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert menu item from server to Route
|
* Convert menu item from server to Route
|
||||||
|
* @author elsiosanchez <elsiosanches@gmail.com>
|
||||||
* @param {object} menu
|
* @param {object} menu
|
||||||
* @param {number} clientId
|
* @param {number} roleUuid
|
||||||
* @param {number} organizationId
|
* @param {number} organizationUuid
|
||||||
*/
|
*/
|
||||||
function getRouteFromMenuItem({ menu, clientId, organizationId }) {
|
function getRouteFromMenuItem({ menu, roleUuid, organizationUuid }) {
|
||||||
const { component, icon, name, isIndex } = convertAction(menu.action)
|
const { component, icon, name, isIndex } = convertAction(menu.action)
|
||||||
|
|
||||||
const optionMenu = {
|
const optionMenu = {
|
||||||
path: '/' + clientId + '/' + organizationId + '/' + menu.id,
|
path: '/' + roleUuid + '/' + organizationUuid + '/' + menu.id,
|
||||||
redirect: '/' + menu.id + '/index',
|
redirect: '/' + menu.id + '/index',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
name: menu.uuid,
|
name: menu.uuid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user