From 995e581315120e58f69e8d4071839bb6027a1d4e Mon Sep 17 00:00:00 2001 From: simontigers <47096077+simontigers@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:26:40 +0800 Subject: [PATCH 1/3] fix(api): common department edit method (#355) --- cmdb-api/api/lib/common_setting/department.py | 10 +++++++++- cmdb-api/api/views/common_setting/department.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmdb-api/api/lib/common_setting/department.py b/cmdb-api/api/lib/common_setting/department.py index 9d11785..fe8c782 100644 --- a/cmdb-api/api/lib/common_setting/department.py +++ b/cmdb-api/api/lib/common_setting/department.py @@ -24,7 +24,15 @@ def get_all_department_list(to_dict=True): *criterion ).order_by(Department.department_id.asc()) results = query.all() - return [r.to_dict() for r in results] if to_dict else results + if to_dict: + datas = [] + for r in results: + d = r.to_dict() + if r.department_id == 0: + d['department_name'] = ErrFormat.company_wide + datas.append(d) + return datas + return results def get_all_employee_list(block=0, to_dict=True): diff --git a/cmdb-api/api/views/common_setting/department.py b/cmdb-api/api/views/common_setting/department.py index 9a8dd4a..7e3d4c8 100644 --- a/cmdb-api/api/views/common_setting/department.py +++ b/cmdb-api/api/views/common_setting/department.py @@ -85,7 +85,7 @@ class DepartmentIDView(APIView): class DepartmentParentView(APIView): url_prefix = (f'{prefix}/allow_parent',) - def get(self): + def put(self): department_id = request.args.get('department_id', None) if department_id is None: abort(400, ErrFormat.department_id_is_required) From 82ea1ddc791fa62a1b00a23aac3fa5e7f0264d4e Mon Sep 17 00:00:00 2001 From: simontigers <47096077+simontigers@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:31:54 +0800 Subject: [PATCH 2/3] fix(api): common department edit method (#356) * fix(api): common department edit method * fix(api): common department edit method --- cmdb-api/api/views/common_setting/department.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdb-api/api/views/common_setting/department.py b/cmdb-api/api/views/common_setting/department.py index 7e3d4c8..c35538e 100644 --- a/cmdb-api/api/views/common_setting/department.py +++ b/cmdb-api/api/views/common_setting/department.py @@ -62,7 +62,7 @@ class DepartmentView(APIView): class DepartmentIDView(APIView): url_prefix = (f'{prefix}/<int:_id>',) - def get(self, _id): + def put(self, _id): form = DepartmentForm(MultiDict(request.json)) if not form.validate(): abort(400, ','.join(['{}: {}'.format(filed, ','.join(msg)) From c98199e98e2bd6833e8676d1927e239b7ba61ae0 Mon Sep 17 00:00:00 2001 From: wang-liang0615 <53748875+wang-liang0615@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:58:47 +0800 Subject: [PATCH 3/3] feat(ui):i18n (#357) * feat(ui):i18n * i18n --- .../acl/views/module/permissionForm.vue | 2 +- .../acl/views/module/resourceTypeForm.vue | 2 +- .../views/module/resourceTypeHistoryTable.vue | 2 +- .../modules/acl/views/module/triggerForm.vue | 20 +- .../modules/resourceTypeHistoryTable.vue | 2 +- .../src/modules/acl/views/resource_types.vue | 2 +- cmdb-ui/src/views/setting/auth/ldap.vue | 2 +- .../setting/companyStructure/BatchUpload.vue | 2 +- .../companyStructure/EmployeeModal.vue | 236 +----------------- .../views/setting/companyStructure/index.vue | 60 ----- cmdb-ui/src/views/setting/lang/en.js | 1 + cmdb-ui/src/views/setting/lang/zh.js | 1 + 12 files changed, 28 insertions(+), 304 deletions(-) diff --git a/cmdb-ui/src/modules/acl/views/module/permissionForm.vue b/cmdb-ui/src/modules/acl/views/module/permissionForm.vue index 8768117..6c1eb6e 100644 --- a/cmdb-ui/src/modules/acl/views/module/permissionForm.vue +++ b/cmdb-ui/src/modules/acl/views/module/permissionForm.vue @@ -1,7 +1,7 @@ <template> <CustomDrawer :closable="false" - :title="$t('acl.addReourceType')" + :title="$t('acl.addResourceType')" :visible="drawerVisible" @close="onClose" placement="right" diff --git a/cmdb-ui/src/modules/acl/views/module/resourceTypeForm.vue b/cmdb-ui/src/modules/acl/views/module/resourceTypeForm.vue index e704a5f..5984c3e 100644 --- a/cmdb-ui/src/modules/acl/views/module/resourceTypeForm.vue +++ b/cmdb-ui/src/modules/acl/views/module/resourceTypeForm.vue @@ -1,7 +1,7 @@ <template> <CustomDrawer :closable="false" - :title="$t('acl.addReourceType')" + :title="$t('acl.addResourceType')" :visible="drawerVisible" @close="onClose" placement="right" diff --git a/cmdb-ui/src/modules/acl/views/module/resourceTypeHistoryTable.vue b/cmdb-ui/src/modules/acl/views/module/resourceTypeHistoryTable.vue index 635c1e7..b729a98 100644 --- a/cmdb-ui/src/modules/acl/views/module/resourceTypeHistoryTable.vue +++ b/cmdb-ui/src/modules/acl/views/module/resourceTypeHistoryTable.vue @@ -240,7 +240,7 @@ export default { switch (operate_type) { // create case 'create': { - item.changeDescription = `${this.$t('acl.addReourceType')}:${item.current.name}\n${this.$t('desc')}:${ + item.changeDescription = `${this.$t('acl.addResourceType')}:${item.current.name}\n${this.$t('desc')}:${ item.current.description }\n${this.$t('acl.permission')}: ${item.extra.permission_ids.current}` break diff --git a/cmdb-ui/src/modules/acl/views/module/triggerForm.vue b/cmdb-ui/src/modules/acl/views/module/triggerForm.vue index eb422b8..93bcc7b 100644 --- a/cmdb-ui/src/modules/acl/views/module/triggerForm.vue +++ b/cmdb-ui/src/modules/acl/views/module/triggerForm.vue @@ -1,4 +1,4 @@ -<template> + <template> <CustomDrawer @close="handleClose" width="500" @@ -8,14 +8,23 @@ > <a-form :form="form" :label-col="{ span: 6 }" :wrapper-col="{ span: 15 }"> <a-form-item :label="$t('name')"> - <a-input size="large" v-decorator="['name', { rules: [{ required: true, message: $t('acl.triggerNameInput') }] }]"> + <a-input + size="large" + v-decorator="['name', { rules: [{ required: true, message: $t('acl.triggerNameInput') }] }]" + > </a-input> </a-form-item> <a-form-item :label="$t('acl.resourceName')"> <a-input size="large" v-decorator="['wildcard']" :placeholder="$t('acl.triggerTips1')"> </a-input> </a-form-item> <a-form-item :label="$t('acl.creator')"> - <el-select :style="{ width: '100%' }" filterable multiple v-decorator="['uid']"> + <el-select + :style="{ width: '100%' }" + filterable + multiple + v-decorator="['uid']" + :placeholder="$t('placeholder2')" + > <template v-for="role in roles"> <el-option v-if="role.uid" :key="role.id" :value="role.uid" :label="role.name">{{ role.name }}</el-option> </template> @@ -25,6 +34,7 @@ <el-select :style="{ width: '100%' }" @change="handleRTChange" + :placeholder="$t('placeholder2')" v-decorator="['resource_type_id', { rules: [{ required: true, message: $t('acl.pleaseSelectType') }] }]" > <el-option @@ -43,6 +53,7 @@ :style="{ width: '100%' }" filterable multiple + :placeholder="$t('placeholder2')" v-decorator="['roles', { rules: [{ required: true, message: $t('acl.role_placeholder2') }] }]" > <el-option v-for="role in roles" :key="role.id" :value="role.id" :label="role.name"></el-option> @@ -50,6 +61,7 @@ </a-form-item> <a-form-item :label="$t('acl.permission')"> <el-select + :placeholder="$t('placeholder2')" :style="{ width: '100%' }" multiple v-decorator="['permissions', { rules: [{ required: true, message: $t('acl.permission_placeholder') }] }]" @@ -62,7 +74,7 @@ ></el-option> </el-select> </a-form-item> - <a-form-item :label="$t('acl.enable')/$t('acl.disable')"> + <a-form-item :label="$t('acl.enable') / $t('acl.disable')"> <a-switch v-decorator="['enabled', { rules: [], valuePropName: 'checked', initialValue: true }]" /> </a-form-item> </a-form> diff --git a/cmdb-ui/src/modules/acl/views/operation_history/modules/resourceTypeHistoryTable.vue b/cmdb-ui/src/modules/acl/views/operation_history/modules/resourceTypeHistoryTable.vue index 357a6d1..722ce52 100644 --- a/cmdb-ui/src/modules/acl/views/operation_history/modules/resourceTypeHistoryTable.vue +++ b/cmdb-ui/src/modules/acl/views/operation_history/modules/resourceTypeHistoryTable.vue @@ -290,7 +290,7 @@ export default { const description = item.current?.description === undefined ? this.$t('acl.none') : item.current?.description const permission = item.extra.permission_ids?.current === undefined ? this.$t('acl.none') : item.extra.permission_ids?.current - item.changeDescription = `${this.$t('acl.addReourceType')}:${item.current.name}\n${this.$t( + item.changeDescription = `${this.$t('acl.addResourceType')}:${item.current.name}\n${this.$t( 'desc' )}:${description}\n${this.$t('acl.permission')}:${permission}` break diff --git a/cmdb-ui/src/modules/acl/views/resource_types.vue b/cmdb-ui/src/modules/acl/views/resource_types.vue index 37c8991..e20a318 100644 --- a/cmdb-ui/src/modules/acl/views/resource_types.vue +++ b/cmdb-ui/src/modules/acl/views/resource_types.vue @@ -2,7 +2,7 @@ <div class="acl-resource-types"> <div class="acl-resource-types-header"> <a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem">{{ - $t('acl.addReourceType') + $t('acl.addResourceType') }}</a-button> <a-input-search class="ops-input" diff --git a/cmdb-ui/src/views/setting/auth/ldap.vue b/cmdb-ui/src/views/setting/auth/ldap.vue index 41343e6..82797a4 100644 --- a/cmdb-ui/src/views/setting/auth/ldap.vue +++ b/cmdb-ui/src/views/setting/auth/ldap.vue @@ -53,7 +53,7 @@ export default { rules() { return { enable: [{ required: true }], - ldap_server: [{ required: true, message: this.$t('cs.auth.ldap.domainPlaceholder') }], + ldap_server: [{ required: true, message: this.$t('cs.auth.ldap.serverAddressPlaceholder') }], } } }, diff --git a/cmdb-ui/src/views/setting/companyStructure/BatchUpload.vue b/cmdb-ui/src/views/setting/companyStructure/BatchUpload.vue index d0b938c..a8bd09b 100644 --- a/cmdb-ui/src/views/setting/companyStructure/BatchUpload.vue +++ b/cmdb-ui/src/views/setting/companyStructure/BatchUpload.vue @@ -399,7 +399,7 @@ export default { ] data[1] = data[1].filter((item) => item['v'] !== '目前所属主体') data[1] = data[1].filter((item) => item['v'] !== '初始入职日期') - downloadExcel(data, '员工导入模板') + downloadExcel(data, this.$t('cs.companyStructure.downloadTemplateName')) }, customRequest(data) { this.fileList = [data.file] diff --git a/cmdb-ui/src/views/setting/companyStructure/EmployeeModal.vue b/cmdb-ui/src/views/setting/companyStructure/EmployeeModal.vue index 822d29f..1ebea1a 100644 --- a/cmdb-ui/src/views/setting/companyStructure/EmployeeModal.vue +++ b/cmdb-ui/src/views/setting/companyStructure/EmployeeModal.vue @@ -48,236 +48,6 @@ <div :style="{ height: '41px', lineHeight: '40px' }">{{ $t('cs.companyStructure.selectDirectSupervisor') }}</div> <EmployeeTreeSelect v-model="employeeFormData.direct_supervisor_id" /> </div> - <!-- <a-form-model-item :label="角色" prop="role" :style="formModalItemStyle"> - <a-select mode="multiple" v-model="employeeFormData.role" :placeholder="请选择角色"> - <a-select-option value="PM"> PM </a-select-option> - <a-select-option value="Test"> Test </a-select-option> - <a-select-option value="Tevelop"> Develop </a-select-option> - </a-select> - </a-form-model-item> --> - <a-form-model-item ref="annual_leave" :label="$t('cs.companyStructure.annualLeave')" prop="annual_leave" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='annual_leave')!==-1"> - <a-input-number - :min="0" - :step="1" - :style="{ width: '100%' }" - v-model="employeeFormData.annual_leave" - :placeholder="$t('cs.companyStructure.annualLeavePlaceholder')" - :formatter="(value) => `${value} $t('cs.companyStructure.day')`" - /> - </a-form-model-item> - <a-form-model-item ref="virtual_annual_leave" :label="$t('cs.companyStructure.virtualAnnualLeave')" prop="virtual_annual_leave" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='virtual_annual_leave')!==-1"> - <a-input-number - :min="0" - :step="1" - :style="{ width: '100%' }" - v-model="employeeFormData.virtual_annual_leave" - :placeholder="$t('cs.companyStructure.virtualAnnualLeavePlaceholder')" - :formatter="(value) => `${value} $t('cs.companyStructure.day')`" - /> - </a-form-model-item> - <a-form-model-item ref="parenting_leave" :label="$t('cs.companyStructure.parentingLeave')" prop="parenting_leave" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='parenting_leave')!==-1"> - <a-input-number - :min="0" - :step="1" - :style="{ width: '100%' }" - v-model="employeeFormData.parenting_leave" - :placeholder="$t('cs.companyStructure.parentingLeavePlaceholder')" - :formatter="(value) => `${value} $t('cs.companyStructure.day')`" - /> - </a-form-model-item> - <a-form-model-item v-if="attributes.findIndex(v=>v=='current_company')!==-1" ref="current_company" :label="$t('cs.companyStructure.currentCompany')" prop="current_company" :style="formModalItemStyle"> - <a-input v-model="employeeFormData.current_company" :placeholder="$t('cs.companyStructure.currentCompanyPlaceholder')" /> - </a-form-model-item> - <a-form-model-item v-if="attributes.findIndex(v=>v=='dfc_entry_date')!==-1" ref="dfc_entry_date" :label="$t('cs.companyStructure.dfcEntryDate')" prop="dfc_entry_date" :style="formModalItemStyle"> - <a-date-picker :placeholder="$t('cs.companyStructure.dfcEntryDatePlaceholder')" v-model="employeeFormData.dfc_entry_date" :style="{ width: '100%'}" @change="onChange($event, 'dfc_entry_date')"></a-date-picker> - </a-form-model-item> - <a-form-model-item ref="entry_date" :label="$t('cs.companyStructure.entryDate')" prop="entry_date" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='entry_date')!==-1"> - <a-date-picker :placeholder="$t('cs.companyStructure.entryDatePlaceholder')" v-model="employeeFormData.entry_date" :style="{ width: '100%'}" @change="onChange($event, 'entry_date')"></a-date-picker> - </a-form-model-item> - <a-form-model-item ref="is_internship" :label="$t('cs.companyStructure.isInternship')" prop="is_internship" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='is_internship')!==-1"> - <a-select v-model="employeeFormData.is_internship" :placeholder="$t('cs.companyStructure.isInternshipPlaceholder')"> - <a-select-option :value="0"> {{ $t('cs.companyStructure.fullTime') }} </a-select-option> - <a-select-option :value="1"> {{ $t('cs.companyStructure.internship') }} </a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item ref="leave_date" :label="$t('cs.companyStructure.leaveDate')" prop="leave_date" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='leave_date')!==-1"> - <a-date-picker v-model="employeeFormData.leave_date" :placeholder="$t('cs.companyStructure.leaveDatePlaceholder')" :style="{ width: '100%'}" @change="onChange($event, 'leave_date')"></a-date-picker> - </a-form-model-item> - <a-form-model-item ref="id_card" :label="$t('cs.companyStructure.idCard')" prop="id_card" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='id_card')!==-1"> - <a-input v-model="employeeFormData.id_card" :placeholder="$t('cs.companyStructure.idCardPlaceholder')" /> - </a-form-model-item> - <a-form-model-item ref="nation" :label="$t('cs.companyStructure.nation')" prop="nation" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='nation')!==-1"> - <a-input v-model="employeeFormData.nation" :placeholder="$t('cs.companyStructure.nationPlaceholder')" /> - </a-form-model-item> - <a-form-model-item ref="id_place" :label="$t('cs.companyStructure.idPlace')" prop="id_place" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='id_place')!==-1"> - <a-input v-model="employeeFormData.id_place" :placeholder="$t('cs.companyStructure.idPlacePlaceholder')" /> - </a-form-model-item> - <a-form-model-item ref="party" :label="$t('cs.companyStructure.party')" prop="party" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='party')!==-1"> - <a-select v-model="employeeFormData.party" :placeholder="$t('cs.companyStructure.')"> - <a-select-option value="党员"> {{ $t('cs.companyStructure.partyMember') }} </a-select-option> - <a-select-option value="团员"> {{ $t('cs.companyStructure.member') }} </a-select-option> - <a-select-option value="群众"> {{ $t('cs.companyStructure.masses') }} </a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item ref="household_registration_type" :label="$t('cs.companyStructure.householdRegistrationType')" prop="household_registration_type" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='household_registration_type')!==-1"> - <a-select v-model="employeeFormData.household_registration_type" :placeholder="$t('cs.companyStructure.')"> - <a-select-option value="城镇"> {{ $t('cs.companyStructure.town') }} </a-select-option> - <a-select-option value="农业"> {{ $t('cs.companyStructure.agriculture') }} </a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item ref="hometown" :label="$t('cs.companyStructure.hometown')" prop="hometown" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='hometown')!==-1"> - <a-input v-model="employeeFormData.hometown" :placeholder="$t('cs.companyStructure.hometownPlaceholder')" /> - </a-form-model-item> - <a-form-model-item ref="marry" :label="$t('cs.companyStructure.marry')" prop="marry" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='marry')!==-1"> - <a-select v-model="employeeFormData.marry" :placeholder="$t('cs.companyStructure.')"> - <a-select-option value="未婚"> {{ $t('cs.companyStructure.unmarried') }}</a-select-option> - <a-select-option value="已婚"> {{ $t('cs.companyStructure.married') }} </a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item ref="max_degree" :label="$t('cs.companyStructure.maxDegree')" prop="max_degree" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='max_degree')!==-1"> - <a-select v-model="employeeFormData.max_degree" :placeholder="$t('cs.companyStructure.maxDegreePlaceholder')"> - <a-select-option value="博士"> {{ $t('cs.companyStructure.phd') }} </a-select-option> - <a-select-option value="硕士"> {{ $t('cs.companyStructure.master') }} </a-select-option> - <a-select-option value="本科"> {{ $t('cs.companyStructure.undergraduate') }} </a-select-option> - <a-select-option value="专科"> {{ $t('cs.companyStructure.specialist') }} </a-select-option> - <a-select-option value="高中"> {{ $t('cs.companyStructure.highSchool') }} </a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item ref="emergency_person" :label="$t('cs.companyStructure.emergencyPerson')" prop="emergency_person" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='emergency_person')!==-1"> - <a-input v-model="employeeFormData.emergency_person" :placeholder="$t('cs.companyStructure.emergencyPersonPlaceholder')" /> - </a-form-model-item> - <a-form-model-item ref="emergency_phone" :label="$t('cs.companyStructure.emergencyPhone')" prop="emergency_phone" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='emergency_phone')!==-1"> - <a-input v-model="employeeFormData.emergency_phone" :placeholder="$t('cs.companyStructure.emergencyPhonePlaceholder')" /> - </a-form-model-item> - <a-form-model-item ref="birth_date" :label="$t('cs.companyStructure.birthDate')" prop="birth_date" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='birth_date')!==-1"> - <a-date-picker v-model="employeeFormData.birth_date" :placeholder="$t('cs.companyStructure.birthDatePlaceholder')" :style="{ width: '100%'}" @change="onChange($event, 'birth_date')"></a-date-picker> - </a-form-model-item> - <a-form-model-item ref="birth_place" :label="$t('cs.companyStructure.birthPlace')" prop="birth_place" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='birth_place')!==-1"> - <a-input v-model="employeeFormData.birth_place" :placeholder="$t('cs.companyStructure.birthPlacePlaceholder')" /> - </a-form-model-item> - <a-form-model-item ref="nationality_region" :label="$t('cs.companyStructure.nationalityRegion')" prop="nationality_region" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='nationality_region')!==-1"> - <a-input v-model="employeeFormData.nationality_region" :placeholder="$t('cs.companyStructure.nationalityRegionPlaceholder')" /> - </a-form-model-item> - <a-form-model-item ref="first_entry_date" :label="$t('cs.companyStructure.firstEntryDate')" prop="first_entry_date" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='first_entry_date')!==-1"> - <a-date-picker v-model="employeeFormData.first_entry_date" :placeholder="$t('cs.companyStructure.firstEntryDatePlaceholder')" :style="{ width: '100%'}" @change="onChange($event, 'first_entry_date')"></a-date-picker> - </a-form-model-item> - <a-form-model-item ref="estimated_departure_date" :label="$t('cs.companyStructure.estimatedDepartureDate')" prop="estimated_departure_date" :style="formModalItemStyle" v-if="attributes.findIndex(v=>v=='estimated_departure_date')!==-1"> - <a-date-picker v-model="employeeFormData.estimated_departure_date" :placeholder="$t('cs.companyStructure.estimatedDepartureDatePlaceholder')" :style="{ width: '100%'}" @change="onChange($event, 'estimated_departure_date')"></a-date-picker> - </a-form-model-item> - <a-form-model-item :label="$t('cs.companyStructure.educationalExperience')" prop="employeeFormData" :style="{ display: 'inline-block', width: '100%', margin: '0 7px'}" v-if="attributes.findIndex(v=>v=='educational_experience')!==-1"> - <a-row - :gutter="[8,{xs:8}]" - v-for="(item) in educational_experience" - :key="item.id" - > - <a-col :span="5"> - <a-input v-model="item.school" :placeholder="$t('cs.companyStructure.school')" allowClear></a-input> - </a-col> - <a-col :span="5"> - <a-input v-model="item.major" :placeholder="$t('cs.companyStructure.major')" allowClear></a-input> - </a-col> - <a-col :span="5"> - <a-select v-model="item.education" :placeholder="$t('cs.companyStructure.education')" allowClear> - <a-select-option value="小学"> {{ $t('cs.companyStructure.primarySchool') }} </a-select-option> - <a-select-option value="初中"> {{ $t('cs.companyStructure.juniorHighSchool') }} </a-select-option> - <a-select-option value="中专/高中"> {{ $t('cs.companyStructure.technicalSecondaryOrHighSchool') }} </a-select-option> - <a-select-option value="专科"> {{ $t('cs.companyStructure.specialist') }} </a-select-option> - <a-select-option value="本科"> {{ $t('cs.companyStructure.undergraduate') }} </a-select-option> - <a-select-option value="硕士"> {{ $t('cs.companyStructure.master') }} </a-select-option> - <a-select-option value="博士"> {{ $t('cs.companyStructure.phd') }} </a-select-option> - </a-select> - </a-col> - <a-col :span="5"> - <a-month-picker v-model="item.graduation_year" :placeholder="$t('cs.companyStructure.graduationYearPlaceholder')" @change="onChange($event, 'graduation_year',item.id)" ></a-month-picker> - </a-col> - <a-col :span="1"> - <a - @click="addEducation" - > - <a-icon type="plus-circle" /> - </a> - </a-col> - <a-col :span="1" v-if="educational_experience.length > 1"> - <a - @click="() => removeEducation(item.id)" - :style="{ color: 'red' }" - > - <a-icon type="delete" /> - </a> - </a-col> - </a-row> - </a-form-model-item> - <a-form-model-item :label="$t('cs.companyStructure.childrenInformation')" prop="employeeFormData" :style="{ display: 'inline-block', width: '100%', margin: '0 7px'}" v-if="attributes.findIndex(v=>v=='children_information')!==-1"> - <!-- <a-space - v-for="(item,index) in educational_experience" - :key="index" - align="baseline" - > --> - <a-row - :gutter="[8,{xs:8}]" - v-for="(item) in children_information" - :key="item.id" - > - <a-col :span="5"> - <a-input v-model="item.name" :placeholder="$t('cs.companyStructure.childrenName')" allowClear></a-input> - </a-col> - <a-col :span="5"> - <a-select v-model="item.gender" :placeholder="$t('cs.companyStructure.sex')" allowClear> - <a-select-option value="男"> {{ $t('cs.companyStructure.male') }} </a-select-option> - <a-select-option value="女"> {{ $t('cs.companyStructure.female') }} </a-select-option> - </a-select> - </a-col> - <a-col :span="5"> - <a-date-picker v-model="item.birthday" :placeholder="$t('cs.companyStructure.birthDatePlaceholder')" @change="onChange($event, 'birthday',item.id)"></a-date-picker> - </a-col> - <a-col :span="5"> - <a-input-number - :min="0" - :step="1" - :style="{ width: '100%' }" - v-model="item.parental_leave_left" - :placeholder="$t('cs.companyStructure.')" - :formatter="(value) => `${value} $t('cs.companyStructure.day')`" - /> - </a-col> - <a-col :span="1"> - <a - @click="addChildren" - > - <a-icon type="plus-circle" /> - </a> - </a-col> - <a-col :span="1" v-if="children_information.length > 1"> - <a - @click="() => removeChildren(item.id)" - :style="{ color: 'red' }" - > - <a-icon type="delete" /> - </a> - </a-col> - </a-row> - </a-form-model-item> - <a-form-model-item - :label="$t('cs.companyStructure.bankCardInfo')" - prop="bank_card" - :style="{display: 'inline-block', width: '98%', margin: '0 7px 24px'}" - v-if="attributes.findIndex(v=>v=='bank_card_number')!==-1 || attributes.findIndex(v=>v=='bank_card_name')!==-1 || attributes.findIndex(v=>v=='opening_bank')!==-1 || attributes.findIndex(v=>v=='account_opening_location')!==-1" - > - <a-row :gutter="[8,{xs:8}]"> - <a-col :span="6" v-if="attributes.findIndex(v=>v=='bank_card_number')!==-1"> - <a-input v-model="employeeFormData.bank_card_number" :placeholder="$t('cs.companyStructure.bankCardNumberPlaceholder')" allowClear></a-input> - </a-col> - <a-col :span="6" v-if="attributes.findIndex(v=>v=='bank_card_name')!==-1"> - <a-input v-model="employeeFormData.bank_card_name" :placeholder="$t('cs.companyStructure.bankCardNamePlaceholder')" allowClear></a-input> - </a-col> - <a-col :span="6" v-if="attributes.findIndex(v=>v=='opening_bank')!==-1"> - <a-input v-model="employeeFormData.opening_bank" :placeholder="$t('cs.companyStructure.openingBankPlaceholder')" allowClear></a-input> - </a-col> - <a-col :span="6" v-if="attributes.findIndex(v=>v=='account_opening_location')!==-1"> - <a-input v-model="employeeFormData.account_opening_location" :placeholder="$t('cs.companyStructure.accountOpeningLocationPlaceholder')" allowClear></a-input> - </a-col> - </a-row> - </a-form-model-item> </a-form-model> <template slot="footer"> <a-button key="back" @click="close"> {{ $t('cancel') }} </a-button> @@ -342,12 +112,12 @@ export default { { max: 50, message: this.$t('cs.person.inputStrCountLimit', { limit: 50 }) }, ], username: [ - { required: true, whitespace: true, message: '请输入用户名', trigger: 'blur' }, + { required: true, whitespace: true, message: this.$t('cs.companyStructure.usernamePlaceholder'), trigger: 'blur' }, { max: 20, message: this.$t('cs.person.inputStrCountLimit', { limit: 20 }) }, ], - password: [{ required: true, whitespace: true, message: '请输入密码', trigger: 'blur' }], + password: [{ required: true, whitespace: true, message: this.$t('cs.companyStructure.passwordPlaceholder'), trigger: 'blur' }], nickname: [ - { required: true, whitespace: true, message: '请输入姓名', trigger: 'blur' }, + { required: true, whitespace: true, message: this.$t('cs.companyStructure.nicknamePlaceholder'), trigger: 'blur' }, { max: 20, message: this.$t('cs.person.inputStrCountLimit', { limit: 20 }) }, ], mobile: [ diff --git a/cmdb-ui/src/views/setting/companyStructure/index.vue b/cmdb-ui/src/views/setting/companyStructure/index.vue index 6b47600..7097610 100644 --- a/cmdb-ui/src/views/setting/companyStructure/index.vue +++ b/cmdb-ui/src/views/setting/companyStructure/index.vue @@ -373,66 +373,6 @@ export default { { 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 () { diff --git a/cmdb-ui/src/views/setting/lang/en.js b/cmdb-ui/src/views/setting/lang/en.js index a934a9c..9fb638f 100644 --- a/cmdb-ui/src/views/setting/lang/en.js +++ b/cmdb-ui/src/views/setting/lang/en.js @@ -48,6 +48,7 @@ const cs_en = { batchImport: 'Batch Import', batchEdit: 'Batch Edit', selectFile: 'Select File', + downloadTemplateName: 'Employee Import Template', clickDownloadImportTemplate: 'Click to download Employee Import Template', importSuccess: 'Imported total {allCount} items, imported successfully', importFailed: 'import failed', diff --git a/cmdb-ui/src/views/setting/lang/zh.js b/cmdb-ui/src/views/setting/lang/zh.js index 98f043b..ee23131 100644 --- a/cmdb-ui/src/views/setting/lang/zh.js +++ b/cmdb-ui/src/views/setting/lang/zh.js @@ -48,6 +48,7 @@ const cs_zh = { batchImport: '批量导入', batchEdit: '批量编辑', selectFile: '选择文件', + downloadTemplateName: '员工导入模板', clickDownloadImportTemplate: '点击下载《员工导入模板》', importSuccess: '导入总数据 {allCount} 条, 导入成功', importFailed: '导入失败',