fix:修改菜单管理兼容多系统

This commit is contained in:
zhangzhiqiang
2022-12-09 17:33:51 +08:00
parent db05e18cae
commit 79cf1955e5
8 changed files with 74 additions and 19 deletions

View File

@@ -49,4 +49,4 @@ export function edit(data) {
})
}
export default { add, edit, del }
export default { get, add, edit, del, getDictMap }

View File

@@ -42,9 +42,9 @@ export function getChild(id) {
})
}
export function buildMenus() {
export function buildMenus(data) {
return request({
url: 'api/menus/build',
url: 'api/menus/build?system_type=' + data,
method: 'get'
})
}
@@ -73,4 +73,4 @@ export function edit(data) {
})
}
export default { add, edit, del, getMenusTree, getMenuSuperior, getMenus, getChild, getMenusByRole }
export default { add, edit, del, getMenusTree, getMenuSuperior, getMenus, getChild, getMenusByRole }

View File

@@ -53,7 +53,8 @@ router.beforeEach((to, from, next) => {
})
export const loadMenus = (next, to) => {
buildMenus().then(res => {
// 配置字典数据库默认构建sso系统菜单
buildMenus(1).then(res => {
const sdata = JSON.parse(JSON.stringify(res))
const rdata = JSON.parse(JSON.stringify(res))
const sidebarRoutes = filterAsyncRouter(sdata)

View File

@@ -13,6 +13,18 @@
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-select
v-model="query.system_type"
style="width: 150px"
placeholder="请选择系统"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.system_type"
:label="item.label"
:value="item.value"
/>
</el-select>
<rrOperation />
</div>
<crudOperation :permission="permission" />
@@ -204,6 +216,7 @@ import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import DateRangePicker from '@/components/DateRangePicker'
import crudDictDetail from '@/api/system/dictDetail'
// crud交由presenter持有
const defaultForm = {
@@ -234,6 +247,8 @@ export default {
dicts: ['system_type'],
data() {
return {
typeList: [],
defaultType: '',
menus: [],
permission: {
add: ['admin', 'menu:add'],
@@ -257,7 +272,22 @@ export default {
}
}
},
beforeMount() {
// const _this=this
// crudDictDetail.get('system_type').then(data => {
// if (data.content.length > 0) {
// const shift = data.content.shift()
// _this.defaultType = shift.para1
// }
// })
},
methods: {
[CRUD.HOOK.beforeRefresh]() {
if (this.crud.query.system_type == null) {
this.crud.query.system_type = '1'
}
return true
},
// 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
console.log(this.dict)