添加一个复职的功能,页面操作列按钮分成两行展示,添加根据离职过滤

This commit is contained in:
2026-09-22 10:17:37 +08:00
parent 2c5823df09
commit c9a2098f3f
7 changed files with 118 additions and 12 deletions
@@ -213,6 +213,18 @@ public class JYSController {
return Result.success();
}
/**
* 复职(还原离职状态)教员
*
* @param jybh 教员编号
*/
@PreAuthorize("@ss.hasPermi('teach:teacher:list')")
@PostMapping("/teacher/enable")
public Result<Void> enableTeacher(@RequestParam("jybh") String jybh) {
facultyService.enableJYB(jybh);
return Result.success();
}
/**
* 单个教员补建/对齐系统账号(幂等:已有账号直接返回用户编号)。
*/
@@ -303,7 +315,8 @@ public class JYSController {
@RequestParam(required = false) String jyxm,
@RequestParam(required = false) String jysdh,
@RequestParam(required = false) String zc,
@RequestParam(required = false) String jylb) {
@RequestParam(required = false) String jylb,
@RequestParam(required = false) Integer lzzt) {
PageQuery query = new PageQuery();
query.setPageNum(pageNum);
query.setPageSize(pageSize);
@@ -312,6 +325,7 @@ public class JYSController {
cond.setJysdh(jysdh);
cond.setZc(zc);
cond.setJylb(jylb);
cond.setLzzt(lzzt);
PageResult<TeacherListVO> pageResult = facultyService.pageJYBDetail(query, cond);
return Result.success(pageResult);
}
@@ -75,11 +75,20 @@
t."虚实类型" AS xslx,
t."教研室代号" AS jysdh,
t."用户编号" AS yhbh,
t."部门编号" AS bmbh
t."部门编号" AS bmbh,
t."离职状态" AS lzzt
FROM "教员表" t
LEFT JOIN "教员属性" s ON s."教员编号" = t."教员编号"
LEFT JOIN "教研室表" j ON j."教研室代号" = t."教研室代号"
WHERE t."离职状态" = 0
WHERE 1=1
<choose>
<when test="jyb.lzzt != null">
AND t."离职状态" = #{jyb.lzzt}
</when>
<otherwise>
AND t."离职状态" = 0
</otherwise>
</choose>
<if test="jyb.jyxm != null and jyb.jyxm != ''">
AND t."教员姓名" LIKE CONCAT('%', #{jyb.jyxm}, '%')
</if>
@@ -79,6 +79,11 @@ public interface FacultyService {
*/
void disableJYB(String jYBH);
/**
* 复职(还原离职状态)教员
*/
void enableJYB(String jYBH);
/**
* 更新教员基本信息
*/
@@ -299,6 +299,23 @@ public class FacultyServiceImpl implements FacultyService {
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void enableJYB(String jybh) {
JYB before = jybMapper.selectById(jybh);
JYB entity = new JYB();
entity.setJybh(jybh);
entity.setLzzt(0);
jybMapper.updateById(entity);
// 复职同步启用关联账号
if (before != null) {
JYB after = new JYB();
after.setJybh(jybh);
after.setLzzt(0);
orgSyncService.syncTeacherAccount(before, after);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateJYB(JYB entity) {
@@ -55,4 +55,7 @@ public class TeacherListVO {
/** 部门编号(SYS_DEPT.DEPT_ID) */
private Long bmbh;
/** 离职状态(0-在职 1-离职) */
private Integer lzzt;
}
+9
View File
@@ -56,6 +56,15 @@ export function disableTeacher(jybh) {
})
}
/** 教员复职(还原离职状态)POST /jys/teacher/enable?jybh= */
export function enableTeacher(jybh) {
return request({
url: '/jys/teacher/enable',
method: 'post',
params: { jybh }
})
}
/** 查询教员属性 GET /jys/teacher/attribute/get?jybh= */
export function getTeacherAttribute(jybh) {
return request({
@@ -24,6 +24,14 @@
<el-input v-model="searchForm.jylb" placeholder="请输入" clearable />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="状态">
<el-radio-group v-model="searchForm.lzzt" @change="handleSearch">
<el-radio label="0">在职</el-radio>
<el-radio label="1">离职</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="search-actions">
@@ -45,7 +53,7 @@
<el-button type="success" plain icon="el-icon-refresh" :loading="alignLoading" @click="handleAlignUsers">对齐到用户表</el-button>
</div>
</div>
<el-table v-loading="loading" :data="tableData" stripe border highlight-current-row
<el-table ref="teacherTable" v-loading="loading" :data="tableData" stripe border highlight-current-row
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column type="index" label="序号" width="60" align="center" />
@@ -75,12 +83,16 @@
@click="handleCreateAccount(row)">创建账号</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="table-action-column" width="260">
<el-table-column label="操作" align="center" fixed="right" width="180">
<template slot-scope="{ row }">
<div class="op-btn-grid">
<el-button type="text" size="small" icon="el-icon-view" @click="handleViewAttribute(row)">查看属性</el-button>
<el-button type="text" size="small" icon="el-icon-edit" @click="handleEdit(row)">编辑</el-button>
<el-button type="text" size="small" icon="el-icon-date" @click="handleTeacherCalendar(row)">教员历</el-button>
<el-button type="text" size="small" class="danger-text" @click="handleDisable(row)">离职</el-button>
<el-button v-if="Number(row.lzzt) === 1" type="text" size="small" class="success-text"
@click="handleEnable(row)">复职</el-button>
<el-button v-else type="text" size="small" class="danger-text" @click="handleDisable(row)">离职</el-button>
</div>
</template>
</el-table-column>
</el-table>
@@ -718,6 +730,7 @@ import {
addTeacher,
updateTeacher,
disableTeacher,
enableTeacher,
getTeacherAttribute,
updateTeacherAttribute,
downloadTeacherTemplate,
@@ -739,7 +752,7 @@ export default {
data() {
return {
// 查询条件(仅后端 JYBMapper.xml 支持的字段:jyxm 模糊 / jysdh 等值 / zc 模糊 / jylb 等值)
searchForm: { jyxm: '', jysdh: '', zc: '', jylb: '' },
searchForm: { jyxm: '', jysdh: '', zc: '', jylb: '', lzzt: '0' },
// 列表
loading: false,
@@ -946,7 +959,7 @@ export default {
// ==================== 列表 ====================
buildQuery() {
const params = {}
;['jyxm', 'jysdh', 'zc', 'jylb'].forEach(key => {
;['jyxm', 'jysdh', 'zc', 'jylb', 'lzzt'].forEach(key => {
const value = this.searchForm[key]
if (value !== '' && value !== null && value !== undefined) {
params[key] = String(value).trim()
@@ -967,6 +980,9 @@ export default {
this.tableData = data.records || []
this.pagination.total = data.total || 0
this.loading = false
this.$nextTick(() => {
this.$refs.teacherTable && this.$refs.teacherTable.doLayout()
})
}).catch(() => {
this.tableData = []
this.pagination.total = 0
@@ -980,7 +996,7 @@ export default {
},
handleReset() {
this.searchForm = { jyxm: '', jysdh: '', zc: '', jylb: '' }
this.searchForm = { jyxm: '', jysdh: '', zc: '', jylb: '', lzzt: '0' }
this.pagination.pageNum = 1
this.fetchList()
},
@@ -1172,6 +1188,24 @@ export default {
}).catch(() => {})
},
// ==================== 复职(还原离职状态) ====================
handleEnable(row) {
if (!row.jybh) {
this.$message.warning('当前行缺少教员编号')
return
}
this.$confirm(`确定要办理教员「${row.jyxm || row.jybh}」复职吗?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
enableTeacher(row.jybh).then(() => {
this.$message.success('已办理复职')
this.fetchList()
}).catch(() => {})
}).catch(() => {})
},
// ==================== 教员属性 ====================
handleViewAttribute(row) {
this.attributeMode = 'view'
@@ -1352,6 +1386,17 @@ export default {
<style scoped lang="scss">
.teacher-page {
.op-btn-grid {
display: grid;
grid-template-columns: 1fr 1fr;
justify-items: center;
row-gap: 2px;
.el-button {
margin-left: 0;
}
}
.search-card {
margin-bottom: 16px;
@@ -1414,6 +1459,10 @@ export default {
color: #f56c6c;
}
.success-text {
color: #67c23a;
}
.account-section {
.section-title {
font-size: 14px;