前端菜单加载优化
This commit is contained in:
parent
ae3cd6899e
commit
bdf46a6036
@ -8,7 +8,13 @@ export function listMenu(query) {
|
|||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 查询菜单列表
|
||||||
|
export function listMenuById(menuId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/menu/list/' + menuId,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
// 查询菜单详细
|
// 查询菜单详细
|
||||||
export function getMenu(menuId) {
|
export function getMenu(menuId) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -25,7 +25,11 @@
|
|||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-if="refreshTable" v-loading="loading" :data="menuList" :default-expand-all="isExpandAll" row-key="menuId" border
|
<el-table v-if="refreshTable" v-loading="loading" :data="menuList" :default-expand-all="isExpandAll"
|
||||||
|
row-key="menuId"
|
||||||
|
border
|
||||||
|
lazy
|
||||||
|
:load="loadMenu"
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
|
||||||
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
|
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
|
||||||
<el-table-column prop="icon" label="图标" align="center" width="80">
|
<el-table-column prop="icon" label="图标" align="center" width="80">
|
||||||
@ -217,6 +221,7 @@ import {
|
|||||||
addMenu,
|
addMenu,
|
||||||
changeMenuSort,
|
changeMenuSort,
|
||||||
updateMenu,
|
updateMenu,
|
||||||
|
listMenuById
|
||||||
} from "@/api/system/menu";
|
} from "@/api/system/menu";
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
@ -228,7 +233,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: false,
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 菜单表格树数据
|
// 菜单表格树数据
|
||||||
@ -274,13 +279,16 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
// this.getList();
|
||||||
this.getDicts("sys_show_hide").then((response) => {
|
this.getDicts("sys_show_hide").then((response) => {
|
||||||
this.visibleOptions = response.data;
|
this.visibleOptions = response.data;
|
||||||
});
|
});
|
||||||
this.getDicts("sys_normal_disable").then((response) => {
|
this.getDicts("sys_normal_disable").then((response) => {
|
||||||
this.statusOptions = response.data;
|
this.statusOptions = response.data;
|
||||||
});
|
});
|
||||||
|
listMenuById(0).then((response) => {
|
||||||
|
this.menuList = response.data
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 选择图标
|
// 选择图标
|
||||||
@ -309,7 +317,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 查询菜单下拉树结构 */
|
/** 查询菜单下拉树结构 */
|
||||||
getTreeselect() {
|
getTreeselect() {
|
||||||
listMenu().then((response) => {
|
listMenu({ menuTypeIds: 'M,C,F' }).then((response) => {
|
||||||
this.menuOptions = [];
|
this.menuOptions = [];
|
||||||
const menu = { menuId: 0, menuName: "根菜单", children: [] };
|
const menu = { menuId: 0, menuName: "根菜单", children: [] };
|
||||||
menu.children = response.data;
|
menu.children = response.data;
|
||||||
@ -453,6 +461,11 @@ export default {
|
|||||||
this.refreshTable = true;
|
this.refreshTable = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
loadMenu (row, treeNode, resolve) {
|
||||||
|
listMenuById(row.menuId).then((res) => {
|
||||||
|
resolve(res.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user