瀏覽代碼

* 数字化施工平台国际化问题

chen.cheng 4 月之前
父節點
當前提交
eda5a88710

+ 5 - 2
src/components/Breadcrumb/index.vue

@@ -2,15 +2,18 @@
   <el-breadcrumb class="app-breadcrumb" separator="/">
     <transition-group name="breadcrumb">
       <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
-        <span v-if="item.redirect === 'noRedirect' || index == levelList.length - 1" class="no-redirect">{{ item.meta.title }}</span>
-        <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
+        <span v-if="item.redirect === 'noRedirect' || index == levelList.length - 1" class="no-redirect">{{ getMenuName(item.meta)}}</span>
+        <a v-else @click.prevent="handleLink(item)">{{ getMenuName(item.meta)}}</a>
       </el-breadcrumb-item>
     </transition-group>
   </el-breadcrumb>
 </template>
 
 <script>
+import MetaI18n from "@/layout/components/MetaI18n";
+
 export default {
+  mixins: [MetaI18n],
   data() {
     return {
       levelList: null

+ 4 - 2
src/components/TopNav/index.vue

@@ -9,7 +9,7 @@
         <svg-icon
         v-if="item.meta && item.meta.icon && item.meta.icon !== '#'"
         :icon-class="item.meta.icon"/>
-        {{ item.meta.title }}
+        {{ getMenuName(item.meta)}}
       </el-menu-item>
     </template>
 
@@ -24,7 +24,7 @@
           <svg-icon
             v-if="item.meta && item.meta.icon && item.meta.icon !== '#'"
             :icon-class="item.meta.icon"/>
-          {{ item.meta.title }}
+          {{ getMenuName(item.meta)}}
         </el-menu-item>
       </template>
     </el-submenu>
@@ -33,11 +33,13 @@
 
 <script>
 import { constantRoutes } from "@/router";
+import MetaI18n from "@/layout/components/MetaI18n";
 
 // 隐藏侧边栏路由
 const hideList = ['/index', '/user/profile'];
 
 export default {
+  mixins: [MetaI18n],
   data() {
     return {
       // 顶部栏初始数

+ 52 - 2
src/i18n/en.js

@@ -22,8 +22,58 @@ export default {
     outTime: "Your login status has expired. You can continue to stay on this page or log in again."
   },
   menus: {
-    "首页": "Home",
-    "用户管理": "User manage"
+    "index": "Home",
+    "1": "System Management",
+    "2": "System Monitoring",
+    "3": "System Tools",
+    "100": "User Management",
+    "101": "Role Management",
+    "102": "Menu Management",
+    "103": "Department Management",
+    "104": "Position Management",
+    "105": "Dictionary Management",
+    "106": "Parameter Settings",
+    "107": "Notification",
+    "108": "Log Management",
+    "109": "Online Users",
+    "110": "Scheduled Tasks",
+    "111": "Data Monitoring",
+    "112": "Service Monitoring",
+    "113": "Cache Monitoring",
+    "114": "Cache List",
+    "115": "Form Builder",
+    "116": "Code Generation",
+    "117": "System Interface",
+    "500": "Operation Log",
+    "501": "Login Log",
+    "1061": "Test Menu",
+    "1092": "OA Leave Application",
+    "1106": "Process Management",
+    "1107": "Process Definition",
+    "1118": "Pending Tasks",
+    "1122": "Completed Tasks",
+    "2006": "CC Tasks",
+    "2007": "Inspection Items",
+    "2013": "Patrol Management",
+    "2014": "Inspection Tasks",
+    "2020": "Inspection Trajectory",
+    "2026": "Attendance Management",
+    "2027": "Attendance Group",
+    "2033": "Attendance Group Members",
+    "2045": "User Clock-in Records",
+    "2051": "Security Monitoring",
+    "2052": "Fence Management",
+    "2059": "Trajectory Query",
+    "2065": "Event Monitoring",
+    "2066": "Campus Overview",
+    "2070": "Construction Layout",
+    "2071": "Command Dispatch",
+    "2077": "Construction Pile Machine Info",
+    "2083": "Construction Pile Point Info",
+    "2089": "Project Information",
+    "2095": "Project Coordinate Settings",
+    "2101": "Construction Unit",
+    "2102": "Construction Dashboard"
   },
   error: {
     401: "Authentication failed, unable to access system resources",

+ 52 - 2
src/i18n/zh.js

@@ -39,8 +39,58 @@ export default {
     outTime: "登录状态已过期,您可以继续留在该页面,或者重新登录。"
   },
   menus: {
-    "首页": "home page",
-    "用户管理": "user manage"
+    "index": "首页",
+    "1": "系统管理",
+    "2": "系统监控",
+    "3": "系统工具",
+    "100": "用户管理",
+    "101": "角色管理",
+    "102": "菜单管理",
+    "103": "部门管理",
+    "104": "岗位管理",
+    "105": "字典管理",
+    "106": "参数设置",
+    "107": "通知公告",
+    "108": "日志管理",
+    "109": "在线用户",
+    "110": "定时任务",
+    "111": "数据监控",
+    "112": "服务监控",
+    "113": "缓存监控",
+    "114": "缓存列表",
+    "115": "表单构建",
+    "116": "代码生成",
+    "117": "系统接口",
+    "500": "操作日志",
+    "501": "登录日志",
+    "1061": "测试菜单",
+    "1092": "OA 请假申请",
+    "1106": "流程管理",
+    "1107": "流程定义",
+    "1118": "待办任务",
+    "1122": "已办任务",
+    "2006": "抄送任务",
+    "2007": "巡检项",
+    "2013": "巡防管理",
+    "2014": "巡检任务",
+    "2020": "巡检轨迹",
+    "2026": "人员考勤",
+    "2027": "考勤组",
+    "2033": "考勤组人员",
+    "2045": "用户打卡信息",
+    "2051": "安防监测",
+    "2052": "围栏管理",
+    "2059": "轨迹查询",
+    "2065": "事件监测",
+    "2066": "园区总览",
+    "2070": "施工放样",
+    "2071": "指令下发",
+    "2077": "施工桩机信息",
+    "2083": "施工桩点信息",
+    "2089": "工程信息",
+    "2095": "工程坐标配置",
+    "2101": "施工单元",
+    "2102": "施工大屏",
   },
   error: {
     401: "认证失败,无法访问系统资源",

+ 7 - 0
src/layout/components/MetaI18n.js

@@ -0,0 +1,7 @@
+export default {
+  methods: {
+    getMenuName(meta) {
+      return meta.id ? this.$t(`menus.${meta.id}`) : meta.title
+    },
+  }
+}

+ 10 - 8
src/layout/components/Sidebar/SidebarItem.vue

@@ -1,16 +1,17 @@
 <template>
   <div v-if="!item.hidden">
-    <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
+    <template
+      v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
       <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path, onlyOneChild.query)">
         <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
-          <item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
+          <item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="getMenuName(onlyOneChild.meta)"/>
         </el-menu-item>
       </app-link>
     </template>
 
     <el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
       <template slot="title">
-        <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
+        <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="getMenuName(item.meta)"/>
       </template>
       <sidebar-item
         v-for="(child, index) in item.children"
@@ -26,15 +27,16 @@
 
 <script>
 import path from 'path'
-import { isExternal } from '@/utils/validate'
+import {isExternal} from '@/utils/validate'
 import Item from './Item'
 import AppLink from './Link'
 import FixiOSBug from './FixiOSBug'
+import MetaI18n from "@/layout/components/MetaI18n";
 
 export default {
   name: 'SidebarItem',
-  components: { Item, AppLink },
-  mixins: [FixiOSBug],
+  components: {Item, AppLink},
+  mixins: [FixiOSBug, MetaI18n],
   props: {
     // route object
     item: {
@@ -76,7 +78,7 @@ export default {
 
       // Show parent if there are no child router to display
       if (showingChildren.length === 0) {
-        this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
+        this.onlyOneChild = {...parent, path: '', noShowingChildren: true}
         return true
       }
 
@@ -91,7 +93,7 @@ export default {
       }
       if (routeQuery) {
         let query = JSON.parse(routeQuery);
-        return { path: path.resolve(this.basePath, routePath), query: query }
+        return {path: path.resolve(this.basePath, routePath), query: query}
       }
       return path.resolve(this.basePath, routePath)
     }

+ 24 - 10
src/layout/components/TagsView/index.vue

@@ -13,13 +13,14 @@
         @click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''"
         @contextmenu.prevent.native="openMenu(tag,$event)"
       >
-        {{ tag.title }}
-        <span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
+        {{ getMenuName(tag.meta) }}
+        <span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)"/>
       </router-link>
     </scroll-pane>
     <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
       <li @click="refreshSelectedTag(selectedTag)"><i class="el-icon-refresh-right"></i> 刷新页面</li>
-      <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"><i class="el-icon-close"></i> 关闭当前</li>
+      <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"><i class="el-icon-close"></i> 关闭当前
+      </li>
       <li @click="closeOthersTags"><i class="el-icon-circle-close"></i> 关闭其他</li>
       <li v-if="!isFirstView()" @click="closeLeftTags"><i class="el-icon-back"></i> 关闭左侧</li>
       <li v-if="!isLastView()" @click="closeRightTags"><i class="el-icon-right"></i> 关闭右侧</li>
@@ -31,9 +32,11 @@
 <script>
 import ScrollPane from './ScrollPane'
 import path from 'path'
+import MetaI18n from "@/layout/components/MetaI18n";
 
 export default {
-  components: { ScrollPane },
+  components: {ScrollPane},
+  mixins: [MetaI18n],
   data() {
     return {
       visible: false,
@@ -108,7 +111,7 @@ export default {
             fullPath: tagPath,
             path: tagPath,
             name: route.name,
-            meta: { ...route.meta }
+            meta: {...route.meta}
           })
         }
         if (route.children) {
@@ -130,7 +133,7 @@ export default {
       }
     },
     addTags() {
-      const { name } = this.$route
+      const {name} = this.$route
       if (name) {
         this.$store.dispatch('tagsView/addView', this.$route)
         if (this.$route.meta.link) {
@@ -161,7 +164,7 @@ export default {
       }
     },
     closeSelectedTag(view) {
-      this.$tab.closePage(view).then(({ visitedViews }) => {
+      this.$tab.closePage(view).then(({visitedViews}) => {
         if (this.isActive(view)) {
           this.toLastView(visitedViews, view)
         }
@@ -182,13 +185,14 @@ export default {
       })
     },
     closeOthersTags() {
-      this.$router.push(this.selectedTag.fullPath).catch(()=>{});
+      this.$router.push(this.selectedTag.fullPath).catch(() => {
+      });
       this.$tab.closeOtherPage(this.selectedTag).then(() => {
         this.moveToCurrentTag()
       })
     },
     closeAllTags(view) {
-      this.$tab.closeAllPage().then(({ visitedViews }) => {
+      this.$tab.closeAllPage().then(({visitedViews}) => {
         if (this.affixTags.some(tag => tag.path === this.$route.path)) {
           return
         }
@@ -204,7 +208,7 @@ export default {
         // you can adjust it according to your needs.
         if (view.name === 'Dashboard') {
           // to reload home page
-          this.$router.replace({ path: '/redirect' + view.fullPath })
+          this.$router.replace({path: '/redirect' + view.fullPath})
         } else {
           this.$router.push('/')
         }
@@ -244,6 +248,7 @@ export default {
   background: #fff;
   border-bottom: 1px solid #d8dce5;
   box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
+
   .tags-view-wrapper {
     .tags-view-item {
       display: inline-block;
@@ -258,16 +263,20 @@ export default {
       font-size: 12px;
       margin-left: 5px;
       margin-top: 4px;
+
       &:first-of-type {
         margin-left: 15px;
       }
+
       &:last-of-type {
         margin-right: 15px;
       }
+
       &.active {
         background-color: #42b983;
         color: #fff;
         border-color: #42b983;
+
         &::before {
           content: '';
           background: #fff;
@@ -281,6 +290,7 @@ export default {
       }
     }
   }
+
   .contextmenu {
     margin: 0;
     background: #fff;
@@ -293,10 +303,12 @@ export default {
     font-weight: 400;
     color: #333;
     box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
+
     li {
       margin: 0;
       padding: 7px 16px;
       cursor: pointer;
+
       &:hover {
         background: #eee;
       }
@@ -317,11 +329,13 @@ export default {
       text-align: center;
       transition: all .3s cubic-bezier(.645, .045, .355, 1);
       transform-origin: 100% 50%;
+
       &:before {
         transform: scale(.6);
         display: inline-block;
         vertical-align: -3px;
       }
+
       &:hover {
         background-color: #b4bccc;
         color: #fff;

+ 2 - 1
src/router/index.js

@@ -79,7 +79,7 @@ export const constantRoutes = [
         path: 'index',
         component: () => import('@/views/index'),
         name: 'Index',
-        meta: {title: '首页', icon: 'dashboard', affix: true}
+        meta: {title: '首页', icon: 'dashboard', affix: true, id: "index"}
       }
     ]
   },
@@ -102,6 +102,7 @@ export const constantRoutes = [
 // 动态路由,基于用户权限动态去加载
 export const dynamicRoutes = [
   {
+    id: 'system',
     path: '/system/user-auth',
     component: Layout,
     hidden: true,