From deca72d2dcd7421d17ef0d5537c78dd3076bb3fa Mon Sep 17 00:00:00 2001 From: pixelmaxQM Date: Sun, 4 Aug 2024 01:09:01 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E6=94=AF=E6=8C=81api=E5=92=8C?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E8=87=AA=E5=8A=A8=E5=8C=96=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=9A=84i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/model/system/request/sys_auto_code.go | 26 ++-- server/resource/package/web/view/form.vue.tpl | 8 +- .../resource/package/web/view/table.vue.tpl | 50 +++---- .../plugin/web/form/form.vue.template | 9 +- .../plugin/web/view/view.vue.template | 47 +++--- server/service/system/auto_code_template.go | 134 ++++++++++++++++-- web/src/view/systemTools/autoCode/index.vue | 2 +- 7 files changed, 191 insertions(+), 85 deletions(-) diff --git a/server/model/system/request/sys_auto_code.go b/server/model/system/request/sys_auto_code.go index 088986dfe..dfd5d8f0b 100644 --- a/server/model/system/request/sys_auto_code.go +++ b/server/model/system/request/sys_auto_code.go @@ -50,38 +50,38 @@ func (r *AutoCode) Apis() []model.SysApi { return []model.SysApi{ { Path: "/" + r.Abbreviation + "/" + "create" + r.StructName, - Description: "新增" + r.Description, - ApiGroup: r.Description, + Description: fmt.Sprintf("system.api.desc.%s%s%s", "add", r.Package, r.StructName), + ApiGroup: fmt.Sprintf("system.api.group.%s%s", r.Package, r.StructName), Method: "POST", }, { Path: "/" + r.Abbreviation + "/" + "delete" + r.StructName, - Description: "删除" + r.Description, - ApiGroup: r.Description, + Description: fmt.Sprintf("system.api.desc.%s%s%s", "delete", r.Package, r.StructName), + ApiGroup: fmt.Sprintf("system.api.group.%s%s", r.Package, r.StructName), Method: "DELETE", }, { Path: "/" + r.Abbreviation + "/" + "delete" + r.StructName + "ByIds", - Description: "批量删除" + r.Description, - ApiGroup: r.Description, + Description: fmt.Sprintf("system.api.desc.%s%s%s", "batch", r.Package, r.StructName), + ApiGroup: fmt.Sprintf("system.api.group.%s%s", r.Package, r.StructName), Method: "DELETE", }, { Path: "/" + r.Abbreviation + "/" + "update" + r.StructName, - Description: "更新" + r.Description, - ApiGroup: r.Description, + Description: fmt.Sprintf("system.api.desc.%s%s%s", "update", r.Package, r.StructName), + ApiGroup: fmt.Sprintf("system.api.group.%s%s", r.Package, r.StructName), Method: "PUT", }, { Path: "/" + r.Abbreviation + "/" + "find" + r.StructName, - Description: "根据ID获取" + r.Description, - ApiGroup: r.Description, + Description: fmt.Sprintf("system.api.desc.%s%s%s", "find", r.Package, r.StructName), + ApiGroup: fmt.Sprintf("system.api.group.%s%s", r.Package, r.StructName), Method: "GET", }, { Path: "/" + r.Abbreviation + "/" + "get" + r.StructName + "List", - Description: "获取" + r.Description + "列表", - ApiGroup: r.Description, + Description: fmt.Sprintf("system.api.desc.%s%s%s", "list", r.Package, r.StructName), + ApiGroup: fmt.Sprintf("system.api.group.%s%s", r.Package, r.StructName), Method: "GET", }, } @@ -98,7 +98,7 @@ func (r *AutoCode) Menu(template string) model.SysBaseMenu { Name: r.Abbreviation, Component: component, Meta: model.Meta{ - Title: r.Description, + Title: fmt.Sprintf("system.menu.%s%s", r.Package, r.StructName), }, } } diff --git a/server/resource/package/web/view/form.vue.tpl b/server/resource/package/web/view/form.vue.tpl index 8131c9e76..043ae0c82 100644 --- a/server/resource/package/web/view/form.vue.tpl +++ b/server/resource/package/web/view/form.vue.tpl @@ -4,9 +4,9 @@
{{- range .Fields}} - + {{- if .CheckDataSource}} - + {{- else }} @@ -15,11 +15,11 @@ {{- end }} {{- if eq .FieldType "string" }} {{- if .DictType}} - + {{- else }} - + {{- end }} {{- end }} {{- if eq .FieldType "richtext" }} diff --git a/server/resource/package/web/view/table.vue.tpl b/server/resource/package/web/view/table.vue.tpl index 933ba0c58..61cd832ac 100644 --- a/server/resource/package/web/view/table.vue.tpl +++ b/server/resource/package/web/view/table.vue.tpl @@ -19,7 +19,7 @@ {{ end -}} {{- range .Fields}} {{- if .FieldSearchType}} {{- if not .FieldSearchHide }} {{- if eq .FieldType "bool" }} - + {{- else if .DictType}} - + {{- else}} - + {{- if eq .FieldType "float64" "int"}} {{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}} @@ -59,7 +59,7 @@ {{if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}