diff --git a/server/api/v1/system/sys_auto_code.go b/server/api/v1/system/sys_auto_code.go index c7a612eb6..4dbc34dd2 100644 --- a/server/api/v1/system/sys_auto_code.go +++ b/server/api/v1/system/sys_auto_code.go @@ -52,8 +52,19 @@ func (autoApi *AutoCodeApi) GetDB(c *gin.Context) { // @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前数据库所有表" // @Router /autoCode/getTables [get] func (autoApi *AutoCodeApi) GetTables(c *gin.Context) { - dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname) + dbName := c.Query("dbName") businessDB := c.Query("businessDB") + if dbName == "" { + dbName = global.GVA_CONFIG.Mysql.Dbname + if businessDB != "" { + for _, db := range global.GVA_CONFIG.DBList { + if db.AliasName == businessDB { + dbName = db.Dbname + } + } + } + } + tables, err := autoCodeService.Database(businessDB).GetTables(businessDB, dbName) if err != nil { global.GVA_LOG.Error(global.Translate("sys_auto_code.queryTablesFail"), zap.Error(err)) @@ -73,7 +84,17 @@ func (autoApi *AutoCodeApi) GetTables(c *gin.Context) { // @Router /autoCode/getColumn [get] func (autoApi *AutoCodeApi) GetColumn(c *gin.Context) { businessDB := c.Query("businessDB") - dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname) + dbName := c.Query("dbName") + if dbName == "" { + dbName = global.GVA_CONFIG.Mysql.Dbname + if businessDB != "" { + for _, db := range global.GVA_CONFIG.DBList { + if db.AliasName == businessDB { + dbName = db.Dbname + } + } + } + } tableName := c.Query("tableName") columns, err := autoCodeService.Database(businessDB).GetColumn(businessDB, tableName, dbName) if err != nil { diff --git a/server/core/server.go b/server/core/server.go index e8561d47a..55b693777 100644 --- a/server/core/server.go +++ b/server/core/server.go @@ -2,7 +2,6 @@ package core import ( "fmt" - "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/initialize" "github.com/flipped-aurora/gin-vue-admin/server/service/system" @@ -39,7 +38,7 @@ func RunWindowsServer() { fmt.Printf(` %s gin-vue-admin - %s:v2.7.0 + %s:v2.7.1 加群方式:微信号:shouzi_1994 QQ群:470239250 项目地址:https://github.com/flipped-aurora/gin-vue-admin 插件市场:https://plugin.gin-vue-admin.com diff --git a/server/docs/docs.go b/server/docs/docs.go index 232540981..f3e8847bf 100644 --- a/server/docs/docs.go +++ b/server/docs/docs.go @@ -8087,7 +8087,7 @@ const docTemplate = `{ // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ - Version: "v2.7.0", + Version: "v2.7.1", Host: "", BasePath: "", Schemes: []string{}, diff --git a/server/docs/swagger.json b/server/docs/swagger.json index 33e82d34e..d7facd264 100644 --- a/server/docs/swagger.json +++ b/server/docs/swagger.json @@ -4,7 +4,7 @@ "description": "使用gin+vue进行极速开发的全栈开发基础平台", "title": "Gin-Vue-Admin Swagger API接口文档", "contact": {}, - "version": "v2.7.0" + "version": "v2.7.1" }, "paths": { "/api/createApi": { diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml index a1abe7792..ac18f4dbc 100644 --- a/server/docs/swagger.yaml +++ b/server/docs/swagger.yaml @@ -1634,7 +1634,7 @@ info: contact: {} description: 使用gin+vue进行极速开发的全栈开发基础平台 title: Gin-Vue-Admin Swagger API接口文档 - version: v2.7.0 + version: v2.7.1 paths: /api/createApi: post: diff --git a/server/main.go b/server/main.go index f07f01063..7304ce12a 100644 --- a/server/main.go +++ b/server/main.go @@ -16,7 +16,7 @@ import ( //go:generate go mod download // @title Gin-Vue-Admin Swagger API接口文档 -// @version v2.7.0 +// @version v2.7.1 // @description 使用gin+vue进行极速开发的全栈开发基础平台 // @securityDefinitions.apikey ApiKeyAuth // @in header diff --git a/server/resource/package/server/api/api.go.tpl b/server/resource/package/server/api/api.go.tpl index 2a30782b3..7f2ce0c31 100644 --- a/server/resource/package/server/api/api.go.tpl +++ b/server/resource/package/server/api/api.go.tpl @@ -35,11 +35,11 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Create{{.StructName}}(c *gin.Con {{- end }} err = {{.Abbreviation}}Service.Create{{.StructName}}(&{{.Abbreviation}}) if err != nil { - global.GVA_LOG.Error("创建失败!", zap.Error(err)) - response.FailWithMessage("创建失败", c) + global.GVA_LOG.Error(global.Translate("general.creationFail"), zap.Error(err)) + response.FailWithMessage(global.Translate("general.creationFailErr"), c) return } - response.OkWithMessage("创建成功", c) + response.OkWithMessage(global.Translate("general.createSuccss"), c) } // Delete{{.StructName}} 删除{{.Description}} @@ -58,11 +58,11 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}(c *gin.Con {{- end }} err := {{.Abbreviation}}Service.Delete{{.StructName}}({{.PrimaryField.FieldJson}} {{- if .AutoCreateResource -}},userID{{- end -}}) if err != nil { - global.GVA_LOG.Error("删除失败!", zap.Error(err)) - response.FailWithMessage("删除失败", c) + global.GVA_LOG.Error(global.Translate("general.deleteFail"), zap.Error(err)) + response.FailWithMessage(global.Translate("general.deletFailErr"), c) return } - response.OkWithMessage("删除成功", c) + response.OkWithMessage(global.Translate("general.deleteSuccess"), c) } // Delete{{.StructName}}ByIds 批量删除{{.Description}} @@ -80,11 +80,11 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}ByIds(c *gi {{- end }} err := {{.Abbreviation}}Service.Delete{{.StructName}}ByIds({{.PrimaryField.FieldJson}}s{{- if .AutoCreateResource }},userID{{- end }}) if err != nil { - global.GVA_LOG.Error("批量删除失败!", zap.Error(err)) - response.FailWithMessage("批量删除失败", c) + global.GVA_LOG.Error(global.Translate("sys_operation_record.batchDeleteFail"), zap.Error(err)) + response.FailWithMessage("sys_operation_record.batchDeleteFailErr"), c) return } - response.OkWithMessage("批量删除成功", c) + response.OkWithMessage(global.Translate("sys_operation_record.batchDeleteSuccess"), c) } // Update{{.StructName}} 更新{{.Description}} @@ -108,11 +108,11 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Update{{.StructName}}(c *gin.Con {{- end }} err = {{.Abbreviation}}Service.Update{{.StructName}}({{.Abbreviation}}) if err != nil { - global.GVA_LOG.Error("更新失败!", zap.Error(err)) - response.FailWithMessage("更新失败", c) + global.GVA_LOG.Error(global.Translate("general.updateFail"), zap.Error(err)) + response.FailWithMessage(global.Translate("general.updateFailErr"), c) return } - response.OkWithMessage("更新成功", c) + response.OkWithMessage("general.updateSuccess"), c) } // Find{{.StructName}} 用id查询{{.Description}} @@ -128,8 +128,8 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Conte {{.PrimaryField.FieldJson}} := c.Query("{{.PrimaryField.FieldJson}}") re{{.Abbreviation}}, err := {{.Abbreviation}}Service.Get{{.StructName}}({{.PrimaryField.FieldJson}}) if err != nil { - global.GVA_LOG.Error("查询失败!", zap.Error(err)) - response.FailWithMessage("查询失败", c) + global.GVA_LOG.Error(global.Translate("general.queryFail"), zap.Error(err)) + response.FailWithMessage(global.Translate("general.queryFailErr"), c) return } response.OkWithData(re{{.Abbreviation}}, c) @@ -153,8 +153,8 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co } list, total, err := {{.Abbreviation}}Service.Get{{.StructName}}InfoList(pageInfo) if err != nil { - global.GVA_LOG.Error("获取失败!", zap.Error(err)) - response.FailWithMessage("获取失败", c) + global.GVA_LOG.Error(global.Translate("general.getDataFail"), zap.Error(err)) + response.FailWithMessage(global.Translate("general.getDataFailErr"), c) return } response.OkWithDetailed(response.PageResult{ @@ -162,7 +162,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co Total: total, Page: pageInfo.Page, PageSize: pageInfo.PageSize, - }, "获取成功", c) + }, global.Translate("general.getDataSuccess"), c) } {{- if .HasDataSource }} @@ -177,8 +177,8 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}DataSource(c * // 此接口为获取数据源定义的数据 dataSource, err := {{.Abbreviation}}Service.Get{{.StructName}}DataSource() if err != nil { - global.GVA_LOG.Error("查询失败!", zap.Error(err)) - response.FailWithMessage("查询失败", c) + global.GVA_LOG.Error(global.Translate("general.queryFail"), zap.Error(err)) + response.FailWithMessage(global.Translate("general.queryFailErr"), c) return } response.OkWithData(dataSource, c) @@ -199,4 +199,4 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}Public(c *gin. response.OkWithDetailed(gin.H{ "info": "不需要鉴权的{{.Description}}接口信息", }, "获取成功", c) -} \ No newline at end of file +} diff --git a/server/resource/package/web/view/form.vue.tpl b/server/resource/package/web/view/form.vue.tpl index 043ae0c82..2ef27dcdd 100644 --- a/server/resource/package/web/view/form.vue.tpl +++ b/server/resource/package/web/view/form.vue.tpl @@ -26,10 +26,10 @@ {{- end }} {{- if eq .FieldType "int" }} - + {{- end }} {{- if eq .FieldType "time.Time" }} - + {{- end }} {{- if eq .FieldType "float64" }} @@ -59,8 +59,8 @@ {{- end }} - 保存 - 返回 + {{ "{{ t('general.save') }}" }} + {{ "{{ t('general.back') }}" }} @@ -86,6 +86,9 @@ import { getDictFunc } from '@/utils/format' import { useRoute, useRouter } from "vue-router" import { ElMessage } from 'element-plus' import { ref, reactive } from 'vue' +import { useI18n } from 'vue-i18n' // added by mohamed hassan to support multilanguage + +const { t } = useI18n() // added by mohamed hassan to support multilanguage {{- if .HasPic }} import SelectImage from '@/components/selectImage/selectImage.vue' {{- end }} diff --git a/web/package.json b/web/package.json index cc6b11d2e..4f7bbe0d9 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "gin-vue-admin", - "version": "2.7.0", + "version": "2.7.1", "private": true, "scripts": { "serve": "node openDocument.js && vite --host --mode development", @@ -38,8 +38,7 @@ "vue-echarts": "^6.7.2", "vue-router": "^4.3.2", "vuedraggable": "^4.1.0", - "vue-i18n": "^9.4.1", - "js-cookie": "^3.0.5" + "vue-i18n": "^9.4.1" }, "devDependencies": { "@babel/eslint-parser": "^7.22.9", diff --git a/web/src/config.json b/web/src/config.json index 08d2aebee..9dc37a14a 100644 --- a/web/src/config.json +++ b/web/src/config.json @@ -3,8 +3,8 @@ "primaryColor":"#3b82f6", "showTabs":true, "darkMode":"auto", - "layout_side_width":200, + "layout_side_width":220, "layout_side_collapsed_width":60, "layout_side_item_height":44, - "show_watermark":true, + "show_watermark":false, "side_mode":"normal"} diff --git a/web/src/core/config.js b/web/src/core/config.js index dfb776aba..7d0289932 100644 --- a/web/src/core/config.js +++ b/web/src/core/config.js @@ -20,7 +20,7 @@ export const viteLogo = (env) => { ) console.log( chalk.green( - `> 当前版本:v2.7.0` + `> 当前版本:v2.7.1` ) ) console.log( diff --git a/web/src/core/gin-vue-admin.js b/web/src/core/gin-vue-admin.js index eb8c96dad..8291bd69d 100644 --- a/web/src/core/gin-vue-admin.js +++ b/web/src/core/gin-vue-admin.js @@ -10,7 +10,7 @@ export default { register(app) console.log(` 欢迎使用 Gin-Vue-Admin - 当前版本:v2.7.0 + 当前版本:v2.7.1 加群方式:微信:shouzi_1994 QQ群:622360840 项目地址:https://github.com/flipped-aurora/gin-vue-admin 插件市场:https://plugin.gin-vue-admin.com diff --git a/web/src/locales/en.json b/web/src/locales/en.json index ea3acb88f..8f6501611 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -216,7 +216,8 @@ "search" : "Search", "systemSettings" : "System Settings", "refresh" : "Refresh", - "changeLanguage": "Change Language" + "changeLanguage": "Change Language", + "videoTutorial": "Video Tutorial" }, "setting" : { "defaultTheme" : "Default Theme", @@ -293,6 +294,9 @@ "addButton" : "Add a controllable button", "buttonName" : "Button name", "comments" : "Comments", + "highlightMenu" : "Highlight Menu", + "basicPage" : "Is it a basic page?", + "basicPageNote" : "If you select Yes for this option, the left menu and top information will not be displayed.", "" : "" }, "menus": { @@ -378,7 +382,7 @@ "apiGroup" : "API Group", "apiPath" : "API Path", "apiGrouping" : "API Group", - "apiDescrpition" : "API Description", + "apiDescription" : "API Description", "newApiNote" : "New API, you need to configure permissions in role management to use it", "create" : "Create", "view" : "View", @@ -391,6 +395,20 @@ "editApi" : "Edit Api", "unknownOperation" : "Unknown operation", "deleteApiConfirm" : "This operation will permanently delete the api under all roles, Do you want to continue?", + "refreshCache" : "Refresh the cache", + "synchronousAPI" : "Synchronous API", + "synchronousAPINote" : "Synchronous API, if you do not enter the route group, it will not be automatically synchronized", + "synchronousRouting" : "Synchronous Routing", + "newAddedRouteNote1" : "The newly added route ", + "newAddedRouteNote2" : "exists in the current route, but does not exist in the api table.", + "selectOrAdd" : "Please select or add", + "ignore" : "Ignore", + "deletedRouteNote1" : "The deleted route ", + "deletedRouteNote2" : "no longer exists in the routes of the current project and will be automatically deleted from the apis table after synchronization.", + "ignoreRouteNote1" : "Ignore routes ", + "ignoreRouteNote2" : "and do not participate in API synchronization. This is usually a route that does not require authentication.", + "cancelIgnore" : "Cancel Ignore", + "cacheConfirmNote" : "Are you sure you want to refresh the cache?", "" : "" }, "dictionary" : { diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index 6e029372e..df9cbee39 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -209,7 +209,8 @@ "loading": "正在加载中", "logout": "登 出", "personalInfo": "个人信息", - "switchTo": "切换为:" + "switchTo": "切换为:", + "videoTutorial": "视频教程" }, "tools" : { "switchTheme" : "切换主题", @@ -293,6 +294,9 @@ "addButton" : "新增可控按钮", "buttonName" : "按钮名称", "comments" : "备注", + "highlightMenu" : "高亮菜单", + "basicPage" : "是否为基础页面", + "basicPageNote" : "此项选择为是,则不会展示左侧菜单以及顶部信息。", "" : "" }, "menus": { @@ -378,7 +382,7 @@ "apiGroup" : "API组", "apiPath" : "API路径", "apiGrouping" : "API分组", - "apiDescrpition" : "API简介", + "apiDescription" : "API简介", "newApiNote" : "新增API,需要在角色管理内配置权限才可使用", "create" : "创建", "view" : "查看", @@ -391,6 +395,20 @@ "editApi" : "编辑Api", "unknownOperation" : "未知操作", "deleteApiConfirm" : "此操作将永久删除所有角色下该api, 是否继续?", + "refreshCache" : "刷新缓存", + "synchronousAPI" : "同步API", + "synchronousAPINote" : "同步API,不输入路由分组将不会被自动同步", + "synchronousRouting" : "同步路由", + "newAddedRouteNote1" : "新增路由", + "newAddedRouteNote2" : "存在于当前路由中,但是不存在于api表", + "selectOrAdd" : "请选择或新增", + "ignore" : "忽略", + "deletedRouteNote1" : "已删除路由", + "deletedRouteNote2" : "已经不存在于当前项目的路由中,确定同步后会自动从apis表删除", + "ignoreRouteNote1" : "忽略路由", + "ignoreRouteNote2" : "忽略路由不参与api同步,常见为不需要进行鉴权行为的路由", + "cancelIgnore" : "取消忽略", + "cacheConfirmNote" : "确定要刷新缓存吗?", "": "" }, "dictionary" : { diff --git a/web/src/utils/request.js b/web/src/utils/request.js index 6d25c91a5..93e728335 100644 --- a/web/src/utils/request.js +++ b/web/src/utils/request.js @@ -105,7 +105,6 @@ service.interceptors.response.use( }) return } - switch (error.response.status) { case 500: ElMessageBox.confirm(` @@ -114,8 +113,8 @@ service.interceptors.response.use( `, '接口报错', { dangerouslyUseHTMLString: true, distinguishCancelAndClose: true, - confirmButtonText: i18n.t('general.confirm'), - cancelButtonText: i18n.t('general.cancel') + confirmButtonText: i18n.global.t('general.confirm'), + cancelButtonText: i18n.global.t('general.cancel') }) .then(() => { const userStore = useUserStore() @@ -130,8 +129,8 @@ service.interceptors.response.use( `, '接口报错', { dangerouslyUseHTMLString: true, distinguishCancelAndClose: true, - confirmButtonText: i18n.t('general.confirm'), - cancelButtonText: i18n.t('general.cancel') + confirmButtonText: i18n.global.t('general.confirm'), + cancelButtonText: i18n.global.t('general.cancel') }) break case 401: diff --git a/web/src/view/layout/header/tools.vue b/web/src/view/layout/header/tools.vue index 9c2389d24..1c5daa0ed 100644 --- a/web/src/view/layout/header/tools.vue +++ b/web/src/view/layout/header/tools.vue @@ -5,6 +5,25 @@ @@ -390,13 +384,13 @@ {{ dialogTitle }}
- 取 消 + {{ t('general.close') }} - 确 定 + {{ t('general.confirm') }}
@@ -407,7 +401,7 @@ ref="apiForm" :model="form" :rules="rules" - label-width="80px" + label-width="120px" > { } const onDelete = async() => { - ElMessageBox.confirm('确定要删除吗?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm(t('general.deleteConfirm'), t('general.hint'), { + confirmButtonText: t('general.confirm'), + cancelButtonText: t('general.cancel'), type: 'warning' }).then(async() => { const ids = apis.value.map(item => item.ID) @@ -673,9 +665,9 @@ const onDelete = async() => { }) } const onFresh = async() => { - ElMessageBox.confirm('确定要刷新缓存吗?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm(t('view.api.cacheConfirmNote'), t('general.hint'), { + confirmButtonText: t('general.confirm'), + cancelButtonText: t('general.cancel'), type: 'warning' }).then(async() => { const res = await freshCasbin() @@ -721,7 +713,7 @@ const initForm = () => { } } -const dialogTitle = ref('新增Api') +const dialogTitle = ref(t('view.api.newApi')) const dialogFormVisible = ref(false) const openDialog = (key) => { switch (key) { diff --git a/web/src/view/superAdmin/authority/authority.vue b/web/src/view/superAdmin/authority/authority.vue index d17ceb3d2..efd3a6361 100644 --- a/web/src/view/superAdmin/authority/authority.vue +++ b/web/src/view/superAdmin/authority/authority.vue @@ -8,10 +8,6 @@ icon="plus" @click="addAuthority(0)" >{{ t('authority.addRole') }} - {{ t('menu.addRootMenu') }} - - - @@ -272,7 +262,7 @@