企业管理-员工管理

This commit is contained in:
xiao-fajia 2024-08-13 10:42:55 +08:00
parent 8a8bb098f0
commit 8ae61b472c
9 changed files with 517 additions and 113 deletions

View File

@ -67,3 +67,20 @@ export function getStaffList(){
method: 'get' method: 'get'
}) })
} }
// 验证工号是否重复
export function checkWorkNo(workNo){
return request({
url: '/company/staff/checkWorkNo?workNo=' + workNo,
method: 'get'
})
}
// 重置密码
export function resetPassword(data){
return request({
url: '/company/staff/resetPassword',
method: 'post',
data
})
}

View File

@ -9,10 +9,11 @@ export function createStaffChange(data) {
}) })
} }
// 获取企业管理-员工交接信息及交接双方信息 // 获取企业管理-员工交接信息分页
export function getChangeStaff(id) { export function getStaffChangePage(params) {
return request({ return request({
url: '/company/staffChange/changeItem?id=' + id, url: '/company/staffChange/page',
method: 'get', method: 'get',
params
}) })
} }

View File

@ -118,6 +118,10 @@ export const DICT_TYPE = {
// ------- 企业管理模块 ------- // ------- 企业管理模块 -------
// 员工学历 // 员工学历
COMPANY_STAFF_EDU: 'company_staff_edu', COMPANY_STAFF_EDU: 'company_staff_edu',
// 员工工作交接状态
STAFF_CHANGE_STATUS: 'staff_change_status',
// 员工工作交接类型
STAFF_CHANGE_TYPE: 'staff_change_type',
// ------- 资产管理模块 ------- // ------- 资产管理模块 -------
//资产处置方式 //资产处置方式

View File

@ -10,27 +10,36 @@
<el-select <el-select
v-model="formData.newUserId" v-model="formData.newUserId"
placeholder="请选择接收方" placeholder="请选择接收方"
filterable
style="width: 100%"
clearable
:filter-method="searchOption"
> >
<el-option <el-option
v-for="(item, index) in newStaff" v-for="item in options"
:key="index" :key="item.userId"
:label="item.name" :label="item.name"
:value="item.userId" :value="item.userId"
> >
<div class="options">
<span>姓名:{{ item.name }}</span>
<span>工号:{{ item.workNo }}</span>
<span>手机:{{ item.tel }}</span>
</div>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="附件" prop="fileUrls">
<file-upload v-model="formData.fileUrls"></file-upload>
</el-form-item>
<el-form-item label="交接时间" prop="changeTime"> <el-form-item label="交接时间" prop="changeTime">
<el-date-picker clearable v-model="formData.changeTime" type="datetime" value-format="timestamp" <el-date-picker clearable v-model="formData.changeTime" type="date" value-format="timestamp"
placeholder="选择交接时间" placeholder="选择交接时间"
/> />
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark"/> <el-input v-model="formData.remark"/>
</el-form-item> </el-form-item>
<el-form-item label="附件" prop="fileUrls">
<file-upload v-model="formData.fileUrls"></file-upload>
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button> <el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
@ -69,17 +78,15 @@ export default {
// //
formRules: { formRules: {
newUserId: [{ required: true, message: '接收方不能为空', trigger: 'blur' }], newUserId: [{ required: true, message: '接收方不能为空', trigger: 'blur' }],
changeDate: [{ required: true, message: '接收方不能为空', trigger: 'blur' }] changeTime: [{ required: true, message: '交接时间不能为空', trigger: 'blur' }]
}, },
oldStaff: { oldStaff: {
name: '', name: '',
userId: '' userId: ''
}, },
newStaff: { newStaff: [],
name: '', staffChangList: [],
userId: '' options: [],
},
staffChangList: []
} }
}, },
methods: { methods: {
@ -87,19 +94,21 @@ export default {
async listStaff() { async listStaff() {
const res = await StaffApi.getStaffList() const res = await StaffApi.getStaffList()
this.newStaff = res.data.filter(item => item.userId !== this.oldStaff.userId) this.newStaff = res.data.filter(item => item.userId !== this.oldStaff.userId)
this.options = this.newStaff
}, },
/** 打开弹窗 */ /** 打开弹窗 */
async open(id) { async open(id) {
this.dialogVisible = true
this.reset() this.reset()
const res = await StaffApi.getStaff(id) const res = await StaffApi.getStaff(id)
this.oldStaff = res.data this.oldStaff = res.data
this.formData.oldUserId = this.oldStaff.userId this.formData.oldUserId = this.oldStaff.userId
this.formData.changeTime = new Date()
await this.listStaff() await this.listStaff()
this.dialogVisible = true
}, },
/** 提交按钮 */ /** 提交按钮 */
async submitForm() { async submitForm() {
// // //
await this.$refs['formRef'].validate() await this.$refs['formRef'].validate()
this.formLoading = true this.formLoading = true
try { try {
@ -117,10 +126,25 @@ export default {
fileUrls: undefined, fileUrls: undefined,
remark: undefined, remark: undefined,
oldUserId: undefined, oldUserId: undefined,
newUserId: undefined newUserId: undefined,
changeTime: undefined
} }
this.resetForm('formRef') this.resetForm('formRef')
},
searchOption(val) {
this.options = this.newStaff.filter(item => (
item.name.toLowerCase().includes(val.toLowerCase()) ||
item.workNo.includes(val) ||
item.tel.includes(val)
))
} }
} }
} }
</script> </script>
<style scoped lang="scss">
.options {
display: flex;
justify-content: space-between;
}
</style>

View File

@ -6,7 +6,7 @@
<el-row :gutter="2"> <el-row :gutter="2">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工号" prop="workNo"> <el-form-item label="工号" prop="workNo">
<el-input v-model="formData.workNo" placeholder="请输入工号"/> <el-input :disabled="!!formData.id" v-model="formData.workNo" placeholder="请输入工号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -25,82 +25,93 @@
<el-form-item label="性别" prop="sex"> <el-form-item label="性别" prop="sex">
<el-radio-group v-model="formData.sex"> <el-radio-group v-model="formData.sex">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)" <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)"
:key="dict.value" :label="dict.value">{{dict.label}}</el-radio> :key="dict.value" :label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="家庭住址" prop="address">
<el-input v-model="formData.address" placeholder="请输入家庭住址"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工龄" prop="workYear">
<el-input v-model="formData.workYear" placeholder="请输入工龄"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="司龄" prop="joinedYear">
<el-input v-model="formData.joinedYear" placeholder="请输入司龄"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="学历" prop="education">
<el-select v-model="formData.education" placeholder="请选择学历">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMPANY_STAFF_EDU)"
:key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item v-if="formData.id === undefined" label="登录账号" prop="loginAccount">
<el-input v-model="formData.loginAccount" placeholder="请输入登录账号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item v-if="formData.id === undefined" label="登录密码" prop="password">
<el-input v-model="formData.password" placeholder="请输入登录密码" type="password" show-password />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2"> <el-row :gutter="2">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工作日期" prop="workDate"> <el-form-item label="工作日期" prop="workDate">
<el-date-picker clearable v-model="formData.workDate" type="date" value-format="timestamp" <el-date-picker clearable v-model="formData.workDate" type="date" value-format="timestamp"
placeholder="选择工作日期" placeholder="选择工作日期"
@blur="getWorkYear"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="入职日期" prop="joinedDate"> <el-form-item label="工龄(年)" prop="workYear">
<el-date-picker clearable v-model="formData.joinedDate" type="date" value-format="timestamp" <el-input disabled v-model="formData.workYear" placeholder="工龄"/>
placeholder="选择入职日期"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="入职日期" prop="joinedDate">
<el-date-picker clearable v-model="formData.joinedDate" type="date" value-format="timestamp"
placeholder="选择入职日期"
@blur="getJoinedYear"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="司龄(年)" prop="joinedYear">
<el-input disabled v-model="formData.joinedYear" placeholder="司龄"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item v-if="formData.id === undefined" label="登录账号" prop="loginAccount">
<el-input v-model="formData.loginAccount" placeholder="请输入登录账号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item v-if="formData.id === undefined" label="登录密码" prop="password">
<el-input v-model="formData.password" placeholder="请输入登录密码" type="password" show-password/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="学历" prop="education">
<el-select v-model="formData.education" placeholder="请选择学历">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMPANY_STAFF_EDU)"
:key="dict.value" :label="dict.label" :value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="家庭住址" prop="address">
<el-input v-model="formData.address" placeholder="请输入家庭住址"/>
</el-form-item>
<el-form-item label="技能标签" prop="labelsArray"> <el-form-item label="技能标签" prop="labelsArray">
<el-select <el-select
style="width: 310px" style="width: 100%"
filterable filterable
allow-create allow-create
v-model="formData.labelsArray" multiple placeholder="请选择技能标签"> v-model="formData.labelsArray" multiple placeholder="请选择技能标签"
>
<el-option <el-option
v-for="(item, index) in labelOptions" v-for="(item, index) in labelOptions"
:key="index" :key="index"
:label="item.labelName" :label="item.labelName"
:value="item.labelName"> :value="item.labelName"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="个人简介"> <el-form-item label="个人简介" prop="content">
<Editor v-model="formData.content" :min-height="192"/> <el-input
type="textarea"
:autosize="{ minRows: 2, maxRows: 5}"
placeholder="请输入内容"
v-model="formData.content"
>
</el-input>
</el-form-item> </el-form-item>
<el-form-item label="附件" prop="fileUrls"> <el-form-item label="附件" prop="fileUrls">
<file-upload v-model="formData.fileUrls"></file-upload> <file-upload v-model="formData.fileUrls"></file-upload>
@ -126,6 +137,10 @@ export default {
FileUpload FileUpload
}, },
data() { data() {
const validateWorkNo = async(rule, value, callback) => {
const res = await StaffApi.checkWorkNo(value)
return res.data ? callback() : !this.formData.id ? callback(new Error()) : callback
}
return { return {
// //
dialogTitle: '', dialogTitle: '',
@ -142,7 +157,7 @@ export default {
workNo: undefined, workNo: undefined,
name: undefined, name: undefined,
tel: undefined, tel: undefined,
sex: undefined, sex: "1",
address: undefined, address: undefined,
workDate: undefined, workDate: undefined,
workYear: undefined, workYear: undefined,
@ -154,47 +169,68 @@ export default {
fileUrls: undefined, fileUrls: undefined,
loginAccount: undefined, loginAccount: undefined,
password: undefined, password: undefined,
labelsArray: undefined, labelsArray: undefined
}, },
// //
formRules: { formRules: {
workNo: [{required: true, message: "工号不能为空", trigger: 'blur'}], workNo: [
name: [{required: true, message: "姓名不能为空", trigger: 'blur'}], { required: true, message: '工号不能为空', trigger: 'blur' },
tel: [ { validator: validateWorkNo, message: '工号已存在', trigger: 'blur' }
{required: true, message: "手机号不能为空", trigger: 'blur'}, ],
{ pattern: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,message: '请输入正确的手机号', trigger: ["blur", "change"] }, name: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
tel: [
{ required: true, message: '手机号不能为空', trigger: 'blur' },
{
pattern: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
message: '请输入正确的手机号',
trigger: ['blur', 'change']
}
],
sex: [{ required: true, message: '性别不能为空', trigger: 'blur' }],
address: [{ required: true, message: '家庭住址不能为空', trigger: 'blur' }],
workYear: [{ required: true, message: '工龄不能为空', trigger: 'blur' }],
joinedYear: [{ required: true, message: '司龄不能为空', trigger: 'blur' }],
education: [{ required: true, message: '学历不能为空', trigger: 'blur' }],
loginAccount: [
{ required: true, message: '登录账号不能为空', trigger: 'blur' },
{ min: 6, max: 20, message: '登录账号长度在6~20个字符', trigger: 'blur'}
],
password: [
{ required: true, message: '登录密码不能为空', trigger: 'blur' },
{ min: 6, max: 20, message: "登录密码长度在6~20个字符", trigger: 'blur'},
{
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+{}\[\]:;<>,.?~\\-])\S{6,}$/,
message: '登录密码必须由大小写字母、数字、特殊字符组成',
trigger: 'blur'
}
], ],
sex: [{required: true, message: "性别不能为空", trigger: 'blur'}],
address: [{required: true, message: "家庭住址不能为空", trigger: 'blur'}],
workYear: [{required: true, message: "工龄不能为空", trigger: 'blur'}],
joinedYear: [{required: true, message: "司龄不能为空", trigger: 'blur'}],
education: [{required: true, message: "学历不能为空", trigger: 'blur'}],
loginAccount: [{ required: true, message: '登录账号不能为空', trigger: 'blur' }],
password: [{ required: true, message: '登录密码不能为空', trigger: 'blur' }],
workDate: [{ required: true, message: '工作日期不能为空', trigger: 'blur' }], workDate: [{ required: true, message: '工作日期不能为空', trigger: 'blur' }],
joinedDate: [{ required: true, message: '入职日期不能为空', trigger: 'blur' }], joinedDate: [{ required: true, message: '入职日期不能为空', trigger: 'blur' }]
}, },
labelOptions:[], labelOptions: [],
nowDate: new Date()
} }
}, },
methods: { methods: {
/** 获取标签 */ /** 获取标签 */
async listLabels(){ async listLabels() {
try { try {
const res = await StaffApi.getLabels(); const res = await StaffApi.getLabels()
this.labelOptions = res.data.map(item => ({ this.labelOptions = res.data.map(item => ({
labelName: item.labelName, labelName: item.labelName
})) }))
}finally {} } finally {
}
}, },
/** 打开弹窗 */ /** 打开弹窗 */
async open(id) { async open(id) {
this.dialogVisible = true this.dialogVisible = true
this.dialogTitle = id ? "修改员工信息" : "新增员工信息" this.dialogTitle = id ? '修改员工信息' : '新增员工信息'
await this.listLabels(); await this.listLabels()
this.reset() this.reset()
// //
if (id) { if (id) {
this.formData.id = id;
this.formLoading = true this.formLoading = true
try { try {
const res = await StaffApi.getStaff(id) const res = await StaffApi.getStaff(id)
@ -242,7 +278,7 @@ export default {
workNo: undefined, workNo: undefined,
name: undefined, name: undefined,
tel: undefined, tel: undefined,
sex: undefined, sex: "1",
address: undefined, address: undefined,
workDate: undefined, workDate: undefined,
workYear: undefined, workYear: undefined,
@ -256,7 +292,30 @@ export default {
password: undefined password: undefined
} }
this.resetForm('formRef') this.resetForm('formRef')
} },
//
getWorkYear(){
this.formData.workYear = this.getYearsByDate(this.formData.workDate);
},
//
getJoinedYear(){
this.formData.joinedYear = this.getYearsByDate(this.formData.joinedDate);
},
//
getYearsByDate(date) {
if (!date) {
return '0'
}
const inputDate = new Date(date)
let years = this.nowDate.getFullYear() - inputDate.getFullYear()
if (
this.nowDate.getMonth() < inputDate.getMonth() ||
(this.nowDate.getMonth() === inputDate.getMonth() && this.nowDate.getDate() < inputDate.getDate())
) {
years--
}
return years >= 0 ? years : '0'
},
} }
} }
</script> </script>

View File

@ -0,0 +1,107 @@
<template>
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="40%" v-dialogDrag append-to-body>
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
<el-form-item label="姓名" prop="name">
<el-input v-model="formData.name" disabled />
</el-form-item>
<el-form-item label="工号" prop="workNo">
<el-input v-model="formData.workNo" disabled />
</el-form-item>
<el-form-item label="电话" prop="tel">
<el-input v-model="formData.tel" disabled />
</el-form-item>
<el-form-item label="新密码" prop="password">
<el-input type="password" v-model="formData.password" show-password placeholder="请输入新密码"/>
</el-form-item>
<el-form-item label="确认新密码" prop="newPassword">
<el-input type="password" v-model="formData.newPassword" show-password placeholder="确认新密码"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import * as StaffApi from '@/api/company/staff'
export default {
name: 'StaffResetPassword',
data() {
const validatePassword= async(rule, value, callback) => {
return this.formData.password === value ? callback() : callback(new Error());
}
return {
//
dialogTitle: '重置员工密码',
//
dialogVisible: false,
// 12
formLoading: false,
formData: {
name: undefined,
workNo: undefined,
tel: undefined,
password: undefined,
newPassword: undefined,
userId: undefined
},
formRules:{
password: [
{ required: true, message: '登录密码不能为空', trigger: 'blur' },
{ min: 6, max: 20, message: "登录密码长度在6~20个字符", trigger: 'blur'},
{
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+{}\[\]:;<>,.?~\\-])\S{6,}$/,
message: '登录密码必须由大小写字母、数字、特殊字符组成',
trigger: 'blur'
}
],
newPassword: [
{required: true, message: "登录密码不能为空", trigger: "blur"},
{validator: validatePassword, message: '再次输入的密码不一致', trigger: 'blur'}
]
},
}
},
methods: {
/** 表单重置 */
reset() {
this.formData = {
name: undefined,
workNo: undefined,
tel: undefined,
password: undefined,
newPassword: undefined,
userId: undefined,
}
this.resetForm('formRef')
},
/** 打开弹窗 */
async open(row) {
this.dialogVisible = true
this.reset();
this.formData = row
},
/** 提交表单 */
async submitForm() {
//
await this.$refs['formRef'].validate()
this.formLoading = true
try{
await StaffApi.resetPassword(this.formData)
this.$modal.msgSuccess('密码已重置')
this.dialogVisible = false
this.$emit('success')
} finally {
this.formLoading = false
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -90,18 +90,18 @@
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.sex"/> <dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.sex"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="家庭住址" align="center" prop="address" width="180"/> <el-table-column :show-overflow-tooltip="true" label="家庭住址" align="center" prop="address" width="180"/>
<el-table-column label="工龄" align="center" prop="workYear" width="180"/> <el-table-column label="工作日期" align="center" prop="workDate" width="180"/>
<el-table-column label="司龄" align="center" prop="joinedYear" width="180"/> <el-table-column label="工龄(年)" align="center" prop="workYear" width="180"/>
<el-table-column label="入职日期" align="center" prop="joinedDate" width="180"/>
<el-table-column label="司龄(年)" align="center" prop="joinedYear" width="180"/>
<el-table-column label="学历" align="center" prop="education" width="180"> <el-table-column label="学历" align="center" prop="education" width="180">
<template v-slot="scope"> <template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMPANY_STAFF_EDU" :value="scope.row.education"/> <dict-tag :type="DICT_TYPE.COMPANY_STAFF_EDU" :value="scope.row.education"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="个人简介" align="center" prop="content" width="180"/> <el-table-column :show-overflow-tooltip="true" label="个人简介" align="center" prop="content" width="180"/>
<el-table-column label="唯一推广码" align="center" prop="uniqueCode" width="180"/> <el-table-column label="唯一推广码" align="center" prop="uniqueCode" width="180"/>
<el-table-column label="工作日期" align="center" prop="workDate" width="180"/>
<el-table-column label="入职日期" align="center" prop="joinedDate" width="180"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="180"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="180">
<template v-slot="scope"> <template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)" <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
@ -125,6 +125,10 @@
v-hasPermi="['company:staff:query']" v-hasPermi="['company:staff:query']"
>查看交接记录 >查看交接记录
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item command="handleResetPassword" size="mini" type="text" icon="el-icon-refresh"
v-hasPermi="['company:staff:resetPassword']"
>重置密码
</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
@ -137,7 +141,7 @@
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<StaffForm ref="formRef" @success="getList"/> <StaffForm ref="formRef" @success="getList"/>
<StaffChangeForm ref="staffChangeRef" @success="getList"/> <StaffChangeForm ref="staffChangeRef" @success="getList"/>
<StaffChangeFormData ref="staffChangeDataRef" @success="getList" /> <StaffResetPassword ref="staffResetPassword" @success="getList"/>
</div> </div>
</template> </template>
@ -145,14 +149,14 @@
import * as StaffApi from '@/api/company/staff' import * as StaffApi from '@/api/company/staff'
import StaffForm from './form/StaffForm.vue' import StaffForm from './form/StaffForm.vue'
import StaffChangeForm from './form/StaffChangeForm' import StaffChangeForm from './form/StaffChangeForm'
import StaffChangeFormData from './form/StaffChangeFormData' import StaffResetPassword from './form/StaffResetPassword'
export default { export default {
name: 'Staff', name: 'Staff',
components: { components: {
StaffForm, StaffForm,
StaffChangeForm, StaffChangeForm,
StaffChangeFormData StaffResetPassword
}, },
data() { data() {
return { return {
@ -209,6 +213,9 @@ export default {
case 'handleStaffChangeData': case 'handleStaffChangeData':
this.handleStaffChangeData(row) this.handleStaffChangeData(row)
break break
case 'handleResetPassword':
this.handleResetPassword(row)
break
default: default:
break break
} }
@ -219,7 +226,16 @@ export default {
}, },
/** 查看交接记录 */ /** 查看交接记录 */
handleStaffChangeData(row) { handleStaffChangeData(row) {
this.$refs['staffChangeDataRef'].open(row.id) this.$router.push({
path: '/company/staffChange',
query: {
data: JSON.stringify(row)
}
})
},
/** 重置密码 */
handleResetPassword(row) {
this.$refs['staffResetPassword'].open(row)
}, },
/** 查询列表 */ /** 查询列表 */
async getList() { async getList() {
@ -248,6 +264,11 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
async handleDelete(row) { async handleDelete(row) {
const isChange = row.isChange
if (!isChange) {
this.$modal.msgError('该员工还有工作未交接,不可删除')
return
}
const workNo = row.workNo const workNo = row.workNo
const id = row.id const id = row.id
await this.$modal.confirm('是否确认删除员工工号为"' + workNo + '"的数据项?') await this.$modal.confirm('是否确认删除员工工号为"' + workNo + '"的数据项?')

View File

@ -1,8 +1,7 @@
<template> <template>
<div id="app-container"> <div id="app-container">
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" v-dialogDrag append-to-body> <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" v-dialogDrag append-to-body>
<el-empty v-if="!formData" description="暂无数据"/> <div>
<div v-else>
<el-descriptions class="margin-top" title="交出方员工信息" :column="3" border> <el-descriptions class="margin-top" title="交出方员工信息" :column="3" border>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
@ -27,7 +26,7 @@
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
<i :class="formData.oldStaff.sex == '0' ? 'el-icon-female' : 'el-icon-male'"></i> <i :class="formData.oldStaff.sex == '1' ? 'el-icon-female' : 'el-icon-male'"></i>
性别 性别
</template> </template>
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="formData.oldStaff.sex"/> <dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="formData.oldStaff.sex"/>
@ -65,7 +64,7 @@
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
<i :class="formData.newStaff.sex == '0' ? 'el-icon-female' : 'el-icon-male'"></i> <i :class="formData.newStaff.sex == '1' ? 'el-icon-female' : 'el-icon-male'"></i>
性别 性别
</template> </template>
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="formData.newStaff.sex"/> <dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="formData.newStaff.sex"/>
@ -120,7 +119,6 @@
</template> </template>
<script> <script>
import * as StaffChangeApi from '@/api/company/staffChange'
export default { export default {
name: 'StaffChangeFormData', name: 'StaffChangeFormData',
@ -153,17 +151,15 @@ export default {
fileUrl: '' fileUrl: ''
}], }],
remark: '' remark: ''
} },
} }
}, },
methods: { methods: {
/** 打开弹窗 */ /** 打开弹窗 */
async open(id) { async open(row) {
this.dialogVisible = true
this.reset() this.reset()
const res = await StaffChangeApi.getChangeStaff(id) this.formData = row
this.formData = res.data if (this.formData && this.formData.fileUrls) {
if (!!this.formData) {
this.formData.fileUrls = this.formData.fileUrls.split(',').map(item => { this.formData.fileUrls = this.formData.fileUrls.split(',').map(item => {
return { return {
fileName: item.split('/').pop(), fileName: item.split('/').pop(),
@ -171,6 +167,7 @@ export default {
} }
}) })
} }
this.dialogVisible = true
}, },
/** 表单重置 */ /** 表单重置 */
reset() { reset() {

View File

@ -0,0 +1,174 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="姓名" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入姓名" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="工号" prop="workNo">
<el-input v-model="queryParams.workNo" placeholder="请输入工号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="手机号" prop="tel">
<el-input v-model="queryParams.tel" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="交接时间" prop="changeTimeArray">
<el-date-picker v-model="queryParams.changeTimeArray" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
/>
</el-form-item>
<el-form-item label="交接状态" prop="changeType">
<el-select v-model="queryParams.changeType" placeholder="请选择交接状态" clearable size="small">
<el-option
v-for="dict in this.getDictDatas(DICT_TYPE.STAFF_CHANGE_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="序号" align="center">
<template scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="交出方姓名" align="center" prop="oldStaff.name" width="180" />
<el-table-column label="交出方工号" align="center" prop="oldStaff.workNo" width="180" />
<el-table-column label="交出方电话" align="center" prop="oldStaff.tel" width="180" />
<el-table-column label="交出方性别" align="center" prop="oldStaff.sex" width="180">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.oldStaff.sex"/>
</template>
</el-table-column>
<el-table-column label="交出方地址" :show-overflow-tooltip="true" align="center" prop="oldStaff.address" width="180"/>
<el-table-column label="接收方姓名" align="center" prop="newStaff.name" width="180" />
<el-table-column label="接收方工号" align="center" prop="newStaff.workNo" width="180" />
<el-table-column label="接收方电话" align="center" prop="newStaff.tel" width="180" />
<el-table-column label="接收方性别" align="center" prop="newStaff.sex" width="180">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.newStaff.sex"/>
</template>
</el-table-column>
<el-table-column label="接收方地址" :show-overflow-tooltip="true" align="center" prop="newStaff.address" width="180" />
<el-table-column label="交接时间" align="center" prop="changeTime" width="180" />
<el-table-column label="交接备注" :show-overflow-tooltip="true" align="center" prop="remark" width="180" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="180">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-search" @click="openForm(scope.row)"
>列表查看
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<StaffChangeFormData ref="staffChangeFormData" :success="getList" />
</div>
</template>
<script>
import * as StaffChangeApi from '@/api/company/staffChange'
import StaffChangeFormData from './form/StaffChangeFormData'
export default {
name: 'StaffChange',
components: {
StaffChangeFormData
},
data() {
return{
//
showSearch: true,
//
exportLoading: false,
queryParams:{
pageNo: 1,
pageSize: 10,
workNo: null,
name: null,
changeType: null,
changeTimeArray:null,
tel: null
},
list: [],
total: 0,
//
loading: true,
}
},
watch: {
'$route.query.data':{
immediate: true,
handler(newVal){
if (newVal){
this.getQueryData(JSON.parse(newVal))
this.getList()
}
}
},
},
created() {
this.getList()
},
methods:{
/** 处理点击过来的数据 */
async getQueryData(row){
this.queryParams.name = row.name;
this.queryParams.workNo = row.workNo;
this.queryParams.tel = row.tel;
},
/** 查询列表 */
async getList() {
try {
this.loading = true
const res = await StaffChangeApi.getStaffChangePage(this.queryParams)
this.list = res.data.records
this.total = res.data.total
} finally {
this.loading = false
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNo: 1,
pageSize: 10,
workNo: null,
name: null,
changeType: null,
changeTimeArray:null,
tel: null
}
// this.resetForm('queryForm')
this.handleQuery()
},
/** 添加/修改操作 */
openForm(row) {
this.$refs['staffChangeFormData'].open(row)
},
}
}
</script>
<style scoped>
</style>