Skip to content

Commit 729b3d4

Browse files
author
pixel
committed
修改配置path灵活度 可增加路由参数
1 parent fc82be8 commit 729b3d4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

server/api/v1/sys_menu.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func AddBaseMenu(c *gin.Context) {
7070
var menu model.SysBaseMenu
7171
_ = c.ShouldBindJSON(&menu)
7272
MenuVerify := utils.Rules{
73-
"Path": {"notEmpty"},
73+
"Path": {utils.NotEmpty()},
7474
"ParentId": {utils.NotEmpty()},
7575
"Name": {utils.NotEmpty()},
7676
"Component": {utils.NotEmpty()},

web/src/view/superAdmin/menu/menu.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<el-table :data="tableData" border row-key="ID" stripe>
99
<el-table-column label="ID" min-width="100" prop="ID"></el-table-column>
1010
<el-table-column label="路由Name" min-width="160" prop="name"></el-table-column>
11+
<el-table-column label="路由Path" min-width="160" prop="path"></el-table-column>
1112
<el-table-column label="是否隐藏" min-width="100" prop="hidden">
1213
<template slot-scope="scope">
1314
<span>{{scope.row.hidden?"隐藏":"显示"}}</span>
@@ -46,7 +47,10 @@
4647
label-position="top"
4748
>
4849
<el-form-item label="路由name" prop="path" style="width:30%">
49-
<el-input autocomplete="off" placeholder="唯一英文字符串" v-model="form.path"></el-input>
50+
<el-input autocomplete="off" placeholder="唯一英文字符串" @change="changeName" v-model="form.name"></el-input>
51+
</el-form-item>
52+
<el-form-item label="路由path" prop="path" style="width:30%">
53+
<el-input autocomplete="off" placeholder="建议只在后方拼接参数" v-model="form.path"></el-input>
5054
</el-form-item>
5155
<el-form-item label="是否隐藏" style="width:30%">
5256
<el-select placeholder="是否在列表隐藏" v-model="form.hidden">
@@ -151,6 +155,9 @@ export default {
151155
icon
152156
},
153157
methods: {
158+
changeName(){
159+
this.form.path = this.form.name
160+
},
154161
setOptions() {
155162
this.menuOption = [
156163
{
@@ -259,7 +266,6 @@ export default {
259266
this.$refs.menuForm.validate(async valid => {
260267
if (valid) {
261268
let res;
262-
this.form.name = this.form.path;
263269
if (this.isEdit) {
264270
res = await updateBaseMenu(this.form);
265271
} else {

0 commit comments

Comments
 (0)