From a58c43085896b5cbf15e989726f43940ad9ab629 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Wed, 08 Sep 2021 10:04:23 +0800
Subject: [PATCH] 菜单管理支持配置路由参数
---
ruoyi-ui/src/views/system/menu/index.vue | 98 ++++++++++++++++++++++++++++++------------------
1 files changed, 61 insertions(+), 37 deletions(-)
diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue
index b0ea59a..6e6726b 100644
--- a/ruoyi-ui/src/views/system/menu/index.vue
+++ b/ruoyi-ui/src/views/system/menu/index.vue
@@ -37,13 +37,24 @@
v-hasPermi="['system:menu:add']"
>新增</el-button>
</el-col>
+ <el-col :span="1.5">
+ <el-button
+ type="info"
+ plain
+ icon="el-icon-sort"
+ size="mini"
+ @click="toggleExpandAll"
+ >展开/折叠</el-button>
+ </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
+ v-if="refreshTable"
v-loading="loading"
:data="menuList"
row-key="menuId"
+ :default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
@@ -55,7 +66,11 @@
<el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column prop="status" label="状态" :formatter="statusFormat" width="80"></el-table-column>
+ <el-table-column prop="status" label="状态" width="80">
+ <template slot-scope="scope">
+ <dict-tag :options="statusOptions" :value="scope.row.status"/>
+ </template>
+ </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@@ -63,16 +78,16 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
- <el-button size="mini"
- type="text"
- icon="el-icon-edit"
+ <el-button size="mini"
+ type="text"
+ icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:menu:edit']"
>修改</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-plus"
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['system:menu:add']"
>新增</el-button>
@@ -191,6 +206,31 @@
</el-form-item>
</el-col>
<el-col :span="12">
+ <el-form-item v-if="form.menuType == 'C'">
+ <el-input v-model="form.query" placeholder="请输入路由参数" maxlength="255" />
+ <span slot="label">
+ <el-tooltip content='访问路由的默认传递参数,如:`{"id": 1, "name": "ry"}`' placement="top">
+ <i class="el-icon-question"></i>
+ </el-tooltip>
+ 路由参数
+ </span>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item v-if="form.menuType == 'C'">
+ <span slot="label">
+ <el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top">
+ <i class="el-icon-question"></i>
+ </el-tooltip>
+ 是否缓存
+ </span>
+ <el-radio-group v-model="form.isCache">
+ <el-radio label="0">缓存</el-radio>
+ <el-radio label="1">不缓存</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
<el-form-item v-if="form.menuType != 'F'">
<span slot="label">
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
@@ -221,20 +261,6 @@
:key="dict.dictValue"
:label="dict.dictValue"
>{{dict.dictLabel}}</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item v-if="form.menuType == 'C'">
- <span slot="label">
- <el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top">
- <i class="el-icon-question"></i>
- </el-tooltip>
- 是否缓存
- </span>
- <el-radio-group v-model="form.isCache">
- <el-radio label="0">缓存</el-radio>
- <el-radio label="1">不缓存</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@@ -271,6 +297,10 @@
title: "",
// 是否显示弹出层
open: false,
+ // 是否展开,默认全部折叠
+ isExpandAll: false,
+ // 重新渲染表格状态
+ refreshTable: true,
// 显示状态数据字典
visibleOptions: [],
// 菜单状态数据字典
@@ -338,20 +368,6 @@
this.menuOptions.push(menu);
});
},
- // 显示状态字典翻译
- visibleFormat(row, column) {
- if (row.menuType == "F") {
- return "";
- }
- return this.selectDictLabel(this.visibleOptions, row.visible);
- },
- // 菜单状态字典翻译
- statusFormat(row, column) {
- if (row.menuType == "F") {
- return "";
- }
- return this.selectDictLabel(this.statusOptions, row.status);
- },
// 取消按钮
cancel() {
this.open = false;
@@ -393,6 +409,14 @@
}
this.open = true;
this.title = "添加菜单";
+ },
+ /** 展开/折叠操作 */
+ toggleExpandAll() {
+ this.refreshTable = false;
+ this.isExpandAll = !this.isExpandAll;
+ this.$nextTick(() => {
+ this.refreshTable = true;
+ });
},
/** 修改按钮操作 */
handleUpdate(row) {
@@ -439,4 +463,4 @@
}
}
};
-</script>
\ No newline at end of file
+</script>
--
Gitblit v1.9.3