From c46e41f3e847518f569afe9a5c205957e64d1407 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Mon, 27 Nov 2023 15:17:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20acs=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/menu/impl/SysMenuServiceImpl.java | 5 +- acs/nladmin-ui/package.json | 2 + .../src/components/Breadcrumb/index.vue | 6 +- .../src/components/Crud/CRUD.operation.vue | 16 +-- .../src/components/Crud/RR.operation.vue | 4 +- .../src/components/Crud/UD.operation.vue | 8 +- acs/nladmin-ui/src/components/Crud/crud.js | 3 +- .../src/components/TopNav/index.vue | 2 +- .../src/components/UploadExcel/index.vue | 4 +- acs/nladmin-ui/src/i18n/index.js | 27 ++++ acs/nladmin-ui/src/i18n/langs/chinese.js | 11 ++ acs/nladmin-ui/src/i18n/langs/en.js | 99 +++++++++++++ acs/nladmin-ui/src/i18n/langs/english.js | 11 ++ acs/nladmin-ui/src/i18n/langs/in.js | 99 +++++++++++++ acs/nladmin-ui/src/i18n/langs/indonesian.js | 11 ++ acs/nladmin-ui/src/i18n/langs/menu/en.js | 23 ++++ acs/nladmin-ui/src/i18n/langs/menu/in.js | 23 ++++ acs/nladmin-ui/src/i18n/langs/menu/zh.js | 23 ++++ acs/nladmin-ui/src/i18n/langs/param/en.js | 13 ++ acs/nladmin-ui/src/i18n/langs/param/in.js | 13 ++ acs/nladmin-ui/src/i18n/langs/param/zh.js | 13 ++ acs/nladmin-ui/src/i18n/langs/zh-CN.js | 99 +++++++++++++ .../src/layout/components/Navbar.vue | 55 ++++++-- .../src/layout/components/Settings/index.vue | 20 +-- .../layout/components/Sidebar/SidebarItem.vue | 4 +- .../src/layout/components/TagsView/index.vue | 14 +- acs/nladmin-ui/src/main.js | 9 ++ acs/nladmin-ui/src/router/index.js | 3 +- acs/nladmin-ui/src/router/routers.js | 7 +- acs/nladmin-ui/src/utils/request.js | 2 + acs/nladmin-ui/src/views/login.vue | 130 +++++++++++------- .../src/views/monitor/server/index.vue | 108 +++++++-------- .../src/views/system/menu/index.vue | 77 ++++++++--- .../src/views/system/param/index.vue | 42 +++--- .../src/views/system/user/center.vue | 83 +++++------ .../views/system/user/center/updatePass.vue | 31 +++-- lms/nladmin-ui/src/i18n/langs/en.js | 16 +-- lms/nladmin-ui/src/i18n/langs/in.js | 16 +-- lms/nladmin-ui/src/i18n/langs/menu/en.js | 23 +++- lms/nladmin-ui/src/i18n/langs/menu/in.js | 23 +++- lms/nladmin-ui/src/i18n/langs/menu/zh.js | 23 +++- lms/nladmin-ui/src/i18n/langs/param/en.js | 13 ++ lms/nladmin-ui/src/i18n/langs/param/in.js | 13 ++ lms/nladmin-ui/src/i18n/langs/param/zh.js | 13 ++ lms/nladmin-ui/src/i18n/langs/zh-CN.js | 23 +--- .../src/views/system/menu/index.vue | 28 ++-- 46 files changed, 959 insertions(+), 332 deletions(-) create mode 100644 acs/nladmin-ui/src/i18n/index.js create mode 100644 acs/nladmin-ui/src/i18n/langs/chinese.js create mode 100644 acs/nladmin-ui/src/i18n/langs/en.js create mode 100644 acs/nladmin-ui/src/i18n/langs/english.js create mode 100644 acs/nladmin-ui/src/i18n/langs/in.js create mode 100644 acs/nladmin-ui/src/i18n/langs/indonesian.js create mode 100644 acs/nladmin-ui/src/i18n/langs/menu/en.js create mode 100644 acs/nladmin-ui/src/i18n/langs/menu/in.js create mode 100644 acs/nladmin-ui/src/i18n/langs/menu/zh.js create mode 100644 acs/nladmin-ui/src/i18n/langs/param/en.js create mode 100644 acs/nladmin-ui/src/i18n/langs/param/in.js create mode 100644 acs/nladmin-ui/src/i18n/langs/param/zh.js create mode 100644 acs/nladmin-ui/src/i18n/langs/zh-CN.js create mode 100644 lms/nladmin-ui/src/i18n/langs/param/en.js create mode 100644 lms/nladmin-ui/src/i18n/langs/param/in.js create mode 100644 lms/nladmin-ui/src/i18n/langs/param/zh.js diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/menu/impl/SysMenuServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/menu/impl/SysMenuServiceImpl.java index 79abd17..1039186 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/menu/impl/SysMenuServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/menu/impl/SysMenuServiceImpl.java @@ -69,7 +69,7 @@ public class SysMenuServiceImpl extends ServiceImpl impl if (StringUtils.isNotEmpty(query.getBlurry())){ query.setPid(null); } - Page menuPage = this.page(page.build(), query.build()); + Page menuPage = this.page(page.build(SysMenu.class), query.build()); List collect = menuPage.getRecords().stream().map(menu -> this.doToDto(menu)).collect(Collectors.toList()); return collect; } @@ -360,6 +360,9 @@ public class SysMenuServiceImpl extends ServiceImpl impl menuDto.setType(entity.getType()); menuDto.setPermission(entity.getPermission()); menuDto.setTitle(entity.getTitle()); + menuDto.setIn_title(entity.getIn_title()); + menuDto.setEn_title(entity.getEn_title()); + menuDto.setZh_title(entity.getZh_title()); menuDto.setMenu_sort(entity.getMenu_sort()); menuDto.setPath(entity.getPath()); menuDto.setComponent(entity.getComponent()); diff --git a/acs/nladmin-ui/package.json b/acs/nladmin-ui/package.json index 0fe34f1..64b745b 100644 --- a/acs/nladmin-ui/package.json +++ b/acs/nladmin-ui/package.json @@ -62,6 +62,7 @@ "path-to-regexp": "2.4.0", "qrcodejs2": "0.0.2", "qs": "^6.9.1", + "save": "^2.9.0", "screenfull": "4.2.0", "sortablejs": "1.8.4", "throttle-debounce": "^5.0.0", @@ -73,6 +74,7 @@ "vue-easy-print": "0.0.8", "vue-echarts": "^5.0.0-beta.0", "vue-highlightjs": "^1.3.3", + "vue-i18n": "^8.27.0", "vue-image-crop-upload": "^2.5.0", "vue-print-nb": "^1.7.5", "vue-router": "3.0.2", diff --git a/acs/nladmin-ui/src/components/Breadcrumb/index.vue b/acs/nladmin-ui/src/components/Breadcrumb/index.vue index 204ea59..a5d29ce 100644 --- a/acs/nladmin-ui/src/components/Breadcrumb/index.vue +++ b/acs/nladmin-ui/src/components/Breadcrumb/index.vue @@ -2,8 +2,8 @@ - {{ item.meta.title }} - {{ item.meta.title }} + {{ $t(item.meta.title) }} + {{ $t(item.meta.title) }} @@ -37,7 +37,7 @@ export default { const first = matched[0] if (!this.isDashboard(first)) { - matched = [{ path: '/dashboard', meta: { title: '首页' }}].concat(matched) + matched = [{ path: '/dashboard', meta: { title: this.$t('common.home') }}].concat(matched) } this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) diff --git a/acs/nladmin-ui/src/components/Crud/CRUD.operation.vue b/acs/nladmin-ui/src/components/Crud/CRUD.operation.vue index 4c5cc02..0f029f5 100644 --- a/acs/nladmin-ui/src/components/Crud/CRUD.operation.vue +++ b/acs/nladmin-ui/src/components/Crud/CRUD.operation.vue @@ -12,7 +12,7 @@ icon="el-icon-plus" @click="crud.toAdd" > - 新增 + {{ $t('common.Create') }} - 修改 + {{ $t('common.Update') }} - 删除 + {{ $t('common.Delete') }} 导出 + >{{ $t('common.Export') }} @@ -86,7 +86,7 @@ :indeterminate="allColumnsSelectedIndeterminate" @change="handleCheckAllChange" > - 全选 + {{ $t('common.SelectAll') }} { this.crud.delAllLoading = true diff --git a/acs/nladmin-ui/src/components/Crud/RR.operation.vue b/acs/nladmin-ui/src/components/Crud/RR.operation.vue index 6bcfcbb..6a94f65 100644 --- a/acs/nladmin-ui/src/components/Crud/RR.operation.vue +++ b/acs/nladmin-ui/src/components/Crud/RR.operation.vue @@ -5,9 +5,9 @@ 重置 --> - 查询 + {{ $t('common.Query') }} - 重置 + {{ $t('common.Reset') }} diff --git a/acs/nladmin-ui/src/components/Crud/UD.operation.vue b/acs/nladmin-ui/src/components/Crud/UD.operation.vue index 686247d..7bd742e 100644 --- a/acs/nladmin-ui/src/components/Crud/UD.operation.vue +++ b/acs/nladmin-ui/src/components/Crud/UD.operation.vue @@ -1,13 +1,13 @@ @@ -79,10 +89,12 @@ export default { data() { return { Avatar: Avatar, - dialogVisible: false + dialogVisible: false, + language: '简体中文' } }, created() { + this.setLang(localStorage.getItem('lang')) this.initWebSocket() }, computed: { @@ -110,13 +122,29 @@ export default { } }, methods: { + // 中英文切换 + langChange(command) { + this.$i18n.locale = command + localStorage.setItem('lang', command) + this.setLang(command) + location.reload() + }, + setLang(command) { + if (command === 'en') { + this.language = 'English' + } else if (command === 'zh') { + this.language = '简体中文' + } else if (command === 'in') { + this.language = 'Indonesian' + } + }, toggleSideBar() { this.$store.dispatch('app/toggleSideBar') }, open() { - this.$confirm('确定注销并退出系统吗?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + this.$confirm(this.$t('common.Tip13'), this.$t('common.Tips'), { + confirmButtonText: this.$t('common.Confirm'), + cancelButtonText: this.$t('common.Cancel'), type: 'warning' }).then(() => { this.logout() @@ -128,6 +156,7 @@ export default { }) }, initWebSocket() { + // const wsUri = (process.env.VUE_APP_WS_API === '/' ? '/' : (process.env.VUE_APP_WS_API + '/')) + 'messageInfo' const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + 'messageInfo' this.websock = new WebSocket(wsUri) this.websock.onerror = this.webSocketOnError @@ -135,7 +164,7 @@ export default { }, webSocketOnError(e) { this.$notify({ - title: 'WebSocket连接发生错误', + title: this.$t('common.Tip14'), type: 'error', duration: 0 }) diff --git a/acs/nladmin-ui/src/layout/components/Settings/index.vue b/acs/nladmin-ui/src/layout/components/Settings/index.vue index 5c23081..9adea38 100644 --- a/acs/nladmin-ui/src/layout/components/Settings/index.vue +++ b/acs/nladmin-ui/src/layout/components/Settings/index.vue @@ -3,7 +3,7 @@
-

主题风格设置

+

{{ $t('common.Theme_style_setting') }}

@@ -51,44 +51,44 @@
- 主题颜色 + {{ $t('common.Theme_color') }}
-

系统布局配置

+

{{ $t('common.System_layout_configuration') }}

- 开启 TopNav + {{ $t('common.Open') }} TopNav
- 开启 Tags-Views + {{ $t('common.Open') }} Tags-Views
- 固定 Header + {{ $t('common.Fixation') }} Header
- 显示 Logo + {{ $t('common.Display') }} Logo
- 动态标题 + {{ $t('common.Dynamic_titles') }}
- 保存配置 - 重置配置 + {{ $t('common.Save_settings') }} + {{ $t('common.Reset_settings') }}
diff --git a/acs/nladmin-ui/src/layout/components/Sidebar/SidebarItem.vue b/acs/nladmin-ui/src/layout/components/Sidebar/SidebarItem.vue index 2d49dd8..11c7985 100644 --- a/acs/nladmin-ui/src/layout/components/Sidebar/SidebarItem.vue +++ b/acs/nladmin-ui/src/layout/components/Sidebar/SidebarItem.vue @@ -3,14 +3,14 @@ - {{ tag.title }} + {{ $t(tag.title) }}
    -
  • 刷新
  • -
  • 关闭
  • -
  • 关闭左侧
  • -
  • 关闭右侧
  • -
  • 关闭其他
  • -
  • 关闭全部
  • +
  • {{ $t('common.Refresh') }}
  • +
  • {{ $t('common.Closes') }}
  • +
  • {{ $t('common.Closes_l') }}
  • +
  • {{ $t('common.Closes_r') }}
  • +
  • {{ $t('common.Closes_o') }}
  • +
  • {{ $t('common.Closes_a') }}
diff --git a/acs/nladmin-ui/src/main.js b/acs/nladmin-ui/src/main.js index 8a80f47..e4e0e81 100644 --- a/acs/nladmin-ui/src/main.js +++ b/acs/nladmin-ui/src/main.js @@ -47,6 +47,8 @@ import { addDateRange, handleTree, parseTime, resetForm, selectDictLabel, select import { getValueByCode } from '@/views/system/param/param' import VueBus from 'vue-bus' +// 引入i18 +import i18n from './i18n' LogicFlow.use(Menu) @@ -77,11 +79,18 @@ Vue.use(Element, { size: 'mini' // set element-ui default size }) +Vue.prototype.$langPre = { + computedProp(suffix) { + return localStorage.getItem('lang') + '_' + suffix + } +} + Vue.config.productionTip = false new Vue({ el: '#app', router, store, + i18n, render: h => h(App) }) diff --git a/acs/nladmin-ui/src/router/index.js b/acs/nladmin-ui/src/router/index.js index b3968c2..2f9ad73 100644 --- a/acs/nladmin-ui/src/router/index.js +++ b/acs/nladmin-ui/src/router/index.js @@ -5,6 +5,7 @@ import 'nprogress/nprogress.css' // progress bar style import { getToken } from '@/utils/auth' // getToken from cookie import { buildMenus } from '@/api/system/menu' import { filterAsyncRouter } from '@/store/modules/permission' +import i18n from '@/i18n' NProgress.configure({ showSpinner: false })// NProgress Configuration @@ -13,7 +14,7 @@ const whiteList = ['/login', '/expand']// no redirect whitelist router.beforeEach((to, from, next) => { if (to.meta.title) { // document.title = to.meta.title + ' - ' + Config.title - document.title = to.meta.title + document.title = i18n.t(to.meta.title) } NProgress.start() if (getToken()) { diff --git a/acs/nladmin-ui/src/router/routers.js b/acs/nladmin-ui/src/router/routers.js index 7b43945..2f52d66 100644 --- a/acs/nladmin-ui/src/router/routers.js +++ b/acs/nladmin-ui/src/router/routers.js @@ -1,6 +1,7 @@ import Vue from 'vue' import Router from 'vue-router' import Layout from '../layout/index' +import i18n from '@/i18n' Vue.use(Router) @@ -46,7 +47,7 @@ export const constantRouterMap = [ path: 'dashboard', component: (resolve) => require(['@/views/monitor/server/index'], resolve), name: 'Dashboard', - meta: { title: '首页', icon: 'index', affix: true, noCache: true } + meta: { title: i18n.t('common.home'), icon: 'index', affix: true, noCache: true } } ] }, @@ -65,8 +66,8 @@ export const constantRouterMap = [ { path: 'center', component: (resolve) => require(['@/views/system/user/center'], resolve), - name: '个人中心', - meta: { title: '个人中心' } + name: i18n.t('common.Personal_center'), + meta: { title: i18n.t('common.Personal_center') } } ] } diff --git a/acs/nladmin-ui/src/utils/request.js b/acs/nladmin-ui/src/utils/request.js index 4136273..7589044 100644 --- a/acs/nladmin-ui/src/utils/request.js +++ b/acs/nladmin-ui/src/utils/request.js @@ -18,10 +18,12 @@ const service = axios.create({ // request拦截器 service.interceptors.request.use( config => { + const lang = localStorage.getItem('lang') if (getToken()) { config.headers['Authorization'] = getToken() ? 'Bearer ' + getToken() : undefined // 让每个请求携带自定义token 请根据实际情况自行修改 } config.headers['Content-Type'] = 'application/json' + config.headers['Accept-Language'] = lang return config }, error => { diff --git a/acs/nladmin-ui/src/views/login.vue b/acs/nladmin-ui/src/views/login.vue index 8450ae9..7d3cbbc 100644 --- a/acs/nladmin-ui/src/views/login.vue +++ b/acs/nladmin-ui/src/views/login.vue @@ -4,30 +4,46 @@

{{ title }}

- + - + - + - - 记住我 - + + + + {{ $t('common.login_rm') }} + + + + + + {{ language }} + + + 简体中文 + English + Indonesian + + + + - 登 录 - 登 录 中... + {{ $t('common.login') }} + {{ $t('common.login_ing') }} @@ -50,6 +66,7 @@ export default { name: 'Login', data() { return { + language: '简体中文', title: '诺力开发平台', title_param: 'platform', Background: Background, @@ -80,6 +97,7 @@ export default { } }, created() { + this.setLang(localStorage.getItem('lang')) this.getValueByCode(this.title_param).then(res => { this.title = res.value }) @@ -91,6 +109,22 @@ export default { this.point() }, methods: { + // 中英文切换 + langChange(command) { + this.$i18n.locale = command + localStorage.setItem('lang', command) + this.setLang(command) + location.reload() + }, + setLang(command) { + if (command === 'en') { + this.language = 'English' + } else if (command === 'zh') { + this.language = '简体中文' + } else if (command === 'in') { + this.language = 'Indonesian' + } + }, getCode() { getCodeImg().then(res => { this.codeUrl = res.img @@ -135,7 +169,7 @@ export default { this.$store.dispatch('Login', user).then(() => { this.loading = false window.location.href = this.redirect - // if (this.redirect === 'http://localhost:8014/dashboard'){ + // if (this.redirect === 'http://localhost:8013/dashboard'){ // window.location.href = this.redirect // } // this.$router.push({ path: this.redirect || '/' }) @@ -167,47 +201,47 @@ export default { diff --git a/acs/nladmin-ui/src/views/monitor/server/index.vue b/acs/nladmin-ui/src/views/monitor/server/index.vue index 920861e..13f1bd3 100644 --- a/acs/nladmin-ui/src/views/monitor/server/index.vue +++ b/acs/nladmin-ui/src/views/monitor/server/index.vue @@ -1,28 +1,28 @@ @@ -222,6 +243,9 @@ import Dict from '../../../components/Dict/Dict' const defaultForm = { menu_id: null, title: null, + en_title: null, + in_title: null, + zh_title: null, menu_sort: 999, path: null, system_type: null, @@ -233,15 +257,15 @@ const defaultForm = { pid: 0, icon: null, cache: false, - hidden: true, - type: 0, + hidden: false, + type: 2, permission: null } export default { name: 'Menu', components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation, DateRangePicker }, cruds() { - return CRUD({ title: '菜单', idField: 'menu_id', url: 'api/sysMenu', crudMethod: { ...crudMenu }, sort: 'menu_sort,asc'}) + return CRUD({ title: '菜单', idField: 'menu_id', url: 'api/sysMenu', crudMethod: { ...crudMenu }}) }, mixins: [presenter(), header(), form(defaultForm), crud()], dicts: ['system_type'], @@ -259,6 +283,15 @@ export default { title: [ { required: true, message: '请输入标题', trigger: 'blur' } ], + zh_title: [ + { required: true, message: '请输入标题', trigger: 'blur' } + ], + en_title: [ + { required: true, message: '请输入标题', trigger: 'blur' } + ], + in_title: [ + { required: true, message: '请输入标题', trigger: 'blur' } + ], path: [ { required: true, message: '请输入地址', trigger: 'blur' } ] diff --git a/acs/nladmin-ui/src/views/system/param/index.vue b/acs/nladmin-ui/src/views/system/param/index.vue index 38ac7e7..b9a234b 100644 --- a/acs/nladmin-ui/src/views/system/param/index.vue +++ b/acs/nladmin-ui/src/views/system/param/index.vue @@ -13,22 +13,22 @@ width="500px" > - + - + - + - + @@ -42,11 +42,11 @@ > - - - - - + + + + +