mirror of
https://github.com/shawncai/ERP.git
synced 2025-03-04 19:33:18 +08:00
员工修改
This commit is contained in:
parent
cebd1aee97
commit
d5423bb7cd
4 changed files with 476 additions and 559 deletions
|
@ -99,8 +99,11 @@ export function updateemp(query) {
|
|||
if (query.postId !== '' && query.postId !== null && query.postId !== undefined) {
|
||||
params.append('postid', query.postId) // 你要传给后台的参数值 key/value
|
||||
}
|
||||
if (query.repositoryid2 !== '' && query.repositoryid2 !== null && query.repositoryid2 !== undefined) {
|
||||
params.append('repositoryid', query.repositoryid2) // 你要传给后台的参数值 key/value
|
||||
if (query.repositoryId !== '' && query.repositoryId !== null && query.repositoryId !== undefined) {
|
||||
params.append('repositoryid', query.repositoryId) // 你要传给后台的参数值 key/value
|
||||
}
|
||||
if (query.roleId !== '' && query.roleId !== null && query.roleId !== undefined) {
|
||||
params.append('roleid', query.roleId) // 你要传给后台的参数值 key/value
|
||||
}
|
||||
if (query.regionId !== '' && query.regionId !== null && query.regionId !== undefined) {
|
||||
params.append('regionid', query.regionId) // 你要传给后台的参数值 key/value
|
||||
|
|
|
@ -164,179 +164,25 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total>0" :total="total" :page.sync="getemplist.pagenum" :limit.sync="getemplist.pagesize" @pagination="getlist" />
|
||||
<el-dialog :visible.sync="editVisible" top="10px" title="修改员工">
|
||||
<!--个人信息-->
|
||||
<h2 ref="geren" class="form-name">个人信息</h2>
|
||||
<div class="container">
|
||||
<el-form ref="editAllData" :model="editAllData" :rules="editAllDataRules" :inline="true" status-icon class="demo-ruleForm" label-position="top" label-width="300px" style="margin-left: 30px;">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.account')" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model="editAllData.account" :disabled="true" placeholder="请输入账号名"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.password')" prop="password" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model="editAllData.password" placeholder="请输入密码" autocomplete="new-password" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.lastname')" prop="firstName" style="width: 40%">
|
||||
<el-input v-model="editAllData.firstName" placeholder="请输入姓氏" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.middlename')" style="width: 40%">
|
||||
<el-input v-model="editAllData.middleName" placeholder="请输入中间名" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.firstname')" prop="lastName" style="width: 40%;">
|
||||
<el-input v-model="editAllData.lastName" placeholder="请输入名" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.birthday')" style="width: 40%">
|
||||
<el-date-picker
|
||||
v-model="editAllData.birthday"
|
||||
type="date"
|
||||
placeholder="选择生日"
|
||||
value-format="yyyy-MM-dd"
|
||||
clearable
|
||||
style="width: 100%"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.email')" prop="email" style="width: 40%">
|
||||
<el-input v-model="editAllData.email" placeholder="请输入邮箱地址" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.gender')" prop="gender" style="width: 40%">
|
||||
<el-radio-group v-model="editAllData.gender" style="width: 80%">
|
||||
<el-radio :label="1" style="width: 50%">{{ $t('NewEmployeeInformation.male') }}</el-radio>
|
||||
<el-radio :label="2">{{ $t('NewEmployeeInformation.female') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.certificatetype')" style="width: 40%">
|
||||
<el-select v-model="editAllData.certificateType" placeholder="请选择证件类型" style="width: 100%;">
|
||||
<el-option label="类型1" value="1"/>
|
||||
<el-option label="类型2" value="2"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.certificatenumber')" style="width: 40%">
|
||||
<el-input v-model="editAllData.certificateNumber" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.country')" style="width: 40%">
|
||||
<el-input v-model="editAllData.countryName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editcountry')" style="width: 40%">
|
||||
<el-select v-model="editAllData.countryid" placeholder="请选择国籍" style="width: 100%;" @change ="handlechange">
|
||||
<el-option
|
||||
v-for="(item, index) in nations"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--联系信息-->
|
||||
<h2 ref="lianxi" class="form-name">联系信息</h2>
|
||||
<div class="container">
|
||||
<el-form ref="editAllData2" :model="editAllData" :rules="editAllDataRules" :inline="true" status-icon class="demo-ruleForm" label-position="top" label-width="300px" style="margin-left: 30px;">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.address')" prop="address" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model="editAllData.address" placeholder="请输入地址" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.phone')" prop="phone" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model.number="editAllData.phone" placeholder="请输入手机号" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.provinceid')" style="width: 40%;margin-top: 1%">
|
||||
<el-input v-model="editAllData.provinceName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editprovinceid')" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="provinceid" placeholder="请选择省" style="width: 100%;" @change="handlechange2">
|
||||
<el-option
|
||||
v-for="(item, index) in provinces"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.cityid')" style="width: 40%;margin-top: 1%">
|
||||
<el-input v-model="editAllData.cityName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editcityid')" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="cityid" placeholder="请选择市" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="(item, index) in cities"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--公司信息-->
|
||||
<h2 class="form-name">公司信息</h2>
|
||||
<div class="container">
|
||||
<el-form ref="editAllData3" :model="editAllData" :rules="editAllDataRules" :inline="true" status-icon class="demo-ruleForm" label-position="top" label-width="300px" style="margin-left: 30px;">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.jobnumber')" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model.number="editAllData.jobNumber" :disabled="true" placeholder="请输入工号"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.postid')" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="editAllData.postId" :value="editAllData.postId" placeholder="请选择职位" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="(item, index) in jobs"
|
||||
:key="index"
|
||||
:label="item.categoryName"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.deptid')" prop="deptId" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="editAllData.deptId" placeholder="请选择部门" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="(item, index) in depts2"
|
||||
:key="index"
|
||||
:label="item.deptName"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.regionid')" style="width: 40%;margin-top: 1%">
|
||||
<el-input v-model="editAllData.regionName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editregionid')" style="width: 40%;margin-top: 1%">
|
||||
<el-cascader
|
||||
:options="regions2"
|
||||
:props="props2"
|
||||
v-model="regionId"
|
||||
:show-all-levels="false"
|
||||
change-on-select
|
||||
filterable
|
||||
clearable
|
||||
style="width: 100%;"
|
||||
@change="handlechange4"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.repositoryid')" style="width: 40%;margin-top: 1%">
|
||||
<el-input v-model="editAllData.repositoryName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editrepositoryid')" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="repositoryid2" filterable style="width: 100%;">
|
||||
<el-option
|
||||
v-for="(item, index) in repositories2"
|
||||
:key="index"
|
||||
:label="item.repositoryName"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="buttons" style="margin-top: 20px;margin-left: 30px">
|
||||
<el-button type="primary" @click="handleEditok()">修改</el-button>
|
||||
<el-button type="danger" @click="handlecancel()">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<my-dialog :editcontrol.sync="editVisible" :editdata.sync="personalForm" @rest="refreshlist"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { searchRepository, regionlist, getcountrylist, getprovincelist, getcitylist } from '@/api/public'
|
||||
import { getdeptlist, getemplist, startorendemp, deleteemp, getempinfo, updateemp, searchEmpCategory } from '@/api/EmployeeInformation'
|
||||
import { getdeptlist, getemplist, startorendemp, deleteemp, getempinfo, searchEmpCategory } from '@/api/EmployeeInformation'
|
||||
import waves from '@/directive/waves' // Waves directive
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import permission from '@/directive/permission/index.js' // 权限判断指令
|
||||
import checkPermission from '@/utils/permission' // 权限判断函数
|
||||
import MyDialog from './components/MyDialog'
|
||||
|
||||
export default {
|
||||
name: 'EmployeeInformationList',
|
||||
directives: { waves, permission },
|
||||
components: { Pagination },
|
||||
components: { Pagination, MyDialog },
|
||||
filters: {
|
||||
genderFilter(status) {
|
||||
const statusMap = {
|
||||
|
@ -511,7 +357,9 @@ export default {
|
|||
Repository: [
|
||||
{ required: true, message: '请选择门店', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
},
|
||||
// 传给组件的数据
|
||||
personalForm: {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -591,6 +439,12 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
// 修改组件修改成功后返回
|
||||
refreshlist(val) {
|
||||
if (val === true) {
|
||||
this.getlist()
|
||||
}
|
||||
},
|
||||
// 修改操作
|
||||
handleEdit(row) {
|
||||
console.log(row)
|
||||
|
@ -598,118 +452,15 @@ export default {
|
|||
console.log(res)
|
||||
const emData = res.data.data.content
|
||||
this.editVisible = true
|
||||
this.editAllData = Object.assign({}, emData)
|
||||
this.editAllData.certificateType = String(emData.certificateType)
|
||||
})
|
||||
},
|
||||
// 提交修改
|
||||
handleEditok() {
|
||||
this.$refs.editAllData.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$refs.editAllData2.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$refs.editAllData3.validate((valid) => {
|
||||
if (valid) {
|
||||
this.editAllData.regionId = this.regionId[this.regionId.length - 1]
|
||||
console.log(this.repositoryid2)
|
||||
if (this.repositoryid2 === '') {
|
||||
console.log(123)
|
||||
this.editAllData.repositoryid2 = 0
|
||||
this.editAllData.provinceid = this.provinceid
|
||||
this.editAllData.cityid = this.cityid
|
||||
updateemp(this.editAllData).then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
this.$notify({
|
||||
title: '操作成功',
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
offset: 100
|
||||
})
|
||||
this.$refs.editAllData.clearValidate()
|
||||
this.$refs.editAllData2.clearValidate()
|
||||
this.$refs.editAllData3.clearValidate()
|
||||
this.$refs.editAllData.resetFields()
|
||||
this.$refs.editAllData2.resetFields()
|
||||
this.$refs.editAllData3.resetFields()
|
||||
this.getlist()
|
||||
this.editVisible = false
|
||||
} else {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: '出错了',
|
||||
offset: 100
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.editAllData.repositoryid2 = this.repositoryid2
|
||||
this.editAllData.provinceid = this.provinceid
|
||||
this.editAllData.cityid = this.cityid
|
||||
updateemp(this.editAllData).then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
this.$notify({
|
||||
title: '操作成功',
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
offset: 100
|
||||
})
|
||||
this.$refs.editAllData.clearValidate()
|
||||
this.$refs.editAllData2.clearValidate()
|
||||
this.$refs.editAllData3.clearValidate()
|
||||
this.$refs.editAllData.resetFields()
|
||||
this.$refs.editAllData2.resetFields()
|
||||
this.$refs.editAllData3.resetFields()
|
||||
this.getlist()
|
||||
this.editVisible = false
|
||||
} else {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: '出错了',
|
||||
offset: 100
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: '信息未填完整',
|
||||
offset: 100
|
||||
})
|
||||
return false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: '信息未填完整',
|
||||
offset: 100
|
||||
})
|
||||
return false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: '信息未填完整',
|
||||
offset: 100
|
||||
})
|
||||
return false
|
||||
this.personalForm = Object.assign({}, emData)
|
||||
if (emData.certificateType !== null && emData.certificateType !== undefined && emData.certificateType !== '') {
|
||||
this.personalForm.certificateType = String(emData.certificateType)
|
||||
}
|
||||
if (emData.roleId !== null && emData.roleId !== undefined && emData.roleId !== '') {
|
||||
this.personalForm.roleId = String(emData.roleId)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
handlecancel() {
|
||||
this.$refs.editAllData.clearValidate()
|
||||
this.$refs.editAllData2.clearValidate()
|
||||
this.$refs.editAllData3.clearValidate()
|
||||
this.$refs.editAllData.resetFields()
|
||||
this.$refs.editAllData2.resetFields()
|
||||
this.$refs.editAllData3.resetFields()
|
||||
this.editVisible = false
|
||||
},
|
||||
// 批量操作
|
||||
handleSelectionChange(val) {
|
||||
this.moreaction = val
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getcountrylist, getprovincelist, getcitylist, regionlist, searchRepository, getDetailById } from '@/api/public'
|
||||
import { getcountrylist, getprovincelist, getcitylist, regionlist, searchRepository, getDetailById, saveRegion } from '@/api/public'
|
||||
import { getdeptlist, register, searchEmpCategory } from '@/api/EmployeeInformation'
|
||||
import permission from '@/directive/permission/index.js' // 权限判断指令
|
||||
import checkPermission from '@/utils/permission' // 权限判断函数
|
||||
|
@ -487,6 +487,11 @@ export default {
|
|||
register(form3).then(res => {
|
||||
console.log(res)
|
||||
if (res.data.ret === 200) {
|
||||
saveRegion(this.companyForm.regionid, form3.regionid1).then(res => {
|
||||
if (res.dat.ret === 200) {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '保存成功',
|
||||
|
|
|
@ -1,183 +1,262 @@
|
|||
<template>
|
||||
<el-dialog :visible.sync="dialog" :dialog="dialog" top="10px" title="修改员工">
|
||||
<!--个人信息-->
|
||||
<h2 ref="geren" class="form-name">个人信息</h2>
|
||||
<div class="container">
|
||||
<el-form ref="editAllData" :model="editAllData" :rules="editAllDataRules" :inline="true" status-icon class="demo-ruleForm" label-position="top" label-width="300px" style="margin-left: 30px;">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.account')" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model="editAllData.account" :disabled="true" placeholder="请输入账号名"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.password')" prop="password" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model="editAllData.password" placeholder="请输入密码" autocomplete="new-password" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.lastname')" prop="firstName" style="width: 40%">
|
||||
<el-input v-model="editAllData.firstName" placeholder="请输入姓氏" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.middlename')" style="width: 40%">
|
||||
<el-input v-model="editAllData.middleName" placeholder="请输入中间名" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.firstname')" prop="lastName" style="width: 40%;">
|
||||
<el-input v-model="editAllData.lastName" placeholder="请输入名" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.birthday')" style="width: 40%">
|
||||
<el-date-picker
|
||||
v-model="editAllData.birthday"
|
||||
type="date"
|
||||
placeholder="选择生日"
|
||||
value-format="yyyy-MM-dd"
|
||||
clearable
|
||||
style="width: 100%"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.email')" prop="email" style="width: 40%">
|
||||
<el-input v-model="editAllData.email" placeholder="请输入邮箱地址" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.gender')" prop="gender" style="width: 40%">
|
||||
<el-radio-group v-model="editAllData.gender" style="width: 80%">
|
||||
<el-radio :label="1" style="width: 50%">{{ $t('NewEmployeeInformation.male') }}</el-radio>
|
||||
<el-radio :label="2">{{ $t('NewEmployeeInformation.female') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.certificatetype')" style="width: 40%">
|
||||
<el-select v-model="editAllData.certificateType" placeholder="请选择证件类型" style="width: 100%;">
|
||||
<el-option label="类型1" value="1"/>
|
||||
<el-option label="类型2" value="2"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.certificatenumber')" style="width: 40%">
|
||||
<el-input v-model="editAllData.certificateNumber" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.country')" style="width: 40%">
|
||||
<el-input v-model="editAllData.countryName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editcountry')" style="width: 40%">
|
||||
<el-select v-model="editAllData.countryid" placeholder="请选择国籍" style="width: 100%;" @change ="handlechange">
|
||||
<el-option
|
||||
v-for="(item, index) in nations"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--联系信息-->
|
||||
<h2 ref="lianxi" class="form-name">联系信息</h2>
|
||||
<div class="container">
|
||||
<el-form ref="editAllData2" :model="editAllData" :rules="editAllDataRules" :inline="true" status-icon class="demo-ruleForm" label-position="top" label-width="300px" style="margin-left: 30px;">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.address')" prop="address" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model="editAllData.address" placeholder="请输入地址" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.phone')" prop="phone" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model.number="editAllData.phone" placeholder="请输入手机号" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.provinceid')" style="width: 40%;margin-top: 1%">
|
||||
<el-input v-model="editAllData.provinceName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editprovinceid')" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="provinceid" placeholder="请选择省" style="width: 100%;" @change="handlechange2">
|
||||
<el-option
|
||||
v-for="(item, index) in provinces"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.cityid')" style="width: 40%;margin-top: 1%">
|
||||
<el-input v-model="editAllData.cityName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editcityid')" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="cityid" placeholder="请选择市" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="(item, index) in cities"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-dialog :visible.sync="editVisible" :editcontrol="editcontrol" :editdata="editdata" :close-on-press-escape="false" :title="personalForm.id +' 修改'" width="1010px" class="edit" top="-10px" @close="$emit('update:editcontrol', false)">
|
||||
<!--基本信息-->
|
||||
<el-card class="box-card" style="margin-top: 63px" shadow="never">
|
||||
<h2 ref="geren" class="form-name" style="font-size: 16px;color: #606266;margin-top: -5px;">基本信息</h2>
|
||||
<div class="container" style="margin-top: 37px">
|
||||
<el-form ref="personalForm" :model="personalForm" :rules="personalrules" :inline="true" status-icon class="demo-ruleForm" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.account')" prop="account" style="width: 100%;">
|
||||
<el-input v-model="personalForm.account" placeholder="请输入账号名" disabled style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.password')" prop="password" style="width: 100%;">
|
||||
<el-input v-model="personalForm.password" placeholder="请输入密码" clearable style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.lastname')" prop="firstName" style="width: 100%;">
|
||||
<el-input v-model="personalForm.firstName" placeholder="请输入姓氏" clearable style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.middlename')" style="width: 100%;">
|
||||
<el-input v-model="personalForm.middleName" placeholder="请输入中间名" clearable style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.firstname')" prop="lastName" style="width: 100%;">
|
||||
<el-input v-model="personalForm.lastName" placeholder="请输入名" clearable style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.birthday')" style="width: 100%;">
|
||||
<el-date-picker
|
||||
v-model="personalForm.birthday"
|
||||
type="date"
|
||||
placeholder="选择生日"
|
||||
value-format="yyyy-MM-dd"
|
||||
clearable
|
||||
style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.email')" prop="email" style="width: 100%;">
|
||||
<el-input v-model="personalForm.email" placeholder="请输入邮箱地址" clearable style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.gender')" prop="gender" style="width: 100%;">
|
||||
<el-radio-group v-model="personalForm.gender" style="margin-left: 18px;width: 200px">
|
||||
<el-radio :label="1" style="width: 120px">{{ $t('NewEmployeeInformation.male') }}</el-radio>
|
||||
<el-radio :label="2">{{ $t('NewEmployeeInformation.female') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.certificatetype')" style="width: 100%;">
|
||||
<el-select v-model="personalForm.certificateType" placeholder="请选择证件类型" style="margin-left: 18px;width: 200px">
|
||||
<el-option label="类型1" value="1"/>
|
||||
<el-option label="类型2" value="2"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.certificatenumber')" style="width: 100%;">
|
||||
<el-input v-model="personalForm.certificateNumber" clearable style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.country')" prop="countryId" style="width: 100%;">
|
||||
<el-select v-model="personalForm.countryId" placeholder="请选择国籍" style="margin-left: 18px;width: 200px" @change ="handlechange" @focus="getnationlist">
|
||||
<el-option
|
||||
v-for="(item, index) in nations"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
<!--子件信息-->
|
||||
<el-card class="box-card" shadow="never" style="margin-top: 15px">
|
||||
<h2 ref="lianxi" class="form-name">联系信息</h2>
|
||||
<div class="container" style="margin-top: 37px">
|
||||
<el-form ref="connectForm" :model="personalForm" :rules="connectrules" :inline="true" status-icon class="demo-ruleForm" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.address')" prop="address" style="width: 100%;">
|
||||
<el-input v-model="personalForm.address" placeholder="请输入地址" clearable style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.phone')" prop="phone" style="width: 100%;">
|
||||
<el-input v-model.number="personalForm.phone" placeholder="请输入手机号" clearable style="margin-left: 18px;width: 200px"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.provinceid')" prop="provinceId" style="width: 100%;">
|
||||
<el-select v-model="personalForm.provinceId" placeholder="请选择省" style="margin-left: 18px;width: 200px" @change="handlechange2">
|
||||
<el-option
|
||||
v-for="(item, index) in provinces"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.cityid')" prop="cityId" style="width: 100%;">
|
||||
<el-select v-model="personalForm.cityId" placeholder="请选择市" style="margin-left: 18px;width: 200px">
|
||||
<el-option
|
||||
v-for="(item, index) in cities"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
<!--公司信息-->
|
||||
<h2 class="form-name">公司信息</h2>
|
||||
<div class="container">
|
||||
<el-form ref="editAllData3" :model="editAllData" :rules="editAllDataRules" :inline="true" status-icon class="demo-ruleForm" label-position="top" label-width="300px" style="margin-left: 30px;">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.jobnumber')" style="width: 40%;margin-top:1%">
|
||||
<el-input v-model.number="editAllData.jobNumber" :disabled="true" placeholder="请输入工号"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.postid')" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="editAllData.postId" :value="editAllData.postId" placeholder="请选择职称" style="width: 100%;">
|
||||
<el-option label="xxx" value="1"/>
|
||||
<el-option label="xxx" value="2"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.deptid')" prop="deptId" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="editAllData.deptId" placeholder="请选择部门" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="(item, index) in depts2"
|
||||
:key="index"
|
||||
:label="item.deptName"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.regionid')" style="width: 40%;margin-top: 1%">
|
||||
<el-input v-model="editAllData.regionName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editregionid')" style="width: 40%;margin-top: 1%">
|
||||
<el-cascader
|
||||
:options="regions2"
|
||||
:props="props2"
|
||||
v-model="regionId"
|
||||
:show-all-levels="false"
|
||||
change-on-select
|
||||
filterable
|
||||
clearable
|
||||
style="width: 100%;"
|
||||
@change="handlechange4"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.repositoryid')" style="width: 40%;margin-top: 1%">
|
||||
<el-input v-model="editAllData.repositoryName" :disabled="true" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('NewEmployeeInformation.editrepositoryid')" style="width: 40%;margin-top: 1%">
|
||||
<el-select v-model="repositoryid2" filterable style="width: 100%;">
|
||||
<el-option
|
||||
v-for="(item, index) in repositories2"
|
||||
:key="index"
|
||||
:label="item.repositoryName"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="buttons" style="margin-top: 20px;margin-left: 30px">
|
||||
<el-button type="primary" @click="handleEditok()">修改</el-button>
|
||||
<el-button type="danger" @click="handlecancel()">取消</el-button>
|
||||
</div>
|
||||
<el-card class="box-card" shadow="never" style="margin-top: 15px">
|
||||
<h2 class="form-name">公司信息</h2>
|
||||
<div class="container" style="margin-top: 37px">
|
||||
<el-form ref="companyForm" :model="personalForm" :rules="companyrules" :inline="true" status-icon class="demo-ruleForm" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.jobnumber')" style="width: 100%;">
|
||||
<el-input v-model.number="personalForm.jobNumber" placeholder="请输入工号" style="margin-left: 18px;width: 200px" disabled/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.postid')" style="width: 100%;">
|
||||
<el-select v-model="personalForm.postId" :value="personalForm.postId" placeholder="请选择职位" style="margin-left: 18px;width: 200px" @focus="getnationlist">
|
||||
<el-option
|
||||
v-for="(item, index) in jobs"
|
||||
:key="index"
|
||||
:label="item.categoryName"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.deptid')" prop="deptId" style="width: 100%;">
|
||||
<el-select v-model="personalForm.deptId" placeholder="请选择部门" style="margin-left: 18px;width: 200px" @focus="getnationlist">
|
||||
<el-option
|
||||
v-for="(item, index) in depts"
|
||||
:key="index"
|
||||
:label="item.deptName"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.regionid')" prop="regionId" style="width: 100%;">
|
||||
<el-cascader
|
||||
:options="regions"
|
||||
:props="props"
|
||||
v-model="regionId"
|
||||
:show-all-levels="false"
|
||||
placeholder="请选择区域"
|
||||
change-on-select
|
||||
filterable
|
||||
clearable
|
||||
style="margin-left: 18px;width: 200px"
|
||||
@change="handlechange4"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('NewEmployeeInformation.repositoryid')" style="width: 100%;">
|
||||
<el-select v-model="personalForm.repositoryId" placeholder="请选择门店" filterable style="margin-left: 18px;width: 200px">
|
||||
<el-option
|
||||
v-for="(item, index) in repositories"
|
||||
:key="index"
|
||||
:label="item.repositoryName"
|
||||
:value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="box-card" shadow="never" style="margin-top: 15px;margin-bottom: 40px">
|
||||
<h2 class="form-name">角色信息</h2>
|
||||
<div class="container" style="margin-top: 37px">
|
||||
<el-row>
|
||||
<el-radio-group v-model="personalForm.roleId" style="width: 100%">
|
||||
<el-col v-for="(item, index) in roleNames" :key="index" :span="12" style="text-align: center">
|
||||
<el-radio :label="item.id" style="width: 100%">{{ item.name }}</el-radio>
|
||||
</el-col>
|
||||
</el-radio-group>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="box-card" style="position: fixed;width: 1010px;z-index: 100;height: 74px;bottom: 0;" shadow="never">
|
||||
<div class="buttons" style="float: right;padding-bottom: 10px">
|
||||
<el-button @click="handlecancel()">取消</el-button>
|
||||
<el-button type="primary" @click="handleEditok()">保存</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { searchRepository, getprovincelist, getcitylist } from '@/api/public'
|
||||
import { updateemp } from '@/api/EmployeeInformation'
|
||||
import { getcountrylist, getprovincelist, getcitylist, regionlist, searchRepository, getDetailById, getRegion, saveRegion } from '@/api/public'
|
||||
import { getdeptlist, updateemp, searchEmpCategory } from '@/api/EmployeeInformation'
|
||||
export default {
|
||||
name: 'Mydialog',
|
||||
props: {
|
||||
dialog: {
|
||||
editcontrol: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
editdata: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
var checkphone = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
const checkphone = (rule, value, callback) => {
|
||||
if (!this.personalForm.phone) {
|
||||
return callback(new Error('手机号不能为空'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number(this.personalForm.phone)) {
|
||||
callback(new Error('请输入数字值'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
return {
|
||||
// 控制修改页面
|
||||
editVisible: false,
|
||||
// 修改数据
|
||||
// 选择的区域数据
|
||||
regionId: [],
|
||||
// 选择的数据
|
||||
choosedata: [],
|
||||
// 弹窗组件的控制
|
||||
editVisible: this.editcontrol,
|
||||
// 修改信息数据
|
||||
personalForm: this.editdata,
|
||||
// 角色数据
|
||||
roleNames: [],
|
||||
radio2: 3,
|
||||
// 职位搜索时参数
|
||||
jobCat: {
|
||||
type: 2,
|
||||
pagenum: 1,
|
||||
pagesize: 9999
|
||||
},
|
||||
// 职位列表
|
||||
jobs: [],
|
||||
// 国家列表
|
||||
nations: [],
|
||||
// 省列表
|
||||
|
@ -185,55 +264,21 @@ export default {
|
|||
// 城市列表
|
||||
cities: [],
|
||||
// 区域列表
|
||||
regions2: [],
|
||||
regions: [],
|
||||
// 门店列表
|
||||
repositories2: [],
|
||||
repositories: [],
|
||||
// 部门列表
|
||||
depts2: [],
|
||||
depts: [],
|
||||
// 区域列表字段更改
|
||||
props2: {
|
||||
props: {
|
||||
value: 'id',
|
||||
label: 'regionName',
|
||||
children: 'regionListVos'
|
||||
},
|
||||
// 区域特殊字段
|
||||
FormRegionId: [],
|
||||
// 修改全部信息
|
||||
editAllData: {
|
||||
// 个人信息
|
||||
account: '',
|
||||
password: '',
|
||||
firstName: '',
|
||||
middleName: '',
|
||||
lastName: '',
|
||||
birthday: '',
|
||||
email: '',
|
||||
gender: '',
|
||||
certificateType: '',
|
||||
certificateNumber: '',
|
||||
countryid: '',
|
||||
// 联系信息
|
||||
address: '',
|
||||
phone: '',
|
||||
provinceId: '',
|
||||
cityid: '',
|
||||
provinceName: '',
|
||||
cityName: '',
|
||||
// 公司信息
|
||||
jobNumber: '',
|
||||
postId: '',
|
||||
deptId: '',
|
||||
regionName: '',
|
||||
repositoryName: ''
|
||||
},
|
||||
regionId: [],
|
||||
repositoryid2: '',
|
||||
provinceid: '',
|
||||
cityid: '',
|
||||
editAllDataRules: {
|
||||
// 个人信息规则数据
|
||||
password: [
|
||||
{ message: '请正确输入密码长度', trigger: 'blur' },
|
||||
// 个人信息规则数据
|
||||
personalrules: {
|
||||
passwd: [
|
||||
{ required: true, message: '请正确输入密码长度', trigger: 'blur' },
|
||||
{ min: 6, max: 100, message: '密码长度要大于6个字符', trigger: 'blur' }
|
||||
],
|
||||
account: [
|
||||
|
@ -252,43 +297,153 @@ export default {
|
|||
{ required: true, message: '请选择工作地区', trigger: 'change' }
|
||||
],
|
||||
email: [
|
||||
{ type: 'email', message: '请输入正确邮箱号', trigger: 'blur' },
|
||||
{ required: true, type: 'email', message: '请输入正确邮箱号', trigger: 'blur' },
|
||||
{ min: 1, message: '请输入正确邮箱号', trigger: 'blur' }
|
||||
],
|
||||
// 联系信息规则数据
|
||||
]
|
||||
},
|
||||
// 联系信息数据
|
||||
connectForm: {
|
||||
address: '',
|
||||
phone: '',
|
||||
provinceid: '',
|
||||
cityid: ''
|
||||
},
|
||||
// 联系信息规则数据
|
||||
connectrules: {
|
||||
address: [
|
||||
{ required: true, message: '请输入地址', trigger: 'blur' }
|
||||
],
|
||||
Provinces: [
|
||||
provinceId: [
|
||||
{ required: true, message: '请选择省', trigger: 'change' }
|
||||
],
|
||||
City: [
|
||||
cityId: [
|
||||
{ required: true, message: '请选择市', trigger: 'change' }
|
||||
],
|
||||
phone: [
|
||||
{ required: true, validator: checkphone, trigger: 'change' }
|
||||
],
|
||||
// 公司信息规则数据
|
||||
]
|
||||
},
|
||||
// 公司信息数据
|
||||
companyForm: {
|
||||
jobnumber: '',
|
||||
postid: '',
|
||||
deptid: '',
|
||||
regionid: [],
|
||||
repositoryid: ''
|
||||
},
|
||||
// 公司信息规则数据
|
||||
companyrules: {
|
||||
deptId: [
|
||||
{ required: true, message: '请选择部门', trigger: 'change' }
|
||||
],
|
||||
regionId: [
|
||||
{ required: true, message: '请选择区域', trigger: 'change' }
|
||||
],
|
||||
Repository: [
|
||||
repositoryId: [
|
||||
{ required: true, message: '请选择门店', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
editcontrol() {
|
||||
this.editVisible = this.editcontrol
|
||||
},
|
||||
editdata() {
|
||||
this.personalForm = this.editdata
|
||||
this.getnationlist()
|
||||
this.handlechange(this.personalForm.countryId)
|
||||
this.handlechange2(this.personalForm.provinceId)
|
||||
getRegion(this.personalForm.regionId).then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
if (res.data.data.content.zcc !== null && res.data.data.content.zcc !== '' && res.data.data.content.zcc !== undefined) {
|
||||
const zhuz = res.data.data.content.zcc.split(',')
|
||||
this.regionId = zhuz.map(function(item) {
|
||||
return parseInt(item)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
this.handlechange4(this.personalForm.regionId)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getnationlist()
|
||||
this.getroleName()
|
||||
},
|
||||
methods: {
|
||||
async getroleName() {
|
||||
console.log(this.$store.getters)
|
||||
const rolesIds = this.$store.getters.roles
|
||||
const rolesfilter = rolesIds.filter(function(elem) {
|
||||
return (elem.indexOf('1-2-3') !== -1)
|
||||
})
|
||||
const needRolesId = rolesfilter.map(function(item) {
|
||||
return (item.replace('1-2-3-', ''))
|
||||
})
|
||||
const list = await Promise.all(needRolesId.map(function(item) {
|
||||
return getDetailById(item).then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
return res.data.data.content[0]
|
||||
}
|
||||
})
|
||||
}))
|
||||
const listRoleName = list.filter(function(ele) {
|
||||
return (ele.name.indexOf('-') !== -1)
|
||||
})
|
||||
console.log(listRoleName)
|
||||
const sss2 = listRoleName.map(function(item) {
|
||||
return item.name
|
||||
})
|
||||
const sss3 = sss2.map(function(item) {
|
||||
return {
|
||||
id: item.split('-')[0],
|
||||
name: item.split('-')[1]
|
||||
}
|
||||
})
|
||||
this.roleNames = sss3
|
||||
},
|
||||
// 国籍列表
|
||||
getnationlist() {
|
||||
getcountrylist().then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
this.nations = res.data.data.content
|
||||
} else {
|
||||
console.log('国家列表出错')
|
||||
}
|
||||
})
|
||||
// 区域列表数据
|
||||
regionlist().then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
this.regions = this.tranKTree(res.data.data.content)
|
||||
} else {
|
||||
console.log('区域列表出错')
|
||||
}
|
||||
})
|
||||
// 部门列表数据
|
||||
getdeptlist().then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
this.depts = res.data.data.content
|
||||
} else {
|
||||
console.log('部门列表出错')
|
||||
}
|
||||
})
|
||||
// 职位列表数据
|
||||
searchEmpCategory(this.jobCat).then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
this.jobs = res.data.data.content.list
|
||||
} else {
|
||||
console.log('职位列表出错')
|
||||
}
|
||||
})
|
||||
},
|
||||
// 根据国家选择省
|
||||
handlechange(val) {
|
||||
console.log(val)
|
||||
val = this.editAllData.countryId
|
||||
getprovincelist(val).then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
this.provinces = res.data.data.content
|
||||
} else {
|
||||
console.log('国家选择省出错')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -298,91 +453,79 @@ export default {
|
|||
console.log(res)
|
||||
if (res.data.ret === 200) {
|
||||
this.cities = res.data.data.content
|
||||
} else {
|
||||
console.log('省选择市出错')
|
||||
}
|
||||
})
|
||||
},
|
||||
// 转化数据方法
|
||||
tranKTree(arr) {
|
||||
if (!arr || !arr.length) return
|
||||
return arr.map(item => ({
|
||||
id: item.id,
|
||||
regionName: item.regionName,
|
||||
regionListVos: this.tranKTree(item.regionListVos)
|
||||
}))
|
||||
},
|
||||
// 根据区域选择门店
|
||||
handlechange4(val) {
|
||||
const finalid = val[val.length - 1]
|
||||
searchRepository(finalid).then(res => {
|
||||
console.log(res)
|
||||
if (res.data.ret === 200) {
|
||||
this.repositories = res.data.data.content.list
|
||||
this.repositories2 = res.data.data.content.list
|
||||
} else {
|
||||
this.$message.error('出错了')
|
||||
console.log('区域选择门店')
|
||||
}
|
||||
})
|
||||
},
|
||||
// 拼接json
|
||||
extend(jsonbject1, jsonbject2) {
|
||||
var resultJsonObject = {}
|
||||
for (const attr in jsonbject1) {
|
||||
resultJsonObject[attr] = jsonbject1[attr]
|
||||
}
|
||||
for (const attr in jsonbject2) {
|
||||
resultJsonObject[attr] = jsonbject2[attr]
|
||||
}
|
||||
return resultJsonObject
|
||||
},
|
||||
// 提交修改
|
||||
handleEditok() {
|
||||
this.$refs.editAllData.validate((valid) => {
|
||||
this.personalForm.modifyPersonId = this.$store.getters.userId
|
||||
if (this.regionId !== '' && this.regionId !== null && this.regionId !== undefined) {
|
||||
this.personalForm.regionId = this.regionId[this.regionId.length - 1]
|
||||
}
|
||||
this.$refs.personalForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$refs.editAllData2.validate((valid) => {
|
||||
this.$refs.connectForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$refs.editAllData3.validate((valid) => {
|
||||
this.$refs.companyForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.editAllData.regionId = this.regionId[this.regionId.length - 1]
|
||||
console.log(this.repositoryid2)
|
||||
if (this.repositoryid2 === '') {
|
||||
console.log(123)
|
||||
this.editAllData.repositoryid2 = 0
|
||||
this.editAllData.provinceid = this.provinceid
|
||||
this.editAllData.cityid = this.cityid
|
||||
updateemp(this.editAllData).then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
this.$notify({
|
||||
title: '操作成功',
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
offset: 100
|
||||
})
|
||||
this.$refs.editAllData.clearValidate()
|
||||
this.$refs.editAllData2.clearValidate()
|
||||
this.$refs.editAllData3.clearValidate()
|
||||
this.$refs.editAllData.resetFields()
|
||||
this.$refs.editAllData2.resetFields()
|
||||
this.$refs.editAllData3.resetFields()
|
||||
this.getlist()
|
||||
this.editVisible = false
|
||||
} else {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: '出错了',
|
||||
offset: 100
|
||||
})
|
||||
updateemp(this.personalForm).then(res => {
|
||||
saveRegion(this.regionId, this.personalForm.regionId).then(res => {
|
||||
if (res.dat.ret === 200) {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.editAllData.repositoryid2 = this.repositoryid2
|
||||
this.editAllData.provinceid = this.provinceid
|
||||
this.editAllData.cityid = this.cityid
|
||||
updateemp(this.editAllData).then(res => {
|
||||
if (res.data.ret === 200) {
|
||||
this.$notify({
|
||||
title: '操作成功',
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
offset: 100
|
||||
})
|
||||
this.$refs.editAllData.clearValidate()
|
||||
this.$refs.editAllData2.clearValidate()
|
||||
this.$refs.editAllData3.clearValidate()
|
||||
this.$refs.editAllData.resetFields()
|
||||
this.$refs.editAllData2.resetFields()
|
||||
this.$refs.editAllData3.resetFields()
|
||||
this.getlist()
|
||||
this.editVisible = false
|
||||
} else {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
message: '出错了',
|
||||
offset: 100
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
if (res.data.ret === 200) {
|
||||
this.$notify({
|
||||
title: '修改成功',
|
||||
message: '修改成功',
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
offset: 100
|
||||
})
|
||||
this.$refs.personalForm.resetFields()
|
||||
this.$refs.connectForm.resetFields()
|
||||
this.$refs.companyForm.resetFields()
|
||||
this.$refs.personalForm.clearValidate()
|
||||
this.$refs.connectForm.clearValidate()
|
||||
this.$refs.companyForm.clearValidate()
|
||||
this.$emit('rest', true)
|
||||
this.editVisible = false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$notify.error({
|
||||
title: '错误',
|
||||
|
@ -413,18 +556,33 @@ export default {
|
|||
},
|
||||
// 取消按钮
|
||||
handlecancel() {
|
||||
this.$refs.editAllData.clearValidate()
|
||||
this.$refs.editAllData2.clearValidate()
|
||||
this.$refs.editAllData3.clearValidate()
|
||||
this.$refs.editAllData.resetFields()
|
||||
this.$refs.editAllData2.resetFields()
|
||||
this.$refs.editAllData3.resetFields()
|
||||
this.$refs.personalForm.resetFields()
|
||||
this.$refs.connectForm.resetFields()
|
||||
this.$refs.companyForm.resetFields()
|
||||
this.$refs.personalForm.clearValidate()
|
||||
this.$refs.connectForm.clearValidate()
|
||||
this.$refs.companyForm.clearValidate()
|
||||
this.editVisible = false
|
||||
}
|
||||
// 修改操作结束 -------------------------------------------------
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.container >>> .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before{
|
||||
margin-left: -10px;
|
||||
}
|
||||
.container >>> .el-form-item__label{
|
||||
text-align: left;
|
||||
}
|
||||
.container >>> .el-form-item__label{
|
||||
color: #60626696;
|
||||
}
|
||||
.edit >>> .el-dialog {
|
||||
background:#f1f1f1 ;
|
||||
}
|
||||
.el-col-12{
|
||||
width: 49%;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue