From c6ab25dd4e145333ad64e0ffa772025c1e31f8cb Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Wed, 2 Jul 2025 15:50:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ProjectController.java | 46 +++++ .../sub/evaluate/evaluate/dao/ProjectDao.java | 8 + .../evaluate/service/ProjectService.java | 8 + .../evaluate/service/ProjectServiceImpl.java | 17 ++ .../beans/ViolationBean.java | 1 + .../mappers/evaluate/ProjectMapper.xml | 43 ++++ .../js/evaluate/project/addSubcontractor.js | 78 +++++++ .../static/js/evaluate/project/projectList.js | 31 ++- .../js/evaluate/project/subcontractor.js | 191 ++++++++++++++++++ .../js/evaluate/teamGroup/teamGroupList.js | 1 - .../evaluate/project/addSubcontractor.html | 119 +++++++++++ .../pages/evaluate/project/subcontractor.html | 66 ++++++ 12 files changed, 607 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/static/js/evaluate/project/addSubcontractor.js create mode 100644 src/main/resources/static/js/evaluate/project/subcontractor.js create mode 100644 src/main/resources/static/pages/evaluate/project/addSubcontractor.html create mode 100644 src/main/resources/static/pages/evaluate/project/subcontractor.html diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/ProjectController.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/ProjectController.java index 51d5e49..cb6a3d3 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/ProjectController.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/ProjectController.java @@ -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 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 list = service.getNoBindSubcontractorSelect(bean); + ar.setSucceed(list); + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } } diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/ProjectDao.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/ProjectDao.java index 263d929..16eb73f 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/ProjectDao.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/ProjectDao.java @@ -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 getProjectSubcontractor(ViolationBean bean); + + Integer delProjectSubcontractor(ViolationBean bean); + + List getNoBindSubcontractorSelect(ViolationBean bean); } diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectService.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectService.java index 036e0cf..915af1a 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectService.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectService.java @@ -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 getProjectSubcontractor(ViolationBean bean); + + Integer delProjectSubcontractor(ViolationBean bean); + + List getNoBindSubcontractorSelect(ViolationBean bean); } diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectServiceImpl.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectServiceImpl.java index bfec816..4ac6761 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectServiceImpl.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectServiceImpl.java @@ -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 getProjectSubcontractor(ViolationBean bean) { + return projectDao.getProjectSubcontractor(bean); + } + + @Override + public Integer delProjectSubcontractor(ViolationBean bean) { + return projectDao.delProjectSubcontractor(bean); + } + + @Override + public List getNoBindSubcontractorSelect(ViolationBean bean) { + return projectDao.getNoBindSubcontractorSelect(bean); + } } diff --git a/src/main/java/com/bonus/gs/sub/evaluate/outsourceEnterprise/beans/ViolationBean.java b/src/main/java/com/bonus/gs/sub/evaluate/outsourceEnterprise/beans/ViolationBean.java index 485a150..88e78e1 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/outsourceEnterprise/beans/ViolationBean.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/outsourceEnterprise/beans/ViolationBean.java @@ -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; diff --git a/src/main/resources/mappers/evaluate/ProjectMapper.xml b/src/main/resources/mappers/evaluate/ProjectMapper.xml index a907a98..bc0285b 100644 --- a/src/main/resources/mappers/evaluate/ProjectMapper.xml +++ b/src/main/resources/mappers/evaluate/ProjectMapper.xml @@ -32,6 +32,11 @@ WHERE id = #{id} + + DELETE FROM pm_org_info + WHERE + id = #{id} + + + diff --git a/src/main/resources/static/js/evaluate/project/addSubcontractor.js b/src/main/resources/static/js/evaluate/project/addSubcontractor.js new file mode 100644 index 0000000..c949087 --- /dev/null +++ b/src/main/resources/static/js/evaluate/project/addSubcontractor.js @@ -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 = ''; + if (list && list.length > 0) { + $.each(list, function (index, item) { + html += ``; + }); + } + + $('#' + 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; + }); + }); +} \ No newline at end of file diff --git a/src/main/resources/static/js/evaluate/project/projectList.js b/src/main/resources/static/js/evaluate/project/projectList.js index 1ca996c..a107d1a 100644 --- a/src/main/resources/static/js/evaluate/project/projectList.js +++ b/src/main/resources/static/js/evaluate/project/projectList.js @@ -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 '' + d.subcontractorNum + ''; + } + }, { 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); + } +} \ No newline at end of file diff --git a/src/main/resources/static/js/evaluate/project/subcontractor.js b/src/main/resources/static/js/evaluate/project/subcontractor.js new file mode 100644 index 0000000..54a54b9 --- /dev/null +++ b/src/main/resources/static/js/evaluate/project/subcontractor.js @@ -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 += + '删除'; + 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); + } + }); +} \ No newline at end of file diff --git a/src/main/resources/static/js/evaluate/teamGroup/teamGroupList.js b/src/main/resources/static/js/evaluate/teamGroup/teamGroupList.js index 392da86..6c24e21 100644 --- a/src/main/resources/static/js/evaluate/teamGroup/teamGroupList.js +++ b/src/main/resources/static/js/evaluate/teamGroup/teamGroupList.js @@ -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", diff --git a/src/main/resources/static/pages/evaluate/project/addSubcontractor.html b/src/main/resources/static/pages/evaluate/project/addSubcontractor.html new file mode 100644 index 0000000..e3b39f5 --- /dev/null +++ b/src/main/resources/static/pages/evaluate/project/addSubcontractor.html @@ -0,0 +1,119 @@ + + + + + + + + 新增项目/新增外包商/更换班长 + + + + +
+
+
+
+ +
+ +
+ +
+
+ + +
+
+ +
+
+ +
+
+
+
+ + + + + + + + + + diff --git a/src/main/resources/static/pages/evaluate/project/subcontractor.html b/src/main/resources/static/pages/evaluate/project/subcontractor.html new file mode 100644 index 0000000..26344cd --- /dev/null +++ b/src/main/resources/static/pages/evaluate/project/subcontractor.html @@ -0,0 +1,66 @@ + + + + 外包企业管理 + + + + +
+
+
+ +
+ +
+ + + + +
+ +
+
+
+
+ + + + + + + + + + +