需求开发

This commit is contained in:
liang.chao 2025-07-02 15:50:51 +08:00
parent 3f5be5d844
commit c6ab25dd4e
12 changed files with 607 additions and 2 deletions

View File

@ -1,11 +1,13 @@
package com.bonus.gs.sub.evaluate.evaluate.controller;
import com.bonus.gs.sub.evaluate.evaluate.beans.NodeBean;
import com.bonus.gs.sub.evaluate.evaluate.beans.OrganizationalBean;
import com.bonus.gs.sub.evaluate.evaluate.beans.PersonBean;
import com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean;
import com.bonus.gs.sub.evaluate.evaluate.service.ProjectService;
import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes;
import com.bonus.gs.sub.evaluate.manager.utils.GlobalConst;
import com.bonus.gs.sub.evaluate.outsourceEnterprise.beans.ViolationBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -24,6 +26,7 @@ public class ProjectController {
@Autowired
private ProjectService service;
@GetMapping("list")
public AjaxRes getProjectList(ProjectBean projectBean) {
AjaxRes ar = new AjaxRes();
@ -35,6 +38,7 @@ public class ProjectController {
}
return ar;
}
@PostMapping("updateName")
public AjaxRes updateName(@RequestBody ProjectBean projectBean) {
AjaxRes ar = new AjaxRes();
@ -50,6 +54,7 @@ public class ProjectController {
}
return ar;
}
@PostMapping("delProject")
public AjaxRes delProject(@RequestBody ProjectBean projectBean) {
AjaxRes ar = new AjaxRes();
@ -81,4 +86,45 @@ public class ProjectController {
}
return ar;
}
@GetMapping("getProjectSubcontractor")
public AjaxRes getProjectSubcontractor(ViolationBean bean) {
AjaxRes ar = new AjaxRes();
try {
List<ViolationBean> subcontractorList = service.getProjectSubcontractor(bean);
ar.setListSucceed(subcontractorList);
} catch (Exception e) {
ar.setFailMsg(GlobalConst.DATA_FAIL);
}
return ar;
}
@PostMapping("delProjectSubcontractor")
public AjaxRes delProjectSubcontractor(@RequestBody ViolationBean bean) {
AjaxRes ar = new AjaxRes();
try {
Integer i = service.delProjectSubcontractor(bean);
if (i > 0) {
ar.setSucceedMsg("删除成功");
} else {
ar.setFailMsg("删除失败");
}
} catch (Exception e) {
ar.setFailMsg(GlobalConst.DATA_FAIL);
}
return ar;
}
// 获取该项目未绑定过的分包商
@GetMapping("getNoBindSubcontractorSelect")
public AjaxRes getNoBindSubcontractorSelect(ViolationBean bean) {
AjaxRes ar = new AjaxRes();
try {
List<OrganizationalBean> list = service.getNoBindSubcontractorSelect(bean);
ar.setSucceed(list);
} catch (Exception e) {
ar.setFailMsg(GlobalConst.DATA_FAIL);
}
return ar;
}
}

View File

@ -1,6 +1,8 @@
package com.bonus.gs.sub.evaluate.evaluate.dao;
import com.bonus.gs.sub.evaluate.evaluate.beans.OrganizationalBean;
import com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean;
import com.bonus.gs.sub.evaluate.outsourceEnterprise.beans.ViolationBean;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -21,4 +23,10 @@ public interface ProjectDao {
Integer delProject(ProjectBean projectBean);
Integer addProject(ProjectBean projectBean);
List<ViolationBean> getProjectSubcontractor(ViolationBean bean);
Integer delProjectSubcontractor(ViolationBean bean);
List<OrganizationalBean> getNoBindSubcontractorSelect(ViolationBean bean);
}

View File

@ -1,6 +1,8 @@
package com.bonus.gs.sub.evaluate.evaluate.service;
import com.bonus.gs.sub.evaluate.evaluate.beans.OrganizationalBean;
import com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean;
import com.bonus.gs.sub.evaluate.outsourceEnterprise.beans.ViolationBean;
import java.util.List;
@ -17,4 +19,10 @@ public interface ProjectService {
Integer delProject(ProjectBean projectBean);
Integer addProject(ProjectBean projectBean);
List<ViolationBean> getProjectSubcontractor(ViolationBean bean);
Integer delProjectSubcontractor(ViolationBean bean);
List<OrganizationalBean> getNoBindSubcontractorSelect(ViolationBean bean);
}

View File

@ -1,7 +1,9 @@
package com.bonus.gs.sub.evaluate.evaluate.service;
import com.bonus.gs.sub.evaluate.evaluate.beans.OrganizationalBean;
import com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean;
import com.bonus.gs.sub.evaluate.evaluate.dao.ProjectDao;
import com.bonus.gs.sub.evaluate.outsourceEnterprise.beans.ViolationBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -40,4 +42,19 @@ public class ProjectServiceImpl implements ProjectService {
public Integer addProject(ProjectBean projectBean) {
return projectDao.addProject(projectBean);
}
@Override
public List<ViolationBean> getProjectSubcontractor(ViolationBean bean) {
return projectDao.getProjectSubcontractor(bean);
}
@Override
public Integer delProjectSubcontractor(ViolationBean bean) {
return projectDao.delProjectSubcontractor(bean);
}
@Override
public List<OrganizationalBean> getNoBindSubcontractorSelect(ViolationBean bean) {
return projectDao.getNoBindSubcontractorSelect(bean);
}
}

View File

@ -10,6 +10,7 @@ import lombok.Data;
public class ViolationBean {
private String id;
private String orgId;
private String childId;
private String violator;
private String violationNumber;

View File

@ -32,6 +32,11 @@
WHERE
id = #{id}
</delete>
<delete id="delProjectSubcontractor">
DELETE FROM pm_org_info
WHERE
id = #{id}
</delete>
<select id="getProjectList" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean">
SELECT
@ -63,4 +68,42 @@
WHERE
status = 1 and parent_id = #{id}
</select>
<select id="getProjectSubcontractor"
resultType="com.bonus.gs.sub.evaluate.outsourceEnterprise.beans.ViolationBean">
SELECT
pa.id,
poi.id AS orgId,
pa.enterpriseName AS enterpriseName,
pa.socialCreditCode AS socialCreditCode,
pa.setTime AS setTime,
pa.corporateName AS corporateName,
pa.idCard AS idCard,
pa.phone AS phone,
pa.address AS address
FROM
project_assignment pa
LEFT JOIN pm_org_info poi ON poi.lk_id = pa.id
WHERE
pa.is_active = '1'
AND poi.parent_id = #{id}
<if test="keyWord != null and keyWord != ''">
and (
pa.enterpriseName like concat('%',#{keyWord},'%') or
pa.phone like concat('%',#{keyWord},'%') or
pa.corporateName like concat('%',#{keyWord},'%')
)
</if>
</select>
<select id="getNoBindSubcontractorSelect"
resultType="com.bonus.gs.sub.evaluate.evaluate.beans.OrganizationalBean">
SELECT
pa.id,
pa.enterpriseName AS name
FROM
project_assignment pa
WHERE
pa.is_active = '1'
AND NOT EXISTS ( SELECT 1 FROM pm_org_info poi WHERE poi.lk_id = pa.id AND poi.parent_id = #{id} )
</select>
</mapper>

View File

@ -0,0 +1,78 @@
let form, table, tree;
function setParams(obj, layerIndex) {
layui.use(['table', 'form', 'tree'], function () {
const $ = layui.$;
form = layui.form;
table = layui.table;
// 获取该项目未绑定过的分包商
getSubcontractorSelect();
// 设置下拉框选项
function setSelectValue(list, selectName) {
let html = '<option value="">请选择</option>';
if (list && list.length > 0) {
$.each(list, function (index, item) {
html += `<option value="${item.id}">${item.name}</option>`;
});
}
$('#' + selectName).empty().append(html);
form.render('select');
}
// 获取事业部下拉数据
function getSubcontractorSelect() {
$.ajax({
type: 'get',
url: ctxPath + '/project/getNoBindSubcontractorSelect',
data: {
id: obj,
},
success: function (data) {
setSelectValue(data.obj, 'subcontractor');
}
});
}
// 表单提交事件监听
form.on('submit(formSubmit)', function (data) {
const field = data.field;
const submitData = {
name: $('#subcontractor').find('option:selected').text(),
level: 4,
parentId: obj, // 项目id
tableSource: 'project_assignment',
// 其他字段根据接口需要添加
lkId: field.subcontractor,
};
console.log("表单数据:", JSON.stringify(submitData));
// 调用保存接口
$.ajax({
url: ctxPath + '/organizational/addData',
type: 'POST',
dataType: "json",
contentType: "application/json",
data: JSON.stringify(submitData),
success: function (res) {
if (res.res === 1) {
layer.msg('新增成功', {icon: 6, time: 1500}, function () {
var index = parent.layer.getFrameIndex(window.name); // 获取当前 iframe 层的索引
window.parent.location.reload();
parent.layer.close(index); // 关闭弹窗
});
} else if (res.res === 0) {
layer.msg(res.resMsg, {icon: 5});
}
},
error: function () {
layer.msg("网络异常,请重试", {icon: 5});
}
});
// 阻止默认提交行为
return false;
});
});
}

View File

@ -105,7 +105,14 @@ function initTable() {
{field: "projectName", align: "center", title: "项目名称"},
{field: "department", align: "center", title: "所属事业部"},
{field: "projectManager", align: "center", title: "项目经理"},
{field: "subcontractorNum", align: "center", title: "参与分包商数量"},
{
field: "subcontractorNum",
align: "center",
title: "参与分包商数量",
templet: function(d) {
return '<a onclick="openTeamMemberPage(' + d.id + ')" style="color: #1E9FFF; cursor: pointer;">' + d.subcontractorNum + '</a>';
}
},
{
fixed: "right",
width: 180,
@ -271,3 +278,25 @@ function addProject() {
}
});
}
function openTeamMemberPage(data) {
try {
const layerIndex = layer.open({
type: 2,
title: '分包商列表',
shade: 0.3,
area: ["80%", "90%"],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content:
'./subcontractor.html',
success: function (layero, index) {
let iframeWin = window["layui-layer-iframe" + index];
iframeWin.setParams(JSON.stringify(data), index);
},
});
} catch (error) {
console.error("openTeamMemberPage 错误:", error);
}
}

View File

@ -0,0 +1,191 @@
// 专责审批 js文件
let layer, laydate, table, form, id;
function setParams(obj,layerIndex) {
objParam = JSON.parse(obj);
window.layerIndex = layerIndex;
id = objParam;
console.log(id+"id")
$(function () {
layui.use(["layer", "laydate", "table", "form"], function () {
layer = layui.layer;
laydate = layui.laydate;
form = layui.form;
table = layui.table;
laydate.render({
elem: "#startDate",
type: "month",
format: "yyyy-MM",
});
initTable();
});
});
}
function search(type) {
if (type === 1) {
} else {
$("#keyWord").val("");
form.render("select");
}
table.reload("baseTable", {
url: ctxPath + "/project/getProjectSubcontractor",
page: {
curr: 1,
},
where: {
type: "audit",
id: id,
keyWord: $("#keyWord").val(),
},
});
}
function initTable() {
//渲染表格
table.render({
elem: "#baseTable",
url: ctxPath + "/project/getProjectSubcontractor", //数据接口
method: "get", //方式默认是get
toolbar: "default", //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
where: {
type: "audit",
id: id,
}, //post请求必须加where post请求需要的参数
cellMinWidth: 80,
cols: [
[
//表头
{
field: "number",
width: 80,
title: "序号",
align: "center",
type: "numbers",
},
{field: "enterpriseName", align: "center", title: "外包商名称"},
{field: "corporateName", align: "center", title: "法人"},
{field: "phone", align: "center", title: "法人联系方式"},
{
fixed: "right",
width: 180,
title: "操作",
align: "center",
templet: (d) => {
let text = "";
text +=
'<a lay-event="del" style="color: #009688;cursor: pointer;font-size:' +
' 15px;margin-left: 10px"' +
' id="del">删除</a>';
return text;
},
},
],
],
id: "baseTable",
page: true, //开启分页
loading: true, //数据加载中。。。
limits: [10, 20, 100], //一页选择显示3,5或10条数据
limit: 10, //一页显示5条数据
response: {
statusCode: 200, //规定成功的状态码默认0
},
parseData: function (res) {
//将原始数据解析成 table 组件所规定的数据res为从url中get到的数据
let result;
if (res.data !== "" && res.data != null && res.data !== "null") {
if (this.page.curr) {
result = res.data.slice(
this.limit * (this.page.curr - 1),
this.limit * this.page.curr
);
} else {
result = res.data.slice(0, this.limit);
}
}
return {
code: res.code, //解析接口状态
msg: res.msg, //解析提示文本
count: res.count, //解析数据长度
data: result, //解析数据列表
};
},
toolbar: "#toolbar",
});
table.on("tool(test)", function (obj) {
const data = obj.data; //当前行数据
const rowIndex = obj.index;
const layEvent = obj.event; //当前点击的事件名
switch (layEvent) {
case "del":
DelReviews(data, "删除");
break;
default:
console.warn(`未知事件: ${layEvent}`);
}
});
//删除分包商信息
function DelReviews(data, title) {
try {
layer.confirm('是否确认删除?', {
title: title || '提示',
icon: 3,
shade: 0.3,
btn: ['确定', '取消']
}, function (index) {
let item = {
id: data.orgId
};
$.ajax({
url: `${ctxPath}/project/delProjectSubcontractor`,
type: "POST",
data: JSON.stringify(item),
dataType: "json",
contentType: "application/json",
success: function (res) {
if (res.res === 1) {
layer.msg("删除成功", { icon: 1 });
search(1); // 刷新列表
} else {
layer.msg("删除失败:" + (res.resMsg || "未知错误"), { icon: 2 });
}
layer.close(index); // 关闭弹窗
},
error: function () {
layer.close(loadingMsg);
layer.msg("服务异常,请稍后重试", {
icon: 2,
time: 2000
});
}
});
}, function (index) {
// 取消操作
layer.close(index);
});
} catch (error) {
console.error("DelReviews 错误:", error);
layer.msg("发生异常,请查看控制台", { icon: 2 });
}
}
}
function addSubcontractor() {
layer.open({
type: 2, // iframe 模式
title: "新增项目",
content: "./addSubcontractor.html", // 要打开的页面
maxmin: false, // 不显示最大化/最小化按钮
area: ["60%", "70%"], // 弹出层大小
success: function (layero, index) {
// 如果需要在弹出层加载完成后执行某些操作,可以在这里写
let iframeWin = window["layui-layer-iframe" + index];
iframeWin.setParams(id, index);
}
});
}

View File

@ -102,7 +102,6 @@ function initTable() {
{field: "teamGroupName", align: "center", title: "班组名称"},
{field: "teamLeader", align: "center", title: "班组长"},
{field: "teamType", align: "center", title: "班组类型"},
// {field: "teamPersonNum", align: "center", title: "班组人数"},
{
field: "teamPersonNum",
align: "center",

View File

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../../../layui/css/layui.css" />
<link rel="stylesheet" href="../../../layui/layui_ext/dtree/dtree.css">
<link rel="stylesheet" href="../../../layui/layui_ext/dtree/font/dtreefont.css">
<title>新增项目/新增外包商/更换班长</title>
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden; /* 阻止浏览器自身的滚动条 */
}
#main-box, .form, .layui-form {
height: 100%;
}
#main-box {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.layui-form-label {
width: 120px;
}
.layui-form-item .layui-input-inline {
width: 256px; /* 统一宽度 */
}
.required_icon,
th span {
font-size: 16px;
color: red;
margin: 0 5px;
}
.layui-form {
padding: 20px;
overflow-y: auto;
flex-grow: 1;
}
.btn-box {
width: 100%;
height: 80px;
box-sizing: border-box;
display: flex;
justify-content: flex-end;
align-items: center;
padding-right: 4%;
}
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
background: rgb(233 233 233);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background: rgb(207 207 207);
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: rgb(100, 100, 100);
border-radius: 10px;
}
::-webkit-scrollbar-thumb:active {
background: rgb(68, 68, 68);
border-radius: 10px;
}
</style>
<body>
<div id="main-box">
<div class="form">
<form class="layui-form" onsubmit="return false;" id="form" lay-filter="formFilter">
<div style="width: 100%;height: 100%">
<!-- 选择分包商 -->
<div class="layui-form-item" style="margin-top: 1%;">
<label class="layui-form-label"><span class="required_icon">*</span>选择分包商</label>
<div class="layui-input-inline">
<select id="subcontractor" name="subcontractor" class="layui-select" lay-search
lay-verify="required"></select>
</div>
</div>
<!-- 提交按钮 -->
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formSubmit">保存</button>
</div>
</div>
</div>
</form>
</div>
</div>
</body>
<script src="../../../js/publicJs.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script src="../../../layui/layui.js"></script>
<script src="../../../layui/layui_ext/dtree/dtree.js"></script>
<script src="../../../js/evaluate/project/addSubcontractor.js?v=1"></script>
</html>

View File

@ -0,0 +1,66 @@
<!Doctype html>
<html lang="">
<head>
<title>外包企业管理</title>
<link rel="stylesheet" href="../../../layui/css/layui.css"/>
<style>
#tree-table-box table thead th {
font-size: 16px;
font-weight: bold;
color: #404040;
}
.layui-table thead tr {
background-color: #f0f0f0;
height: 50px;
}
.layui-table td, .layui-table th, .layui-table-col-set, .layui-table-fixed-r, .layui-table-grid-down, .layui-table-header, .layui-table-mend, .layui-table-page, .layui-table-tips-main, .layui-table-tool, .layui-table-total, .layui-table-view, .layui-table[lay-skin=line], .layui-table[lay-skin=row] {
border-color: #ddd;
}
a:hover, a:focus {
color: #2a6496;
text-decoration: underline;
}
a {
color: #428bca;
text-decoration: none;
}
</style>
</head>
<body>
<div class="row-fluid" style="padding: 10px">
<div class="col-xs-12">
<form id="baseForm" class="layui-form" method="POST" onsubmit="return false;">
<!-- 姓名 -->
<div class="layui-input-inline">
<input type="text" required lay-verify="required" id="keyWord" placeholder="请输入关键字"
name="keyWord" autocomplete="off" class="layui-input">
</div>
<button type="button" class="layui-btn layui-bg-blue" style="margin-left: 10px;"
onclick="search(1)">查询
</button>
<button type="button" class="layui-btn layui-bg-blue" onclick="search(2)">重置</button>
<button type="button" class="layui-btn layui-bg-blue" onclick="addSubcontractor();">
新增
</button>
</div>
</form>
<div id="tree-table-box" style="padding: 10px">
<table id="baseTable" class="layui-table" lay-filter="test"></table>
</div>
</div>
</div>
<script src="../../../js/publicJs.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script type="text/javascript" src="../../../js/select.js"></script>
<script src="../../../layui/layui.js"></script>
<script src="../../../js/evaluate/project/subcontractor.js?v=1"></script>
</body>
</html>