소스 검색

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper into master

seyason 1 년 전
부모
커밋
311255bc6c

+ 26 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -1460,8 +1460,8 @@ public class ProjectController {
 
     //依斯倍定制 分组耗用进度表
     @RequestMapping("/groupExpendProcessList")
-    public HttpRespMsg groupExpendProcessList(String startDate,String endDate,Integer pageIndex,Integer pageSize){
-        return projectService.groupExpendProcessList(startDate,endDate,pageIndex,pageSize);
+    public HttpRespMsg groupExpendProcessList(String startDate,String endDate){
+        return projectService.groupExpendProcessList(startDate,endDate);
     }
 
     //依斯倍定制 导出分组耗用进度表
@@ -1469,5 +1469,29 @@ public class ProjectController {
     public HttpRespMsg exportGroupExpendProcessList(String startDate,String endDate){
         return projectService.exportGroupExpendProcessList(startDate,endDate);
     }
+
+    //依斯倍定制 项目耗用进度表
+    @RequestMapping("/projectExpendProcessList")
+    public HttpRespMsg projectExpendProcessList(Integer projectId,Integer categoryId,String userId,Integer pageIndex,Integer pageSize){
+        return projectService.projectExpendProcessList(projectId,categoryId,userId,pageIndex,pageSize);
+    }
+
+    //依斯倍定制 导出项目耗用进度表
+    @RequestMapping("/exportProjectExpendProcessList")
+    public HttpRespMsg exportProjectExpendProcessList(Integer projectId,Integer categoryId,String userId){
+        return projectService.exportProjectExpendProcessList(projectId,categoryId,userId);
+    }
+
+    //依斯倍定制 员工任务完成表
+    @RequestMapping("/userTaskProcessList")
+    public HttpRespMsg userTaskProcessList(Integer deptId,String userId,Integer projectId,String startDate,String endDate,Integer pageIndex,Integer pageSize){
+        return projectService.userTaskProcessList(deptId,userId,projectId,startDate,endDate,pageIndex,pageSize);
+    }
+
+    //依斯倍定制 导出员工项目进度表
+    @RequestMapping("/exportUserTaskProcessList")
+    public HttpRespMsg exportUserTaskProcessList(Integer deptId,String userId,Integer projectId,String startDate,String endDate){
+        return projectService.exportUserTaskProcessList(deptId,userId,projectId,startDate,endDate);
+    }
 }
 

+ 10 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java

@@ -173,7 +173,15 @@ public interface ProjectMapper extends BaseMapper<Project> {
 
     Long userProjectProcessCount(Integer deptId, String userId, Integer projectId, Integer companyId,@Param("list") List<Integer> deptIds);
 
-    List<Map<String, Object>> groupExpendProcessList(String userId, Integer companyId,@Param("list") List<Integer> deptIds, Integer start, Integer size);
+    List<Map<String, Object>> groupExpendProcessList(String userId, Integer companyId,String startDate,String endDate,@Param("list") List<Integer> deptIds);
 
-    Long groupExpendProcessListCount(String userId, Integer companyId,@Param("list") List<Integer> deptIds);
+    Long groupExpendProcessListCount(String userId, Integer companyId,String startDate,String endDate,@Param("list") List<Integer> deptIds);
+
+    List<Map<String, Object>> projectExpendProcessList(Integer projectId, Integer categoryId, String userId, Integer companyId, @Param("list") List<Integer> deptIds, Integer start, Integer size);
+
+    Long projectExpendProcessListCount(Integer projectId, Integer categoryId, String userId, Integer companyId, @Param("list") List<Integer> deptIds);
+
+    List<Map<String, Object>> userTaskProcessList(Integer deptId, String userId, Integer projectId, Integer companyId, @Param("list") List<Integer> deptIds,String startDate,String endDate, Integer start, Integer size);
+
+    Long userTaskProcessListCount(Integer deptId, String userId, Integer projectId, Integer companyId, @Param("list") List<Integer> deptIds,String startDate,String endDate);
 }

+ 9 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java

@@ -277,7 +277,15 @@ public interface ProjectService extends IService<Project> {
 
     HttpRespMsg exportUserProjectProcessList(Integer deptId, String userId, Integer projectId);
 
-    HttpRespMsg groupExpendProcessList(String startDate, String endDate, Integer pageIndex, Integer pageSize);
+    HttpRespMsg groupExpendProcessList(String startDate, String endDate);
 
     HttpRespMsg exportGroupExpendProcessList(String startDate, String endDate);
+
+    HttpRespMsg projectExpendProcessList(Integer projectId, Integer categoryId, String userId, Integer pageIndex, Integer pageSize);
+
+    HttpRespMsg exportProjectExpendProcessList(Integer projectId, Integer categoryId, String userId);
+
+    HttpRespMsg userTaskProcessList(Integer deptId, String userId, Integer projectId,String startDate,String endDate, Integer pageIndex, Integer pageSize);
+
+    HttpRespMsg exportUserTaskProcessList(Integer deptId, String userId, Integer projectId,String startDate,String endDate);
 }

+ 629 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -12391,15 +12391,307 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     }
 
     @Override
-    public HttpRespMsg groupExpendProcessList(String startDate, String endDate, Integer pageIndex, Integer pageSize) {
+    public HttpRespMsg groupExpendProcessList(String startDate, String endDate) {
         HttpRespMsg msg=new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("token"));
+        NumberFormat percentFormat = NumberFormat.getPercentInstance();
+        percentFormat.setMaximumFractionDigits(2);
         Integer companyId = user.getCompanyId();
         boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部分组耗用进度表");
         boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门分组耗用进度表");
         List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
         List<Map<String,Object>> resultList;
         Long total;
+        //是否具有查看全部数据的权限
+        if(!viewAll){
+            if(!incharger){
+                //只能查看本人的数据
+                resultList=projectMapper.groupExpendProcessList(user.getId(),companyId,startDate,endDate,null);
+                total=projectMapper.groupExpendProcessListCount(user.getId(),companyId,startDate,endDate,null);
+            }else {
+                List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
+                List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
+                List<Integer> deptIds=new ArrayList<>();
+                List<Integer> theCollect = departmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
+                theCollect.add(-1);
+                List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
+                otherCollect.add(-1);
+                theCollect.addAll(otherCollect);
+                for (Integer integer : theCollect) {
+                    List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
+                    deptIds.addAll(branchDepartment);
+                }
+                resultList=projectMapper.groupExpendProcessList(null,companyId,startDate,endDate,deptIds);
+                total=projectMapper.groupExpendProcessListCount(null,companyId,startDate,endDate,deptIds);
+            }
+        }else {
+            resultList=projectMapper.groupExpendProcessList(null,companyId,startDate,endDate,null);
+            total=projectMapper.groupExpendProcessListCount(null,companyId,startDate,endDate,null);
+        }
+        Map<String, List<Map<String, Object>>> listMapGroupList = resultList.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("corpwxDeptId"))));
+        List<String> departmentNameList = resultList.stream().map(m -> String.valueOf(m.get("corpwxDeptId"))).distinct().collect(Collectors.toList());
+        List<Map<String,Object>> lastList=new ArrayList<>();
+        for (String deptName : departmentNameList) {
+            List<Map<String, Object>> maps = listMapGroupList.get(deptName);
+            //再根据每个部门下员工数据长度合并人员名称列
+            Map<String, List<Map<String, Object>>> listMapGroupList2 = maps.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("groupName"))));
+            List<String> groupNameList = maps.stream().map(m -> String.valueOf(m.get("groupName"))).distinct().collect(Collectors.toList());
+            for (String groupName : groupNameList) {
+                List<Map<String, Object>> mapList1 = listMapGroupList2.get(groupName);
+                double planHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("planHour")))).sum();
+                double normalHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("normalHour")))).sum();
+                double overHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("overHour")))).sum();
+                double realHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realHour")))).sum();
+                double realCost = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realCost")))).sum();
+                double planHourNum = new BigDecimal(planHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                double normalHourNum = new BigDecimal(normalHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                double overHourNum = new BigDecimal(overHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                double realHourNum = new BigDecimal(realHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                double realCostNum = new BigDecimal(realCost).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                BigDecimal decimal = new BigDecimal(realHourNum);
+                decimal=decimal.divide(new BigDecimal(planHourNum),4,BigDecimal.ROUND_HALF_UP);
+                Map<String,Object> item=new HashMap<>();
+                item.put("deptId",deptName);
+                item.put("corpwxDeptId",maps.get(0).get("corpwxDeptId"));
+                item.put("groupName",groupName);
+                item.put("planHour",planHourNum);
+                item.put("normalHour",normalHourNum);
+                item.put("overHour",overHourNum);
+                item.put("realHour",realHourNum);
+                item.put("realCost",realCostNum);
+                item.put("process",percentFormat.format(decimal.doubleValue()));
+                lastList.add(item);
+            }
+        }
+        Map<String,Object> resultMap=new HashMap<>();
+        resultMap.put("record",lastList);
+        msg.setData(resultMap);
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg exportGroupExpendProcessList(String startDate, String endDate) {
+        HttpRespMsg httpRespMsg=new HttpRespMsg();
+        NumberFormat percentFormat = NumberFormat.getPercentInstance();
+        percentFormat.setMaximumFractionDigits(2);
+        HttpRespMsg resultMsg = groupExpendProcessList(startDate,endDate);
+        Map<String, Object> msgData = (Map<String, Object>) resultMsg.getData();
+        List<Map<String, Object>> mapList = (List<Map<String, Object>>) msgData.get("record");
+        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
+        Company company = companyMapper.selectById(companyId);
+        //1.创建一个workbook,对应一个excel文件
+        SXSSFWorkbook workBook = new SXSSFWorkbook();
+        //2.在workbook中添加一个sheet,对应Excel中的sheet
+        SXSSFSheet sheet = workBook.createSheet("分组耗用进度表");
+        //设置每一列的列宽
+        sheet.setColumnWidth(0,256*15);
+        sheet.setColumnWidth(1,256*15);
+        //3.设置样式以及字体样式
+        //设置冻结
+        sheet.createFreezePane(0, 2);
+        sheet.setDefaultColumnWidth(16);
+        //设置字体样式
+        Font headFont = workBook.createFont();
+        headFont.setBold(true);
+        headFont.setFontHeightInPoints((short) 10);
+        headFont.setFontName("黑体");
+
+        Font titleFont = workBook.createFont();
+        titleFont.setBold(true);
+        titleFont.setFontHeightInPoints((short) 10);
+        titleFont.setFontName("黑体");
+
+        Font font = workBook.createFont();
+        font.setFontHeightInPoints((short) 10);
+        font.setFontName("宋体");
+
+        //设置单元格样式
+        XSSFCellStyle headStyle = (XSSFCellStyle) workBook.createCellStyle();
+        headStyle.setFont(headFont);
+        headStyle.setAlignment(HorizontalAlignment.CENTER);
+        headStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+        headStyle.setWrapText(true);
+        headStyle.setBorderBottom(BorderStyle.THIN); //下边框
+        headStyle.setBorderLeft(BorderStyle.THIN);//左边框
+        headStyle.setBorderTop(BorderStyle.THIN);//上边框
+        headStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+        String color = "c0c0c0";    //此处得到的color为16进制的字符串
+        //转为RGB码
+        int r = Integer.parseInt((color.substring(0,2)),16);   //转为16进制
+        int g = Integer.parseInt((color.substring(2,4)),16);
+        int b = Integer.parseInt((color.substring(4,6)),16);
+
+        //设置自定义颜色
+        XSSFColor xssfColor = new XSSFColor();
+        byte[] colorRgb = { (short)9, (byte) r, (byte) g, (byte) b };
+        xssfColor.setRGB(colorRgb);
+
+        headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);
+        headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);// 填充模式(和背景颜色成对使用)
+        /*headStyle.setFillForegroundColor(IndexedColors.AQUA.getIndex());*/ //设置自带的颜色
+
+        CellStyle titleStyle = workBook.createCellStyle();
+        titleStyle.setFont(titleFont);
+        titleStyle.setAlignment(HorizontalAlignment.CENTER);
+        titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+        titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);  //填充单元格
+        titleStyle.setFillForegroundColor((short)9);    //填色
+        titleStyle.setWrapText(true);
+        titleStyle.setBorderBottom(BorderStyle.THIN); //下边框
+        titleStyle.setBorderLeft(BorderStyle.THIN);//左边框
+        titleStyle.setBorderTop(BorderStyle.THIN);//上边框
+        titleStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+        CellStyle cellStyle = workBook.createCellStyle();
+        cellStyle.setFont(font);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        cellStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+        cellStyle.setWrapText(true);
+        cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
+        cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
+        cellStyle.setBorderTop(BorderStyle.THIN);//上边框
+        cellStyle.setBorderRight(BorderStyle.THIN);//右边框
+        //行号
+        int rowNum = 0;
+        //第一行
+        SXSSFRow row0 = sheet.createRow(rowNum++);
+        row0.setHeight((short)500);
+        List<String> row_first =new ArrayList<>();
+        row_first.add("负责部门");
+        row_first.add("任务分组");
+        row_first.add("计划工时(财务)");
+        row_first.add("实际工时成本");
+        row_first.add("");
+        row_first.add("");
+        row_first.add("");
+        row_first.add("工时耗用率");
+        for (int i = 0; i < row_first.size(); i++) {
+            SXSSFCell tempCell = row0.createCell(i);
+            tempCell.setCellValue(row_first.get(i));
+            tempCell.setCellStyle(headStyle);
+        }
+        sheet.addMergedRegion(new CellRangeAddress(0,0,3,6));
+        sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
+        sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
+        sheet.addMergedRegion(new CellRangeAddress(0,1,2,2));
+        sheet.addMergedRegion(new CellRangeAddress(0,1,7,7));
+        //第二行
+        SXSSFRow row1 = sheet.createRow(rowNum++);
+        row1.setHeight((short)500);
+        List<String> row_second =new ArrayList<>();
+        row_second.add("");
+        row_second.add("");
+        row_second.add("");
+        row_second.add("正常工时");
+        row_second.add("加班工时");
+        row_second.add("合计工时");
+        row_second.add("合计工时成本");
+        row_second.add("");
+        for (int i = 0; i < row_second.size(); i++) {
+            SXSSFCell tempCell = row1.createCell(i);
+            tempCell.setCellValue(row_second.get(i));
+            tempCell.setCellStyle(headStyle);
+        }
+        List<String> list=new ArrayList<>();
+        Map<String, List<Map<String, Object>>> listMapGroupList = mapList.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("corpwxDeptId"))));
+        List<String> departmentNameList = mapList.stream().map(m -> String.valueOf(m.get("corpwxDeptId"))).distinct().collect(Collectors.toList());
+        //根据每个部门下数据长度合并部门名称列
+        int deptIndex=rowNum;
+        int allRowNum=0;
+        for (String deptName : departmentNameList) {
+            List<Map<String, Object>> maps = listMapGroupList.get(deptName);
+            //再根据每个部门下员工数据长度合并人员名称列
+            Map<String, List<Map<String, Object>>> listMapGroupList2 = maps.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("groupName"))));
+            List<String> groupNameList = maps.stream().map(m -> String.valueOf(m.get("groupName"))).distinct().collect(Collectors.toList());
+            if(groupNameList.size()>1){
+                sheet.addMergedRegion(new CellRangeAddress(deptIndex,deptIndex+groupNameList.size()-1,0,0));
+            }
+            deptIndex+=groupNameList.size();
+            for (String groupName : groupNameList) {
+                List<Map<String, Object>> mapList1 = listMapGroupList2.get(groupName);
+                list.add("$departmentName="+deptName+"$");
+                list.add(groupName);
+                double planHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("planHour")))).sum();
+                double normalHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("normalHour")))).sum();
+                double overHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("overHour")))).sum();
+                double realHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realHour")))).sum();
+                double realCost = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realCost")))).sum();
+                double planHourNum = new BigDecimal(planHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                double normalHourNum = new BigDecimal(normalHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                double overHourNum = new BigDecimal(overHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                double realHourNum = new BigDecimal(realHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                double realCostNum = new BigDecimal(realCost).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                list.add(String.valueOf(planHourNum));
+                list.add(String.valueOf(normalHourNum));
+                list.add(String.valueOf(overHourNum));
+                list.add(String.valueOf(realHourNum));
+                list.add(String.valueOf(realCostNum));
+                BigDecimal decimal = new BigDecimal(realHourNum);
+                decimal=decimal.divide(new BigDecimal(planHourNum),4,BigDecimal.ROUND_HALF_UP);
+                list.add(percentFormat.format(decimal.doubleValue()));
+            }
+            allRowNum+=groupNameList.size();
+        }
+        int k=0;
+        for(int i = 0;i<allRowNum;i++){
+            SXSSFRow tempRow = sheet.createRow(rowNum++);
+            tempRow.setHeight((short)500);
+            for(int j=0;j<8;j++){
+                SXSSFCell tempCell = tempRow.createCell(j);
+                String cellValue = "";
+                tempCell.setCellStyle(cellStyle);
+                if(k>=list.size()){
+                    continue;
+                }
+                cellValue=list.get(k);
+                tempCell.setCellValue(cellValue);
+                k++;
+            }
+        }
+
+        //导出excel
+        String result="系统提示:Excel文件导出成功!";
+        String title= "分组耗用进度表_"+company.getCompanyName()+System.currentTimeMillis();
+        String fileName= title+".xlsx";
+        try {
+            File dir = null;
+            dir = new File(path);
+            if (!dir.exists()) {
+                dir.mkdirs();
+            }
+            FileOutputStream os = new FileOutputStream(path+fileName);//保存到本地
+            workBook.write(os);
+            os.flush();
+            os.close();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        if(wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1){
+
+            try {
+                return excelExportService.exportTranForwx(wxCorpInfo, title);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        httpRespMsg.data ="/upload/"+fileName;
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg projectExpendProcessList(Integer projectId, Integer categoryId, String userId, Integer pageIndex, Integer pageSize) {
+        HttpRespMsg msg=new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("token"));
+        NumberFormat percentFormat = NumberFormat.getPercentInstance();
+        percentFormat.setMaximumFractionDigits(2);
+        Integer companyId = user.getCompanyId();
+        boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部项目耗用进度表");
+        boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门项目耗用进度表");
+        List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
+        List<Map<String,Object>> resultList;
+        Long total;
         Integer size=null;
         Integer start=null;
         if(pageIndex!=null&&pageSize!=null){
@@ -12410,8 +12702,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         if(!viewAll){
             if(!incharger){
                 //只能查看本人的数据
-                resultList=projectMapper.groupExpendProcessList(user.getId(),companyId,null,start,size);
-                total=projectMapper.groupExpendProcessListCount(user.getId(),companyId,null);
+                resultList=projectMapper.projectExpendProcessList(projectId,categoryId,user.getId(),companyId,null,start,size);
+                total=projectMapper.projectExpendProcessListCount(projectId,categoryId,user.getId(),companyId,null);
             }else {
                 List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
                 List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
@@ -12425,12 +12717,39 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
                     deptIds.addAll(branchDepartment);
                 }
-                resultList=projectMapper.groupExpendProcessList(null,companyId,deptIds,start,size);
-                total=projectMapper.groupExpendProcessListCount(null,companyId,deptIds);
+                resultList=projectMapper.projectExpendProcessList(projectId,categoryId,userId,companyId,deptIds,start,size);
+                total=projectMapper.projectExpendProcessListCount(projectId,categoryId,userId,companyId,deptIds);
             }
         }else {
-            resultList=projectMapper.groupExpendProcessList(null,companyId,null,start,size);
-            total=projectMapper.groupExpendProcessListCount(null,companyId,null);
+            resultList=projectMapper.projectExpendProcessList(projectId,categoryId,userId,companyId,null,start,size);
+            total=projectMapper.projectExpendProcessListCount(projectId,categoryId,userId,companyId,null);
+        }
+        for (Map<String, Object> map : resultList) {
+            if(StringUtils.isEmpty(String.valueOf(map.get("executorString")))){
+                continue;
+            }
+            String executorString = String.valueOf(map.get("executorString"));
+            List<String> list = ListUtil.convertLongIdsArrayToList(executorString);
+            List<Map<String,Object>> itemList=new ArrayList<>();
+            for (String str : list) {
+                String[] split = str.split("\\|");
+                Map<String,Object> item=new HashMap<>();
+                item.put("userName",split[0]);
+                item.put("progress",split[1]);
+                itemList.add(item);
+            }
+            Map<String, List<Map<String, Object>>> listMapGroup = itemList.stream().collect(Collectors.groupingBy(i -> String.valueOf(i.get("userName"))));
+            List<String> userNameList = itemList.stream().map(i -> String.valueOf(i.get("userName"))).distinct().collect(Collectors.toList());
+            List<Map<String,Object>> targetLsit=new ArrayList<>();
+            for (String userName : userNameList) {
+                List<Map<String, Object>> mapList = listMapGroup.get(userName);
+                double progress = mapList.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("progress")))).sum();
+                Map<String,Object> item=new HashMap<>();
+                item.put("userName",userName);
+                item.put("progress",percentFormat.format(progress/Double.valueOf(String.valueOf(map.get("planHour"))).doubleValue()));
+                targetLsit.add(item);
+            }
+            map.put("userProgress",targetLsit);
         }
         Map<String,Object> resultMap=new HashMap<>();
         resultMap.put("record",resultList);
@@ -12440,7 +12759,308 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     }
 
     @Override
-    public HttpRespMsg exportGroupExpendProcessList(String startDate, String endDate) {
-        return null;
+    public HttpRespMsg exportProjectExpendProcessList(Integer projectId, Integer categoryId, String userId) {
+        HttpRespMsg httpRespMsg=new HttpRespMsg();
+        NumberFormat percentFormat = NumberFormat.getPercentInstance();
+        percentFormat.setMaximumFractionDigits(2);
+        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
+        HttpRespMsg resultMsg = projectExpendProcessList(projectId,categoryId,userId,null,null);
+        Map<String, Object> msgData = (Map<String, Object>) resultMsg.getData();
+        List<Map<String, Object>> mapList = (List<Map<String, Object>>) msgData.get("record");
+        List<List<String>> dataList=new ArrayList<>();
+        List<String> titleList=new ArrayList<>();
+        titleList.add("项目名称");
+        titleList.add("项目分类");
+        titleList.add("项目编号");
+        titleList.add("分配工时");
+        titleList.add("已消耗工时");
+        titleList.add("已消耗工时成本");
+        titleList.add("剩余工时");
+        titleList.add("参与员工");
+        dataList.add(titleList);
+        for (Map<String, Object> map : mapList) {
+            List<String> item=new ArrayList<>();
+            item.add(String.valueOf(map.get("projectName")));
+            item.add(String.valueOf(map.get("categoryName")));
+            item.add(String.valueOf(map.get("projectCode")));
+            item.add(String.valueOf(map.get("planHour")));
+            item.add(String.valueOf(map.get("realHour")));
+            item.add(String.valueOf(map.get("realCost")));
+            item.add(String.valueOf(map.get("residueHour")));
+            List<Map<String, Object>> userProgress = (List<Map<String, Object>>) map.get("userProgress");
+            StringBuilder sb=new StringBuilder();
+            for (int i = 0; i < userProgress.size(); i++) {
+                if(i==userProgress.size()-1){
+                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                        sb.append("$userName="+String.valueOf(userProgress.get(i).get("userName"))+"$"+String.valueOf(userProgress.get(i).get("progress")));
+                    }else {
+                        sb.append(String.valueOf(userProgress.get(i).get("userName"))+String.valueOf(userProgress.get(i).get("progress")));
+                    }
+
+                }else {
+                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                        sb.append("$userName="+String.valueOf(userProgress.get(i).get("userName"))+"$"+String.valueOf(userProgress.get(i).get("progress"))+",");
+                    }else {
+                        sb.append(String.valueOf(userProgress.get(i).get("userName"))+String.valueOf(userProgress.get(i).get("progress"))+",");
+                    }
+                }
+            }
+            item.add(sb.toString());
+            dataList.add(item);
+        }
+        String fileName = "项目耗用进度表_"+System.currentTimeMillis();
+        try {
+           return   excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg userTaskProcessList(Integer deptId, String userId, Integer projectId,String startDate,String endDate, Integer pageIndex, Integer pageSize) {
+        HttpRespMsg msg=new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("token"));
+        Integer companyId = user.getCompanyId();
+        boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部员工项目进度表");
+        boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门员工项目进度表");
+        List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
+        List<Map<String,Object>> resultList;
+        Long total;
+        Integer size=null;
+        Integer start=null;
+        if(pageIndex!=null&&pageSize!=null){
+            size=pageSize;
+            start=(pageIndex-1)*size;
+        }
+        //是否具有查看全部数据的权限
+        if(!viewAll){
+            if(!incharger){
+                //只能查看本人的数据
+                resultList=projectMapper.userTaskProcessList(deptId,user.getId(),projectId,companyId,null,startDate,endDate,start,size);
+                total=projectMapper.userTaskProcessListCount(deptId,user.getId(),projectId,companyId,null,startDate,endDate);
+            }else {
+                List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
+                List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
+                List<Integer> deptIds=new ArrayList<>();
+                List<Integer> theCollect = departmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
+                theCollect.add(-1);
+                List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
+                otherCollect.add(-1);
+                theCollect.addAll(otherCollect);
+                for (Integer integer : theCollect) {
+                    List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
+                    deptIds.addAll(branchDepartment);
+                }
+                resultList=projectMapper.userTaskProcessList(deptId,userId,projectId,companyId,deptIds,startDate,endDate,start,size);
+                total=projectMapper.userTaskProcessListCount(deptId,userId,projectId,companyId,deptIds,startDate,endDate);
+            }
+        }else {
+            resultList=projectMapper.userTaskProcessList(deptId,userId,projectId,companyId,null,startDate,endDate,start,size);
+            total=projectMapper.userTaskProcessListCount(deptId,userId,projectId,companyId,null,startDate,endDate);
+        }
+        Map<String,Object> resultMap=new HashMap<>();
+        resultMap.put("record",resultList);
+        resultMap.put("total",total);
+        msg.setData(resultMap);
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg exportUserTaskProcessList(Integer deptId, String userId, Integer projectId,String startDate,String endDate) {
+        HttpRespMsg httpRespMsg=new HttpRespMsg();
+        HttpRespMsg resultMsg = userTaskProcessList(deptId, userId, projectId,startDate,endDate, null, null);
+        Map<String, Object> msgData = (Map<String, Object>) resultMsg.getData();
+        List<Map<String, Object>> mapList = (List<Map<String, Object>>) msgData.get("record");
+        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
+        Company company = companyMapper.selectById(companyId);
+        //1.创建一个workbook,对应一个excel文件
+        SXSSFWorkbook workBook = new SXSSFWorkbook();
+        //2.在workbook中添加一个sheet,对应Excel中的sheet
+        SXSSFSheet sheet = workBook.createSheet("员工项目进度表");
+        //设置每一列的列宽
+        sheet.setColumnWidth(0,256*15);
+        sheet.setColumnWidth(1,256*15);
+        //3.设置样式以及字体样式
+        //设置冻结
+        sheet.createFreezePane(0, 2);
+        sheet.setDefaultColumnWidth(16);
+        //设置字体样式
+        Font headFont = workBook.createFont();
+        headFont.setBold(true);
+        headFont.setFontHeightInPoints((short) 10);
+        headFont.setFontName("黑体");
+
+        Font titleFont = workBook.createFont();
+        titleFont.setBold(true);
+        titleFont.setFontHeightInPoints((short) 10);
+        titleFont.setFontName("黑体");
+
+        Font font = workBook.createFont();
+        font.setFontHeightInPoints((short) 10);
+        font.setFontName("宋体");
+
+        //设置单元格样式
+        XSSFCellStyle headStyle = (XSSFCellStyle) workBook.createCellStyle();
+        headStyle.setFont(headFont);
+        headStyle.setAlignment(HorizontalAlignment.CENTER);
+        headStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+        headStyle.setWrapText(true);
+        headStyle.setBorderBottom(BorderStyle.THIN); //下边框
+        headStyle.setBorderLeft(BorderStyle.THIN);//左边框
+        headStyle.setBorderTop(BorderStyle.THIN);//上边框
+        headStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+        String color = "c0c0c0";    //此处得到的color为16进制的字符串
+        //转为RGB码
+        int r = Integer.parseInt((color.substring(0,2)),16);   //转为16进制
+        int g = Integer.parseInt((color.substring(2,4)),16);
+        int b = Integer.parseInt((color.substring(4,6)),16);
+
+        //设置自定义颜色
+        XSSFColor xssfColor = new XSSFColor();
+        byte[] colorRgb = { (short)9, (byte) r, (byte) g, (byte) b };
+        xssfColor.setRGB(colorRgb);
+
+        headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);
+        headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);// 填充模式(和背景颜色成对使用)
+        /*headStyle.setFillForegroundColor(IndexedColors.AQUA.getIndex());*/ //设置自带的颜色
+
+        CellStyle titleStyle = workBook.createCellStyle();
+        titleStyle.setFont(titleFont);
+        titleStyle.setAlignment(HorizontalAlignment.CENTER);
+        titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+        titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);  //填充单元格
+        titleStyle.setFillForegroundColor((short)9);    //填色
+        titleStyle.setWrapText(true);
+        titleStyle.setBorderBottom(BorderStyle.THIN); //下边框
+        titleStyle.setBorderLeft(BorderStyle.THIN);//左边框
+        titleStyle.setBorderTop(BorderStyle.THIN);//上边框
+        titleStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+        CellStyle cellStyle = workBook.createCellStyle();
+        cellStyle.setFont(font);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        cellStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+        cellStyle.setWrapText(true);
+        cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
+        cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
+        cellStyle.setBorderTop(BorderStyle.THIN);//上边框
+        cellStyle.setBorderRight(BorderStyle.THIN);//右边框
+        //行号
+        int rowNum = 0;
+        //第一行
+        SXSSFRow row0 = sheet.createRow(rowNum++);
+        row0.setHeight((short)500);
+        List<String> row_first =new ArrayList<>();
+        row_first.add("部门");
+        row_first.add("员工");
+        row_first.add("项目");
+        row_first.add("");
+        row_first.add("");
+        row_first.add("");
+        row_first.add("");
+        for (int i = 0; i < row_first.size(); i++) {
+            SXSSFCell tempCell = row0.createCell(i);
+            tempCell.setCellValue(row_first.get(i));
+            tempCell.setCellStyle(headStyle);
+        }
+        sheet.addMergedRegion(new CellRangeAddress(0,0,2,6));
+        sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
+        sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
+        //第二行
+        SXSSFRow row1 = sheet.createRow(rowNum++);
+        row1.setHeight((short)500);
+        List<String> row_second =new ArrayList<>();
+        row_second.add("");
+        row_second.add("");
+        row_second.add("项目名称");
+        row_second.add("项目编号");
+        row_second.add("项目任务");
+        row_second.add("计划工时");
+        row_second.add("消耗工时");
+        for (int i = 0; i < row_second.size(); i++) {
+            SXSSFCell tempCell = row1.createCell(i);
+            tempCell.setCellValue(row_second.get(i));
+            tempCell.setCellStyle(headStyle);
+        }
+        List<String> list=new ArrayList<>();
+        Map<String, List<Map<String, Object>>> listMapGroupList = mapList.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("departmentName"))));
+        List<String> departmentNameList = mapList.stream().map(m -> String.valueOf(m.get("departmentName"))).distinct().collect(Collectors.toList());
+        //根据每个部门下数据长度合并部门名称列
+        int deptIndex=rowNum;
+        for (String deptName : departmentNameList) {
+            List<Map<String, Object>> maps = listMapGroupList.get(deptName);
+            //再根据每个部门下员工数据长度合并人员名称列
+            Map<String, List<Map<String, Object>>> listMapGroupList2 = maps.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("jobNumber"))));
+            List<String> userNameList = maps.stream().map(m -> String.valueOf(m.get("jobNumber"))).distinct().collect(Collectors.toList());
+            if(maps.size()>1){
+                sheet.addMergedRegion(new CellRangeAddress(deptIndex,deptIndex+maps.size()-1,0,0));
+                int userIndex=deptIndex;
+                for (String userName : userNameList) {
+                    List<Map<String, Object>> mapList1 = listMapGroupList2.get(userName);
+                    if(mapList1.size()>1){
+                        sheet.addMergedRegion(new CellRangeAddress(userIndex,userIndex+mapList1.size()-1,1,1));
+                    }
+                    userIndex+=mapList1.size();
+                }
+            }
+            deptIndex+=maps.size();
+            for (int i = 0; i < maps.size(); i++) {
+                list.add("$departmentName="+String.valueOf(maps.get(i).get("corpwxDeptId"))+"$");
+                list.add("$userName="+maps.get(i).get("corpwxUserId")+"$");
+                list.add(String.valueOf(maps.get(i).get("projectName")));
+                list.add(String.valueOf(maps.get(i).get("projectCode")));
+                list.add(String.valueOf(maps.get(i).get("taskName")));
+                list.add(String.valueOf(maps.get(i).get("planHour")));
+                list.add(String.valueOf(maps.get(i).get("consumeTime")));
+            }
+        }
+        int k=0;
+        for(int i = 0;i<mapList.size();i++){
+            SXSSFRow tempRow = sheet.createRow(rowNum++);
+            tempRow.setHeight((short)500);
+            for(int j=0;j<7;j++){
+                SXSSFCell tempCell = tempRow.createCell(j);
+                String cellValue = "";
+                tempCell.setCellStyle(cellStyle);
+                if(k>=list.size()){
+                    continue;
+                }
+                cellValue=list.get(k);
+                tempCell.setCellValue(cellValue);
+                k++;
+            }
+        }
+
+        //导出excel
+        String result="系统提示:Excel文件导出成功!";
+        String title= "员工任务完成表_"+company.getCompanyName()+System.currentTimeMillis();
+        String fileName= title+".xlsx";
+        try {
+            File dir = null;
+            dir = new File(path);
+            if (!dir.exists()) {
+                dir.mkdirs();
+            }
+            FileOutputStream os = new FileOutputStream(path+fileName);//保存到本地
+            workBook.write(os);
+            os.flush();
+            os.close();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        if(wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1){
+
+            try {
+                return excelExportService.exportTranForwx(wxCorpInfo, title);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        httpRespMsg.data ="/upload/"+fileName;
+        return httpRespMsg;
     }
 }

+ 163 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -1793,7 +1793,7 @@
             and u.id=#{userId}
         </if>
         <if test="projectId!=null">
-            and p.id=#{project}
+            and p.id=#{projectId}
         </if>
         <if test="list!=null and list.size()>0">
             and d.department_id in
@@ -1824,7 +1824,7 @@
                 and u.id=#{userId}
             </if>
             <if test="projectId!=null">
-                and p.id=#{project}
+                and p.id=#{projectId}
             </if>
             <if test="list!=null and list.size()>0">
                 and d.department_id in
@@ -1837,20 +1837,20 @@
     </select>
 
     <select id="groupExpendProcessList" resultType="java.util.Map">
-        select d.department_name,tg.name as groupName,IFNULL(SUM(te.plan_hours),0) as planHour,
+        select d.department_name,d.corpwx_deptid as corpwxDeptId,tg.name as groupName,IFNULL(SUM(te.plan_hours),0) as planHour,
         IFNULL(IFNULL((select SUM(working_time) from report where task_id=te.task_id <if test="startDate!=null and endDate!=null">
-            create_date between #{startDate} and #{endDate}
+          and  create_date between #{startDate} and #{endDate}
         </if> ),0)-IFNULL((select SUM(overtime_hours) from report where task_id=te.task_id <if test="startDate!=null and endDate!=null">
-        create_date between #{startDate} and #{endDate}
+          and create_date between #{startDate} and #{endDate}
         </if>),0),0) as normalHour,
         IFNULL((select SUM(overtime_hours) from report where task_id=te.task_id <if test="startDate!=null and endDate!=null">
-        create_date between #{startDate} and #{endDate}
+          and create_date between #{startDate} and #{endDate}
         </if>),0) as overHour,
         IFNULL((select SUM(working_time) from report where task_id=te.task_id <if test="startDate!=null and endDate!=null">
-        create_date between #{startDate} and #{endDate}
+          and create_date between #{startDate} and #{endDate}
         </if>),0) as realHour,
         IFNULL((select SUM(cost) from report where task_id=te.task_id <if test="startDate!=null and endDate!=null">
-        create_date between #{startDate} and #{endDate}
+          and create_date between #{startDate} and #{endDate}
         </if>),0) as realCost
         from task_executor te
         left join  user u on u.id=te.executor_id
@@ -1860,7 +1860,7 @@
         where u.company_id=#{companyId} and te.project_id is not null and d.department_name in ('4','12','14')
         and tg.name in ('生产部电气','生产部车间','工程部现场安装施工','工程部配合调试','研发部工艺设计','研发部结构设计','研发部BIM设计','研发部电气设计','研发部工艺调试验收','研发部电气调试验收')
         <if test="userId!=null and userId!=''">
-            te.executor_id=#{userId}
+            and te.executor_id=#{userId}
         </if>
         <if test="list!=null and list.size()>0">
             and d.department_id in
@@ -1870,9 +1870,163 @@
         </if>
         group by t.group_id
         order by d.department_id
+    </select>
+
+    <select id="groupExpendProcessListCount" resultType="java.lang.Long">
+        select count(1) from (
+        select d.department_name,tg.name as groupName
+        from task_executor te
+        left join  user u on u.id=te.executor_id
+        left join task t on t.id=te.task_id
+        left join task_group tg on tg.id=t.group_id
+        left join department d on d.department_id=u.department_id
+        where u.company_id=#{companyId} and te.project_id is not null and d.department_name in ('4','12','14')
+        and tg.name in ('生产部电气','生产部车间','工程部现场安装施工','工程部配合调试','研发部工艺设计','研发部结构设计','研发部BIM设计','研发部电气设计','研发部工艺调试验收','研发部电气调试验收')
+        <if test="userId!=null and userId!=''">
+            and te.executor_id=#{userId}
+        </if>
+        <if test="list!=null and list.size()>0">
+            and d.department_id in
+            <foreach collection="list" open="(" close=")" item="item" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        group by t.group_id
+        order by d.department_id
+        ) as total
+    </select>
+
+    <select id="projectExpendProcessList" resultType="java.util.Map">
+        select p.project_name as projectName,pc.name as categoryName,p.project_code as projectCode,IFNULL(SUM(te.plan_hours),0) as planHour,
+        IFNULL((select SUM(working_time) from report where project_id=p.id),0) as realHour, IFNULL((select SUM(cost) from report where project_id=p.id),0) as realCost,
+        IFNULL(IFNULL(SUM(te.plan_hours),0)-IFNULL((select SUM(working_time) from report where project_id=p.id),0),0) as residueHour,
+        GROUP_CONCAT(CONCAT_WS('|',te.executor_name,IFNULL((select SUM(working_time) from report where creator_id=te.executor_id and project_id=p.id),0))) as executorString
+        from task_executor te
+        left join  user u on u.id=te.executor_id
+        left join department d on u.department_id=d.department_id
+        left join task t on t.id=te.task_id
+        left join project p on p.id=t.project_id
+        left join project_category pc on pc.id=p.category
+        where u.company_id=#{companyId} and te.project_id is not null  and pc.name in ('报价项目','售后报价项目','售后工程项目')
+        <if test="projectId!=null">
+            and p.id=#{projectId}
+        </if>
+        <if test="userId!=null and userId!=''">
+            and FIND_IN_SET(#{userId},t.executor_id)
+        </if>
+        <if test="categoryId!=null">
+            and pc.id=#{categoryId}
+        </if>
+        <if test="list!=null and list.size()>0">
+            and d.department_id in
+            <foreach collection="list" open="(" close=")" separator="," item="item">
+                #{item}
+            </foreach>
+        </if>
+        group by t.project_id
+        <if test="start!=null and size!=null">
+            limit #{start},#{size}
+        </if>
+    </select>
+
+    <select id="projectExpendProcessListCount" resultType="java.lang.Long">
+        select count(1) from (
+        select p.project_name as projectName,pc.name as categoryName,p.project_code as projectCode,IFNULL(SUM(te.plan_hours),0) as planHour,
+        IFNULL((select SUM(working_time) from report where task_id=te.task_id),0) as realHour,
+        IFNULL((select SUM(cost) from report where task_id=te.task_id),0) as realCost,
+        IFNULL(IFNULL(SUM(te.plan_hours),0)-IFNULL((select SUM(working_time) from report where task_id=te.task_id),0),0) as residueHour,
+        GROUP_CONCAT(CONCAT_WS('|',te.executor_name,CONCAT_WS('',FORMAT(IFNULL(IFNULL((select SUM(working_time) from report where creator_id=te.executor_id and task_id=t.id),0)/(IFNULL((select SUM(working_time) from report where task_id=te.task_id),0)),0)*100,2),'%'))) as executorString
+        from task_executor te
+        left join  user u on u.id=te.executor_id
+        left join department d on u.department_id=d.department_id
+        left join task t on t.id=te.task_id
+        left join project p on p.id=t.project_id
+        left join project_category pc on pc.id=p.category
+        where u.company_id=#{companyId} and te.project_id is not null  and pc.name in ('报价项目','售后报价项目','售后工程项目')
+        <if test="projectId!=null">
+            and p.id=#{projectId}
+        </if>
+        <if test="userId!=null and userId!=''">
+            and te.executor_id=#{userId}
+        </if>
+        <if test="categoryId!=null">
+            and pc.id=#{categoryId}
+        </if>
+        <if test="list!=null and list.size()>0">
+            and d.department_id in
+            <foreach collection="list" open="(" close=")" separator="," item="item">
+                #{item}
+            </foreach>
+        </if>
+        group by t.project_id
+        ) as total
+    </select>
+
+    <select id="userTaskProcessList" resultType="java.util.Map">
+        select d.department_name as departmentName,d.corpwx_deptid as corpwxDeptId,u.corpwx_userid as corpwxUserId,t.name as taskName,IFNULL(t.plan_hours,0) as planHour,u.name as userName,u.job_number as jobNumber,p.project_name as projectName,p.project_code as projectCode,
+        IFNULL((select SUM(working_time) from report where task_id=te.task_id),0)as consumeTime
+        from task_executor te
+        left join  user u on u.id=te.executor_id
+        left join department d on d.department_id=u.department_id
+        left join project p on p.id=te.project_id
+        left join task t on te.task_id=t.id
+        where u.company_id=#{companyId} and te.project_id is not null and d.department_name in ('4','12','14')
+        <if test="deptId!=null">
+            and d.department_id=#{deptId}
+        </if>
+        <if test="userId!=null and userId!=''">
+            and u.id=#{userId}
+        </if>
+        <if test="projectId!=null">
+            and p.id=#{projectId}
+        </if>
+        <if test="list!=null and list.size()>0">
+            and d.department_id in
+            <foreach collection="list" open="(" close=")" item="item" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="startDate!=null and endDate!=null and startDate!='' and endDate!=''">
+            and t.start_date &gt;= #{startDate} and t.end_date &lt;= #{endDate}
+        </if>
+        group by te.executor_id,t.id
+        order by d.department_id,u.id
         <if test="start!=null and size!=null">
             limit #{start},#{size}
         </if>
     </select>
 
+    <select id="userTaskProcessListCount" resultType="java.lang.Long">
+        select count(1) from (
+        select d.department_name as departmentName,d.corpwx_deptid as corpwxDeptId,u.corpwx_userid as corpwxUserId,t.name as taskName,IFNULL(t.plan_hours,0) as planHour,u.name as userName,u.job_number as jobNumber,p.project_name as projectName,p.project_code as projectCode,
+        IFNULL((select SUM(working_time) from report where task_id=te.task_id),0)as consumeTime
+        from task_executor te
+        left join  user u on u.id=te.executor_id
+        left join department d on d.department_id=u.department_id
+        left join project p on p.id=te.project_id
+        left join task t on te.task_id=t.id
+        where u.company_id=#{companyId} and te.project_id is not null and d.department_name in ('4','12','14')
+        <if test="deptId!=null">
+            and d.department_id=#{deptId}
+        </if>
+        <if test="userId!=null and userId!=''">
+            and u.id=#{userId}
+        </if>
+        <if test="projectId!=null">
+            and p.id=#{projectId}
+        </if>
+        <if test="list!=null and list.size()>0">
+            and d.department_id in
+            <foreach collection="list" open="(" close=")" item="item" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="startDate!=null and endDate!=null and startDate!='' and endDate!=''">
+            and t.start_date &gt;= #{startDate} and t.end_date &lt;= #{endDate}
+        </if>
+        group by te.executor_id,t.id
+        order by d.department_id,u.id
+        ) as total
+    </select>
+
 </mapper>

+ 8 - 8
fhKeeper/formulahousekeeper/timesheet/src/permissions.js

@@ -98,10 +98,10 @@ const StringUtil = {
         reportSortScaleTable: false, // 项目分类工时占比表 // 
         reportSortDetailTable: false, // 分类全部工时明细表 // 
         reportSortSectionDetailTable: false, // 分类负责部门工时明细表 //
-        reportStaffProject: true, // 员工项目进度表 //
-        reportProjectConsumptionFirst: true, // 项目耗用进度表1 //
-        reportProjectConsumptionTwo: true, // 项目耗用进度表2 //
-        reportStaffTaskAccomplished: true, // 员工任务完成表 //
+        reportStaffProject: false, // 员工项目进度表 //
+        reportProjectConsumptionFirst: false, // 分组耗用进度表 //
+        reportProjectConsumptionTwo: false, // 项目耗用进度表 //
+        reportStaffTaskAccomplished: false, // 员工任务完成表 //
 
         // 请假模块
         leaveFil : false, // 请假填报 // 
@@ -256,10 +256,10 @@ const StringUtil = {
         arr[i] == '分类全部工时明细表' ? obj.reportSortDetailTable = true : ''
         arr[i] == '分类负责部门工时明细表' ? obj.reportSortSectionDetailTable = true : ''
 
-        arr[i] == '员工项目进度表' ? obj.reportStaffProject = true : ''
-        arr[i] == '项目耗用进度表1' ? obj.reportProjectConsumptionFirst = true : ''
-        arr[i] == '项目耗用进度表2' ? obj.reportProjectConsumptionTwo = true : ''
-        arr[i] == '员工任务完成表' ? obj.reportStaffTaskAccomplished = true : ''
+        arr[i] == '全部员工项目进度表' || arr[i] == '负责部门员工项目进度表' ? obj.reportStaffProject = true : ''
+        arr[i] == '全部分组耗用进度表' || arr[i] == '负责部门分组耗用进度表' ? obj.reportProjectConsumptionFirst = true : ''
+        arr[i] == '全部项目耗用进度表' || arr[i] == '负责部门项目耗用进度表' ? obj.reportProjectConsumptionTwo = true : ''
+        arr[i] == '全部员工任务完成表' || arr[i] == '负责部门员工任务完成表' ? obj.reportStaffTaskAccomplished = true : ''
     }
     return obj
   }

+ 319 - 26
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -44,8 +44,8 @@
                   <el-menu-item index="1-22" v-if="permissions.reportSortScaleTable" @click="ssl(21)"><p>项目分类工时占比表</p></el-menu-item>
                   <el-menu-item index="1-23" v-if="permissions.reportSortDetailTable || permissions.reportSortSectionDetailTable" @click="ssl(22)"><p>分类工时明细表</p></el-menu-item>
                   <el-menu-item index="1-24" v-if="permissions.reportStaffProject" @click="ssl(23)"><p>员工项目进度表</p></el-menu-item>
-                  <el-menu-item index="1-25" v-if="permissions.reportProjectConsumptionFirst" @click="ssl(24)"><p>项目耗用进度表1</p></el-menu-item>
-                  <el-menu-item index="1-26" v-if="permissions.reportProjectConsumptionTwo" @click="ssl(25)"><p>项目耗用进度表2</p></el-menu-item>
+                  <el-menu-item index="1-25" v-if="permissions.reportProjectConsumptionFirst" @click="ssl(24)"><p>分组耗用进度表</p></el-menu-item>
+                  <el-menu-item index="1-26" v-if="permissions.reportProjectConsumptionTwo" @click="ssl(25)"><p>项目耗用进度表</p></el-menu-item>
                   <el-menu-item index="1-27" v-if="permissions.reportStaffTaskAccomplished" @click="ssl(26)"><p>员工任务完成表</p></el-menu-item>
                 </el-submenu>
               </el-menu>
@@ -78,8 +78,8 @@
             </el-option>
           </el-select>
         </template>
-        <!-- 时间段筛选 -->
-        <template v-if="ins == 6 || ins == 8 || ins == 9 || ins == 10 || ins == 11 || ins == 12 || ins == 5 || ins == 16 || ins == 17 || ins == 18 || ins == 20 || ins == 21 || ins == 22">
+        <!-- 时间段筛选 ins == 6 || ins == 8 || ins == 9 || ins == 10 || ins == 11 || ins == 12 || ins == 5 || ins == 16 || ins == 17 || ins == 18 || ins == 20 || ins == 21 || ins == 22 -->
+        <template v-if="screeningCondition.timePeriod.includes(ins)">
           <span>
             <span class="demonstration" style="color:#999;padding:0 10px">
               {{ ins == 15 ? $t('xiang-mu-chuang-jian-shi-jian-duan') : $t('message.period') }}
@@ -95,7 +95,17 @@
               项目分类
             </span>
             <el-select v-model="projectSortId" placeholder="请选择" @change="picks()" size="small">
-              <el-option v-for="item in projectSortList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              <el-option v-for="item in projectSortList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
+            </el-select>
+          </span>
+        </template>
+        <template v-if="ins == 25">
+          <span>
+            <span class="demonstration" style="color:#999;padding:0 10px">
+              项目分类
+            </span>
+            <el-select v-model="projectSortIdTwo" placeholder="请选择" @change="picks()" size="small" clearable>
+              <el-option v-for="item in projectSortListTwo" :key="item.id" :label="item.name" :value="item.id" ></el-option>
             </el-select>
           </span>
         </template>
@@ -106,7 +116,8 @@
           <el-option label="查看部门审核人" :value="0"></el-option>
         </el-select> -->
         <!-- 项目筛选 -->
-        <el-select v-if="ins != 4 && ins != 8 && ins != 9 && ins != 19 && ins != 10 && ins != 11 && ins != 14 && ins != 15 && ins != 17 && ins != 20 && ins != 21 && ins != 22" v-model="proJuctId" :placeholder="$t('defaultText.pleaseSelectSnItem')" clearable filterable size="small" @change="projectChange()" style="margin-left:10px">
+        <!-- <el-select v-if="ins != 4 && ins != 8 && ins != 9 && ins != 19 && ins != 10 && ins != 11 && ins != 14 && ins != 15 && ins != 17 && ins != 20 && ins != 21 && ins != 22" v-model="proJuctId" :placeholder="$t('defaultText.pleaseSelectSnItem')" clearable filterable size="small" @change="projectChange()" style="margin-left:10px"> -->
+        <el-select v-if="!screeningCondition.project.includes(ins)" v-model="proJuctId" :placeholder="$t('defaultText.pleaseSelectSnItem')" clearable filterable size="small" @change="projectChange()" style="margin-left:10px">
           <el-option v-for="(item) in proListOvertime" :key="item.id" :label="item.projectName + (item.projectCode ? item.projectCode : '')" :value="item.id">
             <span style="float: left;color: #8492a6;">{{ item.projectCode }}</span>
             <span style="float: right;font-size: 13px;margin-left: 20px">{{ item.projectName }}</span>
@@ -125,17 +136,17 @@
         <el-select v-if="ins == 16" multiple v-model="groupNames" @change="onGroupSelectChange" clearable size="small" filterable collapse-tags placeholder="请选择任务分组" style="margin-left:10px;">
           <el-option v-for="item in taskgroupList" :key="item.name" :label="item.name" :value="item.name"></el-option>
         </el-select>
-        <!-- 月份选择 -->
-        <el-date-picker v-if="ins == 14 || ins == 15 || ins == 19" value-format="yyyy-MM" v-model="monthPersonnel" type="month" :placeholder="$t('Selectmonth')" :clearable="false" @change="selcts()" size="small"></el-date-picker>
+        <!-- 月份选择 v-if="ins == 14 || ins == 15 || ins == 19" -->
+        <el-date-picker v-if="screeningCondition.months.includes(ins)" value-format="yyyy-MM" v-model="monthPersonnel" type="month" :placeholder="$t('Selectmonth')" :clearable="false" @change="selcts()" size="small"></el-date-picker>
           
-          <!-- 部门筛选 -->
-          <el-cascader v-if="(ins == 15 || (ins == 9 && permissions.reportAllTimely) || (ins == 8 && permissions.reportAllTimeDivide) || (ins == 6 && permissions.reportAllOvertime) || (ins == 11 && permissions.reportPersonnel) || (ins == 14)) && user.userNameNeedTranslate != 1" v-model="departmentIdArray" :options="departmentList" :placeholder="$t('qing-xuan-ze-bu-men')"
+          <!-- 部门筛选 ins == 15 || (ins == 9 && permissions.reportAllTimely) || (ins == 8 && permissions.reportAllTimeDivide) || (ins == 6 && permissions.reportAllOvertime) || (ins == 11 && permissions.reportPersonnel) || (ins == 14) -->
+          <el-cascader v-if="(screeningCondition.departments.includes(ins)  || (ins == 9 && permissions.reportAllTimely) || (ins == 8 && permissions.reportAllTimeDivide) || (ins == 6 && permissions.reportAllOvertime) || (ins == 11 && permissions.reportPersonnel)) && user.userNameNeedTranslate != 1" v-model="departmentIdArray" :options="departmentList" :placeholder="$t('qing-xuan-ze-bu-men')"
             :props="{ checkStrictly: true,expandTrigger: 'hover',multiple: ins == 6 ? true : false }" collapse-tags :show-all-levels="false" clearable
             @change="selcts(9)" size="small" style="margin-left:10px"
           ></el-cascader>
 
           <!-- 部门筛选 -->
-          <vueCascader :size="'small'" :widthStr="'125'" :clearable="true" :subject="departmentList" :radios="true" :distinction="'1'" @vueCasader="vueCasader" v-if="((ins == 15 || (ins == 9 && permissions.reportAllTimely) || (ins == 8 && permissions.reportAllTimeDivide) || (ins == 6 && permissions.reportAllOvertime) || (ins == 11 && permissions.reportPersonnel) || (ins == 14)) && user.userNameNeedTranslate == 1)" :selectNameChuan="$t('qing-xuan-ze-bu-men')"></vueCascader>
+          <vueCascader :size="'small'" :widthStr="'125'" :clearable="true" :subject="departmentList" :radios="true" :distinction="'1'" @vueCasader="vueCasader" v-if="(screeningCondition.departments.includes(ins)  || (ins == 9 && permissions.reportAllTimely) || (ins == 8 && permissions.reportAllTimeDivide) || (ins == 6 && permissions.reportAllOvertime) || (ins == 11 && permissions.reportPersonnel)) && user.userNameNeedTranslate == 1" :selectNameChuan="$t('qing-xuan-ze-bu-men')"></vueCascader>
           <!-- <vueCascader :size="'small'" :widthStr="'125'" :clearable="true" :subject="departmentList" :radios="true" :distinction="'1'" @vueCasader="vueCasader" v-if="((ins == 15 || (ins == 9 && permissions.reportAllTimely) || (ins == 8 && permissions.reportAllTimeDivide) || (ins == 6 && permissions.reportAllOvertime) || (ins == 11 && permissions.reportPersonnel) || (ins == 14)) && user.userNameNeedTranslate != 1)" :selectNameChuan="$t('qing-xuan-ze-bu-men')"></vueCascader> -->
 
           <!-- 任务筛选 -->
@@ -155,12 +166,12 @@
             <el-option :label="item" :value="item" v-for="item,index in areaList" :key="index"></el-option>
           </el-select>
 
-          <!-- 人员筛选 -->
-          <el-select v-if="(ins == 6 || ins == 8 || ins == 9 || ins == 10 || ins == 11 || ins == 14 || ins == 18)  && user.userNameNeedTranslate != '1'" v-model="userId" :placeholder="$t('pleaseselectpersonnel')" @change="selcts()" clearable filterable size="small" style="width:100px">
+          <!-- 人员筛选 ins == 6 || ins == 8 || ins == 9 || ins == 10 || ins == 11 || ins == 14 || ins == 18 -->
+          <el-select v-if="(screeningCondition.staff.includes(ins))  && user.userNameNeedTranslate != '1'" v-model="userId" :placeholder="$t('pleaseselectpersonnel')" @change="selcts()" clearable filterable size="small" style="width:100px">
             <el-option v-for="(item, index) in selUserList" :key="index" :label="item.name" :value="item.id"></el-option>
           </el-select>
 
-          <selectCat :subject="selUserList" :filterable="true" :searchBoxTop="'1'" :subjectId="userId" :clearable="true" :size="mini" @selectCal="selectCal" v-if="(ins == 6 || ins == 8 || ins == 9 || ins == 10 || ins == 11 || ins == 14 || ins == 18) && user.userNameNeedTranslate == '1'"></selectCat>
+          <selectCat :subject="selUserList" :filterable="true" :searchBoxTop="'1'" :subjectId="userId" :clearable="true" :size="mini" @selectCal="selectCal" v-if="(screeningCondition.staff.includes(ins)) && user.userNameNeedTranslate == '1'"></selectCat>
           
 
           <!-- 待审核筛选切换 -->
@@ -1027,7 +1038,7 @@
                       <ww-open-data type='departmentName' :openid='scope.row.deptName'></ww-open-data>
                     </span>
                     <span v-if="user.userNameNeedTranslate != '1'">
-                      {{scope.row.userName}}
+                      {{scope.row.deptName}}
                     </span>
                   </div>
                 </template>
@@ -1057,8 +1068,130 @@
               </el-table-column>
 
             </el-table>
+
+            <!-- 员工项目进度表 -->
+            <el-table  v-if="ins == 23" :key="23" border :data="isbeCustomReport.projectSchedule" highlight-current-row v-loading="listLoading" :height="(+tableHeight) - 1" style="width: 100%;" :span-method="objectSpanMethod">
+              <el-table-column align="center" prop="departmentName" label="部门" width="150">
+                <template slot-scope="scope">
+                  <div>
+                    <span v-if="user.userNameNeedTranslate == '1'">
+                      <ww-open-data type='departmentName' :openid='scope.row.departmentName'></ww-open-data>
+                    </span>
+                    <span v-if="user.userNameNeedTranslate != '1'">
+                      {{scope.row.deptName}}
+                    </span>
+                    <!-- {{ scope.row.departmentName }} -->
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column align="center" prop="userName" label="人员" width="150">
+                <template slot-scope="scope">
+                  <div>
+                    <span v-if="user.userNameNeedTranslate == '1'">
+                      <ww-open-data type='userName' :openid='scope.row.userName'></ww-open-data>
+                    </span>
+                    <span v-if="user.userNameNeedTranslate != '1'">
+                      {{scope.row.userName}}
+                    </span>
+                    <!-- {{scope.row.userName}} -->
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column align="center" prop="projectName" label="项目名称"></el-table-column>
+              <el-table-column align="center" prop="projectCode" label="项目编号"></el-table-column>
+              <el-table-column align="center" prop="residueTime" label="剩余工时(h)" width="150"></el-table-column>
+            </el-table>
+
+            <!-- 分组耗用进度表 -->
+            <el-table  v-if="ins == 24" :key="24" border :data="isbeCustomReport.consumptionSchedule" highlight-current-row v-loading="listLoading" :height="(+tableHeight + 50) - 1" style="width: 100%;" :span-method="objectSpanMethod">
+              <el-table-column align="center" prop="department_name" label="负责部门" min-width="150">
+                <template slot-scope="scope">
+                  <div>
+                    <span v-if="user.userNameNeedTranslate == '1'">
+                      <ww-open-data type='departmentName' :openid='scope.row.corpwxDeptId'></ww-open-data>
+                    </span>
+                    <span v-if="user.userNameNeedTranslate != '1'">
+                      {{scope.row.departmentName}}
+                    </span>
+                    <!-- {{ scope.row.corpwxDeptId }} -->
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column align="center" prop="groupName" label="任务分组" min-width="150"></el-table-column>
+              <el-table-column align="center" prop="planHour" label="计划工时(财务)" width="120"></el-table-column>
+              <el-table-column align="center" label="实际工时成本">
+                <el-table-column align="center" prop="normalHour" label="正常工时(h)" width="100"></el-table-column>
+                <el-table-column align="center" prop="overHour" label="加班工时(h)" width="100"></el-table-column>
+                <el-table-column align="center" prop="realHour" label="合计工时(h)" width="100"></el-table-column>
+                <el-table-column align="center" prop="realCost" label="合计工时成本" width="140"></el-table-column>
+              </el-table-column>
+              <el-table-column align="center" prop="process" label="工时耗用率" width="150"></el-table-column>
+            </el-table>
+
+            <!-- 项目耗用进度表 -->
+            <el-table  v-if="ins == 25" :key="25" border :data="isbeCustomReport.consumptionScheduleTwo" highlight-current-row v-loading="listLoading" :height="(+tableHeight) - 1" style="width: 100%;" >
+              <el-table-column align="center" prop="projectName" label="项目名称" min-width="220"></el-table-column>
+              <el-table-column align="center" prop="categoryName" label="项目分类" min-width="150"></el-table-column>
+              <el-table-column align="center" prop="projectCode" label="项目编号" min-width="150"></el-table-column>
+              <el-table-column align="center" prop="planHour" label="分配工时(h)" width="100"></el-table-column>
+              <el-table-column align="center" prop="realHour" label="已消耗工时(h)" width="120"></el-table-column>
+              <el-table-column align="center" prop="realCost" label="已消耗工时成本(¥)" width="150"></el-table-column>
+              <el-table-column align="center" prop="residueHour" label="剩余工时(h)" width="100"></el-table-column>
+              <el-table-column align="center" label="参与员工" min-width="150">
+                <template slot-scope="scope">
+                  <div class="participatingEmployee">
+                    <div v-for="(item,index) in scope.row.userProgress" :key="index">
+                      <span v-if="user.userNameNeedTranslate == '1'">
+                        <ww-open-data type='userName' :openid='item.userName'></ww-open-data> 
+                        {{item.progress}}%
+                      </span>
+                      <span v-if="user.userNameNeedTranslate != '1'">
+                        {{item.userName}} {{item.progress}}%
+                      </span>
+                      <!-- {{item.userName}} {{item.progress}}% -->
+                      <span v-if="index < scope.row.userProgress.length - 1">,</span>
+                    </div>
+                  </div>
+                </template>
+              </el-table-column>
+            </el-table>
+
+            <!-- 员工任务完成表 -->
+            <el-table  v-if="ins == 26" :key="26" border :data="isbeCustomReport.taskCompletionSheet" highlight-current-row v-loading="listLoading" :height="(+tableHeight) - 1" style="width: 100%;" :span-method="objectSpanMethod">
+              <el-table-column align="center" prop="departmentName" label="部门" min-width="150">
+                <template slot-scope="scope">
+                  <div>
+                    <span v-if="user.userNameNeedTranslate == '1'">
+                      <ww-open-data type='departmentName' :openid='scope.row.departmentName'></ww-open-data>
+                    </span>
+                    <span v-if="user.userNameNeedTranslate != '1'">
+                      {{scope.row.departmentName}}
+                    </span>
+                    <!-- {{ scope.row.departmentName }} -->
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column align="center" prop="w" label="人员" min-width="150">
+                <template slot-scope="scope">
+                  <div>
+                    <span v-if="user.userNameNeedTranslate == '1'">
+                      <ww-open-data type='userName' :openid='scope.row.userName'></ww-open-data>
+                    </span>
+                    <span v-if="user.userNameNeedTranslate != '1'">
+                      {{scope.row.userName}}
+                    </span>
+                    <!-- {{scope.row.userName}} -->
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column align="center" prop="projectName" label="项目名称" min-width="150"></el-table-column>
+              <el-table-column align="center" prop="projectCode" label="项目编号" min-width="150"></el-table-column>
+              <el-table-column align="center" prop="taskName" label="项目任务" min-width="150"></el-table-column>
+              <el-table-column align="center" prop="planHour" label="计划工时(h)" min-width="150"></el-table-column>
+              <el-table-column align="center" prop="consumeTime" label="消耗工时(h)" min-width="150"></el-table-column>
+            </el-table>
         <!--工具条-->
-        <el-col :span="24" class="toolbar" v-if="ins != 6 && ins != 20 && ins != 21">
+        <el-col :span="24" class="toolbar" v-if="ins != 6 && ins != 20 && ins != 21 && ins != 24">
           <el-pagination
                 v-if="ins == 12"
                 @size-change="groupSizeChange"
@@ -1318,7 +1451,13 @@ export default {
   props: {},
   data() {
     return {
-      
+      screeningCondition: { // 筛选条件的判断
+        project: [4, 8, 9, 10, 11, 14, 15, 17, 19, 20, 21, 22, 24], // 项目筛选条件 (不等于)
+        months: [14, 15, 19], // 月份筛选条件 (等于)
+        staff: [6, 8, 9, 19, 11, 14, 18, 23, 25, 26], // 人员筛选条件 (等于)
+        departments: [14, 15, 23, 26], // 部门筛选条件 (等于)
+        timePeriod: [5, 6, 8, 9, 10, 11, 12, 16, 17, 18, 20, 21, 22, 24, 26], // 时间段筛选条件 (等于)
+      },
       efficentList:[],
       groupNames: [],
       taskgroupList: [],
@@ -1376,14 +1515,14 @@ export default {
       this.$t('statisticsofovertimework'),this.$t('timecostearlywarningtable'),this.$t('personneltimeallocationtable'),
       this.$t('statisticsofstafffillingintimerate'),this.$t('dailyreporttobereviewedstatistics'),this.$t('statisticsofpersonnelhours'),this.$t('taskgrouptimesheet'),this.$t('projectcostbaselinetable'),
       this.$t('ren-yuan-yue-du-gong-shi-biao'), this.$t('bumenchanyuqingkuang'), this.$t('ge-fen-zu-yu-jie-duan-gong-shi-biao'), '子项目工时成本表', '任务重启表', 'FTE报表', '有效工时率表', '项目分类工时占比表', '分类工时明细表',
-      '员工项目进度表', '项目耗用进度表1', '项目耗用进度表2', '员工任务完成表'],
+      '员工项目进度表', '分组耗用进度表', '项目耗用进度表', '员工任务完成表'],
 
       shuzArr: [this.$t('projectreport'),this.$t('projectTaskReport'),this.$t('projectcoststatement'),
       this.$t('projectbalancesheet'),this.$t('customerprojectincomestatement'),this.$t('projectphasetimesheet'),
       this.$t('statisticsofovertimework'),this.$t('timecostearlywarningtable'),this.$t('personneltimeallocationtable'),
       this.$t('employeereporttimelinessrate'),this.$t('dailyreporttobereviewedstatistics'),this.$t('statisticsofpersonnelhours'),this.$t('taskgrouptimesheet'),this.$t('projectcostbaselinetable'),
       this.$t('ren-yuan-yue-du-gong-shi-biao'), this.$t('bumenchanyuqingkuang'), this.$t('ge-fen-zu-yu-jie-duan-gong-shi-biao'), '子项目工时成本表', '任务重启表', 'FTE报表','有效工时率表', '项目分类工时占比表', '分类工时明细表',
-      '员工项目进度表', '项目耗用进度表1', '项目耗用进度表2', '员工任务完成表'],
+      '员工项目进度表', '分组耗用进度表', '项目耗用进度表', '员工任务完成表'],
 
       ins: 10000,
       user: JSON.parse(sessionStorage.user),
@@ -1499,11 +1638,20 @@ export default {
       projectSortId: '', // 项目分类选中的id
       projectSortName: '', // 项目分类选中的Name
       projectSortList: [], // 项目分类
+      projectSortListTwo: [],
+      projectSortIdTwo: '',
 
       projectTaskgroupList: [], // 选择项目的任务分组
       projectGroupId: '', // 选择项目的任务分组id
 
       detailProjectId:null,//报销费用详情项目id
+
+      isbeCustomReport: { // 依斯倍定制报表数据
+        projectSchedule: [], // 员工项目进度表
+        consumptionSchedule: [], // 分组耗用进度表
+        consumptionScheduleTwo: [], // 项目耗用进度表
+        taskCompletionSheet: [], // 员工任务完成表
+      }
     };
   },
   computed: {},
@@ -1611,13 +1759,14 @@ export default {
       if(this.permissions.reportStaffTaskAccomplished) {this.ssl(26);this.defaultActive = '1-27';return} else
       {this.allWrong = false}
     },
-    rowspan(spanArr,position,spanName){
-      this.list1.forEach((item,index) => {
+    rowspan(spanArr,position,spanName,dataItem = []){
+      let newArray = dataItem.length > 0 ? dataItem : this.list1
+      newArray.forEach((item,index) => {
         if(index == 0){
           spanArr.push(1)
           position = 0
         }else {
-          if(this.list1[index][spanName] == this.list1[index-1][spanName]){
+          if(newArray[index][spanName] == newArray[index-1][spanName]){
             spanArr[position] += 1
             spanArr.push(0)
           }else {
@@ -1629,7 +1778,7 @@ export default {
     },
     objectSpanMethod({ row, column, rowIndex, columnIndex }){
       const { companyId } = this.user
-      if(columnIndex == 0){
+      if(columnIndex == 0 && this.listArr1.length > 0){
         const _row = this.listArr1[rowIndex]
         const _col = _row > 0 ? 1 : 0
         return {
@@ -1637,7 +1786,7 @@ export default {
           colspan: _col
         }
       }
-      if(columnIndex == 1){
+      if(columnIndex == 1 && this.listArr2.length > 0){
         const _row = this.listArr2[rowIndex]
         const _col = _row > 0 ? 1 : 0
         return {
@@ -1645,7 +1794,7 @@ export default {
           colspan: _col
         }
       }
-      if(columnIndex == 2 && companyId == '3092') {
+      if(columnIndex == 2 && companyId == '3092' && this.listArr3.length > 0) {
         const _row = this.listArr3[rowIndex]
         const _col = _row > 0 ? 1 : 0
         return {
@@ -1859,7 +2008,7 @@ export default {
                 this.getGroupWorktimeAll()
             },
             getList(e) {
-              let noUserList = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
+              let noUserList = [16, 17, 18, 19, 20, 21, 22, 24, 25, 26]
               if(this.ins == 15) {
                 this.rangeDatas = null
               } else if(!e){
@@ -1926,6 +2075,19 @@ export default {
                 if(this.ins == 22) {
                   this.getHoursDetailClass()
                 }
+
+                if(this.ins == 23) {
+                  this.getProjectSchedule()
+                }
+                if(this.ins == 24) {
+                  this.getConsumptionSchedule()
+                }
+                if(this.ins == 25) {
+                  this.getConsumptionScheduleTwo()
+                }
+                if(this.ins == 26) {
+                  this.getTaskCompletionSheet()
+                }
             },
       exportExcel() {
         var url = "/project";
@@ -2074,6 +2236,33 @@ export default {
           sl.categoryId = this.projectSortId
           sl.startDate = this.rangeDatas[0]
           sl.endDate = this.rangeDatas[1]
+        } else if(this.ins == 23) {
+          fName = '员工项目进度表' + '.xlsx'
+          url = "/project/exportUserProjectProcessList"
+          let dept = this.departmentIdArray[this.departmentIdArray.length - 1]
+          this.proJuctId ? sl.projectId = this.proJuctId : ''
+          this.userId ? sl.userId = this.userId : ''
+          dept ? sl.deptId = dept : ''
+        } else if(this.ins == 24) {
+          fName = '分组耗用进度表' + '.xlsx'
+          url = "/project/exportGroupExpendProcessList"
+          sl.startDate = this.rangeDatas[0]
+          sl.endDate = this.rangeDatas[1]
+        } else if(this.ins == 25) {
+          fName = '项目耗用进度表' + '.xlsx'
+          url = "/project/exportProjectExpendProcessList"
+          this.proJuctId ? sl.projectId = this.proJuctId : ''
+          this.userId ? sl.userId = this.userId : ''
+          this.projectSortIdTwo ? sl.categoryId = this.projectSortIdTwo : ''
+        } else if(this.ins == 26) {
+          fName = '员工任务完成表' + '.xlsx'
+          url = "/project/exportUserTaskProcessList"
+          let dept = this.departmentIdArray[this.departmentIdArray.length - 1]
+          this.proJuctId ? sl.projectId = this.proJuctId : ''
+          this.userId ? sl.userId = this.userId : ''
+          dept ? sl.deptId = dept : ''
+          sl.startDate = this.rangeDatas[0]
+          sl.endDate = this.rangeDatas[1]
         }
           this.http.post(url, sl,
             res => {
@@ -3168,6 +3357,19 @@ export default {
         console.log(this.projectSortName)
         this.getHoursDetailClass()
       }
+
+      if(this.ins == 23) {
+        this.getProjectSchedule()
+      }
+      if(this.ins == 24) {
+        this.getConsumptionSchedule()
+      }
+      if(this.ins == 25) {
+        this.getConsumptionScheduleTwo()
+      }
+      if(this.ins == 26) {
+        this.getTaskCompletionSheet()
+      }
     },
     // 任务重启表
     taskRestart() {
@@ -3488,6 +3690,7 @@ export default {
       let dataList = data || []
       dataList.push({id: 0, name: '未分类'})
       this.projectSortList = dataList
+      this.projectSortListTwo = dataList.filter((item) => item.name == '报价项目' || item.name == '售后工程项目' || item.name == '售后报价项目')
       this.projectSortId = dataList[0].id
       this.projectSortName = dataList[0].name
     },
@@ -3498,10 +3701,100 @@ export default {
       })
       this.projectTaskgroupList = data
     },
+    // 合并重置数据
+    resetMerge() {
+      this.listArr1 = []
+      this.listArr2 = []
+      this.listArr3 = []
+      this.listPosition1 = 0
+      this.listPosition2 = 0
+      this.listPosition3 = 0
+    },
+    // 获取员工项目进度表
+    async getProjectSchedule() {
+      let parameter = {
+        pageIndex: this.page,
+        pageSize: this.size,
+      }
+      let dept = this.departmentIdArray[this.departmentIdArray.length - 1]
+      this.proJuctId ? parameter.projectId = this.proJuctId : ''
+      this.userId ? parameter.userId = this.userId : ''
+      dept ? parameter.deptId = dept : ''
+      this.listLoading = true
+      let { data } = await this.postData('/project/userProjectProcessList', {
+        ...parameter
+      })
+      this.resetMerge()
+      this.rowspan(this.listArr1, this.listPosition1, 'corpwxDeptId', data.record)
+      this.rowspan(this.listArr2, this.listPosition2, 'corpwxUserId', data.record)
+      this.isbeCustomReport.projectSchedule = data.record
+      this.total = data.total
+      this.listLoading = false
+    },
+    // 分组耗用进度表
+    async getConsumptionSchedule() {
+      let parameter = {
+        startDate: this.rangeDatas[0],
+        endDate: this.rangeDatas[1],
+      }
+      this.listLoading = true
+      let { data } = await this.postData('/project/groupExpendProcessList', {
+        ...parameter
+      }) 
+      this.resetMerge()
+      this.rowspan(this.listArr1, this.listPosition1, 'corpwxDeptId', data.record)
+      this.isbeCustomReport.consumptionSchedule = data.record
+      this.total = data.total
+      this.listLoading = false
+    },
+    // 项目耗用进度表
+    async getConsumptionScheduleTwo() {
+      let parameter = {
+        pageIndex: this.page,
+        pageSize: this.size,
+      }
+      this.proJuctId ? parameter.projectId = this.proJuctId : ''
+      this.userId ? parameter.userId = this.userId : ''
+      this.projectSortIdTwo ? parameter.categoryId = this.projectSortIdTwo : ''
+      this.listLoading = true
+      let { data } = await this.postData('/project/projectExpendProcessList', {
+        ...parameter
+      }) 
+      this.isbeCustomReport.consumptionScheduleTwo = data.record
+      this.total = data.total
+      this.listLoading = false
+    },
+    // 员工任务完成表
+    async getTaskCompletionSheet() {
+      let parameter = {
+        pageIndex: this.page,
+        pageSize: this.size,
+        startDate: this.rangeDatas[0],
+        endDate: this.rangeDatas[1],
+      }
+      let dept = this.departmentIdArray[this.departmentIdArray.length - 1]
+      this.proJuctId ? parameter.projectId = this.proJuctId : ''
+      this.userId ? parameter.userId = this.userId : ''
+      dept ? parameter.deptId = dept : ''
+      this.listLoading = true
+      let { data } = await this.postData('/project/userTaskProcessList', {
+        ...parameter
+      })
+      this.resetMerge()
+      this.rowspan(this.listArr1, this.listPosition1, 'corpwxDeptId', data.record)
+      this.rowspan(this.listArr2, this.listPosition2, 'corpwxUserId', data.record)
+      this.isbeCustomReport.taskCompletionSheet = data.record
+      this.total = data.total
+      this.listLoading = false
+    }
   },
 };
 </script>
 <style scoped>
+.participatingEmployee {
+  display: flex;
+  flex-wrap: wrap;
+}
 .sliderSetup {
   display: flex;
   align-items: center;