bug fixed 所属部门

This commit is contained in:
Timer
2026-03-17 00:53:23 +08:00
parent 3ea3e0a9af
commit 6de1aabe80
6 changed files with 64 additions and 4 deletions

View File

@ -170,6 +170,16 @@ public class StaffArchivesController {
return "result";
}
// 更新用户的所属部门
String pid = request.getParameter("pid");
if(StringUtils.isNotBlank(pid)){
User user = this.userService.getUserById(safetyStaffArchives.getUserid());
if(user != null){
user.setPid(pid);
this.userService.updateUserById(user);
}
}
this.staffArchivesService.save(safetyStaffArchives);
model.addAttribute("result", CommUtil.toJson(Result.success()));
return "result";
@ -195,6 +205,16 @@ public class StaffArchivesController {
return "result";
}
// 更新用户的所属部门
String pid = request.getParameter("pid");
if(StringUtils.isNotBlank(pid)){
User user = this.userService.getUserById(safetyStaffArchives.getUserid());
if(user != null){
user.setPid(pid);
this.userService.updateUserById(user);
}
}
int result = this.staffArchivesService.update(safetyStaffArchives);
model.addAttribute("result", CommUtil.toJson(Result.success()));
return "result";

View File

@ -22,6 +22,10 @@ public class SafetyStaffArchivesVo extends SafetyStaffArchives {
* 性别翻译
*/
private String sexText;
/**
* 所属部门ID
*/
private String pid;
/**
* 所属部门
*/

View File

@ -28,6 +28,7 @@
<result column="caption" property="caption" jdbcType="VARCHAR"/>
<result column="sex" property="sex" jdbcType="VARCHAR"/>
<result column="sexText" property="sexText" jdbcType="VARCHAR"/>
<result column="pid" property="pid" jdbcType="VARCHAR"/>
<result column="deptName" property="deptName" jdbcType="VARCHAR"/>
</resultMap>
@ -164,6 +165,7 @@
u.caption,
u.sex,
(case when u.sex='0' then '女' else '男' end) as sexText,
u.pid,
uu.name as deptName
from tb_safety_staff_archives ssa
INNER JOIN tb_user u ON ssa.userid = u.id
@ -178,6 +180,7 @@
u.caption,
u.sex,
(case when u.sex='0' then '女' else '男' end) as sexText,
u.pid,
uu.name as deptName
from tb_safety_staff_archives ssa
INNER JOIN tb_user u ON ssa.userid = u.id

View File

@ -147,6 +147,7 @@
hiddenId: "userid",
textId: "username",
deptNameDom: "deptName",
deptIdDom: "pid",
sexDom: "sex",
userCardIdDom: "userCardId",
userId: userId
@ -156,6 +157,18 @@
});
}
//选择所属部门
function showDept4SelectFun() {
$.post(ext.contextPath + '/user/showUnit4Select_Limited.do', {
formId: "subForm",
hiddenId: "pid",
textId: "deptName"
}, function (data) {
$("#deptSelectDiv").html(data);
openModal('unit4SelectModal_Limited');
});
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog" style="width: 53%">
@ -239,8 +252,9 @@
</div>
<label class="col-sm-2 control-label">*所属部门:</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="deptName" name="deptName" placeholder="所属部门"
value="" disabled>
<input type="text" class="form-control" id="deptName" name="deptName" placeholder="点击选择所属部门"
value="" onclick="showDept4SelectFun();" readonly>
<input type="hidden" id="pid" name="pid" value="">
</div>
</div>
@ -274,3 +288,4 @@
</div>
<!-- /.modal-dialog -->
</div>
<div id="deptSelectDiv"></div>

View File

@ -152,6 +152,7 @@
hiddenId: "userid",
textId: "username",
deptNameDom: "deptName",
deptIdDom: "pid",
sexDom: "sex",
userCardIdDom: "userCardId",
userId: userId
@ -161,6 +162,18 @@
});
}
//选择所属部门
function showDept4SelectFun() {
$.post(ext.contextPath + '/user/showUnit4Select_Limited.do', {
formId: "subForm",
hiddenId: "pid",
textId: "deptName"
}, function (data) {
$("#deptSelectDiv").html(data);
openModal('unit4SelectModal_Limited');
});
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog modal-lg">
@ -245,8 +258,9 @@
<label class="col-sm-2 control-label">*所属部门:</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="deptName" name="deptName" placeholder="所属部门"
value="${safetyStaffArchives.deptName}" disabled>
<input type="text" class="form-control" id="deptName" name="deptName" placeholder="点击选择所属部门"
value="${safetyStaffArchives.deptName}" onclick="showDept4SelectFun();" readonly>
<input type="hidden" id="pid" name="pid" value="${safetyStaffArchives.pid}">
</div>
</div>
@ -282,3 +296,4 @@
</div>
<!-- /.modal-dialog -->
</div>
<div id="deptSelectDiv"></div>

View File

@ -26,6 +26,9 @@
if(`${param.deptNameDom}` != ""){
$('#${param.formId} #${param.deptNameDom}').val(resp[0]._pname);
}
if(`${param.deptIdDom}` != ""){
$('#${param.formId} #${param.deptIdDom}').val(resp[0].pid);
}
if(`${param.sexDom}` != ""){
$('#${param.formId} #${param.sexDom}').val(resp[0].sex);
}