feat: 档案管理前端

This commit is contained in:
2025-03-08 15:22:29 +08:00
parent 4a1009e02e
commit ea298f00f6
7 changed files with 1230 additions and 0 deletions

View File

@@ -0,0 +1,129 @@
<template>
<div class="app-container apply-container">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>转正申请</span>
<el-tag :type="statusType">{{ statusText }}</el-tag>
</div>
<el-steps :active="activeStep" finish-status="success">
<el-step title="填写申请" />
<el-step title="部门审批" />
<el-step title="HR确认" />
</el-steps>
<el-form :model="form" :rules="rules" ref="form" class="apply-form">
<el-form-item label="试用总结" prop="summary">
<el-input
type="textarea"
:rows="5"
v-model="form.summary"
placeholder="请总结试用期间的工作成果、收获与不足"
/>
</el-form-item>
<el-form-item label="附件材料">
<el-upload
action="/api/upload"
multiple
:limit="3"
:file-list="fileList"
:on-success="handleUploadSuccess"
>
<el-button icon="el-icon-upload">上传文件</el-button>
<div class="el-upload__tip">支持PDF/DOC/PPT格式单个文件不超过20MB</div>
</el-upload>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm">提交申请</el-button>
<el-button @click="saveDraft">保存草稿</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- 申请记录 -->
<el-card class="box-card history-card">
<div slot="header">申请记录</div>
<el-table :data="historyList">
<el-table-column prop="applyDate" label="申请时间" width="180" />
<el-table-column prop="status" label="状态">
<template slot-scope="scope">
<el-tag :type="statusMap[scope.row.status].type">
{{ statusMap[scope.row.status].label }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="comment" label="审批意见" />
</el-table>
</el-card>
</div>
</template>
<script>
// import { getApplyInfo, submitApply } from '@/api/user/probation'
export default {
name: 'ProbationApply',
data() {
return {
activeStep: 1,
form: {
summary: '',
attachments: []
},
rules: {
summary: [
{ required: true, message: '请输入试用总结', trigger: 'blur' },
{ min: 100, message: '总结内容不少于100字', trigger: 'blur' }
]
},
fileList: [],
historyList: [],
statusMap: {
0: { label: '草稿', type: 'info' },
1: { label: '待审批', type: 'warning' },
2: { label: '已通过', type: 'success' },
3: { label: '已驳回', type: 'danger' }
}
}
},
computed: {
statusType() {
return this.historyList[0]?.status ? this.statusMap[this.historyList[0].status].type : 'info'
},
statusText() {
return this.historyList[0]?.status ? this.statusMap[this.historyList[0].status].label : '未申请'
}
},
methods: {
submitForm() {
this.$refs.form.validate(valid => {
if (valid) {
// submitApply(this.form).then(() => {
// this.$message.success('申请已提交')
// this.loadHistory()
// })
}
})
},
handleUploadSuccess(res) {
this.form.attachments.push(res.data)
},
loadHistory() {
// getApplyInfo().then(res => {
// this.historyList = res.data
// })
}
}
}
</script>
<style scoped>
.apply-form {
margin-top: 20px;
}
.history-card {
margin-top: 20px;
}
</style>

View File

@@ -0,0 +1,198 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="姓名" prop="nickname">
<el-input
clearable
v-model="queryParams.nickname"
placeholder="根据姓名查询"
></el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="试用状态">
<el-option label="试用中" value="0"></el-option>
<el-option label="待审核" value="1"></el-option>
<el-option label="已转正" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="部门" prop="deptId">
<el-select
v-model="queryParams.deptId"
placeholder="选择部门"
clearable
>
<el-option
v-for="dept in deptOptions"
:key="dept.deptId"
:label="dept.deptName"
:value="dept.deptId"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-check"
size="mini"
@click="handleBatchRegular"
:disabled="multiple"
>批量转正</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="probationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" type="index"/>
<el-table-column label="姓名" align="center" prop="nickName"/>
<el-table-column label="性别" align="center" prop="sex">
<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">
<template slot-scope="scope">
<div>{{ scope.row.probationStart }} ~ {{ scope.row.probationEnd }}</div>
<el-tag :type="getRemainingDaysStatus(scope.row.remainingDays)">
剩余{{ scope.row.remainingDays }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-tag :type="statusMap[scope.row.status].type">
{{ statusMap[scope.row.status].label }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleRegular(scope.row)"
v-if="scope.row.status === '0'"
>转正</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleDetail(scope.row)"
>详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 转正对话框 -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="500px">
<el-form :model="form" label-width="80px">
<el-form-item label="生效日期">
<el-date-picker
v-model="form.effectiveDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择转正日期"
/>
</el-form-item>
<el-form-item label="转正意见">
<el-input
type="textarea"
:rows="4"
v-model="form.remark"
placeholder="请输入转正意见"
/>
</el-form-item>
</el-form>
<span slot="footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitRegular">确认</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
// import { getProbationList, batchRegular } from '@/api/hr/probation'
export default {
name: 'ProbationManage',
data() {
return {
queryParams: {
pageNum: 1,
pageSize: 10,
nickname: '',
status: '',
deptId: null
},
statusMap: {
'0': { label: '试用中', type: 'warning' },
'1': { label: '待审核', type: 'info' },
'2': { label: '已转正', type: 'success' }
},
probationList: [],
deptOptions: [],
multiple: true,
dialogVisible: false,
dialogTitle: '',
form: {
userIds: [],
effectiveDate: '',
remark: ''
}
}
},
methods: {
getList() {
// getProbationList(this.queryParams).then(res => {
// this.probationList = res.rows
// this.total = res.total
// })
},
handleRegular(row) {
this.form = {
userIds: [row.userId],
effectiveDate: '',
remark: ''
}
this.dialogTitle = `转正操作 - ${row.nickName}`
this.dialogVisible = true
},
handleBatchRegular() {
this.form.userIds = this.selectedIds
this.dialogTitle = `批量转正 (${this.selectedIds.length}人)`
this.dialogVisible = true
},
submitRegular() {
// batchRegular(this.form).then(() => {
// this.$message.success('操作成功')
// this.dialogVisible = false
// this.getList()
// })
},
getRemainingDaysStatus(days) {
if (days > 7) return 'success'
if (days > 3) return 'warning'
return 'danger'
}
}
}
</script>

View File

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