wenhongquan 3 년 전
부모
커밋
c0092d2b99

+ 9 - 16
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysPlanController.java

@@ -1,29 +1,22 @@
 package com.ruoyi.system.controller;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.SysPlan;
 import com.ruoyi.system.service.ISysPlanService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 【请填写功能名称】Controller
- * 
+ *
  * @author ruoyi
  * @date 2022-06-09
  */
@@ -54,7 +47,7 @@ public class SysPlanController extends BaseController
     {
         List<SysPlan> list = sysPlanService.selectSysPlanList(sysPlan);
         ExcelUtil<SysPlan> util = new ExcelUtil<SysPlan>(SysPlan.class);
-        util.exportExcel(response, list, "【请填写功能名称】数据");
+        util.exportExcel(response, list, "数据");
     }
 
     /**

+ 44 - 16
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysReportController.java

@@ -1,29 +1,23 @@
 package com.ruoyi.system.controller;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.SysReport;
 import com.ruoyi.system.service.ISysReportService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 【请填写功能名称】Controller
- * 
+ *
  * @author ruoyi
  * @date 2022-06-20
  */
@@ -42,6 +36,14 @@ public class SysReportController extends BaseController
     public TableDataInfo list(SysReport sysReport)
     {
         startPage();
+        if(SecurityUtils.isAdmin(SecurityUtils.getUserId())){
+
+        }else{
+            sysReport.setClashId(SecurityUtils.getLoginUser().getDeptId()+"");
+
+        }
+
+        sysReport.setIsMerge("-1");
         List<SysReport> list = sysReportService.selectSysReportList(sysReport);
         return getDataTable(list);
     }
@@ -63,7 +65,7 @@ public class SysReportController extends BaseController
     {
         List<SysReport> list = sysReportService.selectSysReportList(sysReport);
         ExcelUtil<SysReport> util = new ExcelUtil<SysReport>(SysReport.class);
-        util.exportExcel(response, list, "【请填写功能名称】数据");
+        util.exportExcel(response, list, "数据");
     }
 
     /**
@@ -104,4 +106,30 @@ public class SysReportController extends BaseController
     {
         return toAjax(sysReportService.deleteSysReportByIds(ids));
     }
+
+
+    @GetMapping("collisionDetection/{ids}")
+    public AjaxResult collisionDetection(@PathVariable Long[] ids)
+    {
+        return AjaxResult.success(sysReportService.collisionDetection(ids));
+    }
+
+    @GetMapping("mergeQuery/{ids}")
+    public AjaxResult mergeQuery(@PathVariable Long[] ids)
+    {
+        return AjaxResult.success(sysReportService.mergeQuery(ids));
+    }
+
+    @GetMapping("mergeReport/{ids}")
+    public AjaxResult mergeReport(@PathVariable Long[] ids)
+    {
+        try{
+            return AjaxResult.success(sysReportService.mergeReport(ids));
+
+        }catch (Error e){
+            AjaxResult.error("所选报备无法合并!");
+        }
+        return AjaxResult.success();
+
+    }
 }

+ 41 - 40
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysPlan.java

@@ -1,15 +1,16 @@
 package com.ruoyi.system.domain;
 
-import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
 
 /**
  * 【请填写功能名称】对象 sys_plan
- * 
+ *
  * @author ruoyi
  * @date 2022-06-09
  */
@@ -90,165 +91,165 @@ public class SysPlan extends BaseEntity
     @Excel(name = "施工内容二")
     private String contentTwo;
 
-    public void setId(Long id) 
+    public void setId(Long id)
     {
         this.id = id;
     }
 
-    public Long getId() 
+    public Long getId()
     {
         return id;
     }
-    public void setName(String name) 
+    public void setName(String name)
     {
         this.name = name;
     }
 
-    public String getName() 
+    public String getName()
     {
         return name;
     }
-    public void setStatus(String status) 
+    public void setStatus(String status)
     {
         this.status = status;
     }
 
-    public String getStatus() 
+    public String getStatus()
     {
         return status;
     }
-    public void setSection(String section) 
+    public void setSection(String section)
     {
         this.section = section;
     }
 
-    public String getSection() 
+    public String getSection()
     {
         return section;
     }
-    public void setDirection(String direction) 
+    public void setDirection(String direction)
     {
         this.direction = direction;
     }
 
-    public String getDirection() 
+    public String getDirection()
     {
         return direction;
     }
-    public void setStartKm(String startKm) 
+    public void setStartKm(String startKm)
     {
         this.startKm = startKm;
     }
 
-    public String getStartKm() 
+    public String getStartKm()
     {
         return startKm;
     }
-    public void setStartHectometer(String startHectometer) 
+    public void setStartHectometer(String startHectometer)
     {
         this.startHectometer = startHectometer;
     }
 
-    public String getStartHectometer() 
+    public String getStartHectometer()
     {
         return startHectometer;
     }
-    public void setEndKm(String endKm) 
+    public void setEndKm(String endKm)
     {
         this.endKm = endKm;
     }
 
-    public String getEndKm() 
+    public String getEndKm()
     {
         return endKm;
     }
-    public void setEndHectometer(String endHectometer) 
+    public void setEndHectometer(String endHectometer)
     {
         this.endHectometer = endHectometer;
     }
 
-    public String getEndHectometer() 
+    public String getEndHectometer()
     {
         return endHectometer;
     }
-    public void setStartTime(Date startTime) 
+    public void setStartTime(Date startTime)
     {
         this.startTime = startTime;
     }
 
-    public Date getStartTime() 
+    public Date getStartTime()
     {
         return startTime;
     }
-    public void setEndTime(Date endTime) 
+    public void setEndTime(Date endTime)
     {
         this.endTime = endTime;
     }
 
-    public Date getEndTime() 
+    public Date getEndTime()
     {
         return endTime;
     }
-    public void setDept(String dept) 
+    public void setDept(String dept)
     {
         this.dept = dept;
     }
 
-    public String getDept() 
+    public String getDept()
     {
         return dept;
     }
-    public void setCreatUser(String creatUser) 
+    public void setCreatUser(String creatUser)
     {
         this.creatUser = creatUser;
     }
 
-    public String getCreatUser() 
+    public String getCreatUser()
     {
         return creatUser;
     }
-    public void setBridgeHeightWidth(String bridgeHeightWidth) 
+    public void setBridgeHeightWidth(String bridgeHeightWidth)
     {
         this.bridgeHeightWidth = bridgeHeightWidth;
     }
 
-    public String getBridgeHeightWidth() 
+    public String getBridgeHeightWidth()
     {
         return bridgeHeightWidth;
     }
-    public void setLevel(String level) 
+    public void setLevel(String level)
     {
         this.level = level;
     }
 
-    public String getLevel() 
+    public String getLevel()
     {
         return level;
     }
-    public void setFileUrl(String fileUrl) 
+    public void setFileUrl(String fileUrl)
     {
         this.fileUrl = fileUrl;
     }
 
-    public String getFileUrl() 
+    public String getFileUrl()
     {
         return fileUrl;
     }
-    public void setContentOne(String contentOne) 
+    public void setContentOne(String contentOne)
     {
         this.contentOne = contentOne;
     }
 
-    public String getContentOne() 
+    public String getContentOne()
     {
         return contentOne;
     }
-    public void setContentTwo(String contentTwo) 
+    public void setContentTwo(String contentTwo)
     {
         this.contentTwo = contentTwo;
     }
 
-    public String getContentTwo() 
+    public String getContentTwo()
     {
         return contentTwo;
     }

+ 13 - 9
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysReport.java

@@ -1,16 +1,18 @@
 package com.ruoyi.system.domain;
 
-import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
 import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
-import com.ruoyi.common.annotation.Excel;
-import com.ruoyi.common.core.domain.BaseEntity;
+
+import java.util.Date;
+import java.util.List;
 
 /**
  * 【请填写功能名称】对象 sys_report
- * 
+ *
  * @author ruoyi
  * @date 2022-06-20
  */
@@ -31,13 +33,13 @@ public class SysReport extends BaseEntity
     private String lane;
 
     /** 预计开始时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "预计开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "预计开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date startTime;
 
     /** 预计结束时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "预计结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "预计结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date endTime;
 
     /** 现场负责人 */
@@ -120,9 +122,11 @@ public class SysReport extends BaseEntity
     @Excel(name = "审核部门")
     private String dept;
 
+    private String cids;
 
+    private String ext1;
 
-
+    private List<SysReport> children;
 
 
     @Override

+ 10 - 9
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysPlanMapper.java

@@ -1,19 +1,20 @@
 package com.ruoyi.system.mapper;
 
-import java.util.List;
 import com.ruoyi.system.domain.SysPlan;
 
+import java.util.List;
+
 /**
  * 【请填写功能名称】Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2022-06-09
  */
-public interface SysPlanMapper 
+public interface SysPlanMapper
 {
     /**
      * 查询【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 【请填写功能名称】
      */
@@ -21,7 +22,7 @@ public interface SysPlanMapper
 
     /**
      * 查询【请填写功能名称】列表
-     * 
+     *
      * @param sysPlan 【请填写功能名称】
      * @return 【请填写功能名称】集合
      */
@@ -29,7 +30,7 @@ public interface SysPlanMapper
 
     /**
      * 新增【请填写功能名称】
-     * 
+     *
      * @param sysPlan 【请填写功能名称】
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface SysPlanMapper
 
     /**
      * 修改【请填写功能名称】
-     * 
+     *
      * @param sysPlan 【请填写功能名称】
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface SysPlanMapper
 
     /**
      * 删除【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 结果
      */
@@ -53,7 +54,7 @@ public interface SysPlanMapper
 
     /**
      * 批量删除【请填写功能名称】
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */

+ 21 - 9
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysReportMapper.java

@@ -1,27 +1,32 @@
 package com.ruoyi.system.mapper;
 
-import java.util.List;
 import com.ruoyi.system.domain.SysReport;
 
+import java.util.List;
+
 /**
  * 【请填写功能名称】Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2022-06-20
  */
-public interface SysReportMapper 
+public interface SysReportMapper
 {
     /**
      * 查询【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 【请填写功能名称】
      */
     public SysReport selectSysReportById(Long id);
 
+
+    public List<SysReport> selectSysReportByIds(Long[] ids);
+
+
     /**
      * 查询【请填写功能名称】列表
-     * 
+     *
      * @param sysReport 【请填写功能名称】
      * @return 【请填写功能名称】集合
      */
@@ -29,7 +34,7 @@ public interface SysReportMapper
 
     /**
      * 新增【请填写功能名称】
-     * 
+     *
      * @param sysReport 【请填写功能名称】
      * @return 结果
      */
@@ -37,7 +42,7 @@ public interface SysReportMapper
 
     /**
      * 修改【请填写功能名称】
-     * 
+     *
      * @param sysReport 【请填写功能名称】
      * @return 结果
      */
@@ -45,7 +50,7 @@ public interface SysReportMapper
 
     /**
      * 删除【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 结果
      */
@@ -53,9 +58,16 @@ public interface SysReportMapper
 
     /**
      * 批量删除【请填写功能名称】
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteSysReportByIds(Long[] ids);
+
+
+    public List<SysReport> collisionDetection(Long[] ids);
+
+    public List<SysReport> mergeQuery(Long[] ids);
+
+
 }

+ 10 - 9
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysPlanService.java

@@ -1,19 +1,20 @@
 package com.ruoyi.system.service;
 
-import java.util.List;
 import com.ruoyi.system.domain.SysPlan;
 
+import java.util.List;
+
 /**
  * 【请填写功能名称】Service接口
- * 
+ *
  * @author ruoyi
  * @date 2022-06-09
  */
-public interface ISysPlanService 
+public interface ISysPlanService
 {
     /**
      * 查询【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 【请填写功能名称】
      */
@@ -21,7 +22,7 @@ public interface ISysPlanService
 
     /**
      * 查询【请填写功能名称】列表
-     * 
+     *
      * @param sysPlan 【请填写功能名称】
      * @return 【请填写功能名称】集合
      */
@@ -29,7 +30,7 @@ public interface ISysPlanService
 
     /**
      * 新增【请填写功能名称】
-     * 
+     *
      * @param sysPlan 【请填写功能名称】
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface ISysPlanService
 
     /**
      * 修改【请填写功能名称】
-     * 
+     *
      * @param sysPlan 【请填写功能名称】
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface ISysPlanService
 
     /**
      * 批量删除【请填写功能名称】
-     * 
+     *
      * @param ids 需要删除的【请填写功能名称】主键集合
      * @return 结果
      */
@@ -53,7 +54,7 @@ public interface ISysPlanService
 
     /**
      * 删除【请填写功能名称】信息
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 结果
      */

+ 19 - 9
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysReportService.java

@@ -1,19 +1,21 @@
 package com.ruoyi.system.service;
 
-import java.util.List;
 import com.ruoyi.system.domain.SysReport;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * 【请填写功能名称】Service接口
- * 
+ *
  * @author ruoyi
  * @date 2022-06-20
  */
-public interface ISysReportService 
+public interface ISysReportService
 {
     /**
      * 查询【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 【请填写功能名称】
      */
@@ -21,7 +23,7 @@ public interface ISysReportService
 
     /**
      * 查询【请填写功能名称】列表
-     * 
+     *
      * @param sysReport 【请填写功能名称】
      * @return 【请填写功能名称】集合
      */
@@ -29,7 +31,7 @@ public interface ISysReportService
 
     /**
      * 新增【请填写功能名称】
-     * 
+     *
      * @param sysReport 【请填写功能名称】
      * @return 结果
      */
@@ -37,7 +39,7 @@ public interface ISysReportService
 
     /**
      * 修改【请填写功能名称】
-     * 
+     *
      * @param sysReport 【请填写功能名称】
      * @return 结果
      */
@@ -45,7 +47,7 @@ public interface ISysReportService
 
     /**
      * 批量删除【请填写功能名称】
-     * 
+     *
      * @param ids 需要删除的【请填写功能名称】主键集合
      * @return 结果
      */
@@ -53,9 +55,17 @@ public interface ISysReportService
 
     /**
      * 删除【请填写功能名称】信息
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 结果
      */
     public int deleteSysReportById(Long id);
+
+    public List<SysReport> collisionDetection(Long[] ids);
+
+
+    public List<SysReport> mergeQuery(Long[] ids);
+
+    public Map mergeReport(Long[] ids);
+
 }

+ 13 - 12
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysPlanServiceImpl.java

@@ -1,28 +1,29 @@
 package com.ruoyi.system.service.impl;
 
-import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.system.mapper.SysPlanMapper;
 import com.ruoyi.system.domain.SysPlan;
+import com.ruoyi.system.mapper.SysPlanMapper;
 import com.ruoyi.system.service.ISysPlanService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * 【请填写功能名称】Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2022-06-09
  */
 @Service
-public class SysPlanServiceImpl implements ISysPlanService 
+public class SysPlanServiceImpl implements ISysPlanService
 {
     @Autowired
     private SysPlanMapper sysPlanMapper;
 
     /**
      * 查询【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 【请填写功能名称】
      */
@@ -34,7 +35,7 @@ public class SysPlanServiceImpl implements ISysPlanService
 
     /**
      * 查询【请填写功能名称】列表
-     * 
+     *
      * @param sysPlan 【请填写功能名称】
      * @return 【请填写功能名称】
      */
@@ -46,7 +47,7 @@ public class SysPlanServiceImpl implements ISysPlanService
 
     /**
      * 新增【请填写功能名称】
-     * 
+     *
      * @param sysPlan 【请填写功能名称】
      * @return 结果
      */
@@ -59,7 +60,7 @@ public class SysPlanServiceImpl implements ISysPlanService
 
     /**
      * 修改【请填写功能名称】
-     * 
+     *
      * @param sysPlan 【请填写功能名称】
      * @return 结果
      */
@@ -71,7 +72,7 @@ public class SysPlanServiceImpl implements ISysPlanService
 
     /**
      * 批量删除【请填写功能名称】
-     * 
+     *
      * @param ids 需要删除的【请填写功能名称】主键
      * @return 结果
      */
@@ -83,7 +84,7 @@ public class SysPlanServiceImpl implements ISysPlanService
 
     /**
      * 删除【请填写功能名称】信息
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 结果
      */

+ 242 - 13
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysReportServiceImpl.java

@@ -1,28 +1,41 @@
 package com.ruoyi.system.service.impl;
 
-import java.util.List;
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.system.mapper.SysReportMapper;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.domain.SysReport;
+import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.system.mapper.SysDictDataMapper;
+import com.ruoyi.system.mapper.SysReportMapper;
 import com.ruoyi.system.service.ISysReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
 
 /**
  * 【请填写功能名称】Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2022-06-20
  */
 @Service
-public class SysReportServiceImpl implements ISysReportService 
+public class SysReportServiceImpl implements ISysReportService
 {
     @Autowired
     private SysReportMapper sysReportMapper;
 
+    @Autowired
+    private SysDictDataMapper sysDictDataMapper;
+
+    @Autowired
+    private SysConfigMapper sysConfigMapper;
+
     /**
      * 查询【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 【请填写功能名称】
      */
@@ -34,19 +47,48 @@ public class SysReportServiceImpl implements ISysReportService
 
     /**
      * 查询【请填写功能名称】列表
-     * 
+     *
      * @param sysReport 【请填写功能名称】
      * @return 【请填写功能名称】
      */
     @Override
     public List<SysReport> selectSysReportList(SysReport sysReport)
     {
-        return sysReportMapper.selectSysReportList(sysReport);
+       List<SysReport>  list = sysReportMapper.selectSysReportList(sysReport);
+       SysReport p = new SysReport();
+       Map<String,Object> pm = new HashMap<>();
+       pm.put("isMerge","-1");
+       p.setParams(pm);
+       List<SysReport>  list2 = sysReportMapper.selectSysReportList(p);
+        for (SysReport r:list
+             ) {
+            for (SysReport r1:list2
+            ) {
+                for (SysReport r2:list2
+                ) {
+                    if((r1.getId()+"").equals(r2.getIsMerge())){
+                        if(r1.getChildren()==null){
+                            r1.setChildren(new ArrayList<>());
+                        }
+                        r1.getChildren().add(r2);
+                    }
+
+                }
+
+                if((r.getId()+"").equals(r1.getIsMerge())){
+                    if(r.getChildren()==null){
+                        r.setChildren(new ArrayList<>());
+                    }
+                    r.getChildren().add(r1);
+                }
+           }
+        }
+        return list;
     }
 
     /**
      * 新增【请填写功能名称】
-     * 
+     *
      * @param sysReport 【请填写功能名称】
      * @return 结果
      */
@@ -54,12 +96,33 @@ public class SysReportServiceImpl implements ISysReportService
     public int insertSysReport(SysReport sysReport)
     {
         sysReport.setCreateTime(DateUtils.getNowDate());
+        sysReport.setCreateUser(SecurityUtils.getUserId()+"");
+        //设置施工单位
+        sysReport.setDept(SecurityUtils.getLoginUser().getUser().getDept().getDeptName());
+        sysReport.setClashId("[\""+SecurityUtils.getLoginUser().getDeptId()+"\"]");
+        //创建施工日志
+        if(sysReport.getAuditDept()!=null){
+            try{
+                List<String> depts = JSON.parseArray(sysReport.getClashId(),String.class);
+                depts.add(sysReport.getAuditDept());
+                sysReport.setClashId(JSON.toJSONString(depts));
+
+                sysReport.setExt1("[{\"content\":\"创建施工报备\",\"timestamp\":\""+DateUtils.getTime()+"\",\"deptname\":\""+SecurityUtils.getLoginUser().getUser().getDept().getDeptName()+"\"}]");
+                List c= JSON.parseArray(sysReport.getExt1(),Object.class);
+
+                c.add(0,JSON.parse("{\"content\":\"提交审核\",\"timestamp\":\""+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.addSeconds(new Date(),1))+"\",\"deptname\":\""+SecurityUtils.getLoginUser().getUser().getDept().getDeptName()+"\"}"));
+                sysReport.setExt1( JSON.toJSONString(c));
+            }catch (Exception e){}
+        }else{
+            sysReport.setExt1("[{\"content\":\"创建施工报备\",\"timestamp\":\""+DateUtils.getTime()+"\",\"deptname\":\""+SecurityUtils.getLoginUser().getUser().getDept().getDeptName()+"\"}]");
+
+        }
         return sysReportMapper.insertSysReport(sysReport);
     }
 
     /**
      * 修改【请填写功能名称】
-     * 
+     *
      * @param sysReport 【请填写功能名称】
      * @return 结果
      */
@@ -67,12 +130,103 @@ public class SysReportServiceImpl implements ISysReportService
     public int updateSysReport(SysReport sysReport)
     {
         sysReport.setUpdateTime(DateUtils.getNowDate());
+        List<SysDictData> sysDictDatas = sysDictDataMapper.selectDictDataByType("report_status");
+        if(sysReport.getAuditDept()!=null){
+            List<String> depts = JSON.parseArray(sysReport.getClashId(),String.class);
+            depts.add(sysReport.getAuditDept());
+            sysReport.setClashId(JSON.toJSONString(depts));
+        }
+
+
+
+
+        if(sysReport.getStatus()!=null){
+            for ( SysDictData d:sysDictDatas
+                 ) {
+                if(d.getDictValue().equals(sysReport.getStatus()) && d.getRemark()!=null && !d.getDictValue().equals("")){
+                    try{
+                        SysReport report = sysReportMapper.selectSysReportById(sysReport.getId());
+                        List c= JSON.parseArray(report.getExt1(),Object.class);
+                        c.add(0,JSON.parse("{\"content\":\""+d.getRemark()+"\",\"timestamp\":\""+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.addSeconds(new Date(),1))+"\",\"deptname\":\""+SecurityUtils.getLoginUser().getUser().getDept().getDeptName()+"\"}"));
+                        sysReport.setExt1( JSON.toJSONString(c));
+                    }catch (Exception e){}
+                }
+            }
+
+        }
+        try{
+
+            if(sysReport.getExt1()!=null){
+                List c = JSON.parseArray(sysReport.getExt1(),Map.class);
+                Map<String,String> last = (Map<String, String>) c.get(c.size()-1);
+                if(last.get("content").contains("审批结果:同意")){
+                    //当审批同意时 自动转入下一部门审批
+//                    Map<String,Object> stringObjectMap = new HashMap<>();
+//                    stringObjectMap.put("config_key","spflow");
+                    SysConfig config = new SysConfig();
+                    config.setConfigKey("spflow");
+                    List<SysConfig> configs =  sysConfigMapper.selectConfigList(config);
+
+                    if(configs.size()>0 && sysReport.getStatus()==null && sysReport.getAuditDept()==null ){
+                        List<List> lclist = JSON.parseArray(configs.get(0).getConfigValue(),List.class);
+                        if(lclist.size()>0){
+                            for (List c1:
+                                lclist) {
+                                if(c1.size()>0){
+                                    //包含审批部门
+                                    if(c1.contains(SecurityUtils.getLoginUser().getDeptId()+"")){
+                                        int index =  c1.indexOf(SecurityUtils.getLoginUser().getDeptId()+"");
+                                        if(index+1<c1.size()){
+                                            String deptid = (String) c1.get(index+1);
+                                            try{
+                                                //写审批部门
+                                                sysReport.setAuditDept(deptid);
+
+                                                SysReport report = sysReportMapper.selectSysReportById(sysReport.getId());
+                                                List<String> depts = JSON.parseArray(report.getClashId(),String.class);
+                                                depts.add(sysReport.getAuditDept());
+                                                sysReport.setClashId(JSON.toJSONString(depts));
+
+                                                //写审批日志
+                                                List c2= JSON.parseArray(sysReport.getExt1(),Object.class);
+                                                c2.add(JSON.parse("{\"content\":\"提交审批\",\"timestamp\":\""+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.addSeconds(new Date(),1))+"\",\"deptname\":\""+SecurityUtils.getLoginUser().getUser().getDept().getDeptName()+"\"}"));
+                                                sysReport.setExt1( JSON.toJSONString(c2));
+                                            }catch (Exception e){}
+
+                                        }else {
+                                            //完成审批
+                                            sysReport.setStatus("3");
+                                        }
+                                    }
+                                }
+
+                            }
+
+                        }
+                    }
+
+
+                }else if(last.get("content").contains("审批结果:不同意")){
+                    //当审批不同意是 自动关闭
+                    sysReport.setStatus("4");
+                }
+
+
+            }
+
+
+
+
+        }catch (Exception w){}
+
+
+
         return sysReportMapper.updateSysReport(sysReport);
     }
 
     /**
      * 批量删除【请填写功能名称】
-     * 
+     *
      * @param ids 需要删除的【请填写功能名称】主键
      * @return 结果
      */
@@ -84,7 +238,7 @@ public class SysReportServiceImpl implements ISysReportService
 
     /**
      * 删除【请填写功能名称】信息
-     * 
+     *
      * @param id 【请填写功能名称】主键
      * @return 结果
      */
@@ -93,4 +247,79 @@ public class SysReportServiceImpl implements ISysReportService
     {
         return sysReportMapper.deleteSysReportById(id);
     }
+
+    @Override
+    public List<SysReport> collisionDetection(Long[] ids) {
+        return sysReportMapper.collisionDetection(ids);
+    }
+
+    @Override
+    public List<SysReport> mergeQuery(Long[] ids) {
+        return sysReportMapper.mergeQuery(ids);
+    }
+
+    @Override
+    public Map mergeReport(Long[] ids) {
+        //合并
+        boolean canmerge = true;
+        List<SysReport>  mreports = sysReportMapper.mergeQuery(ids);
+
+
+        List<String> depts = new ArrayList<>();
+
+        for (SysReport r:mreports
+             ) {
+            //拒绝合并 无合并项 的情况
+            if(r.getCids()==null || r.getCids().equals("")){
+                canmerge = false;
+                break;
+            }
+            //拒绝合并 A与B B与C A不与C 的情况
+            if(r.getCids().split(",").length != mreports.size()-1){
+                canmerge = false;
+                break;
+            }
+        }
+        if(!canmerge) {
+            throw  new RuntimeException("所选id存在不可以合并报备单");
+        }
+
+        List<SysReport> reportList = sysReportMapper.selectSysReportByIds(ids);
+        for (SysReport s:reportList
+        ) {
+            List<String> dept = JSON.parseArray(s.getClashId(),String.class);
+            depts.addAll(dept);
+        }
+
+
+        List<SysReport> reports = sysReportMapper.selectSysReportByIds(ids);
+        SysReport sysReport = new SysReport();
+        sysReport.setIsMerge("-1");
+        //合并后待审核是当前部门
+        sysReport.setAuditDept(SecurityUtils.getDeptId()+"");
+        //合并后可见范围为合并子任务可见范围的合集
+        sysReport.setClashId(JSON.toJSONString(depts));
+
+        sysReport.setExt1("[{\"content\":\"创建合并施工报备\",\"timestamp\":\""+DateUtils.getTime()+"\",\"deptname\":\""+SecurityUtils.getLoginUser().getUser().getDept().getDeptName()+"\"}]");
+//        List c= JSON.parseArray(sysReport.getExt1(),Object.class);
+//        sysReport.setExt1( JSON.toJSONString(c));
+
+
+
+        sysReportMapper.insertSysReport(sysReport);
+        Long id =sysReport.getId();
+        for (SysReport r:reports
+             ) {
+            r.setIsMerge(id+"");
+            r.setStatus("5");
+            sysReportMapper.updateSysReport(r);
+        }
+        sysReport.setId(Long.parseLong(id+""));
+        Map<String, Object> map = new HashMap<>();
+        map.put("childlist",reports);
+        map.put("p",sysReport);
+        return map;
+    }
+
+
 }

+ 73 - 8
ruoyi-admin/src/main/resources/mapper/system/SysReportMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.SysReportMapper">
-    
+
     <resultMap type="SysReport" id="SysReportResult">
         <result property="id"    column="id"    />
         <result property="planId"    column="plan_id"    />
@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="isMerge"    column="is_merge"    />
         <result property="section"    column="section"    />
         <result property="direction"    column="direction"    />
+        <result property="clashId"    column="clash_id"    />
         <result property="startKm"    column="start_km"    />
         <result property="startHectometer"    column="start_hectometer"    />
         <result property="endKm"    column="end_km"    />
@@ -31,19 +32,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="contentDes"    column="content_des"    />
         <result property="auditDept"    column="audit_dept"    />
         <result property="status"    column="status"    />
+        <result property="cids"    column="cids"    />
+        <result property="ext1"    column="ext1"    />
     </resultMap>
 
     <sql id="selectSysReportVo">
         select a.id, a.plan_id, a.lane,a.dept, a.start_time, a.end_time, a.manage_user, a.manage_phone, a.save_user, a.save_phone,
                a.create_user, a.create_time, a.update_user, a.update_time, a.is_merge,a.status,a.audit_dept,a.section,a.direction,a.start_km,a.start_hectometer,
-               a.end_km,a.end_hectometer,a.content_one,a.content_two,a.content_des
+               a.end_km,a.end_hectometer,a.content_one,a.content_two,a.content_des,a.ext1,a.clash_id
         from
         sys_report a
     </sql>
 
     <select id="selectSysReportList" parameterType="SysReport" resultMap="SysReportResult">
         <include refid="selectSysReportVo"/>
-        <where>  
+        <where>
             <if test="planId != null "> and plan_id = #{planId}</if>
             <if test="lane != null  and lane != ''"> and lane = #{lane}</if>
             <if test="startTime != null "> and start_time = #{startTime}</if>
@@ -56,15 +59,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
             <if test="isMerge != null  and isMerge != ''"> and is_merge = #{isMerge}</if>
             <if test="status != null  and status != ''"> and status = #{status}</if>
+            <if test="clashId != null  and clashId != ''"> and clash_id like '%${clashId}%'</if>
+            <if test="params.isMerge != null  and params.isMerge != ''"> and is_merge != #{params.isMerge}</if>
         </where>
     </select>
-    
+
     <select id="selectSysReportById" parameterType="Long" resultMap="SysReportResult">
         <include refid="selectSysReportVo"/>
         where id = #{id}
     </select>
-        
-    <insert id="insertSysReport" parameterType="SysReport" useGeneratedKeys="true" keyProperty="id">
+
+    <select id="selectSysReportByIds" parameterType="String" resultMap="SysReportResult">
+        <include refid="selectSysReportVo"/>
+        where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <insert id="insertSysReport" parameterType="SysReport" useGeneratedKeys="true"  keyProperty="id" keyColumn="id">
         insert into sys_report
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="planId != null">plan_id,</if>
@@ -92,6 +105,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="contentOne != null">content_one,</if>
             <if test="contentTwo != null">content_two,</if>
             <if test="contentDes != null">content_des,</if>
+            <if test="ext1 != null">ext1,</if>
+            <if test="clashId != null">clash_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="planId != null">#{planId},</if>
@@ -119,6 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="contentOne != null">#{contentOne},</if>
             <if test="contentTwo != null">#{contentTwo},</if>
             <if test="contentDes != null">#{contentDes},</if>
+            <if test="ext1 != null">#{ext1},</if>
+            <if test="clashId != null">#{clashId},</if>
          </trim>
     </insert>
 
@@ -150,6 +167,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="contentTwo != null">content_two = #{contentTwo},</if>
             <if test="contentDes != null">content_des = #{contentDes},</if>
             <if test="dept != null">dept = #{dept},</if>
+            <if test="clashId != null">clash_id = #{clashId},</if>
+            <if test="ext1 != null">ext1 = #{ext1},</if>
         </trim>
         where id = #{id}
     </update>
@@ -159,12 +178,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteSysReportByIds" parameterType="String">
-        delete from sys_report where id in 
+        delete from sys_report where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
 
+    <select id="collisionDetection" parameterType="String" resultMap="SysReportResult">
+
+    <![CDATA[
+        select a.id,(select GROUP_CONCAT(b.id SEPARATOR ',') from sys_report b where b.id in
+           ]]>
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+                #{id}
+        </foreach>
+        <![CDATA[
+         and a.direction = b.direction and a.section = b.section and a.id <> b.id and
+        ( (UNIX_TIMESTAMP(a.start_time)>=UNIX_TIMESTAMP(b.start_time) and  UNIX_TIMESTAMP(b.end_time)-UNIX_TIMESTAMP(a.start_time)> 3600 ) or
+        (UNIX_TIMESTAMP(b.end_time)-UNIX_TIMESTAMP(b.start_time)>3600 and  UNIX_TIMESTAMP(a.end_time)>=UNIX_TIMESTAMP(b.end_time) and  UNIX_TIMESTAMP(b.start_time)>=UNIX_TIMESTAMP(a.start_time)  ) or
+        (UNIX_TIMESTAMP(b.end_time)>=UNIX_TIMESTAMP(a.end_time) and  UNIX_TIMESTAMP(a.end_time)-UNIX_TIMESTAMP(b.start_time)> 3600 ) OR
+        (UNIX_TIMESTAMP(b.start_time)<=UNIX_TIMESTAMP(a.start_time) and  UNIX_TIMESTAMP(a.end_time)<=UNIX_TIMESTAMP(b.end_time) and UNIX_TIMESTAMP(a.end_time)-UNIX_TIMESTAMP(a.start_time)> 3600   ) )
+        and	NOT
+        (   ( (CONVERT(b.end_km, UNSIGNED)+CONVERT(b.end_hectometer, UNSIGNED)/1000) < (CONVERT(a.start_km, UNSIGNED)+CONVERT(a.start_hectometer, UNSIGNED)/1000) and (CONVERT(a.start_km, UNSIGNED)+CONVERT(a.start_hectometer, UNSIGNED)/1000) - (CONVERT(b.end_km, UNSIGNED)+CONVERT(b.end_hectometer, UNSIGNED)/1000)>5  ) or
+        ( (CONVERT(b.start_km, UNSIGNED)+CONVERT(b.start_hectometer, UNSIGNED)/1000) > (CONVERT(a.end_km, UNSIGNED)+CONVERT(a.end_hectometer, UNSIGNED)/1000) and (CONVERT(b.start_km, UNSIGNED)+CONVERT(b.start_hectometer, UNSIGNED)/1000) - (CONVERT(a.end_km, UNSIGNED)+CONVERT(a.end_hectometer, UNSIGNED)/1000)>5 )  )
+
+        ) as cids from sys_report a where a.id in
+]]>
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+
+
+    </select>
+
+    <select id="mergeQuery" parameterType="String" resultMap="SysReportResult">
+        <![CDATA[
+        SELECT a.id,(SELECT GROUP_CONCAT(b.id SEPARATOR ',') FROM sys_report b WHERE b.id IN
+           ]]>
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        <![CDATA[
+         AND a.id<> b.id and a.section = b.section AND a.direction=b.direction AND (ABS(UNIX_TIMESTAMP(a.end_time)-UNIX_TIMESTAMP(b.end_time))<=3600) AND NOT ((locate('1',b.lane)=0 AND locate('2',b.lane)=0 AND locate('3',a.lane)=0 AND locate('4',a.lane)=0) OR (locate('1',a.lane)=0 AND locate('2',a.lane)=0 AND locate('3',b.lane)=0 AND locate('4',b.lane)=0)) AND ( (
+             ABS(CONVERT ( b.end_km, UNSIGNED )+ CONVERT ( b.end_hectometer, UNSIGNED )/ 1000-CONVERT ( a.start_km, UNSIGNED )+ CONVERT ( a.start_hectometer, UNSIGNED )/ 1000 )
+				)< 2.5  and (
+				ABS(CONVERT ( a.end_km, UNSIGNED )+ CONVERT ( a.end_hectometer, UNSIGNED )/ 1000-CONVERT ( b.start_km, UNSIGNED )+ CONVERT ( b.start_hectometer, UNSIGNED )/ 1000 )
+				)< 2.5 AND (((CONVERT (b.end_km,UNSIGNED)+CONVERT (b.end_hectometer,UNSIGNED)/1000)>=(CONVERT (a.end_km,UNSIGNED)+CONVERT (a.end_hectometer,UNSIGNED)/1000) AND (CONVERT (a.start_km,UNSIGNED)+CONVERT (a.start_hectometer,UNSIGNED)/1000)>=(CONVERT (b.start_km,UNSIGNED)+CONVERT (b.start_hectometer,UNSIGNED)/1000)) OR ((CONVERT (b.end_km,UNSIGNED)+CONVERT (b.end_hectometer,UNSIGNED)/1000)<=(CONVERT (a.end_km,UNSIGNED)+CONVERT (a.end_hectometer,UNSIGNED)/1000) AND (CONVERT (a.start_km,UNSIGNED)+CONVERT (a.start_hectometer,UNSIGNED)/1000)<=(CONVERT (b.start_km,UNSIGNED)+CONVERT (b.start_hectometer,UNSIGNED)/1000))))) AS cids FROM sys_report a WHERE a.id IN   ]]>
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+
+    </select>
+
 <!--    <select id="selectSysReportById" parameterType="Long" resultMap="SysReportResult">-->
 <!--        SELECT-->
 <!--        *-->
@@ -178,4 +243,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <!--        AND ( UNIX_TIMESTAMP( start_time ) &lt; end_time - 3600 OR UNIX_TIMESTAMP( end_time ) &lt; start_time + 3600 )-->
 <!--    </select>-->
 
-</mapper>
+</mapper>

+ 2 - 0
ruoyi-ui/package.json

@@ -48,6 +48,8 @@
     "js-beautify": "1.13.0",
     "js-cookie": "3.0.1",
     "jsencrypt": "3.0.0-rc.1",
+    "lodash": "^4.17.21",
+    "moment": "^2.29.4",
     "nprogress": "0.2.0",
     "quill": "1.3.7",
     "screenfull": "5.0.2",

+ 25 - 0
ruoyi-ui/src/api/system/report.js

@@ -42,3 +42,28 @@ export function delReport(id) {
     method: 'delete'
   })
 }
+
+//冲突检测
+export function collisionDetection(id) {
+  return request({
+    url: '/system/report/collisionDetection/' + id,
+    method: 'get'
+  })
+}
+
+//合并检测
+export function mergeQuery(id) {
+  return request({
+    url: '/system/report/mergeQuery/' + id,
+    method: 'get'
+  })
+}
+
+export function mergeReport(id) {
+  return request({
+    url: '/system/report/mergeReport/' + id,
+    method: 'get'
+  })
+}
+
+

+ 2 - 1
ruoyi-ui/src/directive/permission/hasPermi.js

@@ -2,7 +2,7 @@
  * v-hasPermi 操作权限处理
  * Copyright (c) 2019 ruoyi
  */
- 
+
 import store from '@/store'
 
 export default {
@@ -14,6 +14,7 @@ export default {
     if (value && value instanceof Array && value.length > 0) {
       const permissionFlag = value
 
+
       const hasPermissions = permissions.some(permission => {
         return all_permission === permission || permissionFlag.includes(permission)
       })

+ 2 - 2
ruoyi-ui/src/layout/components/Navbar.vue

@@ -26,10 +26,10 @@
       </template>
 
       <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
-        <!-- <div class="avatar-wrapper">
+        <div class="avatar-wrapper">
           <img :src="avatar" class="user-avatar">
           <i class="el-icon-caret-bottom" />
-        </div> -->
+        </div>
         <el-dropdown-menu slot="dropdown">
           <router-link to="/user/profile">
             <el-dropdown-item>个人中心</el-dropdown-item>

+ 1 - 0
ruoyi-ui/src/store/getters.js

@@ -5,6 +5,7 @@ const getters = {
   visitedViews: state => state.tagsView.visitedViews,
   cachedViews: state => state.tagsView.cachedViews,
   token: state => state.user.token,
+  dept: state=>state.user.dept ,
   avatar: state => state.user.avatar,
   name: state => state.user.name,
   introduction: state => state.user.introduction,

+ 4 - 0
ruoyi-ui/src/store/modules/user.js

@@ -6,6 +6,7 @@ const user = {
     token: getToken(),
     name: '',
     avatar: '',
+    dept:{},
     roles: [],
     permissions: []
   },
@@ -25,6 +26,9 @@ const user = {
     },
     SET_PERMISSIONS: (state, permissions) => {
       state.permissions = permissions
+    },
+    SET_DEPT: (state, dept) => {
+      state.dept = dept
     }
   },
 

+ 3 - 2
ruoyi-ui/src/views/home/index.vue

@@ -65,6 +65,7 @@
 
 <script>
 import { getUserProfile } from "@/api/system/user";
+import store from '@/store'
 
 export default {
   name: "Index",
@@ -97,8 +98,8 @@ export default {
     },
     getUserProfile(){
        getUserProfile().then(response =>{
-            console.log(response);
-            this.user = response.data
+            this.user = response.data;
+            store.commit('SET_DEPT', response.data.dept);
             this.user.photo = process.env.VUE_APP_BASE_API+response.data.avatar;
        })
     },

+ 5 - 1
ruoyi-ui/src/views/plan/index.vue

@@ -86,7 +86,7 @@
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:report:edit']"
+            v-hasPermi="['system:plan:edit']"
           >修改</el-button>
         </template>
       </el-table-column>
@@ -229,6 +229,10 @@ export default {
   created() {
     this.getList();
   },
+  mounted() {
+    this.$parent.divSelect =1;
+    this.$parent.activeIndex='1';
+  },
   methods: {
     handlePreview(obj) {
         // console.log(file);

+ 151 - 31
ruoyi-ui/src/views/report/add.vue

@@ -7,6 +7,7 @@
           font-weight: 1000;
           text-align: left;
           color: #333333;position: relative;
+          background: #fff;
         "
       >
         {{ name }}
@@ -17,15 +18,16 @@
         :model="form"
         :rules="rules"
         label-width="200rem"
-        style="padding-left: 300rem; margin-top: 50rem"
+        style="padding-left: 10%; margin-top: 50rem"
       >
-        <el-form-item label="选择" prop="planId">
+        <el-form-item label="选择计划" prop="planId">
           <el-select
             v-model="form.planId"
             placeholder="请选择施工计划"
             clearable
             size="small"
             style="width: 300rem"
+            :disabled="readonly"
             @change="planChange()"
           >
             <el-option
@@ -44,6 +46,7 @@
                 placeholder="请选择路段"
                 clearable
                 size="small"
+                :disabled="readonly"
                 style="width: 300rem"
               >
                 <el-option
@@ -61,6 +64,7 @@
                 v-model="form.direction"
                 placeholder="请选择方向"
                 clearable
+                :disabled="readonly"
                 size="small"
               >
                 <el-option
@@ -80,6 +84,7 @@
                 v-model="form.startKm"
                 placeholder="请输入开始公里桩"
                 style="width: 300rem"
+                :readonly="readonly"
               >
                 <template slot="prepend">K</template>
               </el-input>
@@ -91,6 +96,7 @@
                 v-model="form.startHectometer"
                 placeholder="请输入开始米桩"
                 style="width: 300rem"
+                :readonly="readonly"
               >
                 <template slot="prepend">+</template>
               </el-input>
@@ -102,6 +108,7 @@
             <el-form-item label="结束公里桩" prop="endKm">
               <el-input
                 v-model="form.endKm"
+                :readonly="readonly"
                 placeholder="请输入结束公里桩"
                 style="width: 300rem"
               >
@@ -113,15 +120,19 @@
             <el-form-item label="" prop="endHectometer">
               <el-input
                 v-model="form.endHectometer"
+                :readonly="readonly"
                 placeholder="请输入结束米桩"
                 style="width: 300rem"
               >
                 <template slot="prepend">+</template>
               </el-input>
+
             </el-form-item>
+            <span v-if="showlengthover" style="color:red;position: absolute;bottom:0;left: 12vw;width:200px">{{showlenfthmsg}}</span>
           </el-col>
         </el-row>
 
+
         <el-row :gutter="20">
           <el-col :span="7">
             <el-form-item label="施工内容一" prop="contentOne">
@@ -129,6 +140,7 @@
                 v-model="form.contentOne"
                 placeholder="请选择方向"
                 clearable
+                :disabled="readonly"
                 size="small"
                 style="width: 300rem"
               >
@@ -143,17 +155,12 @@
           </el-col>
           <el-col :span="6">
             <el-form-item label="施工内容二" prop="contentTwo">
-              <el-input
-                v-if="form.contentOne != 2"
-                v-model="form.contentTwo"
-                placeholder="请输入施工内容二"
-                style="width: 300rem"
-              />
+
               <el-select
-                v-if="form.contentOne == 2"
                 v-model="form.contentTwo"
                 placeholder="请选择方向"
                 clearable
+                :disabled="readonly"
                 size="small"
                 style="width: 300rem"
               >
@@ -168,8 +175,18 @@
           </el-col>
         </el-row>
 
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="施工内容描述" prop="contentDes">
+              <el-input type="textarea" :readonly="readonly" v-model="form['contentDes']"></el-input>
+            </el-form-item>
+
+          </el-col>
+
+        </el-row>
+
         <el-row :gutter="20">
-          <el-col :span="7">
+          <el-col :span="8">
             <el-form-item label="预计开始时间" prop="startTime">
               <!-- <el-date-picker clearable
                                                 v-model="form.startTime"
@@ -180,7 +197,9 @@
               <el-date-picker
                 style="width: 300rem"
                 v-model="form.startTime"
+                value-format="yyyy-MM-dd HH:mm:dd"
                 type="datetime"
+                :readonly="readonly"
                 placeholder="选择日期时间"
               >
               </el-date-picker>
@@ -192,6 +211,8 @@
                 clearable
                 style="width: 300rem"
                 v-model="form.endTime"
+                :readonly="readonly"
+                value-format="yyyy-MM-dd HH:mm:dd"
                 type="datetime"
                 placeholder="请选择预计结束时间"
               >
@@ -206,6 +227,7 @@
             v-model="roadlan"
             placeholder="请选择方向"
             clearable
+            :disabled="readonly"
             size="small"
             style="width: 300rem"
           >
@@ -222,14 +244,17 @@
           <el-col :span="7">
             <el-form-item label="现场负责人" prop="manageUser">
               <el-input
+                :readonly="readonly"
                 v-model="form.manageUser"
                 placeholder="请输入现场负责人"
               />
             </el-form-item>
           </el-col>
-          <el-col :span="6">
+          <el-col :span="10">
             <el-form-item label="现场负责人手机号" prop="managePhone">
               <el-input
+                type="textarea"
+                :readonly="readonly"
                 v-model="form.managePhone"
                 placeholder="请输入现场负责人手机号"
               />
@@ -240,14 +265,17 @@
           <el-col :span="7">
             <el-form-item label="现场安全员" prop="saveUser">
               <el-input
+                :readonly="readonly"
                 v-model="form.saveUser"
                 placeholder="请输入现场安全员"
               />
             </el-form-item>
           </el-col>
-          <el-col :span="6">
+          <el-col :span="10">
             <el-form-item label="安全员手机号" prop="savePhone">
               <el-input
+                type="textarea"
+                :readonly="readonly"
                 v-model="form.savePhone"
                 placeholder="请输入安全员手机号"
               />
@@ -256,10 +284,25 @@
         </el-row>
       </el-form>
 
+
+      <div style="padding-left: 300rem;">
+        <el-timeline :reverse="true">
+          <el-timeline-item
+            v-for="(activity, index) in activities"
+            :key="index"
+            :timestamp="activity.timestamp">
+            {{activity.deptname + "  "+activity.content}}
+          </el-timeline-item>
+        </el-timeline>
+
+      </div>
+
+
+
       <div style="text-align: center">
-        <el-button size="mini" @click="save(1)">保存</el-button>
-        <el-button size="mini" @click="dialogVisible = true">提交</el-button>
-        <el-button size="mini" @click="cancle">取消</el-button>
+        <el-button size="mini" v-if="!readonly" @click="save(1)">保存</el-button>
+        <el-button size="mini" v-if="!readonly" @click="dialogVisible = true">提交</el-button>
+        <el-button size="mini" v-if="!readonly" @click="cancle">取消</el-button>
       </div>
     </div>
 
@@ -274,7 +317,7 @@
         <el-row>
           <el-col
             :span="12"
-            v-for="item in deptlist"
+            v-for="item in deptlist" v-bind:key="item.deptId"
             style="margin-bottom: 10px"
           >
             <el-radio v-model="audioDept" :label="item.deptId">{{
@@ -314,6 +357,9 @@ import {
   updateDept,
   listDeptExcludeChild,
 } from "@/api/system/dept";
+import { cloneDeep } from "lodash";
+import moment from "moment";
+import router from "@/router";
 // import { AppMain } from '@/layout/components'
 export default {
   name: "Index",
@@ -327,6 +373,8 @@ export default {
       version: "3.8.2",
       // 表单参数
       form: {},
+      activities:[{content: '报备创建',
+        timestamp: '2018-04-15'}],
       rules: {},
       planList: [],
       status: "",
@@ -335,23 +383,75 @@ export default {
       audioDept: "103",
       deptlist: [],
       roadlan:[],
+      showlengthover:false,
+      showlenfthmsg:"总长不得超过2.5公里",
+      readonly:false
+
     };
   },
   watch: {
-    'roadlan': function(val) {
-      this.form["lane"] = val.join(",");
+    'roadlan': {
+      handler(oldValue, newVal) {
+         var cpc =cloneDeep(oldValue);
+         this.form["lane"] = cpc.sort().join(",");
+      }
+    },
+    form: {
+      handler(oldValue, newVal) {
+
+        var len = (getobjdata(newVal.endKm)+(getobjdata(newVal.endHectometer)/1000)) - (getobjdata(newVal.startKm)+(getobjdata(newVal.startHectometer)/1000));
+
+        if(len>2.5){
+          this.showlenfthmsg = '总长不得超过2.5公里';
+          this.showlengthover = true;
+        }else{
+          if(len<0){
+            this.showlenfthmsg = '起始桩不得大于终止桩';
+            this.showlengthover = true;
+          }else{
+            this.showlengthover = false;
+          }
+
+        }
+
+      },
+      deep: true  // 深度监听
     }
   },
   mounted: function () {
     this.getList();
-    console.log(this.$route.query);
+    var queryd = localStorage.getItem("currentreport");
+    if(queryd){
+      queryd = JSON.parse(queryd);
+    }else{
+      this.$modal.msgError("发生错误");
+      this.$router.back();
+      return;
+    }
+    console.log(queryd);
     this.$route.query.params = null;
-    this.form = this.$route.query;
-    this.name = this.$route.query.routerName;
+    this.form = queryd;
+    this.name = queryd.routerName;
+    this.form.planId= parseInt(this.form.planId);
+
+    this.activities = JSON.parse(queryd.ext1 ?? "[]") ?? [];
+    //根据时间排序
+    this.activities = this.activities.sort((a, b)=>{ return  moment(a.timestamp).unix()-moment(b.timestamp).unix()})
 
 
 
-    this.form.lane = this.$route.query.lane;
+    if(queryd.status==undefined || queryd.status==null || queryd.status==""){
+      queryd.status="1";
+    }
+    if(this.name === '详情' || queryd.status!=="1" ){
+      this.readonly = true;
+    }else{
+      this.readonly=false;
+    }
+
+
+
+    this.form.lane = queryd.lane;
     this.roadlan = this.form.lane?this.form.lane.split(","):[]
     // console.log(this.roadlan)
 
@@ -366,17 +466,26 @@ export default {
   },
   methods: {
     planChange() {
-      console.log(this.form.planId);
+
       for (var index in this.planList) {
         if (this.planList[index].id == this.form.planId) {
-          this.form.section = this.planList[index].section;
-          this.form.direction = this.planList[index].direction;
-          this.form.startKm = this.planList[index].startKm;
-          this.form.startHectometer = this.planList[index].startHectometer;
-          this.form.endKm = this.planList[index].endKm;
-          this.form.endHectometer = this.planList[index].endHectometer;
-          this.form.contentOne = this.planList[index].contentOne;
-          this.form.contentTwo = this.planList[index].contentTwo;
+
+
+          this.form = {...cloneDeep(this.planList[index])};
+          this.form.planId = this.planList[index].id;
+          delete  this.form.id;
+          this.form.startTime +=" 00:00:00";
+          this.form.endTime +=" 00:00:00";
+          this.form.ext1 = this.planList[index].ext1;
+
+          // this.form.section = this.planList[index].section;
+          // this.form.direction = this.planList[index].direction;
+          // this.form.startKm = this.planList[index].startKm;
+          // this.form.startHectometer = this.planList[index].startHectometer;
+          // this.form.endKm = this.planList[index].endKm;
+          // this.form.endHectometer = this.planList[index].endHectometer;
+          // this.form.contentOne = this.planList[index].contentOne;
+          // this.form.contentTwo =  this.planList[index].contentTwo;
 
         }
       }
@@ -394,10 +503,15 @@ export default {
       this.form.status = status;
       if (status == 2) {
         this.form.auditDept = this.audioDept;
+        // this.form.ext1 = JSON.parse(this.form.ext1==undefined?"[]":this.form.ext1) ?? [];
+        // var timedate =  moment().format("YYYY-MM-DD HH:mm:ss");
+        // this.form.ext1.push({"content": "提交审核", "deptname": this.$store.state.user.dept.deptName, "timestamp": timedate})
+        // this.form.ext1 = JSON.stringify(this.form.ext1);
       }
       this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.id != null) {
+            console.log(this.form)
             updateReport(this.form).then((response) => {
               this.$modal.msgSuccess("修改成功");
               this.$router.push({ path: "/report" });
@@ -420,10 +534,16 @@ export default {
     },
   },
 };
+
+function getobjdata(val){
+  return val?parseInt(val):0;
+}
 </script>
 
 <style scoped lang="scss">
 .addPlan {
   background-color: #ffffff;
+  overflow-y: auto;
 }
+
 </style>

+ 370 - 83
ruoyi-ui/src/views/report/index.vue

@@ -13,19 +13,34 @@
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-        <el-button icon="el-icon-plus" size="mini" @click="goAdd">新增</el-button>
+        <el-button icon="el-icon-plus" size="mini"    v-hasPermi="['system:report:add']" @click="goAdd">新增</el-button>
+        <el-popconfirm
+          title="确定要合并所选报备?"
+          @confirm="mergeReport"
+        >
+          <el-button slot="reference"  icon="el-icon-notebook-2" v-hasPermi="['system:report:sp']"  size="mini" style="margin-left: 10px">合并</el-button>
+        </el-popconfirm>
+<!--        <el-button icon="el-icon-notebook-2" size="mini" @click="mergeReport">合并</el-button>-->
       </el-form-item>
 
       <div style="    position: absolute;top: 0;right: 0;">
-        <el-button type="primary" icon="el-icon-warning-outline" size="mini" @click="handleQuery">冲突检测</el-button>
-        <el-button type="primary" icon="el-icon-help" size="mini" @click="handleQuery">合并检测</el-button>
+        <el-button type="primary" icon="el-icon-warning-outline"  v-hasPermi="['system:report:sp']" size="mini" @click="handlect">冲突检测</el-button>
+        <el-button type="primary" icon="el-icon-help" size="mini"  v-hasPermi="['system:report:sp']" @click="handlemerge">合并检测</el-button>
       </div>
     </el-form>
 
 
-    <el-table v-loading="loading" :data="reportList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <!-- <el-table-column label="id" align="center" prop="id" /> -->
+    <el-table ref="listtbl" v-loading="loading" :data="reportList" default-expand-all row-key="id" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" @select="tblselect" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName">
+      <el-table-column type="selection" width="40" align="center"   @selectable="selectable"/>
+<!--      <el-table-column-->
+<!--        type="index"-->
+<!--        width="50" fixed="left">-->
+<!--      </el-table-column>-->
+      <el-table-column label="编号" align="center" prop="id" fixed="left" width='200'>
+        <template v-slot:="scope">
+          <span>{{scope.row.id}}</span>
+        </template>
+      </el-table-column>
       <el-table-column label="施工路段" align="center" prop="section" width='200' fixed="left"/>
       <el-table-column label="方向" align="center" prop="direction" width='100'>
       <template slot-scope="scope">
@@ -49,8 +64,8 @@
       </el-table-column>
        <el-table-column label="施工内容二" align="center" prop="contentTwo" width="120">
         <template slot-scope="scope">
-          <dict-tag v-if="scope.row.contentOne == 2" :options="dict.type.content_two" :value="scope.row.contentTwo"/>
-          <div v-if="scope.row.contentOne != 2">{{scope.row.contentTwo}}</div>
+          <dict-tag :options="dict.type.content_two" :value="scope.row.contentTwo"/>
+<!--          <div v-if="scope.row.contentOne != 2">{{scope.row.contentTwo}}</div>-->
         </template>
       </el-table-column>
       <el-table-column label="占用车道" align="center" prop="lane" />
@@ -77,22 +92,48 @@
           <!-- <div v-if="scope.row.report_status != 2">{{scope.row.contentTwo}}</div> -->
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150px" fixed="right">
         <template slot-scope="scope">
-          <el-button
+
+          <div v-if="scope.row.isMerge==='-1'">
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handleDetail(scope.row)"
+
+            >查看</el-button>
+            <el-button
             size="mini"
             type="text"
             icon="el-icon-edit"
+            v-if="scope.row.status==='1'"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['system:report:edit']"
           >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['system:report:remove']"
-          >删除</el-button>
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-delete"
+              v-if="scope.row.status==='1'"
+              @click="handleDelete(scope.row)"
+              v-hasPermi="['system:report:remove']"
+            >删除</el-button>
+
+
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-edit"
+                v-if="scope.row.status==='2' && scope.row.auditDept+'' === currentuserdeptid+''"
+                @click="handleSP(scope.row)"
+                v-hasPermi="['system:report:sp']"
+
+              >审批</el-button>
+          </div>
+
+
+
         </template>
       </el-table-column>
     </el-table>
@@ -106,63 +147,32 @@
       @pagination="getList"
     />
 
-    <!-- 添加或修改【请填写功能名称】对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="施工计划id" prop="planId">
-          <el-input v-model="form.planId" placeholder="请输入施工计划id" />
-        </el-form-item>
-        <el-form-item label="占用车道" prop="lane">
-          <el-input v-model="form.lane" placeholder="请输入占用车道" />
-        </el-form-item>
-        <el-form-item label="预计开始时间" prop="startTime">
-          <el-date-picker clearable
-            v-model="form.startTime"
-            type="date"
-            value-format="yyyy-MM-dd"
-            placeholder="请选择预计开始时间">
-          </el-date-picker>
-        </el-form-item>
-        <el-form-item label="预计结束时间" prop="endTime">
-          <el-date-picker clearable
-            v-model="form.endTime"
-            type="date"
-            value-format="yyyy-MM-dd"
-            placeholder="请选择预计结束时间">
-          </el-date-picker>
-        </el-form-item>
-        <el-form-item label="现场负责人" prop="manageUser">
-          <el-input v-model="form.manageUser" placeholder="请输入现场负责人" />
-        </el-form-item>
-        <el-form-item label="现场负责人手机号" prop="managePhone">
-          <el-input v-model="form.managePhone" placeholder="请输入现场负责人手机号" />
-        </el-form-item>
-        <el-form-item label="现场安全员" prop="saveUser">
-          <el-input v-model="form.saveUser" placeholder="请输入现场安全员" />
-        </el-form-item>
-        <el-form-item label="安全员手机号" prop="savePhone">
-          <el-input v-model="form.savePhone" placeholder="请输入安全员手机号" />
-        </el-form-item>
-        <el-form-item label="填报人" prop="createUser">
-          <el-input v-model="form.createUser" placeholder="请输入填报人" />
-        </el-form-item>
-        <el-form-item label="修改人" prop="updateUser">
-          <el-input v-model="form.updateUser" placeholder="请输入修改人" />
+
+    <el-dialog title="施工审批"  :visible.sync="spvisible" width="500px" append-to-body>
+      <el-form ref="form" :model="spform"  label-width="80px">
+        <el-form-item label="" >
+          <el-input v-model="spform.msg" type="textarea" placeholder="请输入审批意见" />
         </el-form-item>
-        <el-form-item label="是否合并 0:否 1:是" prop="isMerge">
-          <el-input v-model="form.isMerge" placeholder="请输入是否合并 0:否 1:是" />
+
+        <el-form-item label="" >
+          <el-radio v-model="spform.status" label="1">同意</el-radio>
+          <el-radio v-model="spform.status" label="2">不同意</el-radio>
         </el-form-item>
+
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button type="primary" @click="submitForm">保 存</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+
   </div>
 </template>
 
 <script>
-import { listReport, getReport, delReport, addReport, updateReport } from "@/api/system/report";
+import { listReport, getReport, delReport, addReport, updateReport,collisionDetection,mergeQuery,mergeReport } from "@/api/system/report";
+import moment from "moment";
 
 export default {
   name: "Report",
@@ -171,6 +181,7 @@ export default {
     return {
       // 遮罩层
       loading: true,
+      spvisible:false,
       // 选中数组
       ids: [],
       // 非单个禁用
@@ -207,15 +218,36 @@ export default {
       form: {},
       // 表单校验
       rules: {
+      },
+      // currentuserdeptid:"",
+      spform:{
+        status:"1",
+        reportid:0,
+        msg:"",
+        ext1:"",
       }
     };
   },
   created() {
     this.getList();
   },
+  computed:{
+    currentuserdeptid() {
+      return this.$store.state.user.dept.deptId;
+    }
+
+  },
+  mounted() {
+    this.$parent.divSelect =2;
+    this.$parent.activeIndex='1';
+
+
+
+  },
   methods: {
      goAdd(){
-          this.$router.push({path: '/addReport',query:{ routerName:'新增'}})
+         localStorage.setItem("currentreport",JSON.stringify({ routerName:'新增'}));
+          this.$router.push({path: '/addReport'})
     },
     /** 查询【请填写功能名称】列表 */
     getList() {
@@ -228,7 +260,7 @@ export default {
     },
     // 取消按钮
     cancel() {
-      this.open = false;
+      this.spvisible = false;
       this.reset();
     },
     // 表单重置
@@ -261,11 +293,39 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
+
+
+    tblselect(selection, row){
+      if(row.isMerge!=='-1'){
+        this.$refs.listtbl.toggleRowSelection(row,false);
+      }
+
+    },
     // 多选框选中数据
     handleSelectionChange(selection) {
+      selection.map(item => {
+        if(item.isMerge!=='-1'){
+
+
+        }
+      })
+
+
+
+
       this.ids = selection.map(item => item.id)
       this.single = selection.length!==1
-      this.multiple = !selection.length
+      this.multiple = !selection.length;
+    },
+    tableRowClassName({row, rowIndex}){
+      if(row.cids!=null){
+        return row["css"]?row["css"]:"ct1";
+      }
+      if(row.isMerge!='-1'){
+        return "child5";
+      }
+      return '';
+
     },
     /** 新增按钮操作 */
     handleAdd() {
@@ -276,44 +336,271 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       row.routerName = '修改'
-       this.$router.push({path: '/addReport',query:row})
+      localStorage.setItem("currentreport",JSON.stringify(row));
+      this.$router.push({path: '/addReport'})
+    },
+    handleDetail(row){
+      row.routerName = '详情'
+      localStorage.setItem("currentreport",JSON.stringify(row));
+      this.$router.push({path: '/addReport'})
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateReport(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addReport(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
+          if (this.spform.reportid != null) {
+            var ext1 =  JSON.parse(this.spform.ext1==undefined?"[]":this.spform.ext1) ?? [];
+            var timedate =  moment().format("YYYY-MM-DD HH:mm:ss");
+            ext1.push({"content": `审批结果:${this.spform.status==="1"?'同意':'不同意'} 意见:${this.spform.msg}`, "deptname": this.$store.state.user.dept.deptName, "timestamp": timedate})
+            ext1 = JSON.stringify(ext1);
+            updateReport({id:this.spform.reportid,ext1:ext1}).then((response) => {
+              this.$modal.msgSuccess("成功");
+              this.$router.push({ path: "/report" });
             });
+
+
           }
-        }
-      });
+          this.spvisible = false;
     },
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() {
+      this.$modal.confirm('是否确认删除编号为"' + ids + '"的数据项?').then(function() {
         return delReport(ids);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("删除成功");
       }).catch(() => {});
     },
+
+    handleSP(row){
+      this.spvisible = true;
+      this.spform.reportid = row.id;
+      this.spform.ext1 = row.ext1;
+    },
+
+
     /** 导出按钮操作 */
     handleExport() {
       this.download('system/report/export', {
         ...this.queryParams
       }, `report_${new Date().getTime()}.xlsx`)
+    },
+    selectable(row, index){
+      return (row.isMerge+"") === "-1";
+
+    },
+    handlemerge(){
+      const  ids = this.ids;
+      if(ids.length>0){
+        mergeQuery(ids).then(res=>{
+          var msg = "<span>有施工报备可以合并!</span><br/> ";
+          var mapc = {};
+          var hasc = false;
+          for (const index in this.reportList) {
+            var c = this.reportList[index];
+            mapc[c.id] = c;
+            var p= res.data.find(item=>{return item.id+"" === c.id+"" });
+            if(p && p.cids){
+              c.cids = p.cids;
+              c["css"] = 'ct5';
+              hasc = true;
+            }
+          }
+          for(const index in this.reportList){
+            var c = this.reportList[index];
+            if(c.cids  ){
+              msg+=`施工报备单编号${c.id} 与 ${c.cids.split(",").map(i=>'施工报备单编号'+i).join("或")} 可以合并 <br/>`;
+            }
+          }
+          msg+="<span style='color:#ffba00'>原因:施工结束时间相隔不超过1小时(包含1小时)、同方向、同车道(都在同一车道,或者1、2车道;3、4(应急车道)车道则为同车道),同桩号(指有包含关系或相同且修的全长在2.5公里范围内)判断为合并。</span>";
+          if(hasc) {
+            this.$confirm(msg, '提示', {
+              confirmButtonText: '确定',
+              type: 'warning',
+              showCancelButton: false,
+              dangerouslyUseHTMLString: true
+            }).then(() => {
+
+            }).catch(() => {
+
+            });
+          }else{
+            this.$confirm('未检测到可以合并的报备', '提示', {
+              confirmButtonText: '确定',
+              type: 'info',
+              showCancelButton: false,
+              dangerouslyUseHTMLString: true
+            }).then(() => {
+
+            }).catch(() => {
+
+            });
+          }
+
+
+          // this.$refs.listtbl.doLayout();
+
+        })
+      }else{
+        this.$modal.msgWarning("未选择施工报备");
+      }
+
+    },
+
+    mergeReport(){
+      const  ids = this.ids;
+      if(ids.length>1){
+        mergeReport(ids).then(res=>{
+          //获取合集id
+           var sysreport = res.data["p"];
+           if(sysreport){
+             var listc = res.data["childlist"];
+             sysreport.dept= listc.map(i=>i.dept).join(",");
+             sysreport.planId= listc[0].planId;
+             sysreport.direction= listc[0].direction;
+             sysreport.section= listc[0].section;
+             sysreport.contentOne= '5';
+             sysreport.contentTwo= '9';
+             sysreport.lane= listc.map(i=>i.lane).join(",").split(",").filter(function(value,index,self){
+               return self.indexOf(value) === index;
+             }).join(",");
+             sysreport.manageUser= listc.map(i=>i.manageUser).join(",");
+             sysreport.managePhone= listc.map(i=>i.managePhone).join(",");
+             sysreport.saveUser= listc.map(i=>i.saveUser).join(",");
+             sysreport.savePhone= listc.map(i=>i.savePhone).join(",");
+             sysreport.status = '2';
+             sysreport.createBy = 'sys';
+             sysreport.startKm = listc.sort((a, b) => parseInt(b.startKm) - parseInt(a.startKm)).slice().pop().startKm;
+             sysreport.startHectometer = listc.sort((a, b) => parseInt(b.startKm) - parseInt(a.startKm)).slice().pop().startHectometer;
+             sysreport.endKm = listc.sort((a, b) => parseInt(a.endKm) - parseInt(b.endKm)).slice().pop().endKm;
+             sysreport.endHectometer = listc.sort((a, b) => parseInt(a.endKm) - parseInt(b.endKm)).slice().pop().endHectometer;
+             sysreport.startTime = listc.sort((a, b) => moment(b.startTime).unix() - moment(a.startTime).unix()).slice().pop().startTime;
+             sysreport.endTime = listc.sort((a, b) => moment(a.endTime).unix() - moment(b.endTime).unix()).slice().pop().endTime;
+
+
+             sysreport.contentDes =  listc.map((i,index)=>{
+               var section = i.section;
+               var cone = this.dict.type.content_one.filter(p=>{ return p.value==i.contentOne}).map(p=>p.label).join("");
+               var ctwo = this.dict.type.content_two.filter(p=>{ return p.value==i.contentTwo}).map(p=>p.label).join("");
+               var time = i.startTime + '~' + i.endTime;
+               var lan = i.lane;
+               var addr = `K${i.startKm?i.startKm:"0" }+${i.startHectometer?i.startHectometer:"0" } ~ K${i.endKm?i.endKm:"0" }+${i.endHectometer?i.endHectometer:"0"}`;
+               return `${index+1}、${section}${addr}${cone}${ctwo}${i.contentDes ?? ""} 占用第${lan}车道(${time}) \r\n 负责人:${i.manageUser + "  "+i.managePhone} \r\n 安全员:${i.saveUser + "  "+i.savePhone}`  }).join("\r\n\r\n");
+             updateReport(sysreport).then(res=>{
+               this.handleQuery();
+             })
+
+
+
+           }else{
+             this.$modal.msgWarning("合并错误!");
+           }
+
+        });
+
+      }else{
+        this.$modal.msgWarning("请选择2条以上的施工报备");
+      }
+
+    },
+    handlect(){
+      const  ids = this.ids;
+      if(ids.length>0){
+        collisionDetection(ids).then(res=>{
+          var msg = "<span>有施工报备存在冲突!</span><br/> ";
+          var mapc = {};
+          var hasc = false;
+          for (const index in this.reportList) {
+            var c = this.reportList[index];
+            mapc[c.id] = c;
+            var p= res.data.find(item=>{return item.id+"" === c.id+"" });
+            if(p && p.cids){
+              c.cids = p.cids;
+              c["css"] = 'ct1';
+              hasc = true;
+            }
+          }
+          for(const index in this.reportList){
+            var c = this.reportList[index];
+            if(c.cids  ){
+              msg+=`施工报备单编号${c.id} 与 ${c.cids.split(",").map(i=>'施工报备单编号'+i).join("、")} 冲突 <br/>`;
+            }
+          }
+          msg+="<span style='color:#ffba00'>原因:同时间指时间重合超过1小时(不包含1小时)、同方向、间距小于5公里(不包含5公里)。</span>";
+          if(hasc) {
+            this.$confirm(msg, '提示', {
+              confirmButtonText: '确定',
+              type: 'warning',
+              showCancelButton: false,
+              dangerouslyUseHTMLString: true
+            }).then(() => {
+
+            }).catch(() => {
+
+            });
+          }else{
+            this.$confirm('未检测到冲突', '提示', {
+              confirmButtonText: '确定',
+              type: 'info',
+              showCancelButton: false,
+              dangerouslyUseHTMLString: true
+            }).then(() => {
+
+            }).catch(() => {
+
+            });
+          }
+
+
+          // this.$refs.listtbl.doLayout();
+
+        })
+      }else{
+        this.$modal.msgWarning("未选择施工报备");
+      }
+
     }
   }
 };
 </script>
+
+<style>
+.ct1{
+  background: #fce8e8 !important;
+}
+.ct2{
+  background: #77FFB7 !important;
+}
+.ct3{
+  background: #FFFD77ED !important;
+}
+.ct4{
+  background: #c5c5fd !important;
+}
+
+.ct5{
+  background: #c5e8fd !important;
+}
+
+
+.child5{
+  background: #efefef !important;
+}
+
+.el-table [class*=el-table__row--level] .el-table__expand-icon{
+  margin-left:-100px;
+  width: 94px;
+  font-size: 20px;
+}
+
+.el-table-column--selection .cell{
+  text-overflow:unset
+}
+.small-padding .cell{
+  padding-left: 0;
+  padding-right: 0;
+}
+
+
+
+</style>
+