企业管理-员工管理

This commit is contained in:
xiao-fajia 2024-08-07 15:55:08 +08:00
parent 29bf3c4f56
commit 706e2f489c
4 changed files with 300 additions and 212 deletions

View File

@ -51,3 +51,11 @@ export function exportStaffExcel(params) {
responseType: 'blob'
})
}
// 获取当前登录用户所属标签
export function getLabels(){
return request({
url: '/company/staff/labels',
method: 'get',
})
}

View File

@ -106,6 +106,10 @@ export const DICT_TYPE = {
DICT_BRAND_TYPE : 'brand_type',
//标签样式
DICT_BASE_LABEL_TYPE : 'base_label_type',
// ------- 企业管理模块 -------
// 员工学历
COMPANY_STAFF_EDU: 'company_staff_edu',
}
/**

View File

@ -1,173 +1,256 @@
<template>
<div class="app-container">
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
<el-form-item label="企业idbase_company表中的id" prop="corpId">
<el-input v-model="formData.corpId" placeholder="请输入企业idbase_company表中的id" />
</el-form-item>
<el-form-item label="用户idsystem_users表的id" prop="userId">
<el-input v-model="formData.userId" placeholder="请输入用户idsystem_users表的id" />
</el-form-item>
<el-form-item label="部门id(system_dept表中的id)" prop="deptId">
<el-input v-model="formData.deptId" placeholder="请输入部门id(system_dept表中的id)" />
</el-form-item>
<el-form-item label="工号" prop="workNo">
<el-input v-model="formData.workNo" placeholder="请输入工号" />
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model="formData.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="手机号" prop="tel">
<el-input v-model="formData.tel" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-radio-group v-model="formData.sex">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="家庭住址" prop="address">
<el-input v-model="formData.address" placeholder="请输入家庭住址" />
</el-form-item>
<el-form-item label="工作日期" prop="workDate">
<el-date-picker clearable v-model="formData.workDate" type="date" value-format="timestamp" placeholder="选择工作日期" />
</el-form-item>
<el-form-item label="工龄" prop="workYear">
<el-input v-model="formData.workYear" placeholder="请输入工龄" />
</el-form-item>
<el-form-item label="入职日期" prop="joinedDate">
<el-date-picker clearable v-model="formData.joinedDate" type="date" value-format="timestamp" placeholder="选择入职日期" />
</el-form-item>
<el-form-item label="司龄" prop="joinedYear">
<el-input v-model="formData.joinedYear" placeholder="请输入司龄" />
</el-form-item>
<el-form-item label="学历" prop="education">
<el-input v-model="formData.education" placeholder="请输入学历" />
</el-form-item>
<el-form-item label="个人简介">
<Editor v-model="formData.content" :min-height="192"/>
</el-form-item>
<el-form-item label="唯一推广码(须保证全平台唯一,规则:字母+数字;字母全大写)" prop="uniqueCode">
<el-input v-model="formData.uniqueCode" placeholder="请输入唯一推广码(须保证全平台唯一,规则:字母+数字;字母全大写)" />
</el-form-item>
<el-form-item label="附件idsinfra_file表中的id多个英文逗号拼接" prop="fileIds">
<el-input v-model="formData.fileIds" placeholder="请输入附件idsinfra_file表中的id多个英文逗号拼接" />
</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>
</div>
</template>
<script>
import * as StaffApi from '@/api/company/staff';
import Editor from '@/components/Editor';
export default {
name: "StaffForm",
components: {
Editor,
},
data() {
return {
//
dialogTitle: "",
//
dialogVisible: false,
// 12
formLoading: false,
//
formData: {
id: undefined,
corpId: undefined,
userId: undefined,
deptId: undefined,
workNo: undefined,
name: undefined,
tel: undefined,
sex: undefined,
address: undefined,
workDate: undefined,
workYear: undefined,
joinedDate: undefined,
joinedYear: undefined,
education: undefined,
content: undefined,
uniqueCode: undefined,
fileIds: undefined,
},
//
formRules: {
},
};
},
methods: {
/** 打开弹窗 */
async open(id) {
this.dialogVisible = true;
this.reset();
//
if (id) {
this.formLoading = true;
try {
const res = await StaffApi.getStaff(id);
this.formData = res.data;
this.title = "修改企业管理-员工信息";
} finally {
this.formLoading = false;
}
}
this.title = "新增企业管理-员工信息";
},
/** 提交按钮 */
async submitForm() {
//
await this.$refs["formRef"].validate();
this.formLoading = true;
try {
const data = this.formData;
//
if (data.id) {
await StaffApi.updateStaff(data);
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.$emit('success');
return;
}
//
await StaffApi.createStaff(data);
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.$emit('success');
} finally {
this.formLoading = false;
}
},
/** 表单重置 */
reset() {
this.formData = {
id: undefined,
corpId: undefined,
userId: undefined,
deptId: undefined,
workNo: undefined,
name: undefined,
tel: undefined,
sex: undefined,
address: undefined,
workDate: undefined,
workYear: undefined,
joinedDate: undefined,
joinedYear: undefined,
education: undefined,
content: undefined,
uniqueCode: undefined,
fileIds: undefined,
};
this.resetForm("formRef");
}
}
};
</script>
<template>
<div class="app-container">
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" v-dialogDrag append-to-body>
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="120px">
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="工号" prop="workNo">
<el-input v-model="formData.workNo" placeholder="请输入工号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="姓名" prop="name">
<el-input v-model="formData.name" placeholder="请输入姓名"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="手机号" prop="tel">
<el-input v-model="formData.tel" placeholder="请输入手机号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="sex">
<el-radio-group v-model="formData.sex">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)"
:key="dict.value" :label="dict.value">{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</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-col :span="12">
<el-form-item label="工作日期" prop="workDate">
<el-date-picker clearable v-model="formData.workDate" type="date" value-format="timestamp"
placeholder="选择工作日期"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="入职日期" prop="joinedDate">
<el-date-picker clearable v-model="formData.joinedDate" type="date" value-format="timestamp"
placeholder="选择入职日期"
/>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="技能标签" prop="labelsArray">
<el-select v-model="formData.labelsArray" multiple placeholder="请选择技能标签">
<el-option
v-for="item in labelOptions"
:key="item.id"
:label="item.labelName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="个人简介">
<Editor v-model="formData.content" :min-height="192"/>
</el-form-item>
<el-form-item label="附件" prop="">
<file-upload></file-upload>
</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>
</div>
</template>
<script>
import * as StaffApi from '@/api/company/staff'
import Editor from '@/components/Editor'
import FileUpload from '@/components/FileUpload'
import { getLabels } from '../../../api/company/staff'
export default {
name: 'StaffForm',
components: {
Editor,
FileUpload
},
data() {
return {
//
dialogTitle: '',
//
dialogVisible: false,
// 12
formLoading: false,
//
formData: {
id: undefined,
corpId: undefined,
userId: undefined,
deptId: undefined,
workNo: undefined,
name: undefined,
tel: undefined,
sex: undefined,
address: undefined,
workDate: undefined,
workYear: undefined,
joinedDate: undefined,
joinedYear: undefined,
education: undefined,
content: undefined,
uniqueCode: undefined,
fileIds: undefined,
loginAccount: undefined,
password: undefined,
labelsArray: undefined,
},
//
formRules: {
workNo: [{required: true, message: "工号不能为空", trigger: 'blur'}],
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' }],
password: [{ required: true, message: '登录密码不能为空', trigger: 'blur' }],
workDate: [{ required: true, message: '工作日期不能为空', trigger: 'blur' }],
joinedDate: [{ required: true, message: '入职日期不能为空', trigger: 'blur' }],
},
labelOptions:[],
}
},
methods: {
/** 获取标签 */
async listLabels(){
try {
const res = await StaffApi.getLabels();
console.log(res.data)
this.labelOptions = res.data
}finally {}
},
/** 打开弹窗 */
async open(id) {
this.dialogVisible = true
await this.listLabels();
this.reset()
//
if (id) {
this.formLoading = true
try {
const res = await StaffApi.getStaff(id)
this.formData = res.data
this.title = '修改企业管理-员工信息'
} finally {
this.formLoading = false
}
}
this.title = '新增企业管理-员工信息'
},
/** 提交按钮 */
async submitForm() {
console.log(this.formData)
//
await this.$refs['formRef'].validate()
this.formLoading = true
try {
const data = this.formData
//
if (data.id) {
await StaffApi.updateStaff(data)
this.$modal.msgSuccess('修改成功')
this.dialogVisible = false
this.$emit('success')
return
}
//
await StaffApi.createStaff(data)
this.$modal.msgSuccess('新增成功')
this.dialogVisible = false
this.$emit('success')
} finally {
this.formLoading = false
}
},
/** 表单重置 */
reset() {
this.formData = {
id: undefined,
corpId: undefined,
userId: undefined,
deptId: undefined,
workNo: undefined,
name: undefined,
tel: undefined,
sex: undefined,
address: undefined,
workDate: undefined,
workYear: undefined,
joinedDate: undefined,
joinedYear: undefined,
education: undefined,
content: undefined,
uniqueCode: undefined,
fileIds: undefined,
loginAccount: undefined,
password: undefined
}
this.resetForm('formRef')
}
}
}
</script>

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<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>
@ -13,29 +13,20 @@
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-select v-model="queryParams.sex" placeholder="请选择性别" clearable size="small">
<el-option label="请选择字典生成" value=""/>
<el-option
v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="家庭住址" prop="address">
<el-input v-model="queryParams.address" placeholder="请输入家庭住址" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="工作日期" prop="workDate">
<el-date-picker v-model="queryParams.workDate" 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="workYear">
<el-input v-model="queryParams.workYear" placeholder="请输入工龄" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="入职日期" prop="joinedDate">
<el-date-picker v-model="queryParams.joinedDate" 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="joinedYear">
<el-input v-model="queryParams.joinedYear" placeholder="请输入司龄" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
@ -47,8 +38,15 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
<el-form-item label="工作日期" prop="workDate">
<el-date-picker v-model="queryParams.workDate" 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="joinedDate">
<el-date-picker v-model="queryParams.joinedDate" 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']"
@ -79,29 +77,24 @@
</el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="主键标识" align="center" prop="id"/>
<el-table-column label="企业idbase_company表中的id" align="center" prop="corpId"/>
<el-table-column label="用户idsystem_users表的id" align="center" prop="userId"/>
<el-table-column label="部门id(system_dept表中的id)" align="center" prop="deptId"/>
<el-table-column label="工号" align="center" prop="workNo"/>
<el-table-column label="姓名" align="center" prop="name"/>
<el-table-column label="手机号" align="center" prop="tel"/>
<el-table-column label="性别" align="center" prop="sex"/>
<el-table-column label="家庭住址" align="center" prop="address"/>
<el-table-column label="工作日期" align="center" prop="workDate"/>
<el-table-column label="工龄" align="center" prop="workYear"/>
<el-table-column label="入职日期" align="center" prop="joinedDate"/>
<el-table-column label="司龄" align="center" prop="joinedYear"/>
<el-table-column label="学历" align="center" prop="education"/>
<el-table-column label="个人简介" align="center" prop="content"/>
<el-table-column label="唯一推广码(须保证全平台唯一,规则:字母+数字;字母全大写)" align="center" prop="uniqueCode"/>
<el-table-column label="附件idsinfra_file表中的id多个英文逗号拼接" align="center" prop="fileIds"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
<el-table-column label="序号" align="center">
<template scope="scope">
<span>{{scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="工号" align="center" prop="workNo" width="180"/>
<el-table-column label="姓名" align="center" prop="name" width="180"/>
<el-table-column label="手机号" align="center" prop="tel" width="180"/>
<el-table-column label="性别" align="center" prop="sex" width="180"/>
<el-table-column label="家庭住址" align="center" prop="address" width="180"/>
<el-table-column label="工龄" align="center" prop="workYear" 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="content" 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">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
v-hasPermi="['company:staff:update']"