diff --git a/src/layout/appmain/AppMain.vue b/src/layout/appmain/AppMain.vue index 5be5f72..0c12187 100644 --- a/src/layout/appmain/AppMain.vue +++ b/src/layout/appmain/AppMain.vue @@ -3,10 +3,20 @@
- + + + + + + + + + +
diff --git a/src/stores/permisstion.js b/src/stores/permisstion.js index 5733e3d..ddf9255 100644 --- a/src/stores/permisstion.js +++ b/src/stores/permisstion.js @@ -43,14 +43,6 @@ export const usePermisstionStroe = defineStore('permisstion', () => { route.component = loadView(route.component) } } - if (route.pathParams != null) { - let pathParams = route.pathParams - route.pathParams = JSON.parse(route.pathParams) - route.query = {} - for (const key in route.pathParams) { - route.query = {[key]: route.pathParams[key]} - } - } if (route.children !== null && route.children && route.children.length !== 0) { route.children = formatAsyncRouters(route.children) } @@ -69,12 +61,32 @@ export const usePermisstionStroe = defineStore('permisstion', () => { if (item.children && item.children.length !== 0) { generateMenu(item.children) } + if (item.pathParams != null) { + item.path = formatPath(item.path, JSON.parse(item.pathParams)) + } item.title = item.meta.title item.icon = item.meta.icon return true }) } + // 拼接地址 + const formatPath = (path, query) => { + const queryArr = [] + let newPath = path + for (const key in query) { + queryArr.push({label: key, value: query[key]}) + } + queryArr.forEach((item, index)=>{ + if(!index) { + newPath += `?${item.label}=${item.value}` + } else { + newPath += `&${item.label}=${item.value}` + } + }) + return newPath + } + const loadView = (view) => { if (import.meta.env.MODE === 'development') { diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 81b688c..7ec0a9f 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -25,7 +25,7 @@ const searchConfig = ref([ }, on: { change: async (val) =>{ - const { data } = await getDeptOpt({subCompanyId: val.value}) + const { data } = await getDeptOpt({subCompanyId: val}) searchConfig.value.find(item=>item.prop == 'departmentId').props.data = data } }