菜单功能修改

This commit is contained in:
ludj
2022-11-30 11:08:08 +08:00
parent 4fe3925f8c
commit 35c296996f
7 changed files with 169 additions and 103 deletions

View File

@@ -110,7 +110,7 @@
:load="getMenus"
:data="crud.data"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="id"
row-key="menu_id"
@select="crud.selectChange"
@select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler"
@@ -180,7 +180,7 @@ import udOperation from '@crud/UD.operation'
import DateRangePicker from '@/components/DateRangePicker'
// crud交由presenter持有
const defaultForm = { id: null, title: null, menuSort: 999, path: null, system_type: null, category: null, component: null, componentName: null, iframe: 0, roles: [], pid: 0, icon: null, cache: 0, hidden: 0, type: 0, permission: null }
const defaultForm = { menu_id: null, title: null, menuSort: 999, path: null, system_type: null, category: null, component: null, componentName: null, iframe: 0, roles: [], pid: 0, icon: null, cache: 0, hidden: 0, type: 0, permission: null }
export default {
name: 'Menu',
components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation, DateRangePicker },
@@ -210,37 +210,37 @@ export default {
// 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
this.menus = []
if (form.id != null) {
if (form.menu_id != null) {
if (form.pid === null) {
form.pid = 0
}
this.getSupDepts(form.id)
this.getSupDepts(form.menu_id)
} else {
this.menus.push({ id: 0, label: '顶级类目', children: null })
this.menus.push({ menu_id: 0, label: '顶级类目', children: null })
}
},
getMenus(tree, treeNode, resolve) {
const params = { pid: tree.id }
const params = { pid: tree.menu_id }
setTimeout(() => {
crudMenu.getMenus(params).then(res => {
resolve(res.content)
})
}, 100)
},
getSupDepts(id) {
crudMenu.getMenuSuperior(id).then(res => {
getSupDepts(menu_id) {
crudMenu.getMenuSuperior(menu_id).then(res => {
const children = res.map(function(obj) {
if (!obj.leaf && !obj.children) {
obj.children = null
}
return obj
})
this.menus = [{ id: 0, label: '顶级类目', children: children }]
this.menus = [{ menu_id: null, label: '顶级类目', children: children }]
})
},
loadMenus({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudMenu.getMenusTree(parentNode.id).then(res => {
crudMenu.getMenusTree(parentNode.menu_id).then(res => {
parentNode.children = res.map(function(obj) {
if (!obj.leaf) {
obj.children = null