菜单角色更新

This commit is contained in:
ludj
2022-11-30 14:52:48 +08:00
parent dc2bcc17eb
commit fb28f2a7f4
8 changed files with 85 additions and 108 deletions

View File

@@ -141,6 +141,7 @@
v-loading="crud.loading"
lazy
:load="getMenus"
:auto-load-root-options="false"
:data="crud.data"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="menu_id"
@@ -151,6 +152,7 @@
>
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip label="菜单标题" width="125px" prop="title" />
<el-table-column show-overflow-tooltip label="父Id" width="125px" prop="pid" />
<el-table-column show-overflow-tooltip label="子系统" width="125px" prop="system_type" />
<el-table-column show-overflow-tooltip label="菜单类别" width="125px" prop="category" />
<el-table-column prop="icon" label="图标" align="center" width="60px">
@@ -242,7 +244,7 @@ export default {
name: 'Menu',
components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation, DateRangePicker },
cruds() {
return CRUD({ title: '菜单', url: 'api/menus', crudMethod: { ...crudMenu }})
return CRUD({ title: '菜单', idField: 'menu_id', url: 'api/menus', crudMethod: { ...crudMenu }})
},
mixins: [presenter(), header(), form(defaultForm), crud()],
data() {
@@ -274,12 +276,12 @@ export default {
// 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
this.menus = []
if (form.menu_id) {
if (form.pid === null) {
if (form.menu_id) { // 修改
if (form.pid === null) { // 一级菜单一级的父级菜单的pid为0.
form.pid = 0
}
this.getSupDepts(form.menu_id)
} else {
} else { // 新增
this.menus.push({ menu_id: 0, title: '顶级类目', children: null })
}
},