diff --git a/cmdb-ui/src/App.vue b/cmdb-ui/src/App.vue index 21a0c08..2ee1de5 100644 --- a/cmdb-ui/src/App.vue +++ b/cmdb-ui/src/App.vue @@ -1,5 +1,5 @@ - - + + + + + diff --git a/cmdb-ui/src/components/CMDBFilterComp/index.vue b/cmdb-ui/src/components/CMDBFilterComp/index.vue index 05f171f..acd28a9 100644 --- a/cmdb-ui/src/components/CMDBFilterComp/index.vue +++ b/cmdb-ui/src/components/CMDBFilterComp/index.vue @@ -1,290 +1,296 @@ - - - - - - - + + + + + + + diff --git a/cmdb-ui/src/components/CustomIconSelect/constants.js b/cmdb-ui/src/components/CustomIconSelect/constants.js index 587436f..cb49c52 100644 --- a/cmdb-ui/src/components/CustomIconSelect/constants.js +++ b/cmdb-ui/src/components/CustomIconSelect/constants.js @@ -1,8 +1,10 @@ -export const iconTypeList = [ +import i18n from '@/lang' + +export const iconTypeList = () => [ // { value: '0', label: '常用' }, - { value: '1', label: '线性' }, - { value: '2', label: '实底' }, - { value: '3', label: '多色' } + { value: '1', label: i18n.t('customIconSelect.outlined') }, + { value: '2', label: i18n.t('customIconSelect.filled') }, + { value: '3', label: i18n.t('customIconSelect.multicolor') } ] export const commonIconList = ['changyong-ubuntu', diff --git a/cmdb-ui/src/components/CustomIconSelect/index.vue b/cmdb-ui/src/components/CustomIconSelect/index.vue index dceaa8f..b056614 100644 --- a/cmdb-ui/src/components/CustomIconSelect/index.vue +++ b/cmdb-ui/src/components/CustomIconSelect/index.vue @@ -16,7 +16,7 @@ {{ item.label }}
- 自定义 + {{ this.$t('customIconSelect.custom') }}
- 添加 + {{ $t('add') }}
@@ -55,11 +55,11 @@ @click="clickCustomIcon(icon)" >
- + - +
- 取消 - 确定 + {{ $t('cancel') }} + {{ $t('confirm') }}
-
+
+ diff --git a/cmdb-ui/src/core/use.js b/cmdb-ui/src/core/use.js index e91306e..283889a 100644 --- a/cmdb-ui/src/core/use.js +++ b/cmdb-ui/src/core/use.js @@ -38,11 +38,18 @@ import CardTitle from '@/components/CardTitle' import ElementUI from 'element-ui' import Treeselect from '@riophae/vue-treeselect' import OpsTable from '@/components/OpsTable' +import VueI18n from 'vue-i18n' +import i18n from '@/lang' Vue.config.productionTip = false Vue.prototype.$bus = EventBus + +VXETable.setup({ + i18n: (key, args) => i18n.t(key, args) +}) Vue.use(VXETable) VXETable.use(VXETablePluginExportXLSX) +Vue.use(VueI18n) Vue.config.productionTip = false @@ -75,4 +82,3 @@ Vue.component('CustomRadio', CustomRadio) Vue.component('CardTitle', CardTitle) Vue.component('Treeselect', Treeselect) Vue.component('OpsTable', OpsTable) - diff --git a/cmdb-ui/src/guard.js b/cmdb-ui/src/guard.js index 4627b92..5a70c30 100644 --- a/cmdb-ui/src/guard.js +++ b/cmdb-ui/src/guard.js @@ -7,6 +7,7 @@ import NProgress from 'nprogress' import 'nprogress/nprogress.css' import { setDocumentTitle, domTitle } from '@/utils/domUtil' import { ACCESS_TOKEN } from './store/global/mutation-types' +import i18n from '@/lang' NProgress.configure({ showSpinner: false }) @@ -17,7 +18,7 @@ const whitePath = ['/user/login', '/user/logout', '/user/register', '/api/sso/lo // 登录页面处理处理 是否使用单点登录 router.beforeEach(async (to, from, next) => { NProgress.start() // start progress bar - to.meta && (!!to.meta.title && setDocumentTitle(`${to.meta.title} - ${domTitle}`)) + to.meta && (!!to.meta.title && setDocumentTitle(`${i18n.t(to.meta.title)} - ${domTitle}`)) const authed = store.state.authed const auth_type = localStorage.getItem('ops_auth_type') diff --git a/cmdb-ui/src/lang/en.js b/cmdb-ui/src/lang/en.js new file mode 100644 index 0000000..41a9dc7 --- /dev/null +++ b/cmdb-ui/src/lang/en.js @@ -0,0 +1,140 @@ +import cmdb_en from '@/modules/cmdb/lang/en.js' +import cs_en from '../views/setting/lang/en.js' +import acl_en from '@/modules/acl/lang/en.js' + +export default { + screen: 'Big Screen', + dashboard: 'Dashboard', + admin: 'Admin', + user: 'User', + role: 'Role', + operation: 'Operation', + login: 'Login', + refresh: 'Refresh', + cancel: 'Cancel', + confirm: 'Confirm', + create: 'Create', + edit: 'Edit', + deleting: 'Deleting', + deletingTip: 'Deleting, total of {total}, {successNum} succeeded, {errorNum} failed', + grant: 'Grant', + login_at: 'Login At', + logout_at: 'Logout At', + createSuccess: 'Create Success', + editSuccess: 'edit Success', + warning: 'Warning', + export: 'Export', + placeholderSearch: 'Please Search', + success: 'Success', + fail: 'Fail', + browser: 'Browser', + status: 'Status', + type: 'Type', + description: 'Description', + new: 'New', + add: 'Add', + define: 'Define', + update: 'Update', + clear: 'Clear', + delete: 'Delete', + copy: 'Copy', + created_at: 'Created At', + updated_at: 'Updated At', + placeholder1: 'Please Input', + placeholder2: 'Please Select', + confirmDelete: 'Confirm delete?', + confirmDelete2: 'Confirm delete [{name}]?', + query: 'Query', + search: 'Search', + hide: 'Hide', + expand: 'Expand', + save: 'Save', + submit: 'Submit', + upload: 'Import', + download: 'Export', + name: 'Name', + alias: 'Alias', + desc: 'Description', + other: 'Other', + icon: 'Icon', + addSuccess: 'Added successfully', + uploadSuccess: 'Import successfully', + saveSuccess: 'Save successfully', + copySuccess: 'Copy successfully', + updateSuccess: 'Updated successfully', + deleteSuccess: 'Deleted successfully', + operateSuccess: 'The operation was successful', + noPermission: 'No Permission', + noData: 'No Data', + seconds: 'Seconds', + createdAt: 'Created At', + updatedAt: 'Updated At', + deletedAt: 'Deleted At', + required: 'required', + email: 'Email', + wechat: 'Wechat', + dingding: 'DingTalk', + feishu: 'Feishu', + bot: 'Robot', + checkAll: 'Select All', + loading: 'Loading...', + view: 'View', + reset: 'Reset', + yes: 'Yes', + no: 'No', + all: 'All', + selectRows: 'Selected: {rows} items', + itemsPerPage: '/page', + '星期一': 'Monday', + '星期二': 'Tuesday', + '星期三': 'Wednesday', + '星期四': 'Thursday', + '星期五': 'Friday', + '星期六': 'Saturday', + '星期日': 'Sunday', + hour: 'hour', + 'items/page': '{items} items/page', + max: 'Max', + min: 'Min', + visual: 'Visual', + pagination: { + total: '{range0}-{range1} of {total} items' + }, + topMenu: { + personalCenter: 'Personal Center', + logout: 'logout', + }, + cmdbFilterComp: { + conditionFilter: 'Conditional filtering', + and: 'and', + or: 'or', + is: 'equal', + '~is': 'not equal', + contain: 'contain', + '~contain': 'not contain', + start_with: 'start_with', + '~start_with': 'not start_with', + end_with: 'end_with', + '~end_with': 'not end_with', + '~value': 'null', + value: 'not null', + in: 'in', + '~in': 'not in', + range: 'range', + '~range': 'out of range', + compare: 'compare', + addHere: 'Add Here', + split: 'split by {separator}' + }, + customIconSelect: { + outlined: 'Outlined', + filled: 'Filled', + multicolor: 'Multicolor', + custom: 'Custom', + preview: 'Preview', + sizeLimit: 'The image size cannot exceed 2MB!' + }, + cmdb: cmdb_en, + cs: cs_en, + acl: acl_en, +} diff --git a/cmdb-ui/src/lang/index.js b/cmdb-ui/src/lang/index.js new file mode 100644 index 0000000..d8ece0e --- /dev/null +++ b/cmdb-ui/src/lang/index.js @@ -0,0 +1,18 @@ +import VueI18n from 'vue-i18n' +import zh from './zh' +import en from './en' +import Vue from 'vue' +import zhCN from 'vxe-table/lib/locale/lang/zh-CN' +import enUS from 'vxe-table/lib/locale/lang/en-US' + +Vue.use(VueI18n) +const i18n = new VueI18n({ + locale: 'zh', // 初始化中文 + messages: { + 'zh': { ...zh, ...zhCN }, + 'en': { ...en, ...enUS }, + }, + silentTranslationWarn: true +}) + +export default i18n diff --git a/cmdb-ui/src/lang/zh.js b/cmdb-ui/src/lang/zh.js new file mode 100644 index 0000000..a474d03 --- /dev/null +++ b/cmdb-ui/src/lang/zh.js @@ -0,0 +1,140 @@ +import cmdb_zh from '@/modules/cmdb/lang/zh.js' +import cs_zh from '../views/setting/lang/zh.js' +import acl_zh from '@/modules/acl/lang/zh.js' + +export default { + screen: '大屏', + dashboard: '仪表盘', + admin: '管理员', + user: '用户', + role: '角色', + operation: '操作', + login: '登录', + refresh: '刷新', + cancel: '取消', + confirm: '确定', + create: '创建', + edit: '编辑', + deleting: '正在删除', + deletingTip: '正在删除,共{total}个,成功{successNum}个,失败{errorNum}个', + grant: '授权', + login_at: '登录时间', + logout_at: '登出时间', + createSuccess: '创建成功', + editSuccess: '修改成功', + warning: '警告', + export: '导出', + placeholderSearch: '请查找', + success: '成功', + fail: '失败', + browser: '浏览器', + status: '状态', + type: '类型', + description: '描述', + new: '新增', + add: '添加', + define: '定义', + update: '修改', + clear: '清空', + delete: '删除', + copy: '复制', + created_at: '创建日期', + updated_at: '更新日期', + placeholder1: '请输入', + placeholder2: '请选择', + confirmDelete: '确认删除?', + confirmDelete2: '确认删除【{name}】?', + query: '查询', + search: '搜索', + hide: '隐藏', + expand: '展开', + save: '保存', + submit: '提交', + upload: '导入', + download: '导出', + name: '名称', + alias: '别名', + desc: '描述', + other: '其他', + icon: '图标', + addSuccess: '新增成功', + uploadSuccess: '导入成功', + saveSuccess: '保存成功', + copySuccess: '复制成功', + updateSuccess: '更新成功', + deleteSuccess: '删除成功', + operateSuccess: '操作成功', + noPermission: '权限不足', + noData: '暂无数据', + seconds: '秒', + createdAt: '创建时间', + updatedAt: '更新时间', + deletedAt: '删除时间', + required: '必须', + email: '邮件', + wechat: '企业微信', + dingding: '钉钉', + feishu: '飞书', + bot: '机器人', + checkAll: '全选', + loading: '加载中...', + view: '查看', + reset: '重置', + yes: '是', + no: '否', + all: '全部', + selectRows: '选取:{rows} 项', + itemsPerPage: '/页', + '星期一': '星期一', + '星期二': '星期二', + '星期三': '星期三', + '星期四': '星期四', + '星期五': '星期五', + '星期六': '星期六', + '星期日': '星期日', + hour: '小时', + 'items/page': '{items} 条/页', + max: '最大值', + min: '最小值', + visual: '虚拟', + pagination: { + total: '当前展示 {range0}-{range1} 条数据, 共 {total} 条' + }, + topMenu: { + personalCenter: '个人中心', + logout: '退出登录', + }, + cmdbFilterComp: { + conditionFilter: '条件过滤', + and: '与', + or: '或', + is: '等于', + '~is': '不等于', + contain: '包含', + '~contain': '不包含', + start_with: '以...开始', + '~start_with': '不以...开始', + end_with: '以...结束', + '~end_with': '不以...结束', + '~value': '为空', + value: '不为空', + in: 'in查询', + '~in': '非in查询', + range: '范围', + '~range': '范围外', + compare: '比较', + addHere: '在此处添加', + split: '以 {separator} 分隔' + }, + customIconSelect: { + outlined: '线框', + filled: '实底', + multicolor: '多色', + custom: '自定义', + preview: '预览', + sizeLimit: '图片大小不可超过2MB!' + }, + cmdb: cmdb_zh, + cs: cs_zh, + acl: acl_zh, +} diff --git a/cmdb-ui/src/main.js b/cmdb-ui/src/main.js index 0413916..aa7bc8a 100644 --- a/cmdb-ui/src/main.js +++ b/cmdb-ui/src/main.js @@ -10,6 +10,7 @@ import './guard' // guard permission control import './utils/filter' // global filter import Setting from './config/setting' import { Icon } from 'ant-design-vue' +import i18n from './lang' import iconFont from '../public/iconfont/iconfont' @@ -22,6 +23,7 @@ async function start() { const _vue = new Vue({ router, store, + i18n, created: bootstrap, render: h => h(App) }).$mount('#app') diff --git a/cmdb-ui/src/modules/acl/lang/en.js b/cmdb-ui/src/modules/acl/lang/en.js new file mode 100644 index 0000000..ddde5a8 --- /dev/null +++ b/cmdb-ui/src/modules/acl/lang/en.js @@ -0,0 +1,125 @@ +const acl_en = { + date: 'Date', + operator: 'Operator', + resource: 'Resource', + resourceType: 'Resource Type', + addResourceType: 'Add Resource Type', + app: 'App', + operateTime: 'Operate Time', + permission: 'Permission', + permission_placeholder: 'please select permission', + permissionList: 'Permission List', + summaryPermissions: 'Summary of permissions', + source: 'Source', + username: 'Username', + username_placeholder: 'please input username', + userList: 'User List', + groupUser: 'Group User', + addUser: 'Add User', + subordinateUsers: 'Subordinate Users', + nickname: 'Nickname', + nickname_placeholder: 'please input nickname', + password: 'Password', + password_placeholder: 'please input password', + department: 'Department', + group: 'Group', + email: 'Email', + email_placeholder: 'please input email', + mobile: 'Mobile', + isBlock: 'Is Block', + block: 'Block', + joined_at: 'Joined At', + role: 'Role', + role_placeholder1: 'please input role', + role_placeholder2: 'please select role', + role_placeholder3: 'please select a role name, multiple choices are allowed', + allRole: 'All Roles', + visualRole: 'Virtual Role', + addVisualRole: 'Add Virtual Role', + inheritedFrom: 'Inherited from', + heir: 'Inherit Roles', + permissionChange: 'Permissions', + roleChange: 'Roles', + resourceChange: 'Resources', + resourceTypeChange: 'Resource Type', + trigger: 'Triggers', + triggerNameInput: 'Please enter trigger name', + triggerChange: 'Triggers', + roleManage: 'Roles', + userManage: 'Users', + appManage: 'Applications', + resourceManage: 'Resources', + history: 'Audits', + userSecret: 'Secrets', + none: 'none', + danger: 'Dangerous', + confirmDeleteApp: 'Are you sure you want to delete this app?', + revoke: 'Revoke', + convenient: 'Quick Grant', + group2: 'Group', + groupName: 'Group Name', + resourceName: 'Resource Name', + creator: 'Creator', + member: 'Members', + viewAuth: 'view Auth', + addTypeTips: 'There is no type information yet, please add the resource type first!', + addResource: 'Add Resource', + resourceList: 'Resource List', + confirmResetSecret: 'Are you sure you want to reset the user secrets?', + addTrigger: 'Add Trigger', + deleteTrigger: 'Delete Trigger', + applyTrigger: 'Apply Trigger', + cancelTrigger: 'Cancel Trigger', + enable: 'Enable', + disable: 'Disable', + viewMatchResult: 'View regular matching results', + confirmDeleteTrigger: 'Are you sure you want to delete this trigger?', + ruleApply: 'Apply', + triggerTip1: 'Are you sure you want to apply this trigger?', + triggerTip2: 'Cancel applying this trigger?', + appNameInput: 'Please enter an application name', + descInput: 'Please enter a description', + addApp: 'Add', + updateApp: 'Update', + cancel: 'Cancel', + typeName: 'Name', + typeNameInput: 'Please enter a type name', + resourceNameInput: 'Please enter resource name', + pressEnter: 'Press Enter to confirm filtering', + groupMember: 'Group Members:', + isGroup: 'Group?', + errorTips: 'Error message', + roleList: 'Role List', + virtual: 'Virtual', + resourceBatchTips: 'Please enter the resource name, separated by newlines', + memberManage: 'Members: ', + newResource: 'New Resource: ', + deleteResource: 'Delete Resource: ', + deleteResourceType: 'Delete Resource Type: ', + noChange: 'No change', + batchOperate: 'Batch Operations', + batchGrant: 'Batch Grant', + batchRevoke: 'Batch Revoke', + editPerm: 'Add authorization: ', + permInput: 'Please enter permission name', + resourceTypeName: 'Resource Type Name', + selectedParents: 'Optionally inherit roles', + isAppAdmin: 'is app admin', + addRole: 'Add Role', + roleRelation: 'Role Relation', + roleRelationAdd: 'Add Role Relation', + roleRelationDelete: 'Delete Role Relation', + role2: 'Role', + admin: 'Admin', + involvingRP: 'Involving resources and permissions', + startAt: 'Start Time', + endAt: 'End Time', + triggerTips1: 'Priority regular pattern (secondary wildcard)', + pleaseSelectType: 'Please select resource type', + apply: 'Apply', + mobileTips: 'Please enter the correct phone number', + remove: 'Remove', + deleteUserConfirm: 'Are you sure you want to remove this user?', + copyResource: 'Copy resource name' +} +export default acl_en diff --git a/cmdb-ui/src/modules/acl/lang/zh.js b/cmdb-ui/src/modules/acl/lang/zh.js new file mode 100644 index 0000000..626911f --- /dev/null +++ b/cmdb-ui/src/modules/acl/lang/zh.js @@ -0,0 +1,125 @@ +const acl_zh = { + date: '日期', + operator: '操作员', + resource: '资源', + resourceType: '资源类型', + addResourceType: '新增资源类型', + app: '应用', + operateTime: '操作时间', + permission: '权限', + permission_placeholder: '请选择权限', + permissionList: '权限列表', + summaryPermissions: '权限汇总', + source: '来源', + username: '用户名', + username_placeholder: '请输入用户名', + userList: '用户列表', + groupUser: '组用户', + addUser: '新增用户', + subordinateUsers: '下属用户', + nickname: '中文名', + nickname_placeholder: '请输入中文名', + password: '密码', + password_placeholder: '请输入密码', + department: '部门', + group: '小组', + email: '邮箱', + email_placeholder: '请输入邮箱', + mobile: '手机号', + isBlock: '是否锁定', + block: '锁定', + joined_at: '加入时间', + role: '角色名', + role_placeholder1: '请输入角色名', + role_placeholder2: '请选择角色名称', + role_placeholder3: '请选择角色名称,可多选', + allRole: '所有角色', + visualRole: '虚拟角色', + addVisualRole: '新增虚拟角色', + inheritedFrom: '继承自', + heir: '继承者', + permissionChange: '权限变更', + roleChange: '角色变更', + resourceChange: '资源变更', + resourceTypeChange: '资源类型变更', + trigger: '触发器', + triggerNameInput: '请输入触发器名', + triggerChange: '触发器变更', + roleManage: '角色管理', + userManage: '用户管理', + appManage: '应用管理', + resourceManage: '资源管理', + history: '操作审计', + userSecret: '用户密钥', + none: '无', + danger: '危险操作', + confirmDeleteApp: '确定要删除该App吗?', + revoke: '权限回收', + convenient: '便捷授权', + group2: '组', + groupName: '资源组名', + resourceName: '资源名', + creator: '创建者', + member: '成员', + viewAuth: '查看授权', + addTypeTips: '暂无类型信息,请先添加资源类型!', + addResource: '新增资源', + resourceList: '资源列表', + confirmResetSecret: '确定重置用户密钥?', + addTrigger: '新增触发器', + deleteTrigger: '删除触发器', + applyTrigger: '应用触发器', + cancelTrigger: '取消触发器', + enable: '启用', + disable: '禁用', + viewMatchResult: '查看正则匹配结果', + confirmDeleteTrigger: '确认删除该触发器吗?', + ruleApply: '规则应用', + triggerTip1: '是否确定应用该触发器?', + triggerTip2: '是否取消应用该触发器?', + appNameInput: '请输入应用名称', + descInput: '请输入描述', + addApp: '创建应用', + updateApp: '更新应用', + cancel: '撤销', + typeName: '类型名', + typeNameInput: '请输入类型名', + resourceNameInput: '请输入资源名', + pressEnter: '按回车确认筛选', + groupMember: '组成员:', + isGroup: '是否组', + errorTips: '错误提示', + roleList: '角色列表', + virtual: '虚拟', + resourceBatchTips: '请输入资源名,换行分隔', + memberManage: '成员管理:', + newResource: '新建资源:', + deleteResource: '删除资源:', + deleteResourceType: '删除资源类型:', + noChange: '没有修改', + batchOperate: '批量操作', + batchGrant: '批量授权', + batchRevoke: '批量权限回收', + editPerm: '添加授权:', + permInput: '请输入权限名', + resourceTypeName: '资源类型名', + selectedParents: '可选择继承角色', + isAppAdmin: '是否应用管理员', + addRole: '新增角色', + roleRelation: '角色关系', + roleRelationAdd: '添加角色关系', + roleRelationDelete: '删除角色关系', + role2: '角色', + admin: '管理员', + involvingRP: '涉及资源及权限', + startAt: '开始时间', + endAt: '结束时间', + triggerTips1: '优先正则模式(次通配符)', + pleaseSelectType: '请选择资源类型', + apply: '应用', + mobileTips: '请输入正确的手机号码', + remove: '移除', + deleteUserConfirm: '是否确定要移除该用户', + copyResource: '复制资源名' +} +export default acl_zh diff --git a/cmdb-ui/src/modules/acl/router/index.js b/cmdb-ui/src/modules/acl/router/index.js index c047a16..7e125ce 100644 --- a/cmdb-ui/src/modules/acl/router/index.js +++ b/cmdb-ui/src/modules/acl/router/index.js @@ -12,35 +12,35 @@ const genAppRoute = ({ name }) => { name: `${name}_roles_acl`, hideChildrenInMenu: true, component: () => import('../views/roles'), - meta: { title: '角色管理', icon: 'team', keepAlive: true } + meta: { title: 'acl.roleManage', icon: 'team', keepAlive: true } }, { path: `/acl/${name}/resources`, name: `${name}_resources_acl`, hideChildrenInMenu: true, component: () => import('../views/resources'), - meta: { title: '资源管理', icon: 'credit-card', keepAlive: false } + meta: { title: 'acl.resourceManage', icon: 'credit-card', keepAlive: false } }, { path: `/acl/${name}/resource_types`, name: `${name}_resource_types_acl`, hideChildrenInMenu: true, component: () => import('../views/resource_types'), - meta: { title: '资源类型', icon: 'file-text', keepAlive: true } + meta: { title: 'acl.resourceType', icon: 'file-text', keepAlive: true } }, { path: `/acl/${name}/trigger`, name: `${name}_trigger_acl`, hideChildrenInMenu: true, component: () => import('../views/trigger'), - meta: { title: '触发器', icon: 'clock-circle', keepAlive: true } + meta: { title: 'acl.trigger', icon: 'clock-circle', keepAlive: true } }, { path: `/acl/${name}/history`, name: `${name}_history_acl`, hideChildrenInMenu: true, component: () => import('../views/history'), - meta: { title: '操作审计', icon: 'search', keepAlive: false } + meta: { title: 'acl.history', icon: 'search', keepAlive: false } } ] } @@ -59,31 +59,31 @@ const genAclRoutes = async () => { path: `/acl/secret_key`, name: 'acl_secret_key', component: () => import('../views/secretKey'), - meta: { title: '用户密钥', icon: 'key' } + meta: { title: 'acl.userSecret', icon: 'key' } }, { path: `/acl/operate_history`, name: 'acl_operate_history', component: () => import('../views/operation_history/index.vue'), - meta: { title: '操作审计', icon: 'search', permission: ['acl_admin'] }, + meta: { title: 'acl.history', icon: 'search', permission: ['acl_admin'] } }, { path: `/acl/user`, name: 'acl_user', component: () => import('../views/users'), - meta: { title: '用户管理', icon: 'user', permission: ['acl_admin'] } + meta: { title: 'acl.userManage', icon: 'user', permission: ['acl_admin'] } }, { path: `/acl/roles`, name: `acl_roles`, component: () => import('../views/roles'), - meta: { title: '角色管理', icon: 'team', keepAlive: true, permission: ['acl_admin'] } + meta: { title: 'acl.roleManage', icon: 'team', keepAlive: true, permission: ['acl_admin'] } }, { path: `/acl/apps`, name: 'acl_apps', component: () => import('../views/apps'), - meta: { title: '应用管理', icon: 'appstore', permission: ['acl_admin'] } + meta: { title: 'acl.appManage', icon: 'appstore', permission: ['acl_admin'] } } ] } diff --git a/cmdb-ui/src/modules/acl/views/apps.vue b/cmdb-ui/src/modules/acl/views/apps.vue index b6f7b34..ff7cf89 100644 --- a/cmdb-ui/src/modules/acl/views/apps.vue +++ b/cmdb-ui/src/modules/acl/views/apps.vue @@ -11,7 +11,7 @@ :xs="24"> -
{{ app.description || '无' }}
+
{{ app.description || $t('none') }}
{{ app.name[0].toUpperCase() }}
- + - @@ -122,33 +77,6 @@ export default { resourceTypes: [], resourceTypePerms: [], resources: [], - // tableColumns: [ - // { - // title: '资源名', - // dataIndex: 'name', - // sorter: false, - // width: 150, - // // scopedSlots: { - // // customRender: 'nameSearchRender', - // // filterDropdown: 'filterDropdown', - // // filterIcon: 'filterIcon' - // // }, - // // onFilter: (value, record) => record.name && record.name.toLowerCase().includes(value.toLowerCase()), - // // onFilterDropdownVisibleChange: (visible) => { - // // if (visible) { - // // setTimeout(() => { - // // this.searchInput.focus() - // // }, 0) - // // } - // // } - // }, - // { - // title: '权限列表', - // dataIndex: 'permissions', - // width: 300, - // scopedSlots: { customRender: 'permissions' }, - // }, - // ], columnSearchText: { name: '', }, @@ -156,14 +84,14 @@ export default { }, computed: { ...mapState({ - windowHeight: state => state.windowHeight, + windowHeight: (state) => state.windowHeight, }), displayApps() { const roles = this.$store.state.user.roles.permissions if (roles.includes('acl_admin')) { return this.apps } - return this.apps.filter(item => { + return this.apps.filter((item) => { if (roles.includes(`${item.name}_admin`)) { return true } @@ -192,7 +120,7 @@ export default { }, async loadRoles(_appId) { const res = await searchRole({ app_id: _appId, page_size: 9999, is_all: true }) - this.roles = res.roles.filter(item => item.uid) + this.roles = res.roles.filter((item) => item.uid) }, async handleSwitchApp(appId) { this.currentAppId = appId @@ -218,7 +146,7 @@ export default { }, async loadResource() { this.spinning = true - const fil = this.roles.filter(role => role.uid === this.user.uid) + const fil = this.roles.filter((role) => role.uid === this.user.uid) if (!fil[0]) { return } diff --git a/cmdb-ui/src/modules/acl/views/module/permissionForm.vue b/cmdb-ui/src/modules/acl/views/module/permissionForm.vue index 59eb25a..8768117 100644 --- a/cmdb-ui/src/modules/acl/views/module/permissionForm.vue +++ b/cmdb-ui/src/modules/acl/views/module/permissionForm.vue @@ -1,29 +1,33 @@ @@ -95,10 +95,8 @@ export default { } return (this.windowHeight - 104) / 2 - 116 }, - }, - data() { - return { - permMap, + permMap() { + return permMap() } }, methods: { @@ -131,8 +129,8 @@ export default { } else { const that = this this.$confirm({ - title: '警告', - content: `确认删除 【${row.name}】 的 【授权】 权限?`, + title: that.$t('warning'), + content: that.$t('cmdb.components.confirmRevoke', { name: `${row.name}` }), onOk() { that.handleChange({ target: { checked: false } }, col, row) const _idx = that.tableData.findIndex((item) => item.rid === row.rid) diff --git a/cmdb-ui/src/modules/cmdb/components/cmdbGrant/constants.js b/cmdb-ui/src/modules/cmdb/components/cmdbGrant/constants.js index 709501c..631e5da 100644 --- a/cmdb-ui/src/modules/cmdb/components/cmdbGrant/constants.js +++ b/cmdb-ui/src/modules/cmdb/components/cmdbGrant/constants.js @@ -1,11 +1,15 @@ -export const permMap = { - read: '查看', - add: '新增', - create: '新增', - update: '修改', - delete: '删除', - config: '配置', - grant: '授权', - 'read_attr': '查看字段', - 'read_ci': '查看实例' +import i18n from '@/lang' + +export const permMap = () => { + return { + read: i18n.t('view'), + add: i18n.t('new'), + create: i18n.t('new'), + update: i18n.t('update'), + delete: i18n.t('delete'), + config: i18n.t('cmdb.components.config'), + grant: i18n.t('grant'), + 'read_attr': i18n.t('cmdb.components.readAttribute'), + 'read_ci': i18n.t('cmdb.components.readCI') + } } diff --git a/cmdb-ui/src/modules/cmdb/components/cmdbGrant/grantComp.vue b/cmdb-ui/src/modules/cmdb/components/cmdbGrant/grantComp.vue index 3634695..e9f2756 100644 --- a/cmdb-ui/src/modules/cmdb/components/cmdbGrant/grantComp.vue +++ b/cmdb-ui/src/modules/cmdb/components/cmdbGrant/grantComp.vue @@ -1,7 +1,7 @@ @@ -51,7 +51,6 @@ export default { }, data() { return { - permMap, columns: ['create', 'grant', 'delete'], } }, @@ -65,6 +64,9 @@ export default { } return (this.windowHeight - 104) / 2 - 116 }, + permMap() { + return permMap() + } }, methods: { getCurrentRowStyle, diff --git a/cmdb-ui/src/modules/cmdb/components/colorPicker/index.vue b/cmdb-ui/src/modules/cmdb/components/colorPicker/index.vue index 4ac895a..18d1afc 100644 --- a/cmdb-ui/src/modules/cmdb/components/colorPicker/index.vue +++ b/cmdb-ui/src/modules/cmdb/components/colorPicker/index.vue @@ -132,7 +132,7 @@ export default { } else if (color.indexOf('rgb') !== -1) { hsvObj = this.rgbToHSV(color) } else { - throw new Error('初始化颜色格式错误,使用#fff或rgb格式') + throw new Error(this.$t('cmdb.components.colorPickerError')) // this.$message.error('颜色格式错误,使用16进制格式') } if (hsvObj) { diff --git a/cmdb-ui/src/modules/cmdb/components/httpSnmpAD/index.vue b/cmdb-ui/src/modules/cmdb/components/httpSnmpAD/index.vue index b10ea7c..a369162 100644 --- a/cmdb-ui/src/modules/cmdb/components/httpSnmpAD/index.vue +++ b/cmdb-ui/src/modules/cmdb/components/httpSnmpAD/index.vue @@ -15,19 +15,19 @@ :edit-config="isEdit ? { trigger: 'click', mode: 'cell' } : {}" >
@@ -61,12 +61,6 @@ - - - - + + + + + + + diff --git a/cmdb-ui/src/modules/cmdb/components/preferenceSearch/preferenceSearch.vue b/cmdb-ui/src/modules/cmdb/components/preferenceSearch/preferenceSearch.vue index 18d525e..b1f439e 100644 --- a/cmdb-ui/src/modules/cmdb/components/preferenceSearch/preferenceSearch.vue +++ b/cmdb-ui/src/modules/cmdb/components/preferenceSearch/preferenceSearch.vue @@ -11,7 +11,7 @@ @blur="handleInputConfirm" @keyup.enter="handleInputConfirm" /> - 保存筛选条件 + {{ $t('cmdb.components.saveQuery') }} - 虚拟年假 + {{ $t('cs.companyStructure.virtualAnnualLeave') }} - 育儿假 + {{ $t('cs.companyStructure.parentingLeave') }} - 目前主体入职日期 + {{ $t('cs.companyStructure.entryDate') }} - 正式/实习生 + {{ $t('cs.companyStructure.isInternship') }} - 身份证号码 + {{ $t('cs.companyStructure.idCard') }} - 民族 + {{ $t('cs.companyStructure.idPlace') }} - 籍贯 + {{ $t('cs.companyStructure.idPlace') }} - 组织关系 + {{ $t('cs.companyStructure.party') }} - 户籍类型 + {{ $t('cs.companyStructure.hometown') }} - 户口所在地 + {{ $t('cs.companyStructure.hometown') }} - 婚姻情况 + {{ $t('cs.companyStructure.marry') }} - 最高学历 + {{ $t('cs.companyStructure.maxDegree') }} - 紧急联系人 + {{ $t('cs.companyStructure.emergencyPerson') }} - 紧急联系电话 + {{ $t('cs.companyStructure.emergencyPhone') }} - 卡号 + {{ $t('cs.companyStructure.bankCardNumber') }} - 银行 + {{ $t('cs.companyStructure.bankCardName') }} - 开户行 + {{ $t('cs.companyStructure.openingBank') }} - 开户地 + {{ $t('cs.companyStructure.accountOpeningLocation') }} - 学校 + {{ $t('cs.companyStructure.school') }} - 专业 + {{ $t('cs.companyStructure.major') }} - 学历 + {{ $t('cs.companyStructure.education') }} - 毕业年份 + {{ $t('cs.companyStructure.graduationYear') }} - 子女姓名 + {{ $t('cs.companyStructure.childrenName') }} - 子女性别 + {{ $t('cs.companyStructure.sex') }} - 子女出生日期 + {{ $t('cs.companyStructure.birthDate') }} - 剩余育儿假 + {{ $t('cs.companyStructure.leftParentingLeave') }} + + + + + + + + + + + + + + + + + - 上次登录时间 + {{ $t('cs.companyStructure.lastLogin') }} @@ -728,10 +818,10 @@ key="control" >