班组注册功能开发

This commit is contained in:
liang.chao 2025-08-22 16:00:30 +08:00
parent 8c6b3a6a55
commit b3a098bb7a
11 changed files with 240 additions and 96 deletions

View File

@ -254,6 +254,9 @@ public class TeamGroupServiceImpl implements TeamGroupService {
List<TeamGroupBean> registerList = teamGroupDao.getRegisterList(teamGroupBean);
for (TeamGroupBean groupBean : registerList) {
TeamGroupBean teamLeader = teamGroupDao.getTeamLeader(groupBean);
if (StringUtils.isNotBlank(teamLeader.getName())){
groupBean.setTeamLeader(teamLeader.getName());
}
groupBean.setTeamLeader(teamLeader.getName());
if (StringUtils.isNotBlank(teamLeader.getPhone())) {
groupBean.setPhone(AesCbcUtils.encrypt(teamLeader.getPhone()));

View File

@ -141,28 +141,4 @@ public class SecurityHandlerConfig {
}
/* @Configuration
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.headers(headers -> headers
.contentSecurityPolicy(csp -> csp
.policyDirectives(
"default-src 'self'; " +
"script-src 'self' 'unsafe-inline' 'unsafe-eval'; " +
"style-src 'self' 'unsafe-inline'; " +
"img-src 'self' data: https:; " +
"font-src 'self'; " +
"connect-src 'self'; " +
"frame-src 'none'; " +
"object-src 'none'; " +
"base-uri 'self'; " +
"form-action 'self';"
)
)
);
return http.build();
}
}*/
}

View File

@ -7,6 +7,7 @@ package com.bonus.gs.sub.evaluate.manager.filter;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class DecryptionFilter implements Filter {
@ -16,6 +17,19 @@ public class DecryptionFilter implements Filter {
throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
// 防止点击劫持禁止被 iframe 嵌套
httpResponse.setHeader("X-Frame-Options", "SAMEORIGIN");
httpResponse.setHeader("Content-Security-Policy",
"default-src 'self'; " +
"script-src 'self' 'unsafe-inline' 'unsafe-eval'; " +
"style-src 'self' 'unsafe-inline'; " +
"img-src 'self' data:; " +
"font-src 'self'; " +
"connect-src 'self'; " +
"form-action 'self'; " +
"object-src 'none'; " +
"base-uri 'self';");
if (httpRequest.getRequestURI().endsWith("/login")
&& "POST".equalsIgnoreCase(httpRequest.getMethod())) {

View File

@ -258,8 +258,15 @@
</insert>
<insert id="insetTeamGroupType">
insert into team_group_type(team_group_id,team_type)
values (#{id}, #{teamType})
INSERT INTO team_group_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">team_group_id,</if>
<if test="teamType != null and teamType != ''">team_type,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="teamType != null and teamType != ''">#{teamType},</if>
</trim>
</insert>
<insert id="insetTeamPerson">
insert into team_person(team_id, name, id_card, phone,sex,work_type,face_url,is_team_leader)
@ -304,7 +311,7 @@
<if test="teamGroupName != null and teamGroupName != ''">name,</if>
<if test="level != null">level,</if>
<if test="name != null and name !=''">user_name,</if>
<if test="idCard != null">id_card,</if>
<if test="idCard != null and idCard != ''">id_card,</if>
<if test="sex != null">sex,</if>
<if test="phone != null and phone != ''">user_phone,</if>
<if test="tableSource != null">table_source,</if>
@ -313,7 +320,7 @@
<if test="infoFileUrl != null">info_file_url,</if>
<if test="applyMan != null">apply_man,</if>
create_time,
status,
status
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="teamGroupName != null and teamGroupName != ''">#{teamGroupName},</if>
@ -332,12 +339,50 @@
</trim>
</insert>
<insert id="insetTeamPersonLeader">
insert into team_person(team_id, name, id_card, phone,sex,work_type,face_url,is_team_leader)
values (#{id}, #{name},#{idCard}, #{phone}, #{sex}, #{workType}, #{faceUrl}, #{isTeamLeader})
INSERT INTO team_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">team_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="idCard != null and idCard != ''">id_card,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="sex != null">sex,</if>
<if test="workType != null and workType != ''">work_type,</if>
<if test="faceUrl != null and faceUrl != ''">face_url,</if>
<if test="isTeamLeader != null">is_team_leader,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="idCard != null and idCard != ''">#{idCard},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="sex != null">#{sex},</if>
<if test="workType != null and workType != ''">#{workType},</if>
<if test="faceUrl != null and faceUrl != ''">#{faceUrl},</if>
<if test="isTeamLeader != null">#{isTeamLeader},</if>
</trim>
</insert>
<insert id="insetTeamPersonOthers">
insert into team_person(team_id, name, id_card, phone,sex,work_type,face_url,is_team_leader)
values (#{id}, #{name},#{idCard}, #{phone}, #{sex}, #{workType}, #{faceUrl}, #{isTeamLeader})
INSERT INTO team_person
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">team_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="idCard != null and idCard != ''">id_card,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="sex != null">sex,</if>
<if test="workType != null and workType != ''">work_type,</if>
<if test="faceUrl != null and faceUrl != ''">face_url,</if>
<if test="isTeamLeader != null">is_team_leader,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="idCard != null and idCard != ''">#{idCard},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="sex != null">#{sex},</if>
<if test="workType != null and workType != ''">#{workType},</if>
<if test="faceUrl != null and faceUrl != ''">#{faceUrl},</if>
<if test="isTeamLeader != null">#{isTeamLeader},</if>
</trim>
</insert>
<select id="getUserList" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.OrganizationalBean">
select NAME userName, LOGIN_NAME idCard, SEX, TELPHONE userPhone, dept_id tableId

View File

@ -60,6 +60,7 @@
poi3.user_id as userId,
poi.NAME teamGroupName,
poi.id as id,
poi.audit_status as auditStatus,
poi.parent_id as parentId,
poi.p_parent_id as pParentId,
poi.status as status,
@ -75,6 +76,7 @@
left join team_person tp on poi.id = tp.team_id
WHERE
poi.`level` = 5
and poi.`audit_status` is null or poi.`audit_status` = 4
<if test="userId != null ">
and poi3.user_id = #{userId}
</if>

View File

@ -27,22 +27,14 @@ let memberInfoList = [
},
];
function setParams(id,index,title){
function setParams(id, index, title) {
layui.use(["table", "form", "upload", "tree"], function () {
const $ = layui.$;
form = layui.form;
upload = layui.upload;
table = layui.table;
if (title === "查看") {
layui.$(".submit").css("display", "none");
layui.$("#addMemberBtn").css("display", "none");
layui.$("#uploadBtn").css("display", "none");
layui.$("#uploadBtn1").css("display", "none");
// 如果按钮是异步加载的,需要等待一段时间
setTimeout(function() {
layui.$('[id^="deleteMemberBtn-"]').hide();
layui.$('[id^="uploadBtn-"]').hide();
}, 100);
$(".submit, #addMemberBtn, #uploadBtn, #uploadBtn1").hide();
}
form.verify({
@ -59,7 +51,7 @@ function setParams(id,index,title){
})
setTimeout(function() {
setTimeout(function () {
//查询数据
$.ajax({
url: `${ctxPath}` + '/organizational/getRegisterTeamGroup?id=' + id,
@ -75,7 +67,6 @@ function setParams(id,index,title){
}, 300);
//回显数据
function setFormData(data) {
if (!data) return
@ -92,11 +83,11 @@ function setParams(id,index,title){
// 设置文件URL
if (data.faceUrl) {
faceUrl = data.faceUrl
$("#fileInfo").html("已上传文件")
$("#fileInfo").html(faceUrl.replace(/.*upload[\\/]/, ''))
}
if (data.infoFileUrl) {
infoFileUrl = data.infoFileUrl
$("#fileInfo1").html("已上传文件")
$("#fileInfo1").html(infoFileUrl.replace(/.*upload[\\/]/, ''))
}
// 处理班组成员信息
@ -118,21 +109,40 @@ function setParams(id,index,title){
})
// 构建成员信息UI
constructMemberInfo(index).then(() => {
// 填充成员数据
$(`#name-${index}`).val(member.name || "")
$(`#phone-${index}`).val(member.phone || "")
$(`#idCard-${index}`).val(member.idCard || "")
$(`#workType-${index}`).val(member.workType || "")
$(`#sex-${index}`).val(member.sex || "")
if (title === "查看") {
constructMemberInfoView(index).then(() => {
// 填充成员数据
$(`#name-${index}`).val(member.name || "")
$(`#phone-${index}`).val(member.phone || "")
$(`#idCard-${index}`).val(member.idCard || "")
$(`#workType-${index}`).val(member.workType || "")
$(`#sex-${index}`).val(member.sex || "")
if (member.faceUrl) {
$(`#fileInfo-${index}`).html("已上传文件")
}
if (member.faceUrl) {
$(`#fileInfo-${index}`).html(member.faceUrl.replace(/.*upload[\\/]/, ''))
}
// 重新渲染表单
form.render()
})
} else {
constructMemberInfo(index).then(() => {
// 填充成员数据
$(`#name-${index}`).val(member.name || "")
$(`#phone-${index}`).val(member.phone || "")
$(`#idCard-${index}`).val(member.idCard || "")
$(`#workType-${index}`).val(member.workType || "")
$(`#sex-${index}`).val(member.sex || "")
if (member.faceUrl) {
$(`#fileInfo-${index}`).html(member.faceUrl.replace(/.*upload[\\/]/, ''))
}
// 重新渲染表单
form.render()
})
}
// 重新渲染表单
form.render()
})
})
}
@ -205,18 +215,17 @@ function setParams(id,index,title){
if (memberInfoList[index]) {
memberInfoList[index].faceUrl = res.obj
}
layer.msg("上传成功", { icon: 6, time: 1500 })
layer.msg("上传成功", {icon: 6, time: 1500})
}
},
error: (err) => {
console.error(err)
layer.msg("上传失败,请重试", { icon: 5, time: 2000 })
layer.msg("上传失败,请重试", {icon: 5, time: 2000})
},
})
})
// 文件选择后的回调处理
$("#fileInput").on("change", function () {
const file = $("#fileInput")[0].files[0];
@ -247,7 +256,7 @@ function setParams(id,index,title){
contentType: false,
success: function (res) {
console.log(res, "人脸上传成功");
if(res.res == "1" || res.res == 1){
if (res.res == "1" || res.res == 1) {
faceUrl = res.obj;
}
},
@ -270,7 +279,7 @@ function setParams(id,index,title){
fileExtension !== "jpg" &&
fileExtension !== "pdf"
) {
layer.msg("请选择word、pdf或图片文件", { icon: 2, time: 2000 });
layer.msg("请选择word、pdf或图片文件", {icon: 2, time: 2000});
$("#fileInput1").val("");
$("#fileInfo1").html("");
} else {
@ -288,7 +297,7 @@ function setParams(id,index,title){
contentType: false,
success: function (res) {
console.log(res, "上传成功");
if(res.res == "1" || res.res == 1){
if (res.res == "1" || res.res == 1) {
infoFileUrl = res.obj;
}
},
@ -393,7 +402,7 @@ function setParams(id,index,title){
console.log("暂存班组成员信息数据:", groupMemberList)
const submitData = {
id:formData.id,
id: formData.id,
teamGroupName: formData.teamGroupName || "",
subContractor: formData.subContractor || "",
infoFileUrl: infoFileUrl || "",
@ -418,7 +427,7 @@ function setParams(id,index,title){
data: JSON.stringify(submitData),
success: (res) => {
if (res.res === 1) {
layer.msg("暂存成功", { icon: 6 }, () => {
layer.msg("暂存成功", {icon: 6}, () => {
parent.layer.close(parent.layer.getFrameIndex(window.name))
window.parent.location.reload()
})
@ -430,7 +439,7 @@ function setParams(id,index,title){
})
form.on("submit(formSubmit)", function (data) {
console.log("保存",data.field)
console.log("保存", data.field)
// 表单提交事件监听
const field = data.field;
// 校验文件是否选择
@ -441,8 +450,8 @@ function setParams(id,index,title){
}
console.log("表单数据:", JSON.stringify(field));*/
if(!infoFileUrl){
layer.msg("请上传信息评审表文件", { icon: 2, time: 2000 });
if (!infoFileUrl) {
layer.msg("请上传信息评审表文件", {icon: 2, time: 2000});
return false;
}
@ -459,13 +468,13 @@ function setParams(id,index,title){
};
});
const submitData = {
id:field.id,
id: field.id,
teamGroupName: field.teamGroupName,
subContractor: field.subContractor,
infoFileUrl: infoFileUrl,
teamType: field.teamType,
name: field.name,
tableSource:"pm_dept",
tableSource: "pm_dept",
level: 5,
phone: field.phone,
idCard: field.idCard,
@ -483,7 +492,7 @@ function setParams(id,index,title){
data: JSON.stringify(submitData),
success: res => {
if (res.res === 1) {
layer.msg("成功", { icon: 6 }, () => {
layer.msg("成功", {icon: 6}, () => {
parent.layer.close(parent.layer.getFrameIndex(window.name));
window.parent.location.reload();
});
@ -625,6 +634,87 @@ function setParams(id,index,title){
setSelectValue(sexList, `sex-${index}`);
}
async function constructMemberInfoView(index) {
$("#memberInfo").append(`
<div id="memberInfo-${index}" class="memberInfoItem">
<div class="layui-row">
<div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
<div class="layui-form-item">
<label class="layui-form-label"><span class="required_icon">*</span></label>
<div class="layui-input-block">
<input type="text" required lay-verify="required" id="name-${index}" name="name-${index}"
autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
<div class="layui-form-item">
<label class="layui-form-label"><span class="required_icon">*</span></label>
<div class="layui-input-block">
<input type="text" required lay-verify="required|phone" id="phone-${index}" name="phone-${index}"
autocomplete="off" class="layui-input">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
<div class="layui-form-item">
<label class="layui-form-label"><span
class="required_icon">*</span></label>
<div class="layui-input-block">
<input type="text" required lay-verify="required|idCard" id="idCard-${index}" name="idCard-${index}"
autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
<div class="layui-form-item">
<label class="layui-form-label"><span class="required_icon">*</span></label>
<div class="layui-input-block">
<select id="workType-${index}" name="workType-${index}" class="layui-select" lay-search
lay-verify="required" style="height: 36px;">
</select>
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
<div class="layui-form-item">
<label class="layui-form-label"><span class="required_icon">*</span></label>
<div class="layui-input-block">
<select id="sex-${index}" name="sex-${index}" class="layui-select" lay-search
lay-verify="required" style="height: 36px;">
</select>
</div>
</div>
</div>
<div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
<div class="layui-form-item">
<label class="layui-form-label"><span class="required_icon"></span></label>
<div class="layui-input-block">
<input type="file" id="fileInput-${index}" name="file-${index}" accept=".jpg,.png"
style="display: none;">
<div id="fileInfo-${index}"></div>
</div>
</div>
</div>
</div>
</div>
`);
if (workTypeList.length < 1) {
await getWorkTypeNew();
}
setSelectValue(workTypeList, `workType-${index}`);
setSelectValue(sexList, `sex-${index}`);
}
initMemberInfo();
// 删除操作
@ -643,7 +733,7 @@ function setParams(id,index,title){
// 确保至少保留一个成员
if (memberInfoList.length <= 1) {
layer.msg("至少需要保留一个班组成员", { icon: 2, time: 2000 });
layer.msg("至少需要保留一个班组成员", {icon: 2, time: 2000});
return;
}
const index = parseInt($(this).attr("id").split("-")[1]);
@ -679,7 +769,7 @@ function setParams(id,index,title){
$(`#sex-${i}`).val(member.sex || "");
if (member.faceUrl) {
$(`#fileInfo-${i}`).html("已上传文件");
$(`#fileInfo-${i}`).html(member.faceUrl.replace(/.*upload[\\/]/, ''));
}
}

View File

@ -119,7 +119,7 @@ function initTable() {
align: "center",
title: "班组人数",
templet: function (d) {
return '<a onclick="openTeamMemberPage(' + d.id + ')" style="color: #1E9FFF; cursor: pointer;">' + d.teamPersonNum + '</a>';
return '<a onclick="openTeamMemberPage(' + d.id +","+ d.auditStatus + ')" style="color: #1E9FFF; cursor: pointer;">' + d.teamPersonNum + '</a>';
}
},
{
@ -335,7 +335,7 @@ function initTable() {
}
//班组人员列表
function openTeamMemberPage(data) {
function openTeamMemberPage(id, auditStatus) {
try {
const layerIndex = layer.open({
type: 2,
@ -350,7 +350,7 @@ function openTeamMemberPage(data) {
'./teamMemBer.html',
success: function (layero, index) {
let iframeWin = window["layui-layer-iframe" + index];
iframeWin.setParams(JSON.stringify(data), index);
iframeWin.setParams(JSON.stringify(id),JSON.stringify(auditStatus), index);
},
});
} catch (error) {

View File

@ -79,8 +79,12 @@ function initTable() {
{
field: 'idCard', title: '身份证号码', width: '15%', align: "center",
templet: function (d) {
let idCard = decryptCBC(d.idCard);
return maskSensitiveInfo(idCard, "idCard");
if (d.idCard) {
let idCard = decryptCBC(d.idCard);
return maskSensitiveInfo(idCard, "idCard");
} else {
return "";
}
}
},
{field: "personNum", align: "center", title: "注册骨干人员数量"},

View File

@ -1,9 +1,10 @@
// 专责审批 js文件
let layer, laydate, table, form, id;
let layer, laydate, table, form, id, auditStatus;
let fileList = [];
function setParams(obj, layerIndex) {
objParam = JSON.parse(obj);
id = objParam;
function setParams(obj,obj1, layerIndex) {
id = JSON.parse(obj);
auditStatus = JSON.parse(obj1);
$(function () {
layui.use(["layer", "laydate", "table", "form"], function () {
layer = layui.layer;
@ -86,13 +87,15 @@ function initTable() {
type: "numbers",
},
{field: "name", align: "center", title: "姓名"},
{ field: 'idCard', title: '身份证', width: '15%', align: "center",
{
field: 'idCard', title: '身份证', width: '15%', align: "center",
templet: function (d) {
let idCard = decryptCBC(d.idCard);
return maskSensitiveInfo(idCard, "idCard");
}
},
{ field: 'phone', title: '电话', width: '15%', align: "center",
{
field: 'phone', title: '电话', width: '15%', align: "center",
templet: function (d) {
let phone = decryptCBC(d.phone);
return maskSensitiveInfo(phone, "phone");
@ -107,7 +110,7 @@ function initTable() {
templet: function (d) {
if (d.faceUrl) {
return '<a onclick="openFaceUrlPage(' + d.id + ')" style="color: #1E9FFF; cursor: pointer;"> 查看 </a>';
}else {
} else {
return '';
}
}
@ -120,9 +123,12 @@ function initTable() {
align: "center",
templet: (d) => {
let text = "";
text +=
'<a lay-event="edit" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="edit">编辑</a>';
// 通过注册成功的班组,不可修改班长
if (auditStatus == null) {
text +=
'<a lay-event="edit" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="edit">编辑</a>';
}
if (d.isTeamLeader == '否') {
text +=
'<a lay-event="del" style="color: #009688;cursor: pointer;font-size:' +
@ -259,11 +265,13 @@ function initTable() {
}
// 预览文件
function openFaceUrlPage(id) {
const filePath = ctxPath +"/statics/"+ fileList.filter(item => item.id == id)[0].faceUrl
const filePath = ctxPath + "/statics/" + fileList.filter(item => item.id == id)[0].faceUrl
window.open(filePath)
}
function addPerson() {
layer.open({
type: 2, // iframe 模式
@ -283,8 +291,9 @@ function addPerson() {
function importTemplate() {
let token = localStorage.getItem("token");
window.location.href =ctxPath + "/backstage/download?filename=班组人员导入模版.xls&token=" + token;
window.location.href = ctxPath + "/backstage/download?filename=班组人员导入模版.xls&token=" + token;
}
function importData() {
var formData = new FormData($('form')[0]);
var name = $("#articleImageFile").val();
@ -316,10 +325,10 @@ function importData() {
success: function (data) {
if (data.res === 0) {
layer.close(idx);
layer.msg('导入失败' + data.resMsg, { icon: 2, time: 2000 });
layer.msg('导入失败' + data.resMsg, {icon: 2, time: 2000});
} else {
layer.close(idx);
layer.msg('导入成功', { icon: 1, time: 2000 });
layer.msg('导入成功', {icon: 1, time: 2000});
search(1)
}
},

File diff suppressed because one or more lines are too long

View File

@ -34,7 +34,7 @@
<script src="js/libs/jquery-2.1.1.min.js"></script>
<script src="js/publicJs.js"></script>
<script src="layui/layui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
<script src="layui/crypto-js.min.js"></script>
<script type="text/javascript">
// if (top != self) {