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/router/config.js b/cmdb-ui/src/router/config.js index 4800af4..01d9861 100644 --- a/cmdb-ui/src/router/config.js +++ b/cmdb-ui/src/router/config.js @@ -34,6 +34,7 @@ export const generatorDynamicRouter = async () => { name: 'notice_center', component: BasicLayout, children: [{ + hidden: true, path: '/noticecenter', name: 'notice_center', meta: { title: '消息中心' }, @@ -50,53 +51,53 @@ export const generatorDynamicRouter = async () => { hidden: true, path: '/setting/person', name: 'setting_person', - meta: { title: '个人中心', }, + meta: { title: 'cs.menu.person', }, component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/person/index') }, { path: '/setting/companyinfo', name: 'company_info', - meta: { title: '公司信息', appName: 'backend', icon: 'ops-setting-companyInfo', selectedIcon: 'ops-setting-companyInfo-selected', permission: ['acl_admin', 'backend_admin'] }, + meta: { title: 'cs.menu.companyInfo', appName: 'backend', icon: 'ops-setting-companyInfo', selectedIcon: 'ops-setting-companyInfo-selected', permission: ['公司信息', 'backend_admin'] }, component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/companyInfo/index') }, { path: '/setting/companystructure', name: 'company_structure', - meta: { title: '公司架构', appName: 'backend', icon: 'ops-setting-companyStructure', selectedIcon: 'ops-setting-companyStructure-selected', permission: ['acl_admin', 'backend_admin'] }, + meta: { title: 'cs.menu.companyStructure', appName: 'backend', icon: 'ops-setting-companyStructure', selectedIcon: 'ops-setting-companyStructure-selected', permission: ['公司架构', 'backend_admin'] }, component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/companyStructure/index') }, { path: '/setting/notice', name: 'notice', component: RouteView, - meta: { title: '通知设置', appName: 'backend', icon: 'ops-setting-notice', selectedIcon: 'ops-setting-notice-selected', permission: ['通知设置', 'backend_admin'] }, + meta: { title: 'cs.menu.notice', appName: 'backend', icon: 'ops-setting-notice', selectedIcon: 'ops-setting-notice-selected', permission: ['通知设置', 'backend_admin'] }, redirect: '/setting/notice/email', children: [{ path: '/setting/notice/email', name: 'notice_email', - meta: { title: '邮件设置', icon: 'ops-setting-notice-email', selectedIcon: 'ops-setting-notice-email-selected' }, + meta: { title: 'cs.menu.email', icon: 'ops-setting-notice-email', selectedIcon: 'ops-setting-notice-email-selected' }, component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/notice/email/index') }, { path: '/setting/notice/wx', name: 'notice_wx', - meta: { title: '企业微信', icon: 'ops-setting-notice-wx', selectedIcon: 'ops-setting-notice-wx-selected' }, + meta: { title: 'cs.menu.wx', icon: 'ops-setting-notice-wx', selectedIcon: 'ops-setting-notice-wx-selected' }, component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/notice/wx') }, { path: '/setting/notice/dingding', name: 'notice_dingding', - meta: { title: '钉钉', icon: 'ops-setting-notice-dingding', selectedIcon: 'ops-setting-notice-dingding-selected' }, + meta: { title: 'cs.menu.dingding', icon: 'ops-setting-notice-dingding', selectedIcon: 'ops-setting-notice-dingding-selected' }, component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/notice/dingding') }, { path: '/setting/notice/feishu', name: 'notice_feishu', - meta: { title: '飞书', icon: 'ops-setting-notice-feishu', selectedIcon: 'ops-setting-notice-feishu-selected' }, + meta: { title: 'cs.menu.feishu', icon: 'ops-setting-notice-feishu', selectedIcon: 'ops-setting-notice-feishu-selected' }, component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/notice/feishu') }] }, { path: '/setting/auth', name: 'company_auth', - meta: { title: '认证设置', appName: 'backend', icon: 'ops-setting-auth', selectedIcon: 'ops-setting-auth-selected', permission: ['acl_admin'] }, + meta: { title: 'cs.menu.auth', appName: 'backend', icon: 'ops-setting-auth', selectedIcon: 'ops-setting-auth-selected', permission: ['acl_admin'] }, component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/auth/index') }, ] diff --git a/cmdb-ui/src/store/index.js b/cmdb-ui/src/store/index.js index a2e37cd..47c3e32 100644 --- a/cmdb-ui/src/store/index.js +++ b/cmdb-ui/src/store/index.js @@ -24,6 +24,7 @@ const store = new Vuex.Store({ windowWidth: 800, windowHeight: 600, currentTime: 0, + locale: 'zh' }, mutations: { SET_WINDOW_SIZE(state, { width, height }) { @@ -33,6 +34,10 @@ const store = new Vuex.Store({ SET_TIME: (state, time) => { state.currentTime = time }, + SET_LOCALE: (state, locale) => { + state.locale = locale + localStorage.setItem('ops_locale', locale) + } }, actions: { setWindowSize({ commit }) { diff --git a/cmdb-ui/src/views/setting/auth/cas.vue b/cmdb-ui/src/views/setting/auth/cas.vue index 5e9bb09..1aa8012 100644 --- a/cmdb-ui/src/views/setting/auth/cas.vue +++ b/cmdb-ui/src/views/setting/auth/cas.vue @@ -1,7 +1,7 @@ @@ -75,7 +75,7 @@ export default { const validatePass = (rule, value, callback) => { console.log(this.batchForm) if (this.batchForm.value === '') { - callback(new Error('请输入密码')) + callback(new Error(this.$t('cs.companyStructure.password_placeholder'))) } else { this.$refs.batchForm.validateField('repeatPassword') callback() @@ -84,9 +84,9 @@ export default { const validatePass2 = (rule, value, callback) => { console.log(this.batchForm) if (this.batchForm.confirmValue === '') { - callback(new Error('请输入密码')) + callback(new Error(this.$t('cs.companyStructure.passwordPlaceholder'))) } else if (this.batchForm.confirmValue !== this.batchForm.value) { - callback(new Error('两次密码不一致')) + callback(new Error(this.$t('cs.person.thePasswordEnteredTwiceIsInconsistent'))) } else { callback() } @@ -115,19 +115,19 @@ export default { this.visible = true this.batchProps = batchProps const { type, selectedRowKeys, state } = batchProps - this.title = '批量编辑' + this.title = this.$t('cs.companyStructure.batchEdit') if (type === 'department_id') { this.batchForm.value = null } else if (type === 'direct_supervisor_id') { this.batchForm.value = undefined } else if (type === 'password') { if (selectedRowKeys.length <= 1) { - this.title = '重置密码' + this.title = this.$t('cs.companyStructure.resetPassword') } } else if (type === 'block') { this.batchForm.value = state if (selectedRowKeys.length <= 1) { - this.title = state ? '禁用' : '恢复' + this.title = state ? this.$t('cs.companyStructure.block') : this.$t('cs.companyStructure.recover') } } }, @@ -163,7 +163,7 @@ export default { }) if (res.length) { this.$notification.error({ - message: '操作失败', + message: this.$t('cs.companyStructure.opFailed'), description: res .map((item) => `${getDirectorName(this.allFlatEmployees, item.employee_id)}:${item.err}`) .join('\n'), @@ -175,7 +175,7 @@ export default { }, }) } else { - this.$message.success('操作成功') + this.$message.success(this.$t('cs.companyStructure.opSuccess')) } if (this.batchProps.type === 'department_id') { Bus.$emit('clickSelectGroup', 1) diff --git a/cmdb-ui/src/views/setting/companyStructure/BatchUpload.vue b/cmdb-ui/src/views/setting/companyStructure/BatchUpload.vue index 7582e22..ccff2c4 100644 --- a/cmdb-ui/src/views/setting/companyStructure/BatchUpload.vue +++ b/cmdb-ui/src/views/setting/companyStructure/BatchUpload.vue @@ -1,7 +1,7 @@
导入总数据{{ allCount }}条, 导入成功 {{ allCount - errorCount }} 条, - 导入失败{{ errorCount }}条 + {{ $t('cs.companyStructure.importSuccess', {allCount: allCount}) }}{{ allCount - errorCount }} + {{ $t('cs.companyStructure.count')}}, + {{ $t('cs.companyStructure.importError') }}{{ errorCount }}{{ $t('cs.companyStructure.count')}}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 取消 - 上一步 - 下一步 - 完成 + {{ $t('cancel') }} + {{ $t('cs.companyStructure.prevStep') }} + {{ $t('cs.companyStructure.nextStep') }} + {{ $t('cs.companyStructure.done') }} @@ -98,17 +107,17 @@ export default { const stepList = [ { value: 1, - label: '上传文件', + label: this.$t('cs.companyStructure.uploadFile'), icon: 'icon-shidi-tianjia', }, { value: 2, - label: '确认数据', + label: this.$t('cs.companyStructure.confirmData'), icon: 'icon-shidi-yunshangchuan', }, { value: 3, - label: '上传完成', + label: this.$t('cs.companyStructure.uploadDone'), icon: 'icon-shidi-queren', }, ] @@ -235,10 +244,10 @@ export default { this.errorCount = errData.length this.currentStep += 1 this.importData = errData - this.$message.error('数据存在错误') + this.$message.error(this.$t('cs.companyStructure.dataErr')) } else { this.currentStep += 1 - this.$message.success('操作成功') + this.$message.success(this.$t('cs.companyStructure.opSuccess')) } this.$emit('refresh') } diff --git a/cmdb-ui/src/views/setting/companyStructure/DepartmentModal.vue b/cmdb-ui/src/views/setting/companyStructure/DepartmentModal.vue index 70fd058..83a2463 100644 --- a/cmdb-ui/src/views/setting/companyStructure/DepartmentModal.vue +++ b/cmdb-ui/src/views/setting/companyStructure/DepartmentModal.vue @@ -3,7 +3,7 @@ destroyOnClose width="500px" v-model="visible" - :title="type === 'add' ? '创建子部门' : '编辑部门'" + :title="type === 'add' ? $t('cs.companyStructure.createSubDepartment') : $t('cs.companyStructure.editDepartment')" layout="inline" @cancel="close" > @@ -14,10 +14,10 @@ :label-col="labelCol" :wrapper-col="wrapperCol" > - - + + - + - + @@ -67,10 +67,6 @@ export default { department_parent_id: '', department_director_id: undefined, }, - rules: { - department_name: [{ required: true, message: '请输入部门名称' }], - department_parent_id: [{ required: true, message: '请选择上级部门' }], - }, currentDepartmentParentList: [], selectDepartment: {}, type: 'add', @@ -81,6 +77,12 @@ export default { allFlatEmployees() { return this.provide_allFlatEmployees() }, + rules () { + return { + department_name: [{ required: true, message: this.$t('cs.companyStructure.departmentLabelPlaceholder') }], + department_parent_id: [{ required: true, message: this.$t('cs.companyStructure.parentDepartmentPlaceholder') }], + } + } }, mounted() {}, methods: { @@ -129,7 +131,7 @@ export default { } else if (this.type === 'add') { await postDepartment(params) } - this.$message.success('操作成功') + this.$message.success(this.$t('cs.companyStructure.opSuccess')) this.$emit('refresh') Bus.$emit('updateAllIncludeDepartment') this.close() diff --git a/cmdb-ui/src/views/setting/companyStructure/EmployeeModal.vue b/cmdb-ui/src/views/setting/companyStructure/EmployeeModal.vue index b25fc0b..822d29f 100644 --- a/cmdb-ui/src/views/setting/companyStructure/EmployeeModal.vue +++ b/cmdb-ui/src/views/setting/companyStructure/EmployeeModal.vue @@ -10,349 +10,225 @@ :body-style="{ height: `${windowHeight - 320}px`, overflow: 'hidden', overflowY: 'scroll' }" > - - + + - - + + - + - - + + - - - - + + + {{ $t('cs.companyStructure.male') }} + {{ $t('cs.companyStructure.female') }} - - + + -
-
部门
+
+
{{ $t('cs.companyStructure.departmentName') }}
- - + + -
-
上级
+
+
{{ $t('cs.companyStructure.selectDirectSupervisor') }}
- + + - + - + - - + + - - - 正式 - 实习生 + + + + + + + + + {{ $t('cs.companyStructure.fullTime') }} + {{ $t('cs.companyStructure.internship') }} - - + + - - + + - - + + - - + + - - - 党员 - 团员 - 群众 + + + {{ $t('cs.companyStructure.partyMember') }} + {{ $t('cs.companyStructure.member') }} + {{ $t('cs.companyStructure.masses') }} - - - 城镇 - 农业 + + + {{ $t('cs.companyStructure.town') }} + {{ $t('cs.companyStructure.agriculture') }} - - + + - - - 未婚 - 已婚 + + + {{ $t('cs.companyStructure.unmarried') }} + {{ $t('cs.companyStructure.married') }} - - - 博士 - 硕士 - 本科 - 专科 - 高中 + + + {{ $t('cs.companyStructure.phd') }} + {{ $t('cs.companyStructure.master') }} + {{ $t('cs.companyStructure.undergraduate') }} + {{ $t('cs.companyStructure.specialist') }} + {{ $t('cs.companyStructure.highSchool') }} - - + + - - + + - - + + + + + + + + + + + + + + + + + - + - + - - 小学 - 初中 - 中专/高中 - 专科 - 本科 - 硕士 - 博士 + + {{ $t('cs.companyStructure.primarySchool') }} + {{ $t('cs.companyStructure.juniorHighSchool') }} + {{ $t('cs.companyStructure.technicalSecondaryOrHighSchool') }} + {{ $t('cs.companyStructure.specialist') }} + {{ $t('cs.companyStructure.undergraduate') }} + {{ $t('cs.companyStructure.master') }} + {{ $t('cs.companyStructure.phd') }} - + - + - + - + - + - + - - - + + {{ $t('cs.companyStructure.male') }} + {{ $t('cs.companyStructure.female') }} - + - + - + - - - + + + - - + + - - + + - - + + @@ -425,38 +301,11 @@ export default { visible: false, employeeFormData: {}, formModalItemStyle: { display: 'inline-block', width: '48%', margin: '0 7px 24px', overflow: 'hidden' }, - rules: { - email: [ - { required: true, whitespace: true, message: '请输入邮箱', trigger: 'blur' }, - { - pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/, - message: '邮箱格式错误', - trigger: 'blur', - }, - { max: 50, message: '字符数须小于50' }, - ], - username: [ - { required: true, whitespace: true, message: '请输入用户名', trigger: 'blur' }, - { max: 20, message: '字符数须小于20' }, - ], - password: [{ required: true, whitespace: true, message: '请输入密码', trigger: 'blur' }], - nickname: [ - { required: true, whitespace: true, message: '请输入姓名', trigger: 'blur' }, - { max: 20, message: '字符数须小于20' }, - ], - mobile: [ - { - pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, - message: '请输入正确的手机号', - trigger: 'blur', - }, - ], - }, type: 'add', educational_experience: [], children_information: [], file_is_show: true, - attributes: [], + attributes: [] } }, created() { @@ -466,7 +315,7 @@ export default { }, inject: ['provide_allTreeDepartment', 'provide_allFlatEmployees'], computed: { - ...mapState({ + ...mapState({ windowHeight: (state) => state.windowHeight, }), departemntTreeSelectOption() { @@ -477,10 +326,39 @@ export default { }, title() { if (this.type === 'add') { - return '新建员工' + return this.$t('cs.companyStructure.createEmployee') } - return '编辑员工' + return this.$t('cs.companyStructure.editEmployee') }, + rules() { + return { + email: [ + { required: true, whitespace: true, message: this.$t('cs.companyStructure.emailPlaceholder'), trigger: 'blur' }, + { + pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/, + message: this.$t('cs.companyStructure.emailFormatErr'), + trigger: 'blur', + }, + { max: 50, message: this.$t('cs.person.inputStrCountLimit', { limit: 50 }) }, + ], + username: [ + { required: true, whitespace: true, message: '请输入用户名', trigger: 'blur' }, + { max: 20, message: this.$t('cs.person.inputStrCountLimit', { limit: 20 }) }, + ], + password: [{ required: true, whitespace: true, message: '请输入密码', trigger: 'blur' }], + nickname: [ + { required: true, whitespace: true, message: '请输入姓名', trigger: 'blur' }, + { max: 20, message: this.$t('cs.person.inputStrCountLimit', { limit: 20 }) }, + ], + mobile: [ + { + pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, + message: this.$t('cs.companyStructure.mobileFormatErr'), + trigger: 'blur', + }, + ], + } + } }, beforeDestroy() { Bus.$off('getAttributes') @@ -488,8 +366,7 @@ export default { methods: { async open(getData, type) { // 提交时去掉school, major, education, graduation_year, name, gender, birthday, parental_leave_left - const { school, major, education, graduation_year, name, gender, birthday, parental_leave_left, ...newGetData } = - getData + const { school, major, education, graduation_year, name, gender, birthday, parental_leave_left, ...newGetData } = getData const _getData = _.cloneDeep(newGetData) const { direct_supervisor_id } = newGetData if (direct_supervisor_id) { @@ -502,54 +379,46 @@ export default { // if (type !== 'add' && this.employeeFormData.educational_experience.length !== 0) { // this.educational_experience = this.employeeFormData.educational_experience // } - this.children_information = this.formatChildrenInformationList() || [ - { - id: uuidv4(), - name: '', - gender: undefined, - birthday: null, - parental_leave_left: 0, - }, - ] - this.educational_experience = this.formatEducationalExperienceList() || [ - { - id: uuidv4(), - school: '', - major: '', - education: undefined, - graduation_year: null, - }, - ] + this.children_information = this.formatChildrenInformationList() || [{ + id: uuidv4(), + name: '', + gender: undefined, + birthday: null, + parental_leave_left: 0 + }] + this.educational_experience = this.formatEducationalExperienceList() || [{ + id: uuidv4(), + school: '', + major: '', + education: undefined, + graduation_year: null + }] this.type = type this.visible = true }, close() { this.$refs.employeeFormData.resetFields() - this.educational_experience = [ - { - school: '', - major: '', - education: undefined, - graduation_year: null, - }, - ] - this.children_information = [ - { - id: uuidv4(), - name: '', - gender: undefined, - birthday: null, - parental_leave_left: 0, - }, - ] + this.educational_experience = [{ + school: '', + major: '', + education: undefined, + graduation_year: null + }] + this.children_information = [{ + id: uuidv4(), + name: '', + gender: undefined, + birthday: null, + parental_leave_left: 0 + }] this.visible = false }, formatChildrenInformationList() { let arr = [] arr = this.employeeFormData.children_information ? this.employeeFormData.children_information : undefined if (arr && arr.length) { - arr.forEach((item) => { + arr.forEach(item => { item.id = uuidv4() }) return arr @@ -560,7 +429,7 @@ export default { let arr = [] arr = this.employeeFormData.educational_experience ? this.employeeFormData.educational_experience : undefined if (arr && arr.length) { - arr.forEach((item) => { + arr.forEach(item => { item.id = uuidv4() }) return arr @@ -573,12 +442,12 @@ export default { school: '', major: '', education: undefined, - graduation_year: null, + graduation_year: null } this.educational_experience.push(newEducational_experience) }, removeEducation(removeId) { - const _idx = this.educational_experience.findIndex((item) => item.id === removeId) + const _idx = this.educational_experience.findIndex(item => item.id === removeId) if (_idx !== -1) { this.educational_experience.splice(_idx, 1) } @@ -589,12 +458,12 @@ export default { name: '', gender: undefined, birthday: null, - parental_leave_left: 0, + parental_leave_left: 0 } this.children_information.push(newChildrenInfo) }, removeChildren(removeId) { - const _idx = this.children_information.findIndex((item) => item.id === removeId) + const _idx = this.children_information.findIndex(item => item.id === removeId) if (_idx !== -1) { this.children_information.splice(_idx, 1) } @@ -615,10 +484,10 @@ export default { // } if (date !== null) { if (param === 'graduation_year') { - const _idx = this.educational_experience.findIndex((item) => item.id === id) + const _idx = this.educational_experience.findIndex(item => item.id === id) this.educational_experience[_idx].graduation_year = moment(date).format('YYYY-MM') - } else if (param === 'birth_date') { - const _idx = this.children_information.findIndex((item) => item.id === id) + } else if (param === 'birthday') { + const _idx = this.children_information.findIndex(item => item.id === id) this.children_information[_idx].birthday = moment(date).format('YYYY-MM-DD') } else { this.employeeFormData[param] = moment(date).format('YYYY-MM-DD') @@ -649,12 +518,12 @@ export default { if (this.type === 'edit') { await putEmployee(getFormData.employee_id, getFormData) } - this.$message.success('操作成功') + this.$message.success(this.$t('cs.companyStructure.opSuccess')) this.$emit('refresh') Bus.$emit('updataAllIncludeEmployees') this.close() } else { - this.$message.warning('检查您的输入是否正确!') + this.$message.warning(this.$t('cs.companyInfo.checkInputCorrect')) return false } }) @@ -664,7 +533,7 @@ export default { diff --git a/cmdb-ui/src/views/setting/companyStructure/index.vue b/cmdb-ui/src/views/setting/companyStructure/index.vue index 7620d25..181e6e7 100644 --- a/cmdb-ui/src/views/setting/companyStructure/index.vue +++ b/cmdb-ui/src/views/setting/companyStructure/index.vue @@ -21,7 +21,7 @@ :class="{ 'group-selected': groupIndex === activeGroupIndex }" >
- +
- 在职员工 + {{ $t('cs.companyStructure.activeEmployee') }}
{{ activeEmployeeCount }}
@@ -61,7 +61,7 @@ >
- 停用员工 + {{ $t('cs.companyStructure.blockEmployee') }}
{{ deactiveEmployeeCount }}
@@ -70,7 +70,7 @@
-
    +
@@ -123,16 +123,16 @@
- + {{ getCurrentSceneLabel() }} - +
+ @refresh="handleSearch"/>
@@ -144,10 +144,12 @@ icon="plus" ghost /> - 批量导入 + + {{ $t('cs.companyStructure.batchImport') }} + @@ -168,25 +170,26 @@
- 下载全部 - - 下载选中 - - 编辑部门 - - 编辑上级 - - 编辑岗位 - - 编辑年假 - - 重置密码 - - 禁用 - - 恢复 - - 选取: {{ selectedRowKeys.length }} 项 + {{ $t('cs.companyStructure.downloadAll') }} + + {{ $t('cs.companyStructure.downloadSelected') }} + + {{ $t('cs.companyStructure.editDepartment') }} + + {{ $t('cs.companyStructure.editDirectSupervisor') }} + + {{ $t('cs.companyStructure.editPosition') }} + + {{ $t('cs.companyStructure.editAnnualLeave') }} + + {{ $t('cs.companyStructure.resetPassword') }} + + {{ $t('cs.companyStructure.block') }} + + {{ $t('cs.companyStructure.recover') }} + + {{ $t('selectRows', {rows: selectedRowKeys.length}) }}
- + - + - +
@@ -288,74 +292,16 @@ export default { SearchForm }, data() { - const canSearchPreferenceAttrList = [ - { label: '姓名', value: 'nickname' }, - { label: '用户名', value: 'username' }, - { label: '邮箱', value: 'email' }, - { label: '性别', value: 'sex', is_choice: true, choice_value: [{ label: '男', value: '男' }, { label: '女', value: '女' }] }, - { label: '手机号', value: 'mobile' }, - { label: '部门', value: 'department_name' }, - { label: '岗位', value: 'position_name' }, - { label: '直接上级', value: 'direct_supervisor_id' }, - { label: '年假', value: 'annual_leave' }, - { label: '目前所属主体', value: 'current_company' }, - { label: '初始入职日期', value: 'dfc_entry_date' }, - { label: '目前主体入职日期', value: 'entry_date' }, - { label: '正式/实习生', value: 'is_internship', is_choice: true, choice_value: [{ label: '正式', value: 0 }, { label: '实习生', value: 1 }] }, - { label: '离职日期', value: 'leave_date' }, - { label: '身份证号码', value: 'id_card' }, - { label: '民族', value: 'nation' }, - { label: '籍贯', value: 'id_place' }, - { label: '组织关系', value: 'party', is_choice: true, choice_value: [{ label: '党员', value: '党员' }, { label: '团员', value: '团员' }, { label: '群众', value: '群众' }] }, - { label: '户籍类型', value: 'household_registration_type', is_choice: true, choice_value: [{ label: '城镇', value: '城镇' }, { label: '农业', value: '农业' }] }, - { label: '户口所在地', value: 'hometown' }, - { label: '婚姻情况', value: 'marry', is_choice: true, choice_value: [{ label: '未婚', value: '未婚' }, { label: '已婚', value: '已婚' }] }, - { label: '最高学历', value: 'max_degree', is_choice: true, choice_value: [{ label: '博士', value: '博士' }, { label: '硕士', value: '硕士' }, { label: '本科', value: '本科' }, { label: '专科', value: '专科' }, { label: '高中', value: '高中' }] }, - { label: '紧急联系人', value: 'emergency_person' }, - { label: '紧急联系电话', value: 'emergency_phone' }, - { label: '卡号', value: 'bank_card_number' }, - { label: '银行', value: 'bank_card_name' }, - { label: '开户行', value: 'opening_bank' }, - { label: '开户地', value: 'account_opening_location' }, - { label: '上次登录时间', value: 'last_login' }, - ] - return { isActive: '', visible: true, - sceneList: [ - { - label: '全部', - value: -1, - }, - { - label: '在职员工', - value: 0, - }, - { - label: '停用员工', - value: 1, - }, - ], - localStorageKey: 'setting-company-strcutre', + localStorageKey: 'itsm-company-strcutre', localStoragePaneLengthPixel: 'setting-structure-paneLengthPixel', displayTimeIcon: 'down', currentScene: '', // historySceneitemSelected: 'history-scene-item-selected', // historySceneItem: 'history-scene-item', paneLengthPixel: 204, - groupData: [ - { - id: 0, - title: '员工', - icon: 'user', - }, - { - id: 1, - title: '部门', - icon: 'apartment', - }, - ], tableData: [], activeEmployeeCount: 0, deactiveEmployeeCount: 0, @@ -378,7 +324,6 @@ export default { allTreeDepartment: [], allTreeDepAndEmp: [], isFolder: false, - canSearchPreferenceAttrList, attributes: [], pageSizeOptions: ['50', '100', '200', '9999'], expression: [], @@ -413,6 +358,115 @@ export default { isEditable() { return this.hasDetailPermission('backend', '公司架构', ['update']) }, + canSearchPreferenceAttrList() { + return [ + { label: this.$t('cs.companyStructure.nickname'), value: 'nickname' }, + { label: this.$t('cs.companyStructure.username'), value: 'username' }, + { label: this.$t('cs.companyStructure.email'), value: 'email' }, + { + label: this.$t('cs.companyStructure.sex'), + value: 'sex', + is_choice: true, + choice_value: [ + { label: this.$t('cs.companyStructure.male'), value: '男' }, + { label: this.$t('cs.companyStructure.female'), value: '女' }] + }, + { label: this.$t('cs.companyStructure.mobile'), value: 'mobile' }, + { label: this.$t('cs.companyStructure.departmentName'), value: 'department_name' }, + { label: this.$t('cs.companyStructure.positionName'), value: 'position_name' }, + { label: this.$t('cs.companyStructure.departmentDirector'), value: 'direct_supervisor_id' }, + { label: this.$t('cs.companyStructure.annualLeave'), value: 'annual_leave' }, + { label: this.$t('cs.companyStructure.currentCompany'), value: 'current_company' }, + { label: this.$t('cs.companyStructure.dfcEntryDate'), value: 'dfc_entry_date' }, + { label: this.$t('cs.companyStructure.entryDate'), value: 'entry_date' }, + { + label: this.$t('cs.companyStructure.isInternship'), + value: 'is_internship', + is_choice: true, + choice_value: [{ label: this.$t('cs.companyStructure.fullTime'), value: 0 }, + { label: this.$t('cs.companyStructure.internship'), value: 1 }] + }, + { label: this.$t('cs.companyStructure.leaveDate'), value: 'leave_date' }, + { label: this.$t('cs.companyStructure.idCard'), value: 'id_card' }, + { label: this.$t('cs.companyStructure.nation'), value: 'nation' }, + { label: this.$t('cs.companyStructure.idPlace'), value: 'id_place' }, + { + label: this.$t('cs.companyStructure.party'), + value: 'party', + is_choice: true, + choice_value: [ + { label: this.$t('cs.companyStructure.partyMember'), value: '党员' }, + { label: this.$t('cs.companyStructure.member'), value: '团员' }, + { label: this.$t('cs.companyStructure.masses'), value: '群众' }] + }, + { + label: this.$t('cs.companyStructure.householdRegistrationType'), + value: 'household_registration_type', + is_choice: true, + choice_value: [{ label: this.$t('cs.companyStructure.town'), value: '城镇' }, { label: this.$t('cs.companyStructure.agriculture'), value: '农业' }] + }, + { label: this.$t('cs.companyStructure.hometown'), value: 'hometown' }, + { + label: this.$t('cs.companyStructure.marry'), + value: 'marry', + is_choice: true, + choice_value: [{ label: this.$t('cs.companyStructure.unmarried'), value: '未婚' }, { label: this.$t('cs.companyStructure.married'), value: '已婚' }] + }, + { + label: this.$t('cs.companyStructure.maxDegree'), + value: 'max_degree', + is_choice: true, + choice_value: [{ label: this.$t('cs.companyStructure.phd'), value: '博士' }, { label: this.$t('cs.companyStructure.master'), value: '硕士' }, { + label: this.$t('cs.companyStructure.undergraduate'), + value: '本科' + }, { label: this.$t('cs.companyStructure.specialist'), value: '专科' }, { label: this.$t('cs.companyStructure.highSchool'), value: '高中' }] + }, + { label: this.$t('cs.companyStructure.emergencyPerson'), value: 'emergency_person' }, + { label: this.$t('cs.companyStructure.emergencyPhone'), value: 'emergency_phone' }, + { label: this.$t('cs.companyStructure.bankCardNumber'), value: 'bank_card_number' }, + { label: this.$t('cs.companyStructure.bankCardName'), value: 'bank_card_name' }, + { label: this.$t('cs.companyStructure.openingBank'), value: 'opening_bank' }, + { label: this.$t('cs.companyStructure.accountOpeningLocation'), value: 'account_opening_location' }, + { label: this.$t('cs.companyStructure.birthDate'), value: 'birth_date' }, + { label: this.$t('cs.companyStructure.nationalityRegion'), value: 'nationality_region' }, + { label: this.$t('cs.companyStructure.birthPlace'), value: 'birth_place' }, + { label: this.$t('cs.companyStructure.firstEntryDate'), value: 'first_entry_date' }, + { label: this.$t('cs.companyStructure.estimatedDepartureDate'), value: 'estimated_departure_date' }, + // { label: '角色', value: 'roles' }, + { label: this.$t('cs.companyStructure.lastLogin'), value: 'last_login' }, + + ] + }, + sceneList () { + return [ + { + label: this.$t('all'), + value: -1, + }, + { + label: this.$t('cs.companyStructure.activeEmployee'), + value: 0, + }, + { + label: this.$t('cs.companyStructure.blockEmployee'), + value: 1, + }, + ] + }, + groupData () { + return [ + { + id: 0, + title: this.$t('cs.companyStructure.employee'), + icon: 'user', + }, + { + id: 1, + title: this.$t('cs.companyStructure.departmentName'), + icon: 'apartment', + }, + ] + } }, provide() { return { @@ -470,6 +524,9 @@ export default { Bus.$on('clickSelectGroup', async (index) => { this.clickSelectGroup(index) }) + Bus.$on('changeSelectedRowKeys', (selectedRowKeys) => { + this.selectedRowKeys = selectedRowKeys + }) this.getAllFlatEmployees() this.getAllFlatDepartment() this.getAllTreeDepartment() @@ -480,6 +537,7 @@ export default { Bus.$off('updateAllIncludeDepartment') Bus.$off('selectDepartment') Bus.$off('reqChildren') + Bus.$off('changeSelectedRowKeys') }, methods: { // mouseOver: function() { @@ -579,55 +637,7 @@ export default { order: this.tableSortData || 'direct_supervisor_id', }) } - // console.log(this.activeGroupIndex, reqEmployeeData) - this.tableData = reqEmployeeData.data_list - if (reqEmployeeData.data_list.length) { - // 筛选教育经历数组中学历最高的一条记录 - if (reqEmployeeData.data_list[0].educational_experience) { - reqEmployeeData.data_list.forEach((row, row_index) => { - const educational_experience = row.educational_experience - if (educational_experience.length > 1) { - let max_index = 0 - educational_experience.forEach((item, index) => { - if (index < educational_experience.length - 1) { - max_index = item.graduation_year > educational_experience[index + 1].graduation_year ? index : index + 1 - } - }) - this.tableData[row_index].school = educational_experience[max_index].school - this.tableData[row_index].major = educational_experience[max_index].major - this.tableData[row_index].education = educational_experience[max_index].education - this.tableData[row_index].graduation_year = educational_experience[max_index].graduation_year - } else if (educational_experience.length === 1) { - this.tableData[row_index].school = educational_experience[0].school - this.tableData[row_index].major = educational_experience[0].major - this.tableData[row_index].education = educational_experience[0].education - this.tableData[row_index].graduation_year = educational_experience[0].graduation_year - } else { - this.tableData[row_index].school = '' - this.tableData[row_index].major = '' - this.tableData[row_index].education = '' - this.tableData[row_index].graduation_year = '' - } - }) - } - // 筛选子女信息中第一位展示在employeeTable - if (reqEmployeeData.data_list[0].children_information) { - reqEmployeeData.data_list.forEach((row, row_index) => { - const children_information = row.children_information - if (children_information.length) { - this.tableData[row_index].name = children_information[0].name - this.tableData[row_index].gender = children_information[0].gender - this.tableData[row_index].birthday = children_information[0].birthday - this.tableData[row_index].parental_leave_left = children_information[0].parental_leave_left - } else { - this.tableData[row_index].name = '' - this.tableData[row_index].gender = '' - this.tableData[row_index].birthday = '' - this.tableData[row_index].parental_leave_left = '' - } - }) - } - } + this.tableData = this.FilterTableData(reqEmployeeData) this.tablePage = { ...this.tablePage, currentPage: reqEmployeeData.page, @@ -661,57 +671,7 @@ export default { order: this.tableSortData || 'direct_supervisor_id', }) } - const tableData = reqEmployeeData.data_list - // 筛选教育经历数组中学历最高的一条记录 - if (reqEmployeeData.data_list.length) { - if (reqEmployeeData.data_list[0].educational_experience) { - // reqEmployeeData.data_list.forEach((row, row_index) => { - for (let index = 0, len = reqEmployeeData.data_list.length; index < len; index++) { - const educational_experience = reqEmployeeData.data_list[index].educational_experience - if (educational_experience.length > 1) { - let max_index = 0 - educational_experience.forEach((item, index) => { - if (index < educational_experience.length - 1) { - max_index = item.graduation_year > educational_experience[index + 1].graduation_year ? index : index + 1 - } - }) - tableData[index].school = educational_experience[max_index].school - tableData[index].major = educational_experience[max_index].major - tableData[index].education = educational_experience[max_index].education - tableData[index].graduation_year = educational_experience[max_index].graduation_year - } else if (educational_experience.length === 1) { - tableData[index].school = educational_experience[0].school - tableData[index].major = educational_experience[0].major - tableData[index].education = educational_experience[0].education - tableData[index].graduation_year = educational_experience[0].graduation_year - } else { - tableData[index].school = '' - tableData[index].major = '' - tableData[index].education = '' - tableData[index].graduation_year = '' - } - } - } - // 筛选子女信息中第一位展示在employeeTable - if (reqEmployeeData.data_list[0].children_information) { - // reqEmployeeData.data_list.forEach((row, row_index) => { - for (let row_index = 0, len = reqEmployeeData.data_list.length; row_index < len; row_index++) { - const children_information = reqEmployeeData.data_list[row_index].children_information - if (children_information.length) { - tableData[row_index].name = children_information[0].name - tableData[row_index].gender = children_information[0].gender - tableData[row_index].birthday = children_information[0].birthday - tableData[row_index].parental_leave_left = children_information[0].parental_leave_left - } else { - tableData[row_index].name = '' - tableData[row_index].gender = '' - tableData[row_index].birthday = '' - tableData[row_index].parental_leave_left = '' - } - } - } - } - this.tableData = tableData + this.tableData = this.FilterTableData(reqEmployeeData) this.tablePage = { ...this.tablePage, currentPage: reqEmployeeData.page, @@ -720,6 +680,63 @@ export default { } this.loading = false }, + FilterTableData(reqEmployeeData) { + const tableData = reqEmployeeData.data_list + // 筛选教育经历数组中学历最高的一条记录 + if (reqEmployeeData.data_list.length) { + if (reqEmployeeData.data_list[0].educational_experience) { + // reqEmployeeData.data_list.forEach((row, row_index) => { + for (let index = 0, len = reqEmployeeData.data_list.length; index < len; index++) { + const educational_experience = reqEmployeeData.data_list[index].educational_experience + if (educational_experience) { + if (educational_experience.length > 1) { + let max_index = 0 + educational_experience.forEach((item, index) => { + if (index < educational_experience.length - 1) { + max_index = item.graduation_year > educational_experience[index + 1].graduation_year ? index : index + 1 + } + }) + tableData[index].school = educational_experience[max_index].school + tableData[index].major = educational_experience[max_index].major + tableData[index].education = educational_experience[max_index].education + tableData[index].graduation_year = educational_experience[max_index].graduation_year + } else if (educational_experience.length === 1) { + tableData[index].school = educational_experience[0].school + tableData[index].major = educational_experience[0].major + tableData[index].education = educational_experience[0].education + tableData[index].graduation_year = educational_experience[0].graduation_year + } else { + tableData[index].school = '' + tableData[index].major = '' + tableData[index].education = '' + tableData[index].graduation_year = '' + } + } + } + } + // 筛选子女信息中第一位展示在employeeTable + if (reqEmployeeData.data_list[0].children_information) { + // reqEmployeeData.data_list.forEach((row, row_index) => { + for (let row_index = 0, len = reqEmployeeData.data_list.length; row_index < len; row_index++) { + const children_information = reqEmployeeData.data_list[row_index].children_information + if (children_information) { + if (children_information.length) { + tableData[row_index].name = children_information[0].name + tableData[row_index].gender = children_information[0].gender + tableData[row_index].birthday = children_information[0].birthday + tableData[row_index].parental_leave_left = children_information[0].parental_leave_left + } else { + tableData[row_index].name = '' + tableData[row_index].gender = '' + tableData[row_index].birthday = '' + tableData[row_index].parental_leave_left = '' + } + } + } + } + } + return tableData + }, updateAll() { // this.expression = [] this.updateCount() @@ -771,6 +788,11 @@ export default { a.click() window.URL.revokeObjectURL(url) }) + this.$refs.employeeTable.getVxetableRef().clearCheckboxRow() + this.$refs.employeeTable.getVxetableRef().clearCheckboxReserve() + this.$refs.employeeTable.getVxetableRef().clearSort() + this.tableSortData = undefined + this.selectedRowKeys = [] }, reset() { this.filterName = '' @@ -842,18 +864,18 @@ export default { if (this.selectDepartment.hasOwnProperty('id')) { this.$refs.DepartmentModal.open({ type, selectDepartment: this.selectDepartment }) } else { - this.$message.error('请选择部门') + this.$message.error(this.$t('cs.companyStructure.selectDepartment')) } }, async deleteDepartment() { const that = this this.$confirm({ - title: '警告', - content: `确认删除 【${this.selectDepartment.title}】?`, + title: this.$t('warning'), + content: this.$t('confirmDelete2', { name: this.selectDepartment.title }), onOk() { deleteDepartmentById(that.selectDepartment.id).then((res) => { that.clickSelectGroup(1) - that.$message.success('删除成功!') + that.$message.success(that.$t('deleteSuccess')) Bus.$emit('updateAllIncludeDepartment') }) }, @@ -876,14 +898,20 @@ export default { }, sortChangeEvent({ sortList }) { this.tableSortData = sortList - .map((item) => { - return `${item.order === 'asc' ? '' : '-'}${item.property}` - }) - .join(',') + .map((item) => { + return `${item.order === 'asc' ? '' : '-'}${item.property}` + }) + .join(',') this.updateTableDataByFilter() }, filterChangeEvent({ column, property, values, datas, filterList, $event }) { - if (property === 'is_internship') { + if (property === 'roles') { + this.tableFilterData = { + ...this.tableFilterData, + // role_id_list: values && values.length ? values.join(',') : undefined, + role_id_list: values && values.length ? values : undefined, + } + } else if (property === 'is_internship') { this.tableFilterData = { ...this.tableFilterData, is_internship: values && values.length ? values[0] : undefined, @@ -1098,7 +1126,8 @@ export default { } } } - .ops-setting-batch{ + + .ops-setting-batch { width: 100%; display: flex; justify-content: space-between; diff --git a/cmdb-ui/src/views/setting/components/EditImage.vue b/cmdb-ui/src/views/setting/components/EditImage.vue index e17b4a4..d5481e5 100644 --- a/cmdb-ui/src/views/setting/components/EditImage.vue +++ b/cmdb-ui/src/views/setting/components/EditImage.vue @@ -18,14 +18,13 @@ :img="cropperImg" output-type="png" @realTime="realTime" - v-bind="eidtImageOption" />
-
预览
+
{{ $t('cs.components.preview') }}
@@ -50,7 +49,7 @@ export default { props: { title: { type: String, - default: '编辑头像', + default: () => this.$t('cs.components.editAvatar'), }, show: { type: Boolean, @@ -60,9 +59,13 @@ export default { type: String, default: '', }, - eidtImageOption: { - type: Object, - default: () => {}, + previewWidth: { + type: String, + default: '60px', + }, + previewHeight: { + type: String, + default: '60px', }, }, data() { diff --git a/cmdb-ui/src/views/setting/components/SearchForm.vue b/cmdb-ui/src/views/setting/components/SearchForm.vue index 174d2e5..188b6bb 100644 --- a/cmdb-ui/src/views/setting/components/SearchForm.vue +++ b/cmdb-ui/src/views/setting/components/SearchForm.vue @@ -9,7 +9,7 @@ >
- 条件过滤 + {{ $t('cs.components.conditionFilter') }}
diff --git a/cmdb-ui/src/views/setting/components/departmentTreeSelect.vue b/cmdb-ui/src/views/setting/components/departmentTreeSelect.vue index 8532497..ba76362 100644 --- a/cmdb-ui/src/views/setting/components/departmentTreeSelect.vue +++ b/cmdb-ui/src/views/setting/components/departmentTreeSelect.vue @@ -2,12 +2,12 @@ - 用户名 + {{ $t('cs.companyStructure.username') }} - 邮箱 + {{ $t('cs.companyStructure.email') }} - 性别 + {{ $t('cs.companyStructure.sex') }} - 手机号 + {{ $t('cs.companyStructure.mobile') }} - 部门 + {{ $t('cs.companyStructure.departmentName') }} - 直接上级 + {{ $t('cs.companyStructure.supervisor') }} - 虚拟年假 + {{ $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" >