diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/OrganizationalBean.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/OrganizationalBean.java index b2aee3d..6a96d95 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/OrganizationalBean.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/OrganizationalBean.java @@ -38,6 +38,10 @@ public class OrganizationalBean { private String status; private String keyWorld; + private String workType; + private String teamType; + private String faceUrl; + private Integer isTeamLeader; private String parentUserName; diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/ProjectBean.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/ProjectBean.java new file mode 100644 index 0000000..ec27434 --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/ProjectBean.java @@ -0,0 +1,23 @@ +package com.bonus.gs.sub.evaluate.evaluate.beans; + +import lombok.Data; + +/** + * @Author:liang.chao + * @Date:2025/6/24 - 14:19 + */ +@Data +public class ProjectBean { + private String id; + // 项目名称 + private String projectName; + // 所属事业部 + private String department; + // 项目经理 + private String projectManager; + // 参与分包商数量 + private Integer subcontractorNum; + private Integer evaluateDeptId; + private Integer personInChargeId; + private String keyWord; +} diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/TeamGroupBean.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/TeamGroupBean.java new file mode 100644 index 0000000..4155825 --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/beans/TeamGroupBean.java @@ -0,0 +1,40 @@ +package com.bonus.gs.sub.evaluate.evaluate.beans; + +import lombok.Data; + +/** + * @Author:liang.chao + * @Date:2025/6/26 - 10:13 + */ +@Data +public class TeamGroupBean { + // id + private String id; + // 所属分包商 + private String subContractor; + // 所属项目 + private String project; + // 班组名称 + private String teamGroupName; + // 班组长 + private String teamLeader; + // 班组类型id + private String teamTypeId; + // 班组类型 + private String teamType; + // 班组状态 + private Integer status; + // 班组人数 + private String teamPersonNum; + private String keyWord; + + private String name; + private String idCard; + private String phone; + private String sex; + private String workTypeId; + private String workType; + private String faceUrl; + private String isTeamLeader; + +} diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/OrganizationalController.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/OrganizationalController.java index 1c0ae48..1f6794a 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/OrganizationalController.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/OrganizationalController.java @@ -9,19 +9,20 @@ import com.bonus.gs.sub.evaluate.manager.controller.BaseController; import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes; import com.bonus.gs.sub.evaluate.manager.utils.GlobalConst; import io.swagger.annotations.Api; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.io.File; import java.util.List; /** - * * 外包单位组织架构控制层 + * * @author 黑子 */ @Api(tags = "外包单位组织架") @@ -35,8 +36,13 @@ public class OrganizationalController extends BaseController { @Resource private OrganizationalDao dao; + + @Value("${upload.dir}") + private String uploadDir; + /** * 树拆线呢 + * * @param bean * @return */ @@ -53,6 +59,7 @@ public class OrganizationalController extends BaseController { } return ar; } + @RequestMapping(value = "/getEvaluatePersonList", method = RequestMethod.GET) @ResponseBody public AjaxRes getEvaluatePersonList(EvaluatePersonBean bean) { @@ -70,6 +77,7 @@ public class OrganizationalController extends BaseController { /** * 项目下拉选 + * * @param bean * @return */ @@ -90,6 +98,7 @@ public class OrganizationalController extends BaseController { /** * 负责人下拉选 + * * @param bean * @return */ @@ -106,8 +115,10 @@ public class OrganizationalController extends BaseController { } return ar; } + /** * 外包商下拉选 + * * @param bean * @return */ @@ -125,10 +136,91 @@ public class OrganizationalController extends BaseController { return ar; } + /** + * 所有外包商下拉选 + * + * @param + * @return + */ + @RequestMapping(value = "getSubContractorSelected", method = RequestMethod.POST) + @ResponseBody + public AjaxRes getSubContractorSelected() { + AjaxRes ar = getAjaxRes(); + try { + List list = service.getSubContractorSelected(); + ar.setSucceed(list); + } catch (Exception e) { + logger.error(e.toString(), e); + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + + /** + * 根据外包商获取项目下拉框数据 + * + * @param + * @return + */ + @RequestMapping(value = "getProjectBySubContractor", method = RequestMethod.POST) + @ResponseBody + public AjaxRes getProjectBySubContractor(OrganizationalBean bean) { + AjaxRes ar = getAjaxRes(); + try { + List list = service.getProjectBySubContractor(bean); + ar.setSucceed(list); + } catch (Exception e) { + logger.error(e.toString(), e); + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + + /** + * 获取班组类型下拉框 + * + * @param + * @return + */ + @RequestMapping(value = "getTeamGroupType", method = RequestMethod.POST) + @ResponseBody + public AjaxRes getTeamGroupType(OrganizationalBean bean) { + AjaxRes ar = getAjaxRes(); + try { + List list = service.getTeamGroupType(bean); + ar.setSucceed(list); + } catch (Exception e) { + logger.error(e.toString(), e); + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + + /** + * 获取工种类型下拉框 + * + * @param + * @return + */ + @RequestMapping(value = "getWorkType", method = RequestMethod.POST) + @ResponseBody + public AjaxRes getWorkType(OrganizationalBean bean) { + AjaxRes ar = getAjaxRes(); + try { + List list = service.getWorkType(bean); + ar.setSucceed(list); + } catch (Exception e) { + logger.error(e.toString(), e); + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + /** * 新增人员下拉选(isAdd==1) * 修改 不传 + * * @param bean * @return */ @@ -157,19 +249,58 @@ public class OrganizationalController extends BaseController { public AjaxRes addData(@RequestBody OrganizationalBean bean) { AjaxRes ar = getAjaxRes(); try { - ar = service.addData(bean); + ar = service.addData(bean); } catch (Exception e) { logger.error(e.toString(), e); ar.setFailMsg(GlobalConst.DATA_FAIL); } return ar; } + + /** + * 根据外包商id(project_assignment)和项目id获取组织架构(pm_org_info)中外包商id + * 修改 不传 + * + * @param bean + * @return + */ + @RequestMapping(value = "addTeamGroup", method = RequestMethod.POST) + @ResponseBody + public AjaxRes getsubcontractorId(@ModelAttribute OrganizationalBean bean, + @RequestParam("file") MultipartFile file) { + AjaxRes ar = getAjaxRes(); + try { + if (file != null && !file.isEmpty()) { + // 验证文件类型 + String originalFileName = file.getOriginalFilename(); + String fileExtension = originalFileName != null ? originalFileName.split("\\.")[1] : ""; + if (!"jpg".equalsIgnoreCase(fileExtension) && !"png".equalsIgnoreCase(fileExtension)) { + ar.setFailMsg("文件类型错误,请上传jpg或png格式的文件"); + return ar; + } + } + File targetDir = new File(uploadDir); + if (!targetDir.exists()) { + targetDir.mkdirs(); + } + String fileName = System.currentTimeMillis() + "_" + file.getOriginalFilename(); + File targetFile = new File(uploadDir, fileName); + file.transferTo(targetFile); + bean.setFaceUrl(fileName); + ar = service.addTeamGroup(bean); + } catch (Exception e) { + logger.error(e.toString(), e); + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + @RequestMapping(value = "addDept", method = RequestMethod.POST) @ResponseBody public AjaxRes addDept(@RequestBody OrganizationalBean bean) { AjaxRes ar = getAjaxRes(); try { - ar = service.addDept(bean); + ar = service.addDept(bean); } catch (Exception e) { logger.error(e.toString(), e); ar.setFailMsg(GlobalConst.DATA_FAIL); @@ -178,10 +309,10 @@ public class OrganizationalController extends BaseController { } - /** * 更换班组长 * 更换班组长 + * * @param bean * @return */ @@ -201,6 +332,7 @@ public class OrganizationalController extends BaseController { /** * 查询详情 + * * @param bean * @return */ @@ -216,14 +348,16 @@ public class OrganizationalController extends BaseController { } return ar; } + /** * 退场 + * * @param bean * @return */ @RequestMapping(value = "userOutData", method = RequestMethod.POST) @ResponseBody - public AjaxRes userOutData(OrganizationalBean bean) { + public AjaxRes userOutData(@RequestBody OrganizationalBean bean) { AjaxRes ar = getAjaxRes(); try { ar = service.userOutData(bean); @@ -246,6 +380,7 @@ public class OrganizationalController extends BaseController { } return ar; } + @RequestMapping(value = "updateName", method = RequestMethod.POST) @ResponseBody public AjaxRes updateName(@RequestBody OrganizationalBean bean) { 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 new file mode 100644 index 0000000..51d5e49 --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/ProjectController.java @@ -0,0 +1,84 @@ +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.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 lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/6/24 - 14:15 + */ +@RestController +@RequestMapping("/project") +@Slf4j +public class ProjectController { + + @Autowired + private ProjectService service; + @GetMapping("list") + public AjaxRes getProjectList(ProjectBean projectBean) { + AjaxRes ar = new AjaxRes(); + try { + List projectList = service.getProjectList(projectBean); + ar.setListSucceed(projectList); + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + @PostMapping("updateName") + public AjaxRes updateName(@RequestBody ProjectBean projectBean) { + AjaxRes ar = new AjaxRes(); + try { + Integer i = service.updateName(projectBean); + if (i > 0) { + ar.setSucceedMsg("修改成功"); + } else { + ar.setFailMsg("修改失败"); + } + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + @PostMapping("delProject") + public AjaxRes delProject(@RequestBody ProjectBean projectBean) { + AjaxRes ar = new AjaxRes(); + try { + Integer i = service.delProject(projectBean); + if (i > 0) { + ar.setSucceedMsg("删除成功"); + } else { + ar.setFailMsg("删除失败"); + } + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + + @PostMapping("addProject") + public AjaxRes addProject(@RequestBody ProjectBean projectBean) { + AjaxRes ar = new AjaxRes(); + try { + Integer i = service.addProject(projectBean); + if (i > 0) { + ar.setSucceedMsg("新增成功"); + } else { + ar.setFailMsg("新增失败"); + } + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } +} diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/TeamGroupController.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/TeamGroupController.java new file mode 100644 index 0000000..aeac3aa --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/controller/TeamGroupController.java @@ -0,0 +1,147 @@ +package com.bonus.gs.sub.evaluate.evaluate.controller; + +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.beans.TeamGroupBean; +import com.bonus.gs.sub.evaluate.evaluate.service.TeamGroupService; +import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes; +import com.bonus.gs.sub.evaluate.manager.utils.GlobalConst; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/6/26 - 10:11 + */ +@RestController +@RequestMapping("/teamGroup") +public class TeamGroupController { + + @Autowired + private TeamGroupService teamGroupService; + + @Value("${upload.dir}") + private String uploadDir; + + @GetMapping("list") + public AjaxRes getProjectList(TeamGroupBean teamGroupBean) { + AjaxRes ar = new AjaxRes(); + try { + List teamGroupList = teamGroupService.getTeamGroupList(teamGroupBean); + ar.setListSucceed(teamGroupList); + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + + @PostMapping("delTeamGroup") + public AjaxRes delTeamGroup(@RequestBody TeamGroupBean teamGroupBean) { + AjaxRes ar = new AjaxRes(); + try { + Integer i = teamGroupService.delTeamGroup(teamGroupBean); + if (i > 0) { + ar.setSucceedMsg("删除成功"); + } else { + ar.setFailMsg("删除失败"); + } + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + + // 获取班组人员 + @GetMapping("getTeamGroupPerson") + public AjaxRes getTeamGroupPerson(TeamGroupBean teamGroupBean) { + AjaxRes ar = new AjaxRes(); + try { + List teamGroupList = teamGroupService.getTeamGroupPerson(teamGroupBean); + ar.setListSucceed(teamGroupList); + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + + @PostMapping("addTeamGroupPerson") + public AjaxRes addTeamGroupPerson(@ModelAttribute TeamGroupBean bean, + @RequestParam("file") MultipartFile file) { + AjaxRes ar = new AjaxRes(); + try { + if (file != null && !file.isEmpty()) { + // 验证文件类型 + String originalFileName = file.getOriginalFilename(); + String fileExtension = originalFileName != null ? originalFileName.split("\\.")[1] : ""; + if (!"jpg".equalsIgnoreCase(fileExtension) && !"png".equalsIgnoreCase(fileExtension)) { + ar.setFailMsg("文件类型错误,请上传jpg或png格式的文件"); + return ar; + } + } + File targetDir = new File(uploadDir); + if (!targetDir.exists()) { + targetDir.mkdirs(); + } + String fileName = System.currentTimeMillis() + "_" + file.getOriginalFilename(); + File targetFile = new File(uploadDir, fileName); + file.transferTo(targetFile); + bean.setFaceUrl(fileName); + return teamGroupService.addTeamGroupPerson(bean); + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + + @PostMapping("updateTeamPerson") + public AjaxRes updateTeamPerson(@ModelAttribute TeamGroupBean bean, + @RequestParam(value = "file", required = false)MultipartFile file) { + AjaxRes ar = new AjaxRes(); + try { + if (file != null && !file.isEmpty()) { + // 验证文件类型 + String originalFileName = file.getOriginalFilename(); + String fileExtension = originalFileName != null ? originalFileName.split("\\.")[1] : ""; + if (!"jpg".equalsIgnoreCase(fileExtension) && !"png".equalsIgnoreCase(fileExtension)) { + ar.setFailMsg("文件类型错误,请上传jpg或png格式的文件"); + return ar; + } + + File targetDir = new File(uploadDir); + if (!targetDir.exists()) { + targetDir.mkdirs(); + } + String fileName = System.currentTimeMillis() + "_" + file.getOriginalFilename(); + File targetFile = new File(uploadDir, fileName); + file.transferTo(targetFile); + bean.setFaceUrl(fileName); + } + return teamGroupService.updateTeamPerson(bean); + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } + + + @PostMapping("delTeamPerson") + public AjaxRes delTeamPerson(@RequestBody TeamGroupBean teamGroupBean) { + AjaxRes ar = new AjaxRes(); + try { + Integer i = teamGroupService.delTeamPerson(teamGroupBean); + if (i > 0) { + ar.setSucceedMsg("删除成功"); + } else { + ar.setFailMsg("班组长无法删除!"); + } + } catch (Exception e) { + ar.setFailMsg(GlobalConst.DATA_FAIL); + } + return ar; + } +} diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/OrganizationalDao.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/OrganizationalDao.java index 0b42fc6..555e7b2 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/OrganizationalDao.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/OrganizationalDao.java @@ -169,4 +169,18 @@ public interface OrganizationalDao{ int getConsIsExistByPro(OrganizationalBean bean); int updateName(OrganizationalBean bean); + + List getSubContractorSelected(); + + List getProjectBySubContractor(OrganizationalBean bean); + + List getTeamGroupType(OrganizationalBean bean); + + String getsubcontractorId(OrganizationalBean bean); + + Integer insetTeamGroupType(OrganizationalBean bean); + + Integer insetTeamPerson(OrganizationalBean bean); + + List getWorkType(OrganizationalBean bean); } 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 new file mode 100644 index 0000000..263d929 --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/ProjectDao.java @@ -0,0 +1,24 @@ +package com.bonus.gs.sub.evaluate.evaluate.dao; + +import com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/6/24 - 14:29 + */ + +@Mapper +public interface ProjectDao { + List getProjectList(ProjectBean projectBean); + + Integer getSubcontractorNum(ProjectBean projectBean); + + Integer updateName(ProjectBean projectBean); + + Integer delProject(ProjectBean projectBean); + + Integer addProject(ProjectBean projectBean); +} diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/TeamGroupDao.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/TeamGroupDao.java new file mode 100644 index 0000000..f46aaa9 --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/dao/TeamGroupDao.java @@ -0,0 +1,42 @@ +package com.bonus.gs.sub.evaluate.evaluate.dao; + +import com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean; +import com.bonus.gs.sub.evaluate.evaluate.beans.TeamGroupBean; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/6/24 - 14:29 + */ + +@Mapper +public interface TeamGroupDao { + List getTeamGroupList(TeamGroupBean teamGroupBean); + + Integer updaTeteamGroup(TeamGroupBean teamGroupBean); + Integer updaTeteamType(TeamGroupBean teamGroupBean); + + Integer selectTeteamType(TeamGroupBean teamGroupBean); + + Integer addTeamType(TeamGroupBean teamGroupBean); + + Integer delTeamGroup(TeamGroupBean teamGroupBean); + + Integer delTeamGroupType(TeamGroupBean teamGroupBean); + + List getTeamGroupPerson(TeamGroupBean teamGroupBean); + + Integer addTeamGroupPerson(TeamGroupBean teamGroupBean); + + Integer getUserNumByIdCard(TeamGroupBean teamGroupBean); + + Integer getUserNumByPhone(TeamGroupBean teamGroupBean); + + Integer updateTeamPerson(TeamGroupBean teamGroupBean); + + Integer isTeamLeader(TeamGroupBean teamGroupBean); + + Integer delTeamPerson(TeamGroupBean teamGroupBean); +} diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/OrganizationalService.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/OrganizationalService.java index a9532df..c6360f3 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/OrganizationalService.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/OrganizationalService.java @@ -68,4 +68,14 @@ public interface OrganizationalService{ AjaxRes userOutDataFail(OrganizationalBean bean); AjaxRes updateName(OrganizationalBean bean); + + List getSubContractorSelected(); + + List getProjectBySubContractor(OrganizationalBean bean); + + List getTeamGroupType(OrganizationalBean bean); + + AjaxRes addTeamGroup(OrganizationalBean bean); + + List getWorkType(OrganizationalBean bean); } diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/OrganizationalServiceImpl.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/OrganizationalServiceImpl.java index 1478738..1c7f404 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/OrganizationalServiceImpl.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/OrganizationalServiceImpl.java @@ -329,6 +329,63 @@ public class OrganizationalServiceImpl implements OrganizationalService { return ar; } + @Override + public List getSubContractorSelected() { + return mapper.getSubContractorSelected(); + } + + @Override + public List getProjectBySubContractor(OrganizationalBean bean) { + return mapper.getProjectBySubContractor(bean); + } + + @Override + public List getTeamGroupType(OrganizationalBean bean) { + return mapper.getTeamGroupType(bean); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxRes addTeamGroup(OrganizationalBean bean) { + AjaxRes ar = new AjaxRes(); + try { + // 根据外包商id(project_assignment)和项目id获取组织架构(pm_org_info)中外包商id + String id = mapper.getsubcontractorId(bean); + bean.setParentId(id); + int userNum = mapper.getUserNum(bean); + if (userNum > 0) { + ar.setFailMsg("该人员已存在"); + return ar; + } + int teamName = mapper.getTeamName(bean); + if (teamName > 0) { + ar.setFailMsg("该班组名称已存在"); + return ar; + } + + int num = mapper.addData(bean); + if (num > 0) { + // 新增班组类型 + mapper.insetTeamGroupType(bean); + // 新增班组类型 + mapper.insetTeamPerson(bean); + ar.setSucceed("新增成功"); + return ar; + } + ar.setFailMsg("新增失败,请联系管理员"); + return ar; + } catch (Exception e) { + logger.error(e.toString(), e); + ar.setFailMsg("新增失败,请联系管理员"); + } + return ar; + } + + @Override + public List getWorkType(OrganizationalBean bean) { + return mapper.getWorkType(bean); + } + public static List buildTree(List nodes) { // 根节点是没有父节点的节点 List rootNodes = nodes.stream() 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 new file mode 100644 index 0000000..036e0cf --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectService.java @@ -0,0 +1,20 @@ +package com.bonus.gs.sub.evaluate.evaluate.service; + +import com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/6/24 - 14:16 + */ +public interface ProjectService { + + List getProjectList(ProjectBean projectBean); + + Integer updateName(ProjectBean projectBean); + + Integer delProject(ProjectBean projectBean); + + Integer addProject(ProjectBean projectBean); +} 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 new file mode 100644 index 0000000..bfec816 --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/ProjectServiceImpl.java @@ -0,0 +1,43 @@ +package com.bonus.gs.sub.evaluate.evaluate.service; + +import com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean; +import com.bonus.gs.sub.evaluate.evaluate.dao.ProjectDao; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/6/24 - 14:17 + */ +@Service +public class ProjectServiceImpl implements ProjectService { + @Autowired + private ProjectDao projectDao; + + @Override + public List getProjectList(ProjectBean projectBean) { + List projectList = projectDao.getProjectList(projectBean); + for (ProjectBean bean : projectList) { + Integer num = projectDao.getSubcontractorNum(bean); + bean.setSubcontractorNum(num); + } + return projectList; + } + + @Override + public Integer updateName(ProjectBean projectBean) { + return projectDao.updateName(projectBean); + } + + @Override + public Integer delProject(ProjectBean projectBean) { + return projectDao.delProject(projectBean); + } + + @Override + public Integer addProject(ProjectBean projectBean) { + return projectDao.addProject(projectBean); + } +} diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/TeamGroupService.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/TeamGroupService.java new file mode 100644 index 0000000..49fbd76 --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/TeamGroupService.java @@ -0,0 +1,27 @@ +package com.bonus.gs.sub.evaluate.evaluate.service; + +import com.bonus.gs.sub.evaluate.evaluate.beans.ProjectBean; +import com.bonus.gs.sub.evaluate.evaluate.beans.TeamGroupBean; +import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/6/26 - 10:12 + */ +public interface TeamGroupService { + List getTeamGroupList(TeamGroupBean teamGroupBean); + + void updaTeteamGroup(TeamGroupBean teamGroupBean); + + Integer delTeamGroup(TeamGroupBean teamGroupBean); + + List getTeamGroupPerson(TeamGroupBean teamGroupBean); + + AjaxRes addTeamGroupPerson(TeamGroupBean teamGroupBean); + + AjaxRes updateTeamPerson(TeamGroupBean teamGroupBean); + + Integer delTeamPerson(TeamGroupBean teamGroupBean); +} diff --git a/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/TeamGroupServiceImpl.java b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/TeamGroupServiceImpl.java new file mode 100644 index 0000000..d4e23a9 --- /dev/null +++ b/src/main/java/com/bonus/gs/sub/evaluate/evaluate/service/TeamGroupServiceImpl.java @@ -0,0 +1,99 @@ +package com.bonus.gs.sub.evaluate.evaluate.service; + +import com.bonus.gs.sub.evaluate.evaluate.beans.TeamGroupBean; +import com.bonus.gs.sub.evaluate.evaluate.dao.TeamGroupDao; +import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/6/26 - 10:12 + */ +@Service +public class TeamGroupServiceImpl implements TeamGroupService { + + @Autowired + private TeamGroupDao teamGroupDao; + + @Override + public List getTeamGroupList(TeamGroupBean teamGroupBean) { + return teamGroupDao.getTeamGroupList(teamGroupBean); + } + + @Override + public void updaTeteamGroup(TeamGroupBean teamGroupBean) { + teamGroupDao.updaTeteamGroup(teamGroupBean); + Integer i = teamGroupDao.selectTeteamType(teamGroupBean); + if (i > 0) { + // 有的话执行修改 没有执行新增 + teamGroupDao.updaTeteamType(teamGroupBean); + } else { + teamGroupDao.addTeamType(teamGroupBean); + } + } + + @Override + public Integer delTeamGroup(TeamGroupBean teamGroupBean) { + Integer i = teamGroupDao.delTeamGroup(teamGroupBean); + Integer i1 = teamGroupDao.delTeamGroupType(teamGroupBean); + if (i > 0 || i1 > 0) { + return 1; + } + return 0; + } + + @Override + public List getTeamGroupPerson(TeamGroupBean teamGroupBean) { + return teamGroupDao.getTeamGroupPerson(teamGroupBean); + } + + @Override + public AjaxRes addTeamGroupPerson(TeamGroupBean teamGroupBean) { + AjaxRes ar = new AjaxRes(); + int idCardNum = teamGroupDao.getUserNumByIdCard(teamGroupBean); + if (idCardNum > 0) { + ar.setFailMsg("该人员身份证已注册,请重新输入"); + return ar; + } + int phoneNum = teamGroupDao.getUserNumByPhone(teamGroupBean); + if (phoneNum > 0) { + ar.setFailMsg("该人员手机号已注册,请重新输入"); + return ar; + } + Integer i = teamGroupDao.addTeamGroupPerson(teamGroupBean); + if (i > 0) { + ar.setSucceed("新增成功"); + return ar; + } else { + ar.setFailMsg("新增失败"); + return ar; + } + } + + @Override + public AjaxRes updateTeamPerson(TeamGroupBean teamGroupBean) { + AjaxRes ar = new AjaxRes(); + Integer i = teamGroupDao.updateTeamPerson(teamGroupBean); + if (i > 0) { + ar.setSucceed("修改成功"); + return ar; + } else { + ar.setFailMsg("修改失败"); + return ar; + } + } + + @Override + public Integer delTeamPerson(TeamGroupBean teamGroupBean) { + // 判断是否是班组长,如果是的话不能删除 + Integer isLeader = teamGroupDao.isTeamLeader(teamGroupBean); + if (isLeader == 0) { + return 0; + } else { + return teamGroupDao.delTeamPerson(teamGroupBean); + } + } +} 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 0ffed01..485a150 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 @@ -49,6 +49,8 @@ public class ViolationBean { private String url; private String userName; private String deptId; + @ApiModelProperty("单位地址") + private String address; @ApiModelProperty("企业名称") private String enterpriseName; @ApiModelProperty("统一社会信用代码") diff --git a/src/main/java/com/bonus/gs/sub/evaluate/outsourceEnterprise/controller/ViolationController.java b/src/main/java/com/bonus/gs/sub/evaluate/outsourceEnterprise/controller/ViolationController.java index 81efc36..d26e761 100644 --- a/src/main/java/com/bonus/gs/sub/evaluate/outsourceEnterprise/controller/ViolationController.java +++ b/src/main/java/com/bonus/gs/sub/evaluate/outsourceEnterprise/controller/ViolationController.java @@ -356,12 +356,14 @@ public class ViolationController extends BaseController { String corporateName = getValue(sheetRow.getCell(3)).trim(); String idCard = getValue(sheetRow.getCell(4)).trim(); String phone = translateToPlainStr(getValue(sheetRow.getCell(5)).trim()); + String address = translateToPlainStr(getValue(sheetRow.getCell(6)).trim()); bean.setEnterpriseName(enterpriseName); bean.setSocialCreditCode(socialCreditCode); bean.setSetTime(setTime); bean.setCorporateName(corporateName); bean.setIdCard(idCard); bean.setPhone(phone); + bean.setAddress(address); ar=service.updateShopBaseInfo(bean,row); } catch (Exception e) { logger.error(e.toString(), e); @@ -514,6 +516,7 @@ public class ViolationController extends BaseController { maps.put("idCard", bean.getIdCard()); maps.put("phone", bean.getPhone()); maps.put("proNum", bean.getProNum()); + maps.put("address", bean.getAddress()); break; case"人员违章记录表": maps.put("name", bean.getName()); @@ -571,6 +574,7 @@ public class ViolationController extends BaseController { list.add("法人身份证号码"); list.add("法人手机号码"); list.add("项目数量"); + list.add("单位地址"); break; case"人员违章记录表": list.add("姓名"); diff --git a/src/main/resources/download/外包企业导入模板.xls b/src/main/resources/download/外包企业导入模板.xls index 45cde44..20dc175 100644 Binary files a/src/main/resources/download/外包企业导入模板.xls and b/src/main/resources/download/外包企业导入模板.xls differ diff --git a/src/main/resources/mappers/evaluate/OrganizationalMapper.xml b/src/main/resources/mappers/evaluate/OrganizationalMapper.xml index 5835b55..4206697 100644 --- a/src/main/resources/mappers/evaluate/OrganizationalMapper.xml +++ b/src/main/resources/mappers/evaluate/OrganizationalMapper.xml @@ -1,7 +1,7 @@ - + insert into pm_org_info name, @@ -225,6 +225,14 @@ #{userName}, #{orgRelId}) + + insert into team_group_type(team_group_id,team_type) + values (#{id}, #{teamType}) + + + insert into team_person(team_id, name, id_card, phone,sex,work_type,face_url,is_team_leader) + values (#{id}, #{userName},#{idCard}, #{userPhone}, #{sex}, #{workType}, #{faceUrl}, #{isTeamLeader}) + + + + + + diff --git a/src/main/resources/mappers/evaluate/ProjectMapper.xml b/src/main/resources/mappers/evaluate/ProjectMapper.xml new file mode 100644 index 0000000..a907a98 --- /dev/null +++ b/src/main/resources/mappers/evaluate/ProjectMapper.xml @@ -0,0 +1,66 @@ + + + + + INSERT INTO pm_org_info( + name, + parent_id, + level, + status, + table_source, + user_id, + user_name) + VALUES( + #{projectName}, + #{parentId}, + 3, + 1, + 'pm_dept' + #{userId}, + #{userName} + ) + + + UPDATE pm_org_info + SET + name = #{projectName} + WHERE + id = #{id} + + + DELETE FROM pm_org_info + WHERE + id = #{id} + + + + + diff --git a/src/main/resources/mappers/evaluate/TeamGroupMapper.xml b/src/main/resources/mappers/evaluate/TeamGroupMapper.xml new file mode 100644 index 0000000..2581c29 --- /dev/null +++ b/src/main/resources/mappers/evaluate/TeamGroupMapper.xml @@ -0,0 +1,101 @@ + + + + + insert into team_group_type(team_group_id,team_type) values(#{id},#{teamType}) + + + insert into team_person(team_id,name,id_card,phone,sex,work_type,face_url,is_team_leader) + values + (#{id},#{name},#{idCard},#{phone},#{sex},#{workTypeId},#{faceUrl},#{isTeamLeader}) + + + + update team_group_type set team_type = #{teamType} where team_group_id = #{id} + + + + update pm_org_info set name = #{teamGroupName} where id = #{id} + + + update team_person set name = #{name},id_card = #{idCard},phone = #{phone},sex = #{sex},work_type = #{workType},face_url = #{faceUrl} + where id = #{id} + + + delete from pm_org_info where id = #{id} + + + delete from team_group_type where team_group_id = #{id} + + + delete from team_person where id = #{id} + + + + + + + + + diff --git a/src/main/resources/mappers/violation/ViolationMapper.xml b/src/main/resources/mappers/violation/ViolationMapper.xml index 32c1870..f211686 100644 --- a/src/main/resources/mappers/violation/ViolationMapper.xml +++ b/src/main/resources/mappers/violation/ViolationMapper.xml @@ -13,6 +13,7 @@ currentScore, create_time, update_time, + address, is_active ) values( @@ -26,6 +27,7 @@ #{currentScore}, now(), now(), + #{address}, '1' ) @@ -37,6 +39,7 @@ corporateName, idCard, phone, + address, inThoseDays, currentScore, create_time, @@ -50,6 +53,7 @@ #{corporateName}, #{idCard}, #{phone}, + #{address}, YEAR(NOW()), '12', now(), @@ -67,6 +71,7 @@ phone = #{phone}, inThoseDays = #{inThoseDays}, currentScore = #{currentScore}, + address = #{address}, update_time = now() where id = #{id} @@ -113,7 +118,8 @@ pa.setTime as setTime, pa.corporateName as corporateName, pa.idCard as idCard, - pa.phone as phone + pa.phone as phone, + pa.address as address FROM project_assignment pa LEFT JOIN(SELECT count(1) num, lk_id FROM pm_org_info @@ -131,6 +137,7 @@ pa.corporateName as corporateName, pa.idCard as idCard, pa.phone as phone, + pa.address as address, ifnull(pro.num,'0') as proNum FROM project_assignment pa LEFT JOIN( @@ -294,7 +301,8 @@ pa.setTime as setTime, pa.corporateName as corporateName, pa.idCard as idCard,ifnull(pro.num,'0') proNum, - pa.phone as phone + pa.phone as phone, + pa.address as address FROM project_assignment pa LEFT JOIN( SELECT count(1) num ,lk_id FROM pm_org_info GROUP BY lk_id diff --git a/src/main/resources/static/js/evaluate/project/addForm.js b/src/main/resources/static/js/evaluate/project/addForm.js new file mode 100644 index 0000000..41f08b6 --- /dev/null +++ b/src/main/resources/static/js/evaluate/project/addForm.js @@ -0,0 +1,89 @@ +let form, table, tree; +let alreadyChooseTrees = []; +let selectData = []; + +layui.use(['table', 'form', 'tree'], function () { + const $ = layui.$; + form = layui.form; + table = layui.table; + + // 初始化下拉框 + getdepartmentSelect(); + getPromanagerSelect(); + + // 设置下拉框选项 + 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 getdepartmentSelect() { + $.ajax({ + type: 'POST', + url: ctxPath + '/initiateEvaluate/getOrgSelect', + success: function (data) { + setSelectValue(data.obj, 'department'); + } + }); + } + + // 获取项目经理下拉数据 + function getPromanagerSelect() { + $.ajax({ + type: 'POST', + url: ctxPath + '/organizational/getLeaderSelect', + success: function (data) { + setSelectValue(data.obj, 'personInChargeId'); + } + }); + } + + // 表单提交事件监听 + form.on('submit(formSubmit)', function (data) { + const field = data.field; // 获取表单字段 { proId: "xxx", department: "xxx", personInChargeId: "xxx" } + + console.log("表单数据:", JSON.stringify(field)); + const submitData = { + name: field.name, // 项目名称对应name字段 + level: 3, + parentId: field.department, // 事业部ID + tableSource: 'pm_dept', + // 其他字段根据接口需要添加 + userId: field.personInChargeId,// 保留项目经理ID + userName: $('#personInChargeId').find('option:selected').text() + }; + + // 调用保存接口 + $.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/editForm.js b/src/main/resources/static/js/evaluate/project/editForm.js new file mode 100644 index 0000000..b4e27e3 --- /dev/null +++ b/src/main/resources/static/js/evaluate/project/editForm.js @@ -0,0 +1,89 @@ +let form, layer, dtree; +let objParam; +let id; +let currentLayerIndex = null; +function setParams(obj,layerIndex) { + objParam = JSON.parse(obj); + window.layerIndex = layerIndex; + $("#projectName").val(objParam.projectName); + id = objParam.id; + // $("#orgId").val(objParam.id); + layui.use(["form", "layer"], function () { + form = layui.form; + layer = layui.layer; + form.on("submit(formData)", function (obj) { + updateName(obj,id); + }); + form.render(); + }); +} + +function saveData2() { + $("#formSubmit").trigger("click"); +} + +// 提交 +function updateName(data,id) { + let loadingMsg = layer.msg("正在提交保存,请稍等...", { + icon: 16, + shade: 0.01, + time: "0", + }); + let url = `${ctxPath}` + "/project/updateName"; + let item = { + id: id, + projectName: data.field.projectName, + }; + // console.log(JSON.stringify(data)+"data") + $.ajax({ + url: url, + type: "POST", + data: JSON.stringify(item), + dataType: "json", + contentType: "application/json", + beforeSend: function () { + $(".save").addClass("layui-btn-disabled").attr("disabled", true); + $(".cancel").addClass("layui-btn-disabled").attr("disabled", true); + }, + success: function (result) { + layer.close(loadingMsg); // 关闭提示层 + $(".save") + .removeClass("layui-btn-disabled") + .attr("disabled", false); + $(".cancel") + .removeClass("layui-btn-disabled") + .attr("disabled", false); + if (result.res === 1) { + layer.msg(result.resMsg, {icon: 1}); + closePage(1); + } else { + layer.msg(result.resMsg, {icon: 2}); + } + }, + error: function (result) { + layer.close(loadingMsg); // 关闭提示层 + layer.msg("服务异常,请稍后重试", { + icon: 16, + scrollbar: false, + time: 2000, + }); + $(".save") + .removeClass("layui-btn-disabled") + .attr("disabled", false); + $(".cancel") + .removeClass("layui-btn-disabled") + .attr("disabled", false); + }, + }); +} + +// 关闭页面 +function closePage(type) { + if (type === 1) { + window.parent.search(1); + } + window.parent.layer.close(window.layerIndex); +} + + + diff --git a/src/main/resources/static/js/evaluate/project/projectList.js b/src/main/resources/static/js/evaluate/project/projectList.js new file mode 100644 index 0000000..1ca996c --- /dev/null +++ b/src/main/resources/static/js/evaluate/project/projectList.js @@ -0,0 +1,273 @@ +// 专责审批 js文件 +let layer, laydate, table, form; +$(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", + }); + businessDivisionPullDown(form, null); + getProjectManages(); + initTable(); + }); +}); + +function getProjectManages() { + $.ajax({ + url: `${ctxPath}` + "/organizational/getLeaderSelect", + type: "post", + data: {}, + dataType: "JSON", + success: function (result) { + if (result.res === 1) { + setSelectValue(result.obj, "personInChargeId", "id", "name"); + } + }, + }); +} + +function setSelectValue(list, selectName, code, nameCode) { + let html = ''; + if (list && list.length > 0) { + $.each(list, function (index, item) { + html += + ""; + }); + } + $("#" + selectName) + .empty() + .append(html); + layui.form.render(); +} + +function search(type) { + if (type === 1) { + } else { + $("#keyWord").val(""); + $("#evaluateDeptId").val(""); + $("#personInChargeId").val(""); + // $("#evStatus").val(""); + // $("#status").val(""); + // $("#startDate").val(""); + // $("#endDate").val(""); + form.render("select"); + } + table.reload("baseTable", { + url: ctxPath + "/project/list", + page: { + curr: 1, + }, + where: { + type: "audit", + keyWord: $("#keyWord").val(), + evaluateDeptId: $("#evaluateDeptId").val(), + personInChargeId: $("#personInChargeId").val(), + // evStatus: $("#evStatus").val(), + // status: $("#status").val(), + // startDate: $("#startDate").val(), + // endDate: $("#endDate").val(), + }, + }); +} + +function initTable() { + //渲染表格 + table.render({ + elem: "#baseTable", + url: ctxPath + "/project/list", //数据接口 + method: "get", //方式默认是get + toolbar: "default", //开启工具栏,此处显示默认图标,可以自定义模板,详见文档 + where: { + type: "audit", + }, //post请求必须加where ,post请求需要的参数 + cellMinWidth: 80, + cols: [ + [ + //表头 + { + field: "number", + width: 80, + title: "序号", + align: "center", + type: "numbers", + }, + {field: "projectName", align: "center", title: "项目名称"}, + {field: "department", align: "center", title: "所属事业部"}, + {field: "projectManager", align: "center", title: "项目经理"}, + {field: "subcontractorNum", align: "center", title: "参与分包商数量"}, + { + fixed: "right", + width: 180, + title: "操作", + align: "center", + templet: (d) => { + let text = ""; + // if (d.isAudit == "1") { + 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 "edit": + ViewReviews(data, "编辑"); + break; + case "del": + DelReviews(data, "删除"); + break; + default: + console.warn(`未知事件: ${layEvent}`); + } + }); + + //查看子页面 + function ViewReviews(data, title) { + try { + localStorage.setItem("AllAuditTitle", title); + const layerIndex = layer.open({ + type: 2, + title: title, + shade: 0.3, + area: ["50%", "40%"], + scrollbar: true, + move: true, + anim: 2, + name: "editProject", + shadeClose: false, + content: + './editForm.html', + success: function (layero, index) { + let iframeWin = window["layui-layer-iframe" + index]; + iframeWin.setParams(JSON.stringify(data), index); + }, + // end: function () { + // search(2); + // }, + }); + } catch (error) { + console.error("ViewReviews 错误:", error); + } + } + + //删除项目信息 + function DelReviews(data, title) { + try { + layer.confirm('是否确认删除?', { + title: title || '提示', + icon: 3, + shade: 0.3, + btn: ['确定', '取消'] + }, function (index) { + + // 禁用按钮防止重复提交 + $(".save").addClass("layui-btn-disabled").attr("disabled", true); + $(".cancel").addClass("layui-btn-disabled").attr("disabled", true); + let item = { + id: data.id + }; + $.ajax({ + url: `${ctxPath}/project/delProject`, + type: "POST", + data: JSON.stringify(item), + dataType: "json", + contentType: "application/json", + + success: function (res) { + $(".save").removeClass("layui-btn-disabled").attr("disabled", false); + $(".cancel").removeClass("layui-btn-disabled").attr("disabled", false); + + 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); + $(".save").removeClass("layui-btn-disabled").attr("disabled", false); + $(".cancel").removeClass("layui-btn-disabled").attr("disabled", false); + layer.msg("服务异常,请稍后重试", { + icon: 2, + time: 2000 + }); + } + }); + }, function (index) { + // 取消操作 + layer.close(index); + }); + } catch (error) { + console.error("DelReviews 错误:", error); + layer.msg("发生异常,请查看控制台", { icon: 2 }); + } + } +} + +function addProject() { + layer.open({ + type: 2, // iframe 模式 + title: "新增项目", + content: "./addForm.html", // 要打开的页面 + maxmin: false, // 不显示最大化/最小化按钮 + area: ["40%", "50%"], // 弹出层大小 + success: function (layero, index) { + // 如果需要在弹出层加载完成后执行某些操作,可以在这里写 + } + }); +} diff --git a/src/main/resources/static/js/evaluate/teamGroup/addForm.js b/src/main/resources/static/js/evaluate/teamGroup/addForm.js new file mode 100644 index 0000000..e5a6d19 --- /dev/null +++ b/src/main/resources/static/js/evaluate/teamGroup/addForm.js @@ -0,0 +1,155 @@ +let form, table, tree; +let alreadyChooseTrees = []; +let selectData = []; + +layui.use(['table', 'form', 'upload', 'tree'], function () { + const $ = layui.$; + form = layui.form; + upload = layui.upload; + table = layui.table; + // 使用 layui 的 form.on 监听下拉框变化 + form.on('select(subContractor)', function (obj) { + const subContractorId = obj.value; // 获取选中的值 + console.log("subContractorId:", subContractorId); + + if (subContractorId) { + getPromanagerSelect(subContractorId); + } + }); + + // 让点击上传按钮触发文件输入框的点击事件 + $('#uploadBtn').on('click', function () { + $('#fileInput').click(); + }); + + // 文件选择后的回调处理 + $('#fileInput').on('change', function () { + const file = $('#fileInput')[0].files[0]; + const fileName = file.name; + const fileExtension = fileName.split('.').pop().toLowerCase(); + + // 校验文件类型,确保是 .xls 或 .xlsx 文件 + if (fileExtension !== 'jpg' && fileExtension !== 'png') { + layer.msg('请选择 图片 文件(.jpg 或 .png)', {icon: 2, time: 2000}); + $('#fileInput').val(''); + $('#fileInfo').html(''); + } else { + $('#fileInfo').html('选中的文件:' + fileName); + } + }); + // 初始化下拉框 + getOutSourceSelected(); + getTeamGroupType(); + getWorkType(); + + // 设置下拉框选项 + 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 getOutSourceSelected() { + $.ajax({ + type: 'POST', + url: ctxPath + '/organizational/getSubContractorSelected', + success: function (data) { + setSelectValue(data.obj, 'subContractor'); + } + }); + } + +// 根据外包商获取项目下拉数据(支持传参) + function getPromanagerSelect(subContractorId) { + $.ajax({ + type: 'POST', + url: ctxPath + '/organizational/getProjectBySubContractor', + data: { + id: subContractorId + }, + success: function (data) { + setSelectValue(data.obj, 'project'); + } + }); + } + +// 获取班组类型下拉框 + function getTeamGroupType() { + $.ajax({ + type: 'POST', + url: ctxPath + '/organizational/getTeamGroupType', + success: function (data) { + setSelectValue(data.obj, 'teamType'); + } + }); + } + +// 获取工种类型下拉框 + function getWorkType() { + $.ajax({ + type: 'POST', + url: ctxPath + '/organizational/getWorkType', + success: function (data) { + setSelectValue(data.obj, 'workType'); + } + }); + } + + // 表单提交事件监听 + form.on('submit(formSubmit)', function (data) { + const field = data.field; + // 校验文件是否选择 + const file = $('#fileInput')[0].files[0]; + console.log("file:", file) + if (!file) { + layer.msg("请上传文件", {icon: 2, time: 2000}); + return false; + } + console.log("表单数据:", JSON.stringify(field)); + const formDataWithFile = new FormData(); + + formDataWithFile.append("id", field.subContractor); + formDataWithFile.append("parentId", field.project); + formDataWithFile.append("name", field.teamGroupName); + formDataWithFile.append("userName", field.name); + formDataWithFile.append("idCard", field.idCard); + formDataWithFile.append("sex", field.sex); + formDataWithFile.append("userPhone", field.phone); + formDataWithFile.append("level", 5); // 固定值 + formDataWithFile.append("tableSource", "pm_dept"); + formDataWithFile.append("workType", field.workType); + formDataWithFile.append("teamType", field.teamType); + formDataWithFile.append("isTeamLeader", 0); // 固定值 + formDataWithFile.append("file", file); // 文件类型字段 + $.ajax({ + url: ctxPath + '/organizational/addTeamGroup', + type: 'POST', + dataType: "json", + processData: false, + contentType: false, + data: formDataWithFile, + 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/teamGroup/addPersonForm.js b/src/main/resources/static/js/evaluate/teamGroup/addPersonForm.js new file mode 100644 index 0000000..22f47df --- /dev/null +++ b/src/main/resources/static/js/evaluate/teamGroup/addPersonForm.js @@ -0,0 +1,106 @@ +let form, table, tree; + +function setParams(obj, layerIndex) { + objParam = JSON.parse(obj); + // 班组id + let id = objParam.id; + + layui.use(['table', 'form', 'upload', 'tree'], function () { + const $ = layui.$; + form = layui.form; + upload = layui.upload; + table = layui.table; + + // 让点击上传按钮触发文件输入框的点击事件 + $('#uploadBtn').on('click', function () { + $('#fileInput').click(); + }); + + // 文件选择后的回调处理 + $('#fileInput').on('change', function () { + const file = $('#fileInput')[0].files[0]; + const fileName = file.name; + const fileExtension = fileName.split('.').pop().toLowerCase(); + + // 校验文件类型,确保是 .xls 或 .xlsx 文件 + if (fileExtension !== 'jpg' && fileExtension !== 'png') { + layer.msg('请选择 图片 文件(.jpg 或 .png)', {icon: 2, time: 2000}); + $('#fileInput').val(''); + $('#fileInfo').html(''); + } else { + $('#fileInfo').html('选中的文件:' + fileName); + } + }); + getWorkType(); + + // 设置下拉框选项 + 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 getWorkType() { + $.ajax({ + type: 'POST', + url: ctxPath + '/organizational/getWorkType', + success: function (data) { + setSelectValue(data.obj, 'workType'); + } + }); + } + + // 表单提交事件监听 + form.on('submit(formSubmit)', function (data) { + const field = data.field; + // 校验文件是否选择 + const file = $('#fileInput')[0].files[0]; + console.log("file:", file) + if (!file) { + layer.msg("请上传文件", {icon: 2, time: 2000}); + return false; + } + console.log("表单数据:", JSON.stringify(field)); + const formDataWithFile = new FormData(); + + formDataWithFile.append("id", id); + formDataWithFile.append("name", field.name); + formDataWithFile.append("idCard", field.idCard); + formDataWithFile.append("sex", field.sex); + formDataWithFile.append("phone", field.phone); + formDataWithFile.append("workTypeId", field.workType); + formDataWithFile.append("isTeamLeader", 1); // 固定值 + formDataWithFile.append("file", file); // 文件类型字段 + $.ajax({ + url: ctxPath + '/teamGroup/addTeamGroupPerson', + type: 'POST', + dataType: "json", + processData: false, + contentType: false, + data: formDataWithFile, + 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/teamGroup/editForm.js b/src/main/resources/static/js/evaluate/teamGroup/editForm.js new file mode 100644 index 0000000..a0f4a60 --- /dev/null +++ b/src/main/resources/static/js/evaluate/teamGroup/editForm.js @@ -0,0 +1,125 @@ +let form, layer, dtree; +let objParam; +let id; +let currentLayerIndex = null; + +function setParams(obj, layerIndex) { + objParam = JSON.parse(obj); + window.layerIndex = layerIndex; + getTeamGroupType(objParam.teamTypeId); + // 字段回显 + $("#teamGroupName").val(objParam.teamGroupName); + id = objParam.id; + // $("#orgId").val(objParam.id); + layui.use(["form", "layer"], function () { + form = layui.form; + layer = layui.layer; + // obj是表单数据 + form.on("submit(formData)", function (obj) { + updateName(obj, id); + }); + form.render(); + }); +} + +function saveData2() { + $("#formSubmit").trigger("click"); +} + +// 提交 +function updateName(data, id) { + let loadingMsg = layer.msg("正在提交保存,请稍等...", { + icon: 16, + shade: 0.01, + time: "0", + }); + let url = `${ctxPath}` + "/teamGroup/updaTeteamGroup"; + let item = { + id: id, + teamGroupName: data.field.teamGroupName, + teamType: data.field.teamType, + }; + // console.log(JSON.stringify(data)+"data") + $.ajax({ + url: url, + type: "POST", + data: JSON.stringify(item), + dataType: "json", + contentType: "application/json", + beforeSend: function () { + $(".save").addClass("layui-btn-disabled").attr("disabled", true); + $(".cancel").addClass("layui-btn-disabled").attr("disabled", true); + }, + success: function (result) { + layer.close(loadingMsg); // 关闭提示层 + $(".save") + .removeClass("layui-btn-disabled") + .attr("disabled", false); + $(".cancel") + .removeClass("layui-btn-disabled") + .attr("disabled", false); + if (result.res === 1) { + layer.msg(result.resMsg, {icon: 1}); + setTimeout(function () { + closePage(1); + }, 500); + } else { + layer.msg(result.resMsg, {icon: 2}); + } + }, + error: function (result) { + layer.close(loadingMsg); // 关闭提示层 + layer.msg("服务异常,请稍后重试", { + icon: 16, + scrollbar: false, + time: 2000, + }); + $(".save") + .removeClass("layui-btn-disabled") + .attr("disabled", false); + $(".cancel") + .removeClass("layui-btn-disabled") + .attr("disabled", false); + }, + }); +} + +// 关闭页面 +function closePage(type) { + if (type === 1) { + window.parent.search(1); + } + window.parent.layer.close(window.layerIndex); +} + +// 获取班组类型下拉框 +function getTeamGroupType(teamTypeId) { + $.ajax({ + type: 'POST', + url: ctxPath + '/organizational/getTeamGroupType', + success: function (data) { + setSelectValue(data.obj, 'teamType', teamTypeId); + } + }); +} + +// 设置下拉框选项 +function setSelectValue(list, selectName, teamTypeId) { + let html = ''; + if (list && list.length > 0) { + $.each(list, function (index, item) { + html += ``; + }); + } + + $('#' + selectName).empty().append(html); + // 如果有需要回显的值 + if (teamTypeId !== undefined && teamTypeId !== null) { + $('#' + selectName).val(teamTypeId); + } + form.render('select'); +} + + + + diff --git a/src/main/resources/static/js/evaluate/teamGroup/editPersonForm.js b/src/main/resources/static/js/evaluate/teamGroup/editPersonForm.js new file mode 100644 index 0000000..586de01 --- /dev/null +++ b/src/main/resources/static/js/evaluate/teamGroup/editPersonForm.js @@ -0,0 +1,138 @@ +let form, layer, dtree, upload; +let objParam; +let currentLayerIndex = null; + +function setParams(obj, layerIndex) { + objParam = JSON.parse(obj); + window.layerIndex = layerIndex; + getWorkType(objParam.workTypeId); + // 字段回显 + $("#name").val(objParam.name); + if (objParam.sex === '男') { + $("#sex").val(1); + } else { + $("#sex").val(2); + } + + $("#idCard").val(objParam.idCard); + $("#phone").val(objParam.phone); + if (objParam.faceUrl != null && objParam.faceUrl !== '') { + $('#fileInfo').html(objParam.faceUrl); + } + + layui.use(["form", "layer", "upload"], function () { + form = layui.form; + upload = layui.upload; + layer = layui.layer; + // 让点击上传按钮触发文件输入框的点击事件 + $('#uploadBtn').on('click', function () { + console.log("点击上传按钮"); + $('#fileInput').click(); + }); + + // 文件选择后的回调处理 + $('#fileInput').on('change', function () { + const file = $('#fileInput')[0].files[0]; + const fileName = file.name; + const fileExtension = fileName.split('.').pop().toLowerCase(); + + // 校验文件类型,确保是 .jpg 或 .png 文件 + if (fileExtension !== 'jpg' && fileExtension !== 'png') { + layer.msg('请选择 图片 文件(.jpg 或 .png)', {icon: 2, time: 2000}); + $('#fileInput').val(''); + $('#fileInfo').html(''); + } else { + $('#fileInfo').html('选中的文件:' + fileName); + } + }); + // obj是表单数据 + form.on("submit(formSubmit)", function (obj) { + updateTeamPerson(obj, objParam.id); + }); + form.render(); + }); +} + +// 提交 +function updateTeamPerson(data, id) { + let loadingMsg = layer.msg("正在提交保存,请稍等...", { + icon: 16, + shade: 0.01, + time: "0", + }); + let url = `${ctxPath}` + "/teamGroup/updateTeamPerson"; + const file = $('#fileInput')[0].files[0]; + const fileInfo = $('#fileInfo').html().trim(); + if (!file && !fileInfo) { + layer.msg("请上传文件", {icon: 2, time: 2000}); + return false; + } + const field = data.field; + const formDataWithFile = new FormData(); + formDataWithFile.append("id", id); + formDataWithFile.append("name", field.name); + formDataWithFile.append("idCard", field.idCard); + formDataWithFile.append("sex", field.sex); + formDataWithFile.append("phone", field.phone); + formDataWithFile.append("workType", field.workType); + // 如果有新上传的文件,优先使用;否则,检查是否有 fileInfo(已有文件路径) + if (file) { + formDataWithFile.append("file", file); // 新上传的文件 + } else if (fileInfo) { + formDataWithFile.append("faceUrl", fileInfo); + } + $.ajax({ + url: url, + type: "POST", + data: formDataWithFile, + dataType: "json", + processData: false, + contentType: false, + 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}); + } + }); +} + +// 获取工种下拉框 +function getWorkType(workTypeId) { + $.ajax({ + type: 'POST', + url: ctxPath + '/organizational/getWorkType', + success: function (data) { + setSelectValue(data.obj, 'workType', workTypeId); + } + }); +} + +// 设置下拉框选项 +function setSelectValue(list, selectName, workTypeId) { + let html = ''; + if (list && list.length > 0) { + $.each(list, function (index, item) { + html += ``; + }); + } + + $('#' + selectName).empty().append(html); + // 如果有需要回显的值 + if (workTypeId !== undefined && workTypeId !== null) { + $('#' + selectName).val(workTypeId); + } + form.render('select'); +} + + + + diff --git a/src/main/resources/static/js/evaluate/teamGroup/teamGroupList.js b/src/main/resources/static/js/evaluate/teamGroup/teamGroupList.js new file mode 100644 index 0000000..392da86 --- /dev/null +++ b/src/main/resources/static/js/evaluate/teamGroup/teamGroupList.js @@ -0,0 +1,409 @@ +// 专责审批 js文件 +let layer, laydate, table, form; +$(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", + }); + // businessDivisionPullDown(form, null); + // getProjectManages(); + initTable(); + }); +}); + +function getProjectManages() { + $.ajax({ + url: `${ctxPath}` + "/organizational/getLeaderSelect", + type: "post", + data: {}, + dataType: "JSON", + success: function (result) { + if (result.res === 1) { + setSelectValue(result.obj, "teamLeader", "id", "name"); + } + }, + }); +} + +function setSelectValue(list, selectName, code, nameCode) { + let html = ''; + if (list && list.length > 0) { + $.each(list, function (index, item) { + html += + ""; + }); + } + $("#" + selectName) + .empty() + .append(html); + layui.form.render(); +} + +function search(type) { + if (type === 1) { + } else { + $("#keyWord").val(""); + $("#status").val(""); + // $("#teamGroupName").val(""); + // $("#teamLeader").val(""); + + form.render("select"); + } + table.reload("baseTable", { + url: ctxPath + "/teamGroup/list", + page: { + curr: 1, + }, + where: { + type: "audit", + keyWord: $("#keyWord").val(), + status: $("#status").val(), + // teamGroupName: $("#teamGroupName").val(), + // teamLeader: $("#teamLeader").val(), + }, + }); +} + +function initTable() { + //渲染表格 + table.render({ + elem: "#baseTable", + url: ctxPath + "/teamGroup/list", //数据接口 + method: "get", //方式默认是get + toolbar: "default", //开启工具栏,此处显示默认图标,可以自定义模板,详见文档 + where: { + type: "audit", + }, //post请求必须加where ,post请求需要的参数 + cellMinWidth: 80, + cols: [ + [ + //表头 + { + field: "number", + width: 80, + title: "序号", + align: "center", + type: "numbers", + }, + {field: "subContractor", align: "center", title: "所属分包商"}, + {field: "project", align: "center", title: "所属项目"}, + {field: "teamGroupName", align: "center", title: "班组名称"}, + {field: "teamLeader", align: "center", title: "班组长"}, + {field: "teamType", align: "center", title: "班组类型"}, + // {field: "teamPersonNum", align: "center", title: "班组人数"}, + { + field: "teamPersonNum", + align: "center", + title: "班组人数", + templet: function(d) { + return '' + d.teamPersonNum + ''; + } + }, + { + fixed: "right", + width: 180, + title: "操作", + align: "center", + templet: (d) => { + let text = ""; + text += + '编辑'; + text += + '删除'; + if (d.status == 1) { + 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 "edit": + ViewReviews(data, "编辑"); + break; + case "del": + DelReviews(data, "删除"); + break; + case "exit": + ExitReviews(data, "退场"); + break; + default: + console.warn(`未知事件: ${layEvent}`); + } + }); + + //编辑 + function ViewReviews(data, title) { + try { + localStorage.setItem("teamGroupData", data); + const layerIndex = layer.open({ + type: 2, + title: title, + shade: 0.3, + area: ["50%", "40%"], + scrollbar: true, + move: true, + anim: 2, + name: "editTeamGroup", + shadeClose: false, + content: + './editForm.html', + success: function (layero, index) { + let iframeWin = window["layui-layer-iframe" + index]; + iframeWin.setParams(JSON.stringify(data), index); + }, + }); + } catch (error) { + console.error("ViewReviews 错误:", error); + } + } + + //删除项目信息 + function DelReviews(data, title) { + try { + layer.confirm('是否确认删除?', { + title: title || '提示', + icon: 3, + shade: 0.3, + btn: ['确定', '取消'] + }, function (index) { + + // 禁用按钮防止重复提交 + $(".save").addClass("layui-btn-disabled").attr("disabled", true); + $(".cancel").addClass("layui-btn-disabled").attr("disabled", true); + let item = { + id: data.id + }; + $.ajax({ + url: `${ctxPath}/teamGroup/delTeamGroup`, + type: "POST", + data: JSON.stringify(item), + dataType: "json", + contentType: "application/json", + + success: function (res) { + $(".save").removeClass("layui-btn-disabled").attr("disabled", false); + $(".cancel").removeClass("layui-btn-disabled").attr("disabled", false); + + 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); + $(".save").removeClass("layui-btn-disabled").attr("disabled", false); + $(".cancel").removeClass("layui-btn-disabled").attr("disabled", false); + layer.msg("服务异常,请稍后重试", { + icon: 2, + time: 2000 + }); + } + }); + }, function (index) { + // 取消操作 + layer.close(index); + }); + } catch (error) { + console.error("DelReviews 错误:", error); + layer.msg("发生异常,请查看控制台", {icon: 2}); + } + } + + //退场 + function ExitReviews(data, title) { + console.log("data", data) + try { + layer.confirm('是否确认退场?', { + title: title || '提示', + icon: 3, + shade: 0.3, + btn: ['确定', '取消'] + }, function (index) { + + // 禁用按钮防止重复提交 + $(".save").addClass("layui-btn-disabled").attr("disabled", true); + $(".cancel").addClass("layui-btn-disabled").attr("disabled", true); + let item = { + id: data.id + }; + $.ajax({ + url: `${ctxPath}` + '/organizational/userOutData', + type: "POST", + data: JSON.stringify(item), + dataType: "json", + contentType: "application/json", + + success: function (res) { + $(".save").removeClass("layui-btn-disabled").attr("disabled", false); + $(".cancel").removeClass("layui-btn-disabled").attr("disabled", false); + + if (res.res === 1) { + openEvaluatePage(res.obj) + } else { + layer.msg("删除失败:" + (res.resMsg || "未知错误"), {icon: 2}); + } + layer.close(index); // 关闭弹窗 + }, + error: function () { + layer.close(loadingMsg); + $(".save").removeClass("layui-btn-disabled").attr("disabled", false); + $(".cancel").removeClass("layui-btn-disabled").attr("disabled", false); + layer.msg("服务异常,请稍后重试", { + icon: 2, + time: 2000 + }); + } + }); + }, function (index) { + // 取消操作 + layer.close(index); + }); + } catch (error) { + console.error("DelReviews 错误:", error); + layer.msg("发生异常,请查看控制台", {icon: 2}); + } + } +} + +//班组人员列表 +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: + './teamMemBer.html', + success: function (layero, index) { + let iframeWin = window["layui-layer-iframe" + index]; + iframeWin.setParams(JSON.stringify(data), index); + }, + }); + } catch (error) { + console.error("openTeamMemberPage 错误:", error); + } +} + +function addTeamGroup() { + layer.open({ + type: 2, // iframe 模式 + title: "新增班组", + content: "./addForm.html", // 要打开的页面 + maxmin: false, // 不显示最大化/最小化按钮 + area: ["50%", "80%"], // 弹出层大小 + success: function (layero, index) { + // 如果需要在弹出层加载完成后执行某些操作,可以在这里写 + } + }); +} + +function openEvaluatePage(obj) { + let title = '评价', + content = '../../evaluate/team/evaluateTable.html'; + obj.type = 1; + obj.operType = 'back'; + let layerIndex = layer.open({ + type: 2, + title: title, + shade: 0, + area: ['80%', '90%'], + scrollbar: true, + move: false, + anim: 2, + yes: function (index, layero) { + }, + content: content, + success: function (layero, index) { + let iframeWin = window["layui-layer-iframe" + layerIndex]; + iframeWin.setParams(JSON.stringify(obj)); + }, + end: function () { + console.log("end") + }, + cancel: function () { + $.ajax({ + url: `${ctxPath}` + '/organizational/userOutDataFail', + type: 'POST', + data: { + id: obj.id + }, + dataType: 'json', + success: function (result) { + if (result.res === 1) { + layer.msg(result.obj, {icon: 2}); + search(2); + } else { + layer.msg(result.resMsg, {icon: 2}); + } + }, + error: function (result) { + layer.msg('服务异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000}); + } + }); + } + }); +} + diff --git a/src/main/resources/static/js/evaluate/teamGroup/teamMemBer.js b/src/main/resources/static/js/evaluate/teamGroup/teamMemBer.js new file mode 100644 index 0000000..23f3117 --- /dev/null +++ b/src/main/resources/static/js/evaluate/teamGroup/teamMemBer.js @@ -0,0 +1,266 @@ +// 专责审批 js文件 +let layer, laydate, table, form, id; +let fileList = []; +function setParams(obj, layerIndex) { + objParam = JSON.parse(obj); + id = objParam; + $(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 setSelectValue(list, selectName, code, nameCode) { + let html = ''; + if (list && list.length > 0) { + $.each(list, function (index, item) { + html += + ""; + }); + } + $("#" + selectName) + .empty() + .append(html); + layui.form.render(); +} + +function search(type) { + if (type === 1) { + } else { + $("#name").val(""); + $("#sex").val(""); + + form.render("select"); + } + table.reload("baseTable", { + url: ctxPath + "/teamGroup/getTeamGroupPerson", + page: { + curr: 1, + }, + where: { + type: "audit", + id: id, + name: $("#name").val(), + sex: $("#sex").val(), + }, + }); +} + +function initTable() { + //渲染表格 + table.render({ + elem: "#baseTable", + url: ctxPath + "/teamGroup/getTeamGroupPerson", + method: "get", //方式默认是get + toolbar: "default", //开启工具栏,此处显示默认图标,可以自定义模板,详见文档 + where: { + type: "audit", + id: id + }, + cellMinWidth: 80, + cols: [ + [ + //表头 + { + field: "number", + width: 80, + title: "序号", + align: "center", + type: "numbers", + }, + {field: "name", align: "center", title: "姓名"}, + {field: "idCard", align: "center", title: "身份证"}, + {field: "phone", align: "center", title: "电话"}, + {field: "sex", align: "center", title: "性别"}, + {field: "workType", align: "center", title: "工种"}, + { + field: "faceUrl", + align: "center", + title: "人脸", + templet: function (d) { + return ' 查看 '; + } + }, + {field: "isTeamLeader", align: "center", title: "是否班组长"}, + { + fixed: "right", + width: 180, + title: "操作", + align: "center", + templet: (d) => { + let text = ""; + 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") { + fileList = res.data; + 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 "edit": + ViewReviews(data, "编辑"); + break; + case "del": + DelReviews(data, "删除"); + break; + default: + console.warn(`未知事件: ${layEvent}`); + } + }); + + //修改班组人员信息 + function ViewReviews(data, title) { + try { + const layerIndex = layer.open({ + type: 2, + title: title, + shade: 0.3, + area: ["70%", "70%"], + scrollbar: true, + move: true, + anim: 2, + name: "editTeamGroupPerson", + shadeClose: false, + content: + './editPersonForm.html', + success: function (layero, index) { + let iframeWin = window["layui-layer-iframe" + index]; + iframeWin.setParams(JSON.stringify(data), index); + }, + }); + } catch (error) { + console.error("ViewReviews 错误:", error); + } + } + + //删除班组人员 + function DelReviews(data, title) { + try { + layer.confirm('是否确认删除?', { + title: title || '提示', + icon: 3, + shade: 0.3, + btn: ['确定', '取消'] + }, function (index) { + + // 禁用按钮防止重复提交 + $(".save").addClass("layui-btn-disabled").attr("disabled", true); + $(".cancel").addClass("layui-btn-disabled").attr("disabled", true); + let item = { + id: data.id + }; + $.ajax({ + url: `${ctxPath}/teamGroup/delTeamPerson`, + type: "POST", + data: JSON.stringify(item), + dataType: "json", + contentType: "application/json", + + success: function (res) { + if (res.res === 1) { + layer.msg(res.resMsg, {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 openFaceUrlPage(id) { + const filePath = ctxPath +"/statics/"+ fileList.filter(item => item.id == id)[0].faceUrl + window.open(filePath) +} +function addPerson() { + layer.open({ + type: 2, // iframe 模式 + title: "新增班组人员", + content: "./addPersonForm.html", // 要打开的页面 + maxmin: false, // 不显示最大化/最小化按钮 + area: ["50%", "80%"], // 弹出层大小 + success: function (layero, index) { + let iframeWin = window["layui-layer-iframe" + index]; + const params = { + id: id, + }; + iframeWin.setParams(JSON.stringify(params), index); + }, + }); +} diff --git a/src/main/resources/static/js/filePreview.js b/src/main/resources/static/js/filePreview.js index bf81bdd..b49130e 100644 --- a/src/main/resources/static/js/filePreview.js +++ b/src/main/resources/static/js/filePreview.js @@ -90,16 +90,16 @@ var Base64 = { } // // var filePreviewPath = "http://36.33.26.201:21624/GsSubEvaluate/statics/"; -// var filePreviewPath = "http://192.168.0.14:1803/GsSubEvaluate/statics/"; // 测试环境 +var filePreviewPath = "http://192.168.0.14:1803/GsSubEvaluate/statics/"; // 测试环境 -var filePreviewPath = "http://112.29.103.165:1618/GsSubEvaluate/statics/"; // 生产环境 +// var filePreviewPath = "http://112.29.103.165:1618/GsSubEvaluate/statics/"; // 生产环境 // var filePreviewPath = "http://127.0.0.1:1803/GsSubEvaluate/statics/"; // var filePreviewPath = "http://192.168.0.2:1803/GsSubEvaluate/statics/"; -// var filePreviewPathAll = "http://192.168.0.14:8012/onlinePreview?url="; // 测试环境 -var filePreviewPathAll = "http://112.29.103.165:1618/onlinePreview?url="; // 生产环境 +var filePreviewPathAll = "http://192.168.0.14:8012/onlinePreview?url="; // 测试环境 +// var filePreviewPathAll = "http://112.29.103.165:8012/onlinePreview?url="; // 生产环境 function filePreview(url) { let path; diff --git a/src/main/resources/static/js/select.js b/src/main/resources/static/js/select.js index de80789..28f1091 100644 --- a/src/main/resources/static/js/select.js +++ b/src/main/resources/static/js/select.js @@ -14,7 +14,7 @@ function businessDivisionPullDown(form,evaluateDeptId) { async: true, success: function (data) { let options =data.obj; - let html = ''; + let html = ''; // var html = ''; for (let i = 0; i < options.length; i++) { if (evaluateDeptId === options[i].id) { diff --git a/src/main/resources/static/pages/evaluate/outsourceAudit/outsourceAuditForm.html b/src/main/resources/static/pages/evaluate/outsourceAudit/outsourceAuditForm.html index 48e7dbb..202fb6d 100644 --- a/src/main/resources/static/pages/evaluate/outsourceAudit/outsourceAuditForm.html +++ b/src/main/resources/static/pages/evaluate/outsourceAudit/outsourceAuditForm.html @@ -36,6 +36,7 @@ + + + + + + + + diff --git a/src/main/resources/static/pages/evaluate/project/editForm.html b/src/main/resources/static/pages/evaluate/project/editForm.html new file mode 100644 index 0000000..c1c087b --- /dev/null +++ b/src/main/resources/static/pages/evaluate/project/editForm.html @@ -0,0 +1,89 @@ + + + + + + + + 修改名称 + + + + + +
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+ + +
+
+ + + + + + + + + + diff --git a/src/main/resources/static/pages/evaluate/project/projectList.html b/src/main/resources/static/pages/evaluate/project/projectList.html new file mode 100644 index 0000000..b913db8 --- /dev/null +++ b/src/main/resources/static/pages/evaluate/project/projectList.html @@ -0,0 +1,70 @@ + + + + 外包企业管理 + + + + +
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + diff --git a/src/main/resources/static/pages/evaluate/teamGroup/addForm.html b/src/main/resources/static/pages/evaluate/teamGroup/addForm.html new file mode 100644 index 0000000..07d6089 --- /dev/null +++ b/src/main/resources/static/pages/evaluate/teamGroup/addForm.html @@ -0,0 +1,198 @@ + + + + + + + + 新增班组 + + + + +
+
+
+
+

班组信息

+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +

班组长信息

+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+
+ + +
+
+ +
+
+ +
+
+
+
+ + + + + + + + + + diff --git a/src/main/resources/static/pages/evaluate/teamGroup/addPersonForm.html b/src/main/resources/static/pages/evaluate/teamGroup/addPersonForm.html new file mode 100644 index 0000000..be2fd54 --- /dev/null +++ b/src/main/resources/static/pages/evaluate/teamGroup/addPersonForm.html @@ -0,0 +1,163 @@ + + + + + + + + 新增班组 + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+
+ + +
+
+ +
+
+ +
+
+
+
+ + + + + + + + + + diff --git a/src/main/resources/static/pages/evaluate/teamGroup/editForm.html b/src/main/resources/static/pages/evaluate/teamGroup/editForm.html new file mode 100644 index 0000000..9955e6a --- /dev/null +++ b/src/main/resources/static/pages/evaluate/teamGroup/editForm.html @@ -0,0 +1,100 @@ + + + + + + + + 修改名称 + + + + + +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ + +
+
+
+ + +
+
+ + + + + + + + + + diff --git a/src/main/resources/static/pages/evaluate/teamGroup/editPersonForm.html b/src/main/resources/static/pages/evaluate/teamGroup/editPersonForm.html new file mode 100644 index 0000000..ab88ef6 --- /dev/null +++ b/src/main/resources/static/pages/evaluate/teamGroup/editPersonForm.html @@ -0,0 +1,160 @@ + + + + + + + + 修改名称 + + + + + +
+
+
+ + + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+
+ + +
+
+ +
+
+
+
+
+ + + + + + + + + + diff --git a/src/main/resources/static/pages/evaluate/teamGroup/teamGroupList.html b/src/main/resources/static/pages/evaluate/teamGroup/teamGroupList.html new file mode 100644 index 0000000..bdcd7aa --- /dev/null +++ b/src/main/resources/static/pages/evaluate/teamGroup/teamGroupList.html @@ -0,0 +1,75 @@ + + + + 外包企业管理 + + + + +
+
+
+
+ + + + + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + diff --git a/src/main/resources/static/pages/evaluate/teamGroup/teamMemBer.html b/src/main/resources/static/pages/evaluate/teamGroup/teamMemBer.html new file mode 100644 index 0000000..d623a88 --- /dev/null +++ b/src/main/resources/static/pages/evaluate/teamGroup/teamMemBer.html @@ -0,0 +1,72 @@ + + + + 外包企业管理 + + + + +
+
+
+
+ + +
+ +
+ + + + +
+
+
+
+
+
+
+ + + + + + + + + +