给校工会增加角色时,如果已经给这个用户增加了,再增加会报错,并且页面无提示

分工会干部 加一个 编辑按钮, 只有超级管理员可以看到,另外添加这里的届次改为非必填
This commit is contained in:
2026-10-23 14:36:43 +08:00
parent 713e174650
commit 15d3ec0ddd
5 changed files with 69 additions and 11 deletions
@@ -556,6 +556,28 @@ public class SysUnionController {
return Result.success();
}
@At
@ApiOperation("修改分工会干部届次")
@SaCheckPermission("sys.manager.union.branchOfficer")
public Result updateBranchUnionUserJ(String id, String j) {
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name())) {
return Result.error("仅超级管理员可编辑");
}
if (StrUtil.isBlank(id)) {
return Result.error("请选择干部记录");
}
Sys_union_cadre unionCadre = dao.fetch(Sys_union_cadre.class, id);
if (Lang.isEmpty(unionCadre)) {
return Result.error("未找到对应干部记录");
}
if (StrUtil.isNotBlank(j) && sysDictService.getSubListByCode("TEACHER_CONGRESS_J").stream()
.noneMatch(item -> j.equals(item.getCode()))) {
return Result.error("请选择有效届次");
}
dao.update(Sys_union_cadre.class, Chain.make("j", StrUtil.isBlank(j) ? "" : j), Cnd.where("id", "=", id));
return Result.success();
}
@At
@ApiOperation("分工会干部离任")
@SaCheckPermission("sys.manager.union.branchOfficer")
@@ -19,7 +19,7 @@ const branchUnionManage = {
<el-table-column prop="campus" label="校区"></el-table-column>
<el-table-column prop="chairman" label="分工会主席" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" width="250" v-if="$auth.hasPermissionOr(['sys.manager.union.edit','sys.manager.union.delete'])">
<template scope="scope">
<template slot-scope="scope">
<!-- <el-button v-if="$auth.hasPermission('sys.manager.union.branchOfficer')" type="primary" size="mini">设置干部</el-button>-->
<el-button v-if="$auth.hasPermission('sys.manager.union.edit')" type="primary" size="mini" @click="openEdit(scope.row.id)">编辑</el-button>
<el-button v-if="$auth.hasPermission('sys.manager.union.delete')" type="danger" size="mini" @click="doDelete(scope.row.id)">删除</el-button>
@@ -50,15 +50,17 @@ const branchUnionUserManage = {
<el-table-column prop="userName" label="姓名"></el-table-column>
<el-table-column prop="mobile" label="联系方式"></el-table-column>
<el-table-column label="届数">
<template scope="{row}">
<template slot-scope="{row}">
{{ row.jName || row.j }}
</template>
</el-table-column>
<el-table-column prop="roleName" label="职务"></el-table-column>
<el-table-column prop="displayStatus" label="当前状态"></el-table-column>
<el-table-column label="操作" width="150px"
v-if="$auth.hasPermission('sys.manager.union.branchOfficer')">
<template scope="scope">
<el-table-column label="操作" :width="$auth.hasRole('SYSADMIN') ? '230px' : '150px'"
v-if="$auth.hasRole('SYSADMIN') || $auth.hasPermission('sys.manager.union.branchOfficer')">
<template slot-scope="scope">
<el-button v-if="$auth.hasRole('SYSADMIN')" size="mini" type="primary"
icon="el-icon-edit" @click="openEdit(scope.row)">编辑</el-button>
<el-button
v-if="!isLeft(scope.row)"
size="mini"
@@ -106,6 +108,17 @@ const branchUnionUserManage = {
<el-button type="primary" @click="doSubmit">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="编辑届次" :visible.sync="editDialogVisible" width="420px" :close-on-click-modal="false">
<el-form :model="editForm" size="small" label-width="80px">
<el-form-item label="届次">
<dict-select v-model="editForm.j" code="TEACHER_CONGRESS_J" placeholder="请选择届次"></dict-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="editDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doEdit">确 定</el-button>
</div>
</el-dialog>
<el-dialog title="离任" :visible.sync="leaveDialogVisible" width="420px" :close-on-click-modal="false">
<el-form :model="leaveForm" ref="leaveForm" size="small" label-width="90px">
<el-form-item label="离任时间" required>
@@ -147,6 +160,11 @@ const branchUnionUserManage = {
formData: {},
roleOptions: [],
partySecretaryUnitOptions: [],
editDialogVisible: false,
editForm: {
id: "",
j: ""
},
leaveDialogVisible: false,
leaveForm: {
id: "",
@@ -244,6 +262,25 @@ const branchUnionUserManage = {
this.formData = {}
})
},
openEdit(row) {
this.editForm = {
id: row.id,
j: row.j || ""
}
this.editDialogVisible = true
},
doEdit() {
$.post("/platform/sys/union/updateBranchUnionUserJ", this.editForm, (res) => {
if (res.code === 0) {
this.editDialogVisible = false
this.$message.success(res.msg)
this.loadUsedJCodes()
this.doSearch()
} else {
this.$message.error(res.msg)
}
})
},
openLeave(row) {
this.leaveForm = {
id: row.id,
@@ -252,10 +289,6 @@ const branchUnionUserManage = {
this.leaveDialogVisible = true
},
doSubmit() {
if (!this.formData.j) {
this.$message.error("请选择届数")
return
}
if (this.isUnitPartySecretary() && (!this.formData.unitIds || this.formData.unitIds.length === 0)) {
this.$message.error("请选择所属单位")
return
@@ -164,6 +164,7 @@ layout("/layouts/platform.html"){
new Vue({
el: "#app",
store,
components: {
"sys-union-branch-union-manage": branchUnionManage,
"sys-union-school-union-user-manage": schoolUnionUserManage,
@@ -32,7 +32,7 @@ const schoolUnionUserManage = {
<el-table-column prop="loginname" label="工号"></el-table-column>
<el-table-column prop="roleName" label="角色"></el-table-column>
<el-table-column label="操作" width="100px">
<template scope="scope">
<template slot-scope="scope">
<el-button size="mini" type="danger" icon="el-icon-delete"
@click="doDelete(scope.row)"></el-button>
</template>
@@ -74,11 +74,13 @@ const schoolUnionUserManage = {
})
},
doSubmit() {
$.post("/platform/sys/union/insertSchoolUnionUserRole", this.formData).then((res) => {
$.post("/platform/sys/union/insertSchoolUnionUserRole", this.formData, (res) => {
if (res.code === 0) {
this.dialogFormVisible = false
this.$message.success(res.msg)
this.doSearch()
} else {
this.$message.error(res.msg)
}
})
},