Procházet zdrojové kódy

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

Lijy před 2 roky
rodič
revize
625f9a4948

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -152,6 +152,14 @@ public class ProjectController {
         return projectService.getTimeCost(startDate, endDate, userId, request);
     }
 
+    /**
+     * 获取查询者所在公司每个项目分类的工时成本
+     */
+    @RequestMapping("/getTimeCostByCategory")
+    public HttpRespMsg getTimeCostByCategory(String startDate, String endDate, String userId) {
+        return projectService.getTimeCostByCategory(startDate, endDate, userId, request);
+    }
+
     /**
      * 导出查询者所在公司每个项目的工时成本
      */
@@ -160,6 +168,14 @@ public class ProjectController {
         return projectService.exportTimeCost(startDate, endDate, projectId, userId, projectSum,type, request);
     }
 
+    /**
+     * 导出查询者所在公司每个项目分类的工时成本
+     */
+    @RequestMapping("/exportTimeCostByCategory")
+    public HttpRespMsg exportTimeCostByCategory(String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum,Integer type) {
+        return projectService.exportTimeCostByCategory(startDate, endDate, projectCategoryId, userId, projectSum,type, request);
+    }
+
     /**
      * 获取查询者所在公司每个项目的自定义数值累计
      */

+ 7 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java

@@ -1,23 +1,23 @@
 package com.management.platform.entity;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
+import java.math.BigDecimal;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import java.util.List;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.List;
-
 /**
  * <p>
  * 
  * </p>
  *
  * @author Seyason
- * @since 2022-05-23
+ * @since 2022-06-09
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -224,18 +224,14 @@ public class TimeType extends Model<TimeType> {
     @TableField("is_secret_salary")
     private Integer isSecretSalary;
 
-
     /**
      * 0-每日提醒当天漏填 1-每日提醒昨天漏填
      */
     @TableField("alert_type")
     private Integer alertType;
 
-
     @TableField(exist = false)
     private List<User> userList;
-
-
     @Override
     protected Serializable pkVal() {
         return this.companyId;

+ 6 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java

@@ -86,4 +86,10 @@ public interface ProjectMapper extends BaseMapper<Project> {
     List getBaseCostAndRealCost(Integer companyId, Integer pageStart, Integer pageSize, Integer projectId);
 
     List<Map<String, Object>> getProjectCostGroupByProject(Integer companyId, String startDate, String endDate, Integer projectId);
+
+    List<Map<String, Object>> getTimeCostByCategory(Integer companyId, String startDate, String endDate, Integer projectCategoryId, String userId);
+
+    List<Map<String, Object>> getProjectCostGroupByCategory(Integer companyId, String startDate, String endDate, Integer projectCategoryId,String userId);
+
+    List<Map<String, Object>> getProjectCostByCategory(Integer companyId, String startDate, String endDate, Integer curProjectCategoryId, String userId);
 }

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java

@@ -127,4 +127,8 @@ public interface ProjectService extends IService<Project> {
     HttpRespMsg batchAddMembToGroup(String membIdArray, String groupIds);
 
     HttpRespMsg getProjectByCustomer(Integer customerId, HttpServletRequest request);
+
+    HttpRespMsg getTimeCostByCategory(String startDate, String endDate, String userId, HttpServletRequest request);
+
+    HttpRespMsg exportTimeCostByCategory(String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum, Integer type, HttpServletRequest request);
 }

+ 192 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -821,12 +821,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     headList.add(String.valueOf(pn)+"/工时");
                     headList.add(String.valueOf(pn)+"/成本");
                 });
+                headList.add("合计/工时");
+                headList.add("合计/成本");
                 allList=new ArrayList<>();
                 allList.add(headList);
                 //统计当前所有项目所有人的时间成本投入
                 List<Map<String, Object>> membList = projectMapper.getProjectCostGroupByProject(companyId,startDate, endDate, projectId);
                 for (User user : userList) {
-                    boolean flag=false;
+                    BigDecimal moneyCost = BigDecimal.valueOf(0);
+                    double costTime = 0;
                     List<Map<String, Object>> mapList = membList.stream().filter(mb -> mb.get("creatorId").equals(user.getId())).collect(Collectors.toList());
                     List<String> membRowData=new ArrayList<>();
                     membRowData.add(user.getName());
@@ -835,11 +838,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         if(resultList.size()>0){
                             membRowData.add(String.valueOf(resultList.get(0).get("cost")));
                             membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
+                            costTime += (Double)resultList.get(0).get("cost");
+                            moneyCost = totalMoneyCost.add((BigDecimal)resultList.get(0).get("costMoney"));
                         }else{
                             membRowData.add("");
                             membRowData.add("");
                         }
                     }
+                    membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
+                    membRowData.add(moneyCost.toString());
                     if(mapList.size()>0){
                         allList.add(membRowData);
                     }
@@ -2825,6 +2832,190 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         return msg;
     }
 
+    @Override
+    public HttpRespMsg getTimeCostByCategory(String startDate, String endDate, String userId, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        try {
+            //根据系统配置的员工成本计算方式,按固定时薪还是固定月薪,分情况计算。
+            Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
+            Map<String, Object> resultMap = new HashMap<>();
+
+            TimeType timeType = timeTypeMapper.selectById(companyId);
+            if (timeType.getFixMonthcost() == 1) {
+                //每月固定月薪的方式计算,平摊到各个项目中
+                List<Map<String, Object>> list = projectMapper.getTimeCostReport(companyId, startDate+"-01", endDate+"-31", null);
+                //检查财务表中是否已经导入成本
+                List<Finance> financeList = financeMapper.selectList(new QueryWrapper<Finance>().eq("ymonth", startDate).eq("company_id", companyId));
+                List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+                //计算人员总工时
+                for (Map<String, Object> map : list) {
+                    String creatorId = (String)map.get("creatorId");
+                    double cost = (double)map.get("cost");
+                    User user = userList.stream().filter(u -> u.getId().equals(creatorId)).findFirst().get();
+                    user.setTotalHours(user.getTotalHours() + cost);
+                }
+                //计算实际时薪
+                for (User user : userList) {
+                    if (user.getTotalHours() != 0) {
+                        Optional<Finance> first = financeList.stream().filter(f -> f.getUserId().equals(user.getId())).findFirst();
+                        BigDecimal monthCost = null;
+                        if (first.isPresent()) {
+                            monthCost = first.get().getTotalCost();
+                        } else {
+                            monthCost = user.getMonthCost();
+                        }
+                        user.setCost(monthCost.divide(new BigDecimal(user.getTotalHours()), 6, BigDecimal.ROUND_HALF_UP));
+                    } else {
+                        user.setCost(new BigDecimal(0));
+                    }
+                }
+
+                BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
+                List<Map<String, Object>> retList = new ArrayList<>();
+                List<ProjectCategory> projectCategoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id", companyId).orderByAsc("id"));
+                for (ProjectCategory pc : projectCategoryList) {
+                    Map<String, Object> projectCategoryMap = new HashMap<>();
+                    projectCategoryMap.put("id", pc.getId());
+                    projectCategoryMap.put("name", pc.getName());
+                    //按照项目分类汇总
+                    double pTotalTime = 0;
+                    BigDecimal pTotalMoney = new BigDecimal(0);
+                    for (Map<String, Object> map : list) {
+                        String creatorId = (String)map.get("creatorId");
+                        String projectCategoryName =StringUtils.isEmpty( (String) map.get("categoryName"))?"未分类": (String) map.get("categoryName");
+                        if (projectCategoryName.equals(pc.getName())) {
+                            double costTime = (double)map.get("cost");
+                            pTotalTime += costTime;
+                            User curUser = userList.stream().filter(u->u.getId().equals(creatorId)).findFirst().get();
+                            //该人员的成本
+                            pTotalMoney = pTotalMoney.add(curUser.getCost().multiply(new BigDecimal(costTime)));
+                        }
+                    }
+                    if (pTotalTime > 0) {
+                        projectCategoryMap.put("cost", pTotalTime);
+                        projectCategoryMap.put("costMoney", pTotalMoney);
+                        retList.add(projectCategoryMap);
+                        totalMoneyCost = totalMoneyCost.add(pTotalMoney);
+                    }
+                }
+
+                resultMap.put("costList", retList);
+                resultMap.put("totalMoneyCost", totalMoneyCost);
+                httpRespMsg.data = resultMap;
+
+            } else {
+                List<Map<String, Object>> list = projectMapper.getTimeCostByCategory(companyId, startDate, endDate, null, userId);
+                BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
+                for (Map<String, Object> map : list) {
+                    if (!map.containsKey("cost")) {
+                        map.put("cost", 0);
+                    }
+                    if (!map.containsKey("costMoney")) {
+                        map.put("costMoney", 0);
+                    } else {
+                        totalMoneyCost = totalMoneyCost.add((BigDecimal)map.get("costMoney"));
+                    }
+                }
+
+                resultMap.put("costList", list);
+                resultMap.put("totalMoneyCost", totalMoneyCost);
+                httpRespMsg.data = resultMap;
+            }
+
+
+        } catch (NullPointerException e) {
+            httpRespMsg.setError("验证失败");
+            return httpRespMsg;
+        }
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg exportTimeCostByCategory(String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum, Integer type, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        try {
+            Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
+            Map<String, Object> resultMap = new HashMap<>();
+            List<Map<String, Object>> list = projectMapper.getTimeCostByCategory(companyId, startDate, endDate, projectCategoryId, userId);
+            BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
+            List<List<String>> allList=null ;
+            List<String> sumRow = null;
+            if(type==0){
+                List<String> headList = new ArrayList<String>();
+                headList.add("项目分类");
+                headList.add("工时(h)");
+                headList.add("成本(元)");
+                allList=new ArrayList<>();
+                allList.add(headList);
+                double totalCostTime = 0;
+                for (Map<String, Object> map : list) {
+                    if (!map.containsKey("cost")) {
+                        map.put("cost", 0);
+                    }
+                    if (!map.containsKey("costMoney")) {
+                        map.put("costMoney", 0);
+                    } else {
+                        totalMoneyCost = totalMoneyCost.add((BigDecimal)map.get("costMoney"));
+                    }
+                    totalCostTime += (Double)map.get("cost");
+                    List<String> rowData = new ArrayList<String>();
+                    rowData.add((String)map.get("categoryName"));
+                    rowData.add(((Double)map.get("cost")).toString());
+                    rowData.add(((BigDecimal)map.get("costMoney")).toString());
+                    allList.add(rowData);
+                }
+                //合计
+                sumRow=new ArrayList<>();
+                sumRow.add("合计");
+                sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
+                sumRow.add(totalMoneyCost.toString());
+                allList.add(sumRow);
+            }else{
+                List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).eq("is_active", 1));
+                List<Object> projectCategoryNameS = list.stream().map(mp -> mp.get("categoryName")).collect(Collectors.toList());
+                List<Object> projectCategorys = list.stream().map(mp -> mp.get("category")).collect(Collectors.toList());
+                List<String> headList = new ArrayList<String>();
+                headList.add("人员");
+                projectCategoryNameS.forEach(pc->{
+                    headList.add(String.valueOf(pc)+"/工时");
+                    headList.add(String.valueOf(pc)+"/成本");
+                });
+                allList=new ArrayList<>();
+                allList.add(headList);
+                //统计当前所有项目所有人的时间成本投入
+                List<Map<String, Object>> membList = projectMapper.getProjectCostGroupByCategory(companyId,startDate,endDate, projectCategoryId,userId);
+                for (User user : userList) {
+                    boolean flag=false;
+                    List<Map<String, Object>> mapList = membList.stream().filter(mb -> mb.get("creatorId").equals(user.getId())).collect(Collectors.toList());
+                    List<String> membRowData=new ArrayList<>();
+                    membRowData.add(user.getName());
+                    for(Object i:projectCategorys){
+                        List<Map<String, Object>> resultList = mapList.stream().filter(mp -> mp.get("category").equals(i)).collect(Collectors.toList());
+                        if(resultList.size()>0){
+                            membRowData.add(String.valueOf(resultList.get(0).get("cost")));
+                            membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
+                        }else{
+                            membRowData.add("");
+                            membRowData.add("");
+                        }
+                    }
+                    if(mapList.size()>0){
+                        allList.add(membRowData);
+                    }
+                }
+            }
+            //生成excel文件导出
+            String fileName = "项目成本工时统计_"+System.currentTimeMillis();
+            String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
+            httpRespMsg.data = resp;
+        } catch (NullPointerException e) {
+            e.printStackTrace();
+            httpRespMsg.setError("验证失败");
+            return httpRespMsg;
+        }
+        return httpRespMsg;
+    }
+
 
     private List<Department> getSubDepts(Department dp, List<Department> list) {
         List<Department> collect = list.stream().filter(l -> dp.getDepartmentId().equals(l.getSuperiorId())).collect(Collectors.toList());;

+ 13 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -2632,7 +2632,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 titles.add("审核时间");
             }
             titles.add("工作事项");
-
+            if(stateKey==1){
+                titles.add("审核状态");
+            }
             //创建表头
             HSSFRow headRow = sheet.createRow(0);
             //设置列宽 setColumnWidth的第二个参数要乘以256 这个参数的单位是1/256个字符宽度
@@ -2836,6 +2838,16 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 //                    titles.add("审核时间");
                 }
                 row.createCell(index).setCellValue((String) map.get("content"));
+                index++;
+                if(stateKey==1){
+                    Integer state = (Integer) map.get("state");
+                    switch (state){
+                        case 0:row.createCell(index).setCellValue("待审核");
+                            break;
+                        case 1:row.createCell(index).setCellValue("已通过");
+                            break;
+                    }
+                }
                 rowNum++;
             }
             //生成Excel文件

+ 66 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -104,7 +104,7 @@
             WHERE user_id = #{userId}
         )
         or (is_public = 1 and company_id = #{companyId})
-        ORDER BY is_public DESC, id DESC
+        ORDER BY is_public DESC, id ASC
     </select>
     <!--获取查询者所在公司每个项目的工时成本-->
     <select id="getTimeCost" resultType="java.util.Map">
@@ -128,6 +128,28 @@
     </select>
 
 
+    <!--获取查询者所在公司每个项目分类的工时成本-->
+    <select id="getTimeCostByCategory" resultType="java.util.Map">
+        SELECT  SUM(b.working_time) AS cost, SUM(b.cost) AS costMoney,IFNULL(a.category_name,'未分类')as categoryName,IFNULL(a.category,0) as category
+        FROM project AS a
+        LEFT JOIN report AS b ON b.project_id = a.id
+        JOIN user AS c ON b.creator_id = c.id
+        WHERE a.company_id = #{companyId}
+        <if test="projectCategoryId != null">
+            AND a.category = #{projectCategoryId}
+        </if>
+        <if test="userId != null">
+            AND b.creator_id = #{userId}
+        </if>
+        <if test="startDate != null and endDate != null">
+            AND b.create_date between #{startDate} and #{endDate}
+        </if>
+        AND b.state = 1
+        GROUP BY a.category
+        ORDER BY a.category ASC
+    </select>
+
+
 
 
 
@@ -200,6 +222,27 @@
         ORDER BY b.id ASC, a.dept_id ASC
     </select>
 
+    <!--获取某个项目分类每个人分别需要的工时-->
+    <select id="getProjectCostByCategory" resultType="java.util.Map">
+        SELECT b.id as creatorId,ifnull(c.category_name,'未分类') as categoryName,ifnull(c.category,0) as category, b.name,a.dept_id as deptId, IFNULL(department.department_name, '未分配') as departmentName, SUM(a.working_time) AS cost, SUM(a.cost) AS costMoney
+        FROM report AS a
+        JOIN user AS b ON a.creator_id = b.id
+        left join department on department.department_id = a.dept_id
+        left join project c on c.id=a.project_id
+        WHERE a.company_id=#{companyId} and a.state = 1
+        <if test="curProjectCategoryId != null">
+            and c.category = #{curProjectCategoryId}
+        </if>
+        <if test="startDate != null and endDate != null">
+            AND a.create_date between #{startDate} and #{endDate}
+        </if>
+        <if test="userId != null">
+            AND a.creator_id = #{userId}
+        </if>
+        GROUP BY c.category, a.dept_id
+        ORDER BY c.category ASC, a.dept_id ASC
+    </select>
+
     <!--获取个人每个项目分别需要的工时-->
     <select id="getProjectCostGroupByProject" resultType="java.util.Map">
         SELECT b.id as creatorId,a.creator_id as creatorId,a.project_id as projectId, b.name,a.dept_id as deptId, IFNULL(department.department_name, '未分配') as departmentName, SUM(a.working_time) AS cost, SUM(a.cost) AS costMoney
@@ -218,6 +261,28 @@
     </select>
 
 
+    <!--获取个人每个项目分类分别需要的工时-->
+    <select id="getProjectCostGroupByCategory" resultType="java.util.Map">
+        SELECT b.id as creatorId,a.creator_id as creatorId,ifnull(c.category_name,'未分类') as categoryName,ifnull(c.category,0) as category, b.name,a.dept_id as deptId, IFNULL(department.department_name, '未分配') as departmentName, SUM(a.working_time) AS cost, SUM(a.cost) AS costMoney
+        FROM report AS a
+        JOIN user AS b ON a.creator_id = b.id
+        left join department on department.department_id = a.dept_id
+        left join project c on c.id=a.project_id
+        WHERE a.company_id=#{companyId} and a.state = 1
+        <if test="projectCategoryId != null">
+            and c.category = #{projectCategoryId}
+        </if>
+        <if test="startDate != null and endDate != null">
+            AND a.create_date between #{startDate} and #{endDate}
+        </if>
+        <if test="userId != null">
+            AND a.creator_id = #{userId}
+        </if>
+        GROUP BY b.id, a.dept_id,c.category
+        ORDER BY b.id ASC, a.dept_id ASC
+    </select>
+
+
     <!-- 获取人员在日报填写的自定义数值 -->
     <select id="getProjectCusDataSumItem" resultType="java.util.Map">
         SELECT b.id as creatorId,

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeTypeMapper.xml


binární
fhKeeper/formulahousekeeper/timesheet/src/assets/image/hanglie_corp.png


+ 73 - 19
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -30,6 +30,7 @@
 
             <el-radio-group v-model="radio" @change="getEchart" style="margin-left:10px;">
                 <el-radio-button label="项目"></el-radio-button>
+                <el-radio-button label="项目分类"></el-radio-button>
                 <el-radio-button label="部门"></el-radio-button>
                 <el-radio-button label="人员"></el-radio-button>
                 <el-radio-button :label="namess" v-if="jichu.customDegreeActive == 1"></el-radio-button>
@@ -59,7 +60,7 @@
         <!--导出报表条件选择 -->
         <el-dialog title="工时报表导出" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
             <el-form ref="form3" :model="exportParam" >
-                <el-form-item prop="projectId" label="选择项目" v-if="radio != '人员'">
+                <el-form-item prop="projectId" label="选择项目" v-if="radio != '人员' && radio != '项目分类'">
                     <el-select v-model="exportParam.projectId" placeholder="全部项目"  clearable style="width:350px;" filterable="true">
                         <el-option v-for="item in projectList"  :key="item.id" :label="item.projectName + item.projectCode" :value="item.id">
                             <span style="float: left;color: #8492a6;">{{ item.projectCode }}</span>
@@ -67,6 +68,13 @@
                         </el-option>
                     </el-select>
                 </el-form-item>
+
+                <el-form-item prop="projectCategoryId" label="项目分类" v-if="radio == '项目分类'">
+                    <el-select v-model="exportParam.projectCategoryId" placeholder="全部项目分类"  clearable style="width:350px;" filterable="true">
+                        <el-option v-for="item in categoryList"  :key="item.id" :label="item.name" :value="item.id">
+                        </el-option>
+                    </el-select>
+                </el-form-item>
                 <el-form-item prop="userIds" label="选择人员" v-if="radio == '人员'">
                     <el-select v-model="exportParam.userIds" placeholder="全部人员" multiple="true"  clearable style="width:350px;" filterable="true">
                         <el-option v-for="item in hasReportUserList"  :key="item.id" :label="item.name" :value="item.id"></el-option>
@@ -93,28 +101,29 @@
                     ></el-date-picker>
                 </el-form-item>
                 
-                <el-form-item label="选择人员" v-if="radio == '项目' || radio == '部门'">
+                <el-form-item label="选择人员" v-if="radio == '项目' || radio == '部门' || radio == '项目分类'">
                     <el-select v-model="exportParam.userId"  placeholder="全部人员" style="width: 350px" filterable="true" clearable="true">
                         <span v-for="(item, index) in users" :key="index">
                         <el-option :label="item.name" :value="item.id"></el-option>
                         </span> 
                     </el-select>
                 </el-form-item>
-                <el-form-item prop="type" label="选择样式" v-if="radio == '项目' || radio == '部门'">
+                <el-form-item prop="type" label="选择样式" v-if="radio == '项目' || radio == '部门' || radio == '项目分类'">
                     <el-select v-model="exportParam.type" placeholder="选择样式" style="width:350px;" >
-                        <el-option label="项目在行上" value="0"></el-option>
-                        <el-option label="项目在列上" value="1"></el-option>
+                        <el-option :label="radio == '项目分类' ? '项目分类在行上' : '项目在行上'" value="0"></el-option>
+                        <el-option :label="radio == '项目分类' ? '项目分类在列上' : '项目在列上'" value="1"></el-option>
                     </el-select>
                     <div class="prompt">
                         <el-popover placement="top" width="1200" trigger="hover">
-                            <img src="../../assets/image/hanglie.png" alt="" width="100%">
+                            <img src="../../assets/image/hanglie.png" alt="" width="100%" v-if="this.radio != '项目分类'">
+                            <img src="../../assets/image/hanglie_corp.png" alt="" width="100%" v-else>
                             <i class="el-icon-question" slot="reference" />
                         </el-popover>
                     </div>
                 </el-form-item>
-                <el-form-item v-if="(radio == '项目' || radio == '部门') && exportParam.type == '0'">
+                <!-- <el-form-item v-if="(radio == '项目' || radio == '部门' || radio == '项目分类') && exportParam.type == '0'">
                     <el-checkbox v-model="exportParam.projectSum" >含单个项目数据汇总</el-checkbox>
-                </el-form-item>
+                </el-form-item> -->
             </el-form>
             <div slot="footer" class="dialog-footer">
                 <el-button type="primary" @click="exportProjectData" style="width:100%;" >导出</el-button>
@@ -135,6 +144,7 @@
                 parentDeptId:null,
                 hasReportUserList:[],
                 projectList:[],
+                categoryList: [],
                 exportParam:{projectId:null,dateRange:[],userId: null,type: '0'},
                 exportDialog:false,
                 dateRange:[],
@@ -255,21 +265,31 @@
                         param.userIds = ids;
                      }
                  } 
+                if(this.radio == '项目分类'){
+                    fileName = '项目分类工时成本统计.xls';
+                    url = '/project/exportTimeCostByCategory'
+                    if(this.exportParam.projectCategoryId){
+                        param.projectCategoryId = this.exportParam.projectCategoryId
+                    }
+                }
                 
-                if (this.exportParam.projectId) {
+                if (this.exportParam.projectId && this.radio != '人员' && this.radio != '项目分类') {
                     param.projectId = this.exportParam.projectId;
                 }
                 if (this.exportParam.userId) {
-                    if(this.radio == '项目' || this.radio == '部门' || this.radio == '人员'){
+                    if(this.radio == '项目' || this.radio == '部门' || this.radio == '人员' || this.radio == '项目分类'){
                         param.userId = this.exportParam.userId;
                     }
                 }
-                if (this.exportParam.projectSum != null) {
-                    if(this.radio == '项目' || this.radio == '部门'){
-                        param.projectSum = this.exportParam.projectSum;
-                    }
-                }
-                param.type = this.exportParam.type
+                // if (this.exportParam.type == 1) {
+                //     this.exportParam.projectSum = null
+                // }
+                // if (this.exportParam.projectSum != null) {
+                //     if(this.radio == '项目' || this.radio == '部门' || this.radio == '项目分类'){
+                //         param.projectSum = this.exportParam.projectSum;
+                //     }
+                // }
+                param.type = this.exportParam.type*1
                 this.http.post(url, param,
                     res => {
                         this.listLoading = false;
@@ -659,6 +679,27 @@
                     that.jieliu()
                 // },100);
                 // this.jieliu()
+                if(this.radio == '项目分类'){
+                    this.getCategoryList()
+                }
+            },
+            getCategoryList(){
+                this.http.post('/project-category/list',{},
+                res => {
+                    if(res.code == 'ok'){
+                        this.categoryList = res.data
+                    }else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        })
+                    }
+                },err => {
+                    this.$message({
+                        message: err,
+                        type: 'error'
+                    })
+                })
             },
             backToParentDept() {
                 if (this.radio == '部门') {
@@ -686,6 +727,10 @@
                 var url = '';
                 if (this.radio=='项目') {
                     url = this.port.project.listCost;
+                } else if (this.radio=='项目分类') {
+                    url = '/project/getTimeCostByCategory';
+                    // param.parentDeptId = this.parentDeptId;
+                    // param.userId = this.user.id
                 } else if (this.radio=='部门') {
                     url = this.port.project.depCost;
                     param.parentDeptId = this.parentDeptId;
@@ -713,12 +758,12 @@
                         var list
                         var totalMoneyCost;
                         var totalHours = 0.0;
-                        if(this.radio == '项目' || this.radio=='部门') {
+                        if(this.radio == '项目' || this.radio == '项目分类' || this.radio=='部门') {
                             list = res.data.costList
                             totalMoneyCost = ((this.radio=='项目')?res.data.totalMoneyCost:res.data.totalCostMoney);
                             for(var i in list) {
                                 if(this.radio=='项目') {
-                                    xList.push(this.radio=='项目'?list[i].project:list[i].name);
+                                    xList.push(list[i].project);
                                     yList.push({
                                         "value": this.yAxisValue==0?list[i].costMoney.toFixed(2) || list[i].costMoney:list[i].cost.toFixed(1),
                                         "id": list[i].id || i,
@@ -726,7 +771,7 @@
                                         "money":list[i].costMoney.toFixed(2)
                                     });
                                     totalHours += parseFloat(list[i].cost);
-                                } else {
+                                } else if(this.radio == '部门'){
                                     xList.push(list[i].departmentName);
                                     yList.push({
                                         "value": this.yAxisValue==0? list[i].costMoney.toFixed(2) || list[i].costMoney: list[i].costTime.toFixed(1),
@@ -736,6 +781,15 @@
                                         "money":list[i].costMoney.toFixed(2)
                                     });
                                     totalHours += parseFloat(list[i].costTime);
+                                }else {
+                                    xList.push(list[i].categoryName);
+                                    yList.push({
+                                        "value": this.yAxisValue==0?list[i].costMoney.toFixed(2) || list[i].costMoney:list[i].cost.toFixed(1),
+                                        "id": list[i].id || i,
+                                        "cost": list[i].cost,
+                                        "money":list[i].costMoney.toFixed(2)
+                                    });
+                                    totalHours += parseFloat(list[i].cost);
                                 }
                             }
                         } else {