feat: 人事流程

This commit is contained in:
2025-03-09 16:07:01 +08:00
parent d335612b2f
commit a140dbc846
10 changed files with 435 additions and 160 deletions

View File

@@ -14,7 +14,6 @@ VUE_APP_CONTEXT_PATH = '/'
# 监控地址 # 监控地址
VUE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/login' VUE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/login'
# websocket服务地址 # websocket服务地址
VUE_APP_SOCKET_SERVER = 'ws://localhost:8080/websocket/' VUE_APP_SOCKET_SERVER = 'ws://localhost:8080/websocket/'

33
ruoyi-ui/src/api/oa/hr.js Normal file
View File

@@ -0,0 +1,33 @@
import request from '@/utils/request'
/**
* 获取试用及转正页面信息
*/
export function getProbationList(params) {
return request({
url: '/system/onboarding/list',
method: 'get',
params
})
}
/**
* 更新试用转正信息
*/
export function submitProbation(data) {
return request({
url: '/system/onboarding',
method: 'put',
data
})
}
/**
* 查询当前用户详细信息
*/
export function getUserInfo(userId) {
return request({
url: `/system/onboarding/${userId}`,
method: 'get'
})
}

View File

@@ -10,7 +10,7 @@ export function listOffboarding(query) {
} }
// 查询离职管理详细 // 查询离职管理详细
export function getOffboarding(offboardingId) { export function getOnboarding(offboardingId) {
return request({ return request({
url: '/system/offboarding/' + offboardingId, url: '/system/offboarding/' + offboardingId,
method: 'get' method: 'get'

View File

@@ -29,12 +29,12 @@
<el-table-column prop="uploadTime" label="上传时间" width="180"> <el-table-column prop="uploadTime" label="上传时间" width="180">
<template #default="{row}">{{ formatDate(row.uploadTime) }}</template> <template #default="{row}">{{ formatDate(row.uploadTime) }}</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="150" fixed="right" v-if="!readOnly"> <!-- <el-table-column label="操作" width="150" fixed="right" >
<template #default="{row}"> <template #default="{row}">
<!-- <el-button size="mini" type="text" @click="handlePreview(row)">预览</el-button> --> <el-button size="mini" type="text" @click="handlePreview(row)">预览</el-button>
<el-button size="mini" type="text" @click="handleDownload(row)">下载</el-button> <el-button size="mini" type="text" @click="handleDownload(row)">下载</el-button>
</template> </template>
</el-table-column> </el-table-column> -->
</el-table> </el-table>
<!-- 添加文件对话框 --> <!-- 添加文件对话框 -->
@@ -137,7 +137,7 @@ export default {
try { try {
this.loading = true this.loading = true
const res = await listDocument(this.userId) const res = await listDocument(this.userId)
this.fileList = res.data.fileList this.fileList = res.data.fileList;
console.log(this.fileList) console.log(this.fileList)
const fileTypes = await getFileTypeList(); const fileTypes = await getFileTypeList();
this.fileTypes = fileTypes.rows; this.fileTypes = fileTypes.rows;
@@ -264,6 +264,14 @@ export default {
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectedFiles = selection this.selectedFiles = selection
}, },
handleDownload(row) {
// const a = document.createElement('a')
// a.href = row.fileUrl
// a.download = row.fileName
// a.click()
window.open(row.filePath)
}
} }
} }
</script> </script>

View File

@@ -1,123 +1,144 @@
<template> <template>
<div class="main"> <div class="main">
<el-header style="background-color: #fff;display: flex;justify-content:center;border-radius: 10px">
<el-header style="background-color: #fff;display: flex;justify-content:center;border-radius: 10px"> <h1>员工离职申请表</h1>
<h1>员工离职申请表</h1> </el-header>
</el-header> <el-container style="background-color: #fff;border-radius: 10px;margin-top: 30px;flex-direction: column;padding: 20px">
<el-container style="background-color: #fff;border-radius: 10px;margin-top: 30px;flex-direction: column;padding: 20px"> <div style="display: flex;justify-content: space-between;align-items: center;">
<div style="display: flex;justify-content: space-between;align-items: center;"> <div>基本信息</div>
<div>
<div>基本信息</div> <el-button type="primary" @click="saveFormToOffboarding">
<div> <i class="el-icon-check"></i>提交
<el-button type="primary" @click="saveFormToOffboarding"> </el-button>
<i class="el-icon-check"></i>提交 </div>
</el-button>
</div> </div>
</div> <el-divider></el-divider>
<el-divider></el-divider> <div>
<div> <el-form ref="form" :model="form" label-width="80px">
<el-form ref="form" :model="form" label-width="80px"> <el-row :gutter="18">
<el-row :gutter="18"> <el-col :span="12">
<el-col :span="12"> <el-form-item label="离职人员" required>
<el-form-item label="离职人员" required> <el-select v-model="form.userId" filterable placeholder="请选择">
<el-select v-model="form.userId" filterable placeholder="请选择"> <el-option
<el-option v-for="item in userList"
v-for="item in userList" :key="item.userId"
:key="item.userId" :label="item.nickName"
:label="item.nickName" :value="item.userId">
:value="item.userId"> </el-option>
</el-option> </el-select>
</el-select> </el-form-item>
</el-form-item> <el-form-item label="离职时间" required>
<el-form-item label="离职时间" required> <el-date-picker
<el-date-picker v-model="form.resignationDate"
v-model="form.resignationDate" type="date"
type="date" value-format="yyyy-MM-dd"
value-format="yyyy-MM-dd" placeholder="选择日期">
placeholder="选择日期"> </el-date-picker>
</el-date-picker> </el-form-item>
</el-form-item> </el-col>
</el-col> </el-row>
</el-row> <el-form-item label="离职原因" required>
<el-form-item label="离职原因" required> <el-input type="textarea" v-model="form.exitReason" placeholder="请输入内容"></el-input>
<el-input type="textarea" v-model="form.exitReason" placeholder="请输入内容"></el-input> </el-form-item>
</el-form-item> <!-- 新增文件上传组件 -->
</el-form> <el-form-item label="附件上传">
</div> <el-upload
</el-container> ref="upload"
</div> :auto-upload="false"
:on-change="handleFileChange"
:on-remove="handleFileRemove"
multiple
:file-list="fileList">
<el-button size="small" type="primary">点击选择文件</el-button>
<div slot="tip" class="el-upload__tip">请上传相关文件支持多个文件</div>
</el-upload>
</el-form-item>
</el-form>
</div>
</el-container>
</div>
</template>
<script>
import { addOffboarding } from "@/api/oa/offboarding";
import { listUser } from "@/api/system/user";
import { uploadFile, addFile } from '@/api/oa/document'
</template> export default {
name: "Offboarding",
<script> dicts: [],
data() {
import {addOffboarding} from "@/api/oa/offboarding"; return {
import {listUser} from "@/api/system/user"; form: {},
userList: [],
export default { user: {},
name: "Offboarding", fileList: [] // 存储选中的文件
dicts: [], }
data() { },
return{ created() {
form:{},
userList:[],
user:{}
}
},
created() {
this.getUserList(); this.getUserList();
},
methods: {
//获取用户列表
getUserList() {
listUser().then(res => {
this.userList = res.rows;
console.log(res.rows)
})
}, },
//保存离职信息 methods: {
saveFormToOffboarding(){ // 获取用户列表
addOffboarding(this.form).then(res=>{ getUserList() {
this.$modal.msgSuccess("新增成功"); listUser().then(res => {
this.loading = false; this.userList = res.rows;
this.goBack() })
}) },
},
/** 返回页面 */
goBack() {
// 关闭当前标签页并返回上个页面
this.$tab.closePage(this.$route)
this.$router.back()
},
querySearchAsync(queryString, cb) {
var userList = this.userList;
var results = queryString ? userList.filter(this.createStateFilter(queryString)) : userList;
clearTimeout(this.timeout); // 文件状态改变时的处理
cb(results); handleFileChange(file, fileList) {
}, this.fileList = fileList;
createStateFilter(queryString) { },
return (user) => {
console.log(user); // 文件移除处理
return (user.nickName.toLowerCase().indexOf(queryString.toLowerCase()) === 0); handleFileRemove(file, fileList) {
}; this.fileList = fileList;
}, },
handleSelect(item) {
this.form.userId = item.userId // 保存离职信息
async saveFormToOffboarding() {
try {
// 1. 文件上传
// 创建FormData对象
const formData = new FormData();
// 添加表单数据
formData.append('file', this.fileList[0].raw);
console.log(this.fileList, formData);
const data = uploadFile(formData);
console.log(data, this.form);
// 2. 文件绑定用户
await addFile({
userId: this.user.userId,
fileList: [{
fileName: data.newFileName,
filePath: data.url,
fileType: 1
}]
})
// 3. 提交离职信息
await addOffboarding(this.form);
this.$modal.msgSuccess("提交成功");
this.goBack();
} catch (error) {
this.$modal.msgError("提交失败");
}
},
/** 返回页面 */
goBack() {
this.$tab.closePage(this.$route);
this.$router.back();
}
} }
}
</script>
}, <style scoped>
.main {
} padding: 20px;
background: #f6f6f6;
</script> }
</style>
<style scoped >
.main{
padding: 20px;
background: #f6f6f6;
}
</style>

View File

@@ -0,0 +1,128 @@
<template>
<div class="app-container">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>转正申请</span>
<el-tag :type="statusType">{{ statusText }}</el-tag>
</div>
<el-form ref="form" class="apply-form">
<el-form-item label="申请材料" prop="file">
<el-upload
action=""
:auto-upload="false"
:on-change="handleFileChange"
:file-list="fileList"
>
<el-button size="small" type="primary">选择文件</el-button>
<div slot="tip" class="el-upload__tip">支持PDF/DOC格式大小不超过50MB</div>
</el-upload>
</el-form-item>
<el-form-item>
<el-button
type="primary"
:loading="loading"
@click="handleSubmit"
>提交申请</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import { submitProbation } from '@/api/oa/hr'
import { uploadFile, addFile } from '@/api/oa/document'
import { getOnboarding } from "@/api/oa/onboarding"
export default {
name: 'ProbationApply',
data() {
return {
loading: false,
fileList: [],
currentFile: null,
statusMap: {
pending: { label: '待审批', type: 'warning' },
success: { label: '已提交', type: 'success' }
},
userInfo: null,
}
},
mounted() {
console.log(this.$store.state.user)
// 获取用户入职信息
// this.getUserInfo()
},
computed: {
statusType() {
return this.statusMap[this.fileList.length ? 'success' : 'pending'].type
},
statusText() {
return this.statusMap[this.fileList.length ? 'success' : 'pending'].label
}
},
methods: {
async getUserInfo() {
const { data } = await getOnboarding(this.$store.state.user.id)
this.userInfo = data
},
handleFileChange(file) {
this.currentFile = file.raw
this.fileList = [file]
},
async handleSubmit() {
if (!this.currentFile) {
return this.$message.warning('请先选择申请文件')
}
try {
this.loading = true
// 1. 上传文件
const formData = new FormData()
formData.append('file', this.currentFile)
const data = await uploadFile(formData)
// 2. 将文件关联用户
await addFile({
userId: this.$store.state.user.id,
fileList: [{
fileName: data.originalFilename,
filePath: data.url,
fileType: 0,
}]
})
// 3. 提交申请
await submitProbation({
userId: this.$store.state.user.id,
// onboardingId: this.userInfo.onboardingId,
status: 1,
})
this.$message.success('申请提交成功')
this.fileList = []
} catch (error) {
this.$message.error('提交失败: ' + (error.message || error))
} finally {
this.loading = false
}
}
}
}
</script>
<style scoped>
.apply-form {
max-width: 600px;
margin: 20px auto;
}
.el-upload__tip {
color: #999;
font-size: 12px;
margin-top: 5px;
}
</style>

View File

@@ -74,7 +74,7 @@
size="800px" size="800px"
direction="rtl" direction="rtl"
append-to-body> append-to-body>
<user-file-manager <UserFileManager
:user-id="currentUser.userId" :user-id="currentUser.userId"
:read-only="!hasEditPermission" :read-only="!hasEditPermission"
v-if="fileDrawerVisible" /> v-if="fileDrawerVisible" />
@@ -87,7 +87,7 @@
<script> <script>
import { listUser } from "@/api/system/user"; import { listUser } from "@/api/system/user";
import UserFileManager from "./FileList"; import UserFileManager from "@/components/FileList";
// import UserDetailDialog from "@/components/UserDetailDialog"; // import UserDetailDialog from "@/components/UserDetailDialog";
export default { export default {

View File

@@ -30,7 +30,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -49,16 +49,11 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="probationList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="probationList">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" type="index"/> <el-table-column label="序号" align="center" type="index"/>
<el-table-column label="姓名" align="center" prop="nickName"/> <el-table-column label="姓名" align="center" prop="nickName"/>
<el-table-column label="性别" align="center" prop="sex"> <!-- <el-table-column label="部门" align="center" prop="dept.deptName"/> -->
<template slot-scope="scope">
<span>{{ scope.row.sex === '0' ? '男' : '女' }}</span>
</template>
</el-table-column>
<el-table-column label="部门" align="center" prop="dept.deptName"/>
<el-table-column label="试用期限" align="center" width="200"> <el-table-column label="试用期限" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.probationStart }} ~ {{ scope.row.probationEnd }}</div> <div>{{ scope.row.probationStart }} ~ {{ scope.row.probationEnd }}</div>
@@ -67,7 +62,7 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="statusMap[scope.row.status].type"> <el-tag :type="statusMap[scope.row.status].type">
{{ statusMap[scope.row.status].label }} {{ statusMap[scope.row.status].label }}
@@ -81,7 +76,7 @@
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleRegular(scope.row)" @click="handleRegular(scope.row)"
v-if="scope.row.status === '0'" v-if="scope.row.status == 1"
>转正</el-button> >转正</el-button>
<el-button <el-button
size="mini" size="mini"
@@ -126,14 +121,20 @@
<el-button type="primary" @click="submitRegular">确认</el-button> <el-button type="primary" @click="submitRegular">确认</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog :title="转正详情" :visible.sync="detailVisible" width="500px">
<FileList :userId="currentUserId" readonly="true" ></FileList>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
// import { getProbationList, batchRegular } from '@/api/hr/probation' import { listOnboarding, updateOnboarding } from '@/api/oa/onboarding'
import FileList from '@/components/FileList'
export default { export default {
name: 'ProbationManage', name: 'ProbationManage',
components: { FileList },
data() { data() {
return { return {
queryParams: { queryParams: {
@@ -146,8 +147,12 @@ export default {
statusMap: { statusMap: {
'0': { label: '试用中', type: 'warning' }, '0': { label: '试用中', type: 'warning' },
'1': { label: '待审核', type: 'info' }, '1': { label: '待审核', type: 'info' },
'2': { label: '已转正', type: 'success' } '2': { label: '已转正', type: 'success' },
// '0': { label: '未批准', type: 'danger' },
// '1': { label: '已批准', type: 'success' }
}, },
showSearch: true,
loading: false,
probationList: [], probationList: [],
deptOptions: [], deptOptions: [],
multiple: true, multiple: true,
@@ -157,24 +162,47 @@ export default {
userIds: [], userIds: [],
effectiveDate: '', effectiveDate: '',
remark: '' remark: ''
} },
currentUserId: '',
detailVisible: false,
total: 0,
} }
}, },
mounted() {
this.getList();
console.log('挂在审核')
},
methods: { methods: {
getList() { getList() {
// getProbationList(this.queryParams).then(res => { listOnboarding(this.queryParams).then(res => {
// this.probationList = res.rows this.probationList = res.rows
// this.total = res.total this.total = res.total
// }) })
}, },
handleRegular(row) { handleRegular(row) {
this.form = { // this.form = {
userIds: [row.userId], // userIds: [row.userId],
effectiveDate: '', // effectiveDate: '',
remark: '' // remark: ''
} // }
this.dialogTitle = `转正操作 - ${row.nickName}` // this.dialogTitle = `转正操作 - ${row.nickName}`
this.dialogVisible = true // this.dialogVisible = true
console.log('转正操作', row)
const joiningDate = new Date()
// 格式化为 YYYY-MM-DD
const year = joiningDate.getFullYear()
const month = String(joiningDate.getMonth() + 1).padStart(2, '0')
const day = String(joiningDate.getDate()).padStart(2, '0')
const formattedDate = `${year}-${month}-${day}`
updateOnboarding({
// onboardingId: row.onboardingId,
userId: row.userId,
status: 2,
joiningDate: formattedDate
}).then(res => {
this.getList()
this.$message.success('转正成功')
})
}, },
handleBatchRegular() { handleBatchRegular() {
this.form.userIds = this.selectedIds this.form.userIds = this.selectedIds
@@ -192,6 +220,13 @@ export default {
if (days > 7) return 'success' if (days > 7) return 'success'
if (days > 3) return 'warning' if (days > 3) return 'warning'
return 'danger' return 'danger'
},
handleDetail(row) {
this.currentUserId = row.userId;
this.detailVisible = true
},
resetQuery() {
} }
} }
} }

View File

@@ -1,14 +1,6 @@
<template> <template>
<div class="container"> <div class="container">
<!-- 人事管理界面 --> <ProbationManage />
<div v-if="userRole === 'HR'">
<ProbationManage />
</div>
<!-- 员工申请界面 -->
<div v-else>
<ProbationApply />
</div>
</div> </div>
</template> </template>
@@ -19,7 +11,7 @@ import ProbationManage from "./ProbationManage";
export default { export default {
data() { data() {
return { return {
userRole: 'HR', // 实际应从登录信息获取 userRole: 'DM', // 实际应从登录信息获取
} }
}, },
components: { components: {

View File

@@ -35,6 +35,28 @@
<svg-icon icon-class="date" />创建日期 <svg-icon icon-class="date" />创建日期
<div class="pull-right">{{ user.createTime }}</div> <div class="pull-right">{{ user.createTime }}</div>
</li> </li>
<li class="list-group-item" v-if="onBoardingInfo.status == '0'">
转正申请
<div class="pull-right">
<el-button type="text" @click="toApplyProbation">申请转正</el-button>
</div>
</li>
<li class="list-group-item" v-else>
<svg-icon icon-class="date" />转正日期
<div class="pull-right">{{ onBoardingInfo.joiningDate }}</div>
</li>
<li class="list-group-item">
离职申请
<div class="pull-right">
<el-button type="danger" @click="toApplyQuit">申请离职</el-button>
</div>
</li>
<li class="list-group-item">
个人档案
<div class="pull-right">
<el-button type="text" @click="openFileDrawer">查看档案</el-button>
</div>
</li>
</ul> </ul>
</div> </div>
</el-card> </el-card>
@@ -55,6 +77,17 @@
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
<el-drawer :title="`${user.nickName} - 文件管理`"
:visible.sync="fileDrawerVisible"
size="800px"
direction="rtl"
append-to-body>
<user-file-manager
:user-id="user.userId"
:read-only="true"
v-if="fileDrawerVisible" />
</el-drawer>
</div> </div>
</template> </template>
@@ -62,29 +95,55 @@
import userAvatar from "./userAvatar"; import userAvatar from "./userAvatar";
import userInfo from "./userInfo"; import userInfo from "./userInfo";
import resetPwd from "./resetPwd"; import resetPwd from "./resetPwd";
import UserFileManager from "@/components/FileList";
import { getUserProfile } from "@/api/system/user"; import { getUserProfile } from "@/api/system/user";
import { getOnboarding } from "@/api/oa/onboarding"
export default { export default {
name: "Profile", name: "Profile",
components: { userAvatar, userInfo, resetPwd }, components: { userAvatar, userInfo, resetPwd, UserFileManager },
data() { data() {
return { return {
user: {}, user: {},
roleGroup: {}, roleGroup: {},
postGroup: {}, postGroup: {},
activeTab: "userinfo" activeTab: "userinfo",
fileDrawerVisible: false,
onBoardingInfo: {}
}; };
}, },
created() { created() {
this.getUser(); this.getUser();
// 获取用户入职信息
}, },
methods: { methods: {
getUser() { getUser() {
getUserProfile().then(response => { getUserProfile().then(response => {
this.user = response.data.user; this.user = response.data.user;
console.log(this.user);
this.roleGroup = response.data.roleGroup; this.roleGroup = response.data.roleGroup;
this.postGroup = response.data.postGroup; this.postGroup = response.data.postGroup;
this.getOnBoardInfo();
}); });
},
async getOnBoardInfo() {
const { data } = await getOnboarding(this.user.userId);
this.onBoardingInfo = data;
},
openFileDrawer() {
this.fileDrawerVisible = true;
},
// 跳转到申请转正页面
toApplyProbation() {
console.log("跳转到申请转正页面");
this.$router.push('/people/apply');
},
// 跳转到离职页面
toApplyQuit() {
console.log("跳转到离职页面");
this.$router.push('/people/addOffboarding');
} }
} }
}; };