Skip to content

Commit 83518d0

Browse files
committed
feat(menu): 版本更新为2.8.4,给菜单增加按钮和参数的预制打包
1 parent 39abc7b commit 83518d0

File tree

10 files changed

+279
-236
lines changed

10 files changed

+279
-236
lines changed

server/config.yaml

Lines changed: 193 additions & 228 deletions
Large diffs are not rendered by default.

server/core/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func RunServer() {
3535

3636
fmt.Printf(`
3737
欢迎使用 gin-vue-admin
38-
当前版本:v2.8.3
38+
当前版本:v2.8.4
3939
加群方式:微信号:shouzi_1994 QQ群:470239250
4040
项目地址:https://github.com/flipped-aurora/gin-vue-admin
4141
插件市场:https://plugin.gin-vue-admin.com

server/docs/docs.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
// @Tag.Description 用户
2222

2323
// @title Gin-Vue-Admin Swagger API接口文档
24-
// @version v2.8.3
24+
// @version v2.8.4
2525
// @description 使用gin+vue进行极速开发的全栈开发基础平台
2626
// @securityDefinitions.apikey ApiKeyAuth
2727
// @in header

server/service/system/auto_code_plugin.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (s *autoCodePlugin) PubPlug(plugName string) (zipPath string, err error) {
170170
// (compression is not required; you could use Tar directly)
171171
format := archives.CompressedArchive{
172172
//Compression: archives.Gz{},
173-
Archival: archives.Zip{},
173+
Archival: archives.Zip{},
174174
}
175175

176176
// create the archive
@@ -208,7 +208,8 @@ func (s *autoCodePlugin) InitMenu(menuInfo request.InitMenu) (err error) {
208208
},
209209
}
210210

211-
err = global.GVA_DB.Find(&menus, "id in (?)", menuInfo.Menus).Error
211+
// 查询菜单及其关联的参数和按钮
212+
err = global.GVA_DB.Preload("Parameters").Preload("MenuBtn").Find(&menus, "id in (?)", menuInfo.Menus).Error
212213
if err != nil {
213214
return err
214215
}

server/utils/ast/ast.go

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,81 @@ func CreateMenuStructAst(menus []system.SysBaseMenu) *[]ast.Expr {
121121
},
122122
},
123123
}
124+
125+
// 添加菜单参数
126+
if len(menus[i].Parameters) > 0 {
127+
var paramElts []ast.Expr
128+
for _, param := range menus[i].Parameters {
129+
paramElts = append(paramElts, &ast.CompositeLit{
130+
Type: &ast.SelectorExpr{
131+
X: &ast.Ident{Name: "model"},
132+
Sel: &ast.Ident{Name: "SysBaseMenuParameter"},
133+
},
134+
Elts: []ast.Expr{
135+
&ast.KeyValueExpr{
136+
Key: &ast.Ident{Name: "Type"},
137+
Value: &ast.BasicLit{Kind: token.STRING, Value: fmt.Sprintf("\"%s\"", param.Type)},
138+
},
139+
&ast.KeyValueExpr{
140+
Key: &ast.Ident{Name: "Key"},
141+
Value: &ast.BasicLit{Kind: token.STRING, Value: fmt.Sprintf("\"%s\"", param.Key)},
142+
},
143+
&ast.KeyValueExpr{
144+
Key: &ast.Ident{Name: "Value"},
145+
Value: &ast.BasicLit{Kind: token.STRING, Value: fmt.Sprintf("\"%s\"", param.Value)},
146+
},
147+
},
148+
})
149+
}
150+
elts = append(elts, &ast.KeyValueExpr{
151+
Key: &ast.Ident{Name: "Parameters"},
152+
Value: &ast.CompositeLit{
153+
Type: &ast.ArrayType{
154+
Elt: &ast.SelectorExpr{
155+
X: &ast.Ident{Name: "model"},
156+
Sel: &ast.Ident{Name: "SysBaseMenuParameter"},
157+
},
158+
},
159+
Elts: paramElts,
160+
},
161+
})
162+
}
163+
164+
// 添加菜单按钮
165+
if len(menus[i].MenuBtn) > 0 {
166+
var btnElts []ast.Expr
167+
for _, btn := range menus[i].MenuBtn {
168+
btnElts = append(btnElts, &ast.CompositeLit{
169+
Type: &ast.SelectorExpr{
170+
X: &ast.Ident{Name: "model"},
171+
Sel: &ast.Ident{Name: "SysBaseMenuBtn"},
172+
},
173+
Elts: []ast.Expr{
174+
&ast.KeyValueExpr{
175+
Key: &ast.Ident{Name: "Name"},
176+
Value: &ast.BasicLit{Kind: token.STRING, Value: fmt.Sprintf("\"%s\"", btn.Name)},
177+
},
178+
&ast.KeyValueExpr{
179+
Key: &ast.Ident{Name: "Desc"},
180+
Value: &ast.BasicLit{Kind: token.STRING, Value: fmt.Sprintf("\"%s\"", btn.Desc)},
181+
},
182+
},
183+
})
184+
}
185+
elts = append(elts, &ast.KeyValueExpr{
186+
Key: &ast.Ident{Name: "MenuBtn"},
187+
Value: &ast.CompositeLit{
188+
Type: &ast.ArrayType{
189+
Elt: &ast.SelectorExpr{
190+
X: &ast.Ident{Name: "model"},
191+
Sel: &ast.Ident{Name: "SysBaseMenuBtn"},
192+
},
193+
},
194+
Elts: btnElts,
195+
},
196+
})
197+
}
198+
124199
menuElts = append(menuElts, &ast.CompositeLit{
125200
Type: nil,
126201
Elts: elts,

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gin-vue-admin",
3-
"version": "2.8.2",
3+
"version": "2.8.4",
44
"private": true,
55
"scripts": {
66
"serve": "node openDocument.js && vite --host --mode development",

web/src/core/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const viteLogo = (env) => {
1717
`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`
1818
)
1919
)
20-
console.log(greenText(`> 当前版本:v2.8.3`))
20+
console.log(greenText(`> 当前版本:v2.8.4`))
2121
console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`))
2222
console.log(
2323
greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`)

web/src/core/gin-vue-admin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
register(app)
1111
console.log(`
1212
欢迎使用 Gin-Vue-Admin
13-
当前版本:v2.8.3
13+
当前版本:v2.8.4
1414
加群方式:微信:shouzi_1994 QQ群:622360840
1515
项目地址:https://github.com/flipped-aurora/gin-vue-admin
1616
插件市场:https://plugin.gin-vue-admin.com

web/src/pathInfo.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
"/src/view/superAdmin/menu/menu.vue": "Menus",
5959
"/src/view/superAdmin/operation/sysOperationRecord.vue": "SysOperationRecord",
6060
"/src/view/superAdmin/params/sysParams.vue": "SysParams",
61+
"/src/view/superAdmin/release/syncRelease.vue": "SyncRelease",
6162
"/src/view/superAdmin/user/user.vue": "User",
63+
"/src/view/superAdmin/version/version.vue": "Version",
6264
"/src/view/system/state.vue": "State",
6365
"/src/view/systemTools/autoCode/component/fieldDialog.vue": "FieldDialog",
6466
"/src/view/systemTools/autoCode/component/previewCodeDialog.vue": "PreviewCodeDialog",

0 commit comments

Comments
 (0)