浏览代码

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

Guo1B0 1 年之前
父节点
当前提交
eba0b9534c

+ 24 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/GroupBudgetReviewController.java

@@ -2,6 +2,7 @@ package com.management.platform.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.ProjectMapper;
 import com.management.platform.mapper.TaskGroupMapper;
@@ -10,6 +11,8 @@ import com.management.platform.mapper.WxCorpInfoMapper;
 import com.management.platform.service.ExcelExportService;
 import com.management.platform.service.GroupBudgetReviewService;
 import com.management.platform.service.TaskService;
+import com.management.platform.service.WxCorpInfoService;
+import com.management.platform.service.impl.WxCorpInfoServiceImpl;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.StringUtils;
@@ -56,6 +59,8 @@ public class GroupBudgetReviewController {
     private WxCorpInfoMapper wxCorpInfoMapper;
     @Resource
     private ExcelExportService excelExportService;
+    @Resource
+    private WxCorpInfoService wxCorpInfoService;
 
     @RequestMapping("/add")
     public HttpRespMsg add(Integer groupId,Integer oldManDay,Integer changeManDay,Integer nowManDay,String remark){
@@ -95,6 +100,7 @@ public class GroupBudgetReviewController {
     public HttpRespMsg check(Integer id,Integer checkType,String rejectReason){
         HttpRespMsg httpRespMsg=new HttpRespMsg();
         GroupBudgetReview groupBudgetReview=groupBudgetReviewService.getById(id);
+        User checker = userMapper.selectById(request.getHeader("token"));
         if(rejectReason!=null&&!StringUtils.isEmpty(rejectReason)){
             groupBudgetReview.setRejectReason(rejectReason);
         }
@@ -119,6 +125,24 @@ public class GroupBudgetReviewController {
             project.setManDay(day);
             projectMapper.updateById(project);
         }
+        if(checkType!=0){
+            User user = userMapper.selectById(groupBudgetReview.getCreatorId());
+            StringBuilder sb=new StringBuilder();
+            sb.append("$userName="+checker.getCorpwxUserid()+"$");
+            if(checkType==1){
+                sb.append("通过了");
+                sb.append("您预估工时修改申请");
+            }else{
+                sb.append("驳回了");
+                sb.append("您预估工时修改申请");
+                sb.append(",驳回理由:"+groupBudgetReview.getRejectReason());
+            }
+            String corpwxUserid = user.getCorpwxUserid();
+            if (corpwxUserid != null) {
+                WxCorpInfo info = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",checker.getCompanyId()));
+                wxCorpInfoService.sendWXCorpMsg(info, corpwxUserid,sb.toString(), "groupBudget", WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_DENY);
+            }
+        }
         return  httpRespMsg;
     }
 

+ 99 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskController.java

@@ -15,6 +15,7 @@ import com.management.platform.service.*;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
 import org.assertj.core.util.Lists;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -98,6 +99,10 @@ public class TaskController {
     private TaskPersonLiableMapper taskPersonLiableMapper;
     @Resource
     private SapProjectServiceService sapProjectServiceService;
+    @Resource
+    private ExcelExportService excelExportService;
+    @Value(value = "${upload.path}")
+    private String path;
 
     @RequestMapping("/save")
     @Transactional
@@ -1045,7 +1050,11 @@ public class TaskController {
             List<Department> departmentList=departmentService.list(new QueryWrapper<Department>().eq("company_id",companyId));
             branchDepartment= getBranchDepartment(deptId, departmentList);
         }
-        List<Task> list = taskMapper.getTaskWithProjectName(queryWrapper, (pageIndex-1)*pageSize, pageSize,companyId,branchDepartment);
+        Integer pageStart=null;
+        if(pageIndex!=null&&pageSize!=null){
+            pageStart = (pageIndex - 1) * pageSize;
+        }
+        List<Task> list = taskMapper.getTaskWithProjectName(queryWrapper,pageStart, pageSize,companyId,branchDepartment);
         List<Integer> collect = list.stream().map(l -> l.getId()).distinct().collect(Collectors.toList());
         collect.add(-1);
         List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().in("task_id", collect));
@@ -1162,5 +1171,94 @@ public class TaskController {
     }
 
 
+    @RequestMapping("exportTaskList")
+    public HttpRespMsg exportTaskList(Integer status, Integer viewId,Integer type,Integer dateType,String startDate,String endDate,Integer deptId,Integer projectId,Integer groupId,String targetUserId){
+        HttpRespMsg msg=new HttpRespMsg();
+        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+        DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        List<Department> departmentList = departmentService.list(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
+        WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
+        HttpRespMsg respMsg = listByPage(status, viewId, null, null, type, dateType, startDate, endDate, deptId, projectId, groupId, targetUserId);
+        Map<String, Object> msgData = (Map<String, Object>) respMsg.getData();
+        List<Task> taskList = (List<Task>) msgData.get("records");
+        List<Integer> projectIds = taskList.stream().map(Task::getProjectId).distinct().collect(Collectors.toList());
+        projectIds.add(-1);
+        List<Project> projectList = projectService.list(new LambdaQueryWrapper<Project>().in(Project::getId, projectIds));
+        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("截止时间");
+        boolean anyMatch = projectList.stream().anyMatch(p -> p.getDeptId() != null && !StringUtils.isEmpty(p.getDeptId()));
+        if(anyMatch){
+            titleList.add("所属部门");
+        }
+        dataList.add(titleList);
+        int no=0;
+        for (Task task : taskList) {
+            no++;
+            List<String> item=new ArrayList<>();
+            item.add(no+"");
+            Optional<Project> first = projectList.stream().filter(p -> p.getId().equals(task.getProjectId())).findFirst();
+            if(first.isPresent()){
+                item.add(first.get().getProjectName());
+            }else {
+                item.add("");
+            }
+            item.add(task.getStagesName());
+            switch (task.getTaskLevel()){
+                case 0:item.add("一般");
+                    break;
+                case 1:item.add("重要");
+                    break;
+                case 2:item.add("紧急");
+                    break;
+            }
+            item.add(task.getName());
+            List<TaskExecutor> executorList = task.getExecutorList();
+            String executorString = executorList.stream().map(t->{
+                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                    return "$userName="+t.getExecutorName()+"$";
+                }else {
+                    return t.getExecutorName();
+                }
+            }).collect(Collectors.joining(","));
+            item.add(executorString);
+            item.add(task.getStartDate()==null?"":df.format(task.getStartDate()));
+            item.add(task.getEndDate()==null?"":df.format(task.getEndDate()));
+            if(anyMatch){
+                if(first.isPresent()){
+                    Project project = first.get();
+                    Optional<Department> department = departmentList.stream().filter(d -> d.getDepartmentId().equals(project.getDeptId())).findFirst();
+                    if(department.isPresent()){
+                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                            item.add("$departmentName="+department.get().getCorpwxDeptid()+"$");
+                        }else {
+                            item.add(department.get().getDepartmentName());
+                        }
+                    }else {
+                        item.add("");
+                    }
+                }else {
+                    item.add("");
+                }
+            }
+            dataList.add(item);
+        }
+        String fileName = "待办任务导出_"+System.currentTimeMillis();
+        try {
+            return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return msg;
+    }
+
+
 }
 

+ 28 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -11736,6 +11736,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 saveOrUpdate(project);
                 //处理项目下任务 ----> 工时管家生成任务分组
                 List<ProjectTask> projectTasks = item.getProjectTasks();
+                //todo:SAP已同步项目下 删除的任务分组需要删除
+                List<Integer> needRemoveTaskGroupIds=new ArrayList<>();
+                //当前项目下本次获取到的分组数据
+                List<TaskGroup> nowAddTaskGroupList=new ArrayList<>();
                 if(projectTasks!=null&&projectTasks.size()>0){
                     //找到任务列表中 作为项目出现的第一级列表
                     Optional<ProjectTask> targetProject = projectTasks.stream().filter(p -> p.getProjectElementID().equals(project.getProjectCode())).findFirst();
@@ -11762,6 +11766,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                     taskGroup.setId(one.getId());
                                 }
                                 taskGroupService.saveOrUpdate(taskGroup);
+                                nowAddTaskGroupList.add(taskGroup);
                                 Stages stage = new Stages();
                                 stage.setSequence(1);
                                 stage.setProjectId(project.getId());
@@ -11796,6 +11801,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                     taskGroup.setId(one.getId());
                                 }
                                 taskGroupService.saveOrUpdate(taskGroup);
+                                nowAddTaskGroupList.add(taskGroup);
                                 Map<String,Object> map=new HashMap<>();
                                 map.put("groupId",taskGroup.getId());
                                 map.put("UUID",group.getUUID());
@@ -11889,6 +11895,28 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         taskService.saveOrUpdateBatch(tasks);
                     }
                 }
+                //已经同步过的分组数据
+                List<TaskGroup> hadSyncTaskGroups = taskGroupMapper.selectList(new LambdaQueryWrapper<TaskGroup>().eq(TaskGroup::getProjectId, project.getId()));
+                hadSyncTaskGroups.forEach(h->{
+                    if(h.getTaskGroupCode()!=null){
+                        boolean anyMatch = nowAddTaskGroupList.stream().anyMatch(m ->m.getTaskGroupCode()!=null&&m.getTaskGroupCode().equals(h.getTaskGroupCode()));
+                        if(!anyMatch){
+                            needRemoveTaskGroupIds.add(h.getId());
+                        }
+                    }
+                });
+                //删除SAP已删除的任务分组 已存在填报数据的跳过
+                if(needRemoveTaskGroupIds.size()>0){
+                    for (Integer needRemoveTaskGroupId : needRemoveTaskGroupIds) {
+                        Integer count = reportMapper.selectCount(new LambdaQueryWrapper<Report>().eq(Report::getGroupId, needRemoveTaskGroupId));
+                        if(count>0){
+                            continue;
+                        }
+                        taskService.remove(new LambdaQueryWrapper<Task>().eq(Task::getGroupId,needRemoveTaskGroupId));
+                        stagesService.remove(new LambdaQueryWrapper<Stages>().eq(Stages::getGroupId,needRemoveTaskGroupId));
+                        taskGroupService.removeById(needRemoveTaskGroupId);
+                    }
+                }
             }
         }
         //处理项目下服务数据 ------->工时管家相关项目下任务分组下创建任务数据

+ 4 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.io.*;
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
@@ -178,10 +179,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 row.createCell(0).setCellValue(rowNum);
                 row.createCell(1).setCellValue((String) map.get("name"));
                 row.createCell(2).setCellValue((Double) map.get("workHours"));
-                row.createCell(3).setCellValue((Integer) map.get("planHours"));
+                row.createCell(3).setCellValue(new BigDecimal(String.valueOf(map.get("planHours"))).doubleValue());
                 HSSFCell percentCell = row.createCell(4);
-                if ((Integer) map.get("planHours") != null) {
-                    int percent = (int)(double) map.get("workHours")*100/(Integer) map.get("planHours");
+                if (map.get("planHours") != null) {
+                    int percent = (int)(double) map.get("workHours")*100/new BigDecimal(String.valueOf(map.get("planHours"))).intValue();
                     percent = (percent - 100);
                     String sign = "";
                     if (percent > 0) {

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

@@ -310,6 +310,10 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     //费用报销
                     title = "工时管家:任务到期通知";
                 }
+                else if ("groupBudget".equals(pageRouter)) {
+                    //预估工时审核
+                    title = "预估工时审核通知";
+                }
             }
             cardJson.put("title", title);
             cardJson.put("description", msg);

+ 2 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskMapper.xml

@@ -150,11 +150,10 @@
 
     <!-- 查询任务实际工时和计划工时对比,仅查询有实际工时的数据 -->
     <select id="getTaskTimeCompare" resultType="java.util.Map">
-        SELECT t.id , t.name AS name ,IFNULL(SUM(te.plan_hours),0) AS planHours, IFNULL(SUM(r.`working_time`),0) AS workHours FROM
+        SELECT t.id , t.name AS name ,IFNULL(SUM(te.plan_hours),0) AS planHours, IFNULL((SELECT SUM(r.`working_time`) FROM report r WHERE r.task_id=t.id AND r.state=1),0) AS workHours FROM
         task_executor te
-        LEFT JOIN USER u ON te.executor_id=u.id
+        LEFT JOIN user u ON te.executor_id=u.id
         LEFT JOIN task t ON t.id=te.task_id
-        LEFT JOIN report r ON r.task_id=t.id AND r.state=1
         LEFT JOIN project p ON p.id=t.project_id
         WHERE p.id= #{projectId}
         <if test="deptId!=null and deptId">

+ 150 - 97
fhKeeper/formulahousekeeper/timesheet/src/views/project/summary.vue

@@ -99,6 +99,17 @@
                         </div>
                         <el-divider></el-divider>
                         <div id="taskTimeComparePanel" :style="`height: ${echartsHeight}px;width:1100px`"></div>
+                        <div class="dataPaging">
+                            <el-pagination
+                                @size-change="handleSizeChange"
+                                @current-change="handleCurrentChange"
+                                :current-page="dataPagingPage"
+                                :page-sizes="[5, 10, 15, 20, 30, 40]"
+                                :page-size="dataPagingSize"
+                                layout="total, sizes, prev, pager, next"
+                                :total="dataPagingTotal">
+                            </el-pagination>
+                        </div>
                     </div>
                 </el-col>
             </el-row>
@@ -158,6 +169,11 @@
     align-items: center;
     min-width: 400px;
 }
+.dataPaging {
+    width: 100%;
+    display: flex;
+    justify-content: flex-end;
+}
 </style>
 <script>
 import vueCascader from "@/components/cascader.vue"
@@ -192,10 +208,137 @@ export default {
             departmentOption: [], // 部门
             departmentOptionValue: '',
             echartsHeight: 500,
-            departmentOptionLoading: false
+            departmentOptionLoading: false,
+            dataPagingPage: 1,
+            dataPagingSize: 10,
+            dataPagingTotal: 0,
+            dataPagingData: [],
         };
     },
     methods: {
+        handleSizeChange(val) {
+            this.dataPagingPage = 1
+            this.dataPagingSize = val
+            this.setTaskTimeCompare()
+        },
+        handleCurrentChange(val) {
+            this.dataPagingPage = val
+            this.setTaskTimeCompare()
+        },
+        setTaskTimeCompare() {
+            this.departmentOptionLoading = true
+            let newList = this.dataPagingData
+            let list = newList.slice((this.dataPagingPage - 1) * this.dataPagingSize, this.dataPagingPage * this.dataPagingSize)
+            this.taskTimeComparePublic(list)
+        },
+        taskTimeComparePublic(list) {
+            var _this = this;
+            var xList1 = [], xList2 = []
+            if(list.length > 10) {
+                this.echartsHeight = list.length * 60
+            } else {
+                this.echartsHeight = 500
+            }
+
+            var xList1 = [], xList2 = []
+            if(list.length > 10) {
+                this.echartsHeight = list.length * 60
+            } else {
+                this.echartsHeight = 500
+            }
+            
+            setTimeout(() => {
+                var taskNames = [];
+                for (var i in list) {
+                    xList1.push({
+                        "value": list[i].workHours,
+                        "id": list[i].id,
+                        "fullName": list[i].name,
+                    });
+                    xList2.push({
+                        "value": list[i].planHours,
+                        "id": list[i].id,
+                        "fullName": list[i].name,
+                    });
+                    console.log(list[i], list[i].name)
+                    taskNames.push(list[i].name.length > 12 ? list[i].name.substring(0, 12) + '..' : list[i].name);
+                }
+                var myChart = echarts.init(document.getElementById("taskTimeComparePanel"));
+                _this.compareChart = myChart;
+                var option = {
+                    // 全局调色盘。
+                    color: ["#409EFF", "#71C671"],
+                    title: {
+                        show: list.length == 0,
+                        textStyle: {
+                            color: "#666666",
+                            fontSize: 18,
+                            fontWeight: 'normal',
+                        },
+                        text: list.length == 0 ? this.$t('nodata') : this.$t('gong-shi-dui-bi'),
+                        left: "center",
+                        top: "center"
+                    },
+                    toolbox: {
+                        right: 25,
+                        show: true,
+                        feature: {
+                            saveAsImage: {
+                                show: true
+                            },
+                            restore: {
+                                show: true
+                            },
+                            magicType: {
+                                type: ['line', 'bar']
+                            },
+                        }
+                    },
+                    legend: {
+                        data: [this.$t('shi-ji-gong-shi'), this.$t('plantime')]
+                    },
+                    grid: {
+                        left: '3%',
+                        right: '4%',
+                        bottom: '3%',
+                        containLabel: true
+                    },
+                    tooltip: {
+                        trigger: 'axis',
+                        axisPointer: {
+                            type: 'shadow'
+                        },
+                    },
+                    xAxis: {
+                        type: 'value',
+                        boundaryGap: [0, 1],
+                        axisLabel: {
+                            formatter: '{value} ' + this.$t('time.hour')
+                        }
+                    },
+                    yAxis: [{
+                        type: 'category',
+                        data: taskNames
+                    }],
+                    series: [{
+                        name: this.$t('shi-ji-gong-shi'),
+                        type: 'bar',
+                        data: xList1
+                    },
+                    {
+                        name: this.$t('plantime'),
+                        type: 'bar',
+                        data: xList2
+                    }]
+                };
+                
+                myChart.setOption(option, { notMerge: true });
+                this.$nextTick(() => {
+                    myChart.resize(); // 在DOM更新后,调用resize方法更新图表大小
+                });
+                this.departmentOptionLoading = false
+            }, 1000);
+        },
         vueCasader(obj) {
             if(obj.distinction == '1') {
                 if(obj.id != '') {
@@ -278,103 +421,13 @@ export default {
             this.http.post('/task/getTaskTimeCompare', { ...obj },
                 res => {
                     if (res.code == "ok") {
-                        var xList1 = [], xList2 = [], list = res.data.reverse();
-                        if(list.length > 10) {
-                            this.echartsHeight = list.length * 60
-                        } else {
-                            this.echartsHeight = 500
-                        }
-                        setTimeout(() => {
-                            var taskNames = [];
-                            for (var i in list) {
-                                xList1.push({
-                                    "value": list[i].workHours,
-                                    "id": list[i].id,
-                                    "fullName": list[i].name,
-                                });
-                                xList2.push({
-                                    "value": list[i].planHours,
-                                    "id": list[i].id,
-                                    "fullName": list[i].name,
-                                });
-                                taskNames.push(list[i].name.length > 12 ? list[i].name.substring(0, 12) + '..' : list[i].name);
-                            }
-                            var myChart = echarts.init(document.getElementById("taskTimeComparePanel"));
-                            _this.compareChart = myChart;
-                            var option = {
-                                // 全局调色盘。
-                                color: ["#409EFF", "#71C671"],
-                                title: {
-                                    show: list.length == 0,
-                                    textStyle: {
-                                        color: "#666666",
-                                        fontSize: 18,
-                                        fontWeight: 'normal',
-                                    },
-                                    text: list.length == 0 ? this.$t('nodata') : this.$t('gong-shi-dui-bi'),
-                                    left: "center",
-                                    top: "center"
-                                },
-                                toolbox: {
-                                    right: 25,
-                                    show: true,
-                                    feature: {
-                                        saveAsImage: {
-                                            show: true
-                                        },
-                                        restore: {
-                                            show: true
-                                        },
-                                        magicType: {
-                                            type: ['line', 'bar']
-                                        },
-                                    }
-                                },
-                                legend: {
-                                    data: [this.$t('shi-ji-gong-shi'), this.$t('plantime')]
-                                },
-                                grid: {
-                                    left: '3%',
-                                    right: '4%',
-                                    bottom: '3%',
-                                    containLabel: true
-                                },
-                                tooltip: {
-                                    trigger: 'axis',
-                                    axisPointer: {
-                                        type: 'shadow'
-                                    },
-                                },
-                                xAxis: {
-                                    type: 'value',
-                                    boundaryGap: [0, 1],
-                                    axisLabel: {
-                                        formatter: '{value} ' + this.$t('time.hour')
-                                    }
-                                },
-                                yAxis: [{
-                                    type: 'category',
-                                    data: taskNames
-                                }],
-                                series: [{
-                                    name: this.$t('shi-ji-gong-shi'),
-                                    type: 'bar',
-                                    data: xList1
-                                },
-                                {
-                                    name: this.$t('plantime'),
-                                    type: 'bar',
-                                    data: xList2
-                                }]
-                            };
-                            
-                            myChart.setOption(option, { notMerge: true });
-                            this.$nextTick(() => {
-                                myChart.resize(); // 在DOM更新后,调用resize方法更新图表大小
-                            });
-                            this.departmentOptionLoading = false
-                        }, 1000);
+                        let newList = res.data.reverse()
+                        this.dataPagingData = newList
+                        this.dataPagingTotal = newList.length
+
+                        let list = newList.slice((this.dataPagingPage - 1) * this.dataPagingSize, this.dataPagingPage * this.dataPagingSize)
                         
+                        this.taskTimeComparePublic(list)
                     } else {
                         this.departmentOptionLoading = false
                         this.$message({

+ 52 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/task/list.vue

@@ -82,7 +82,7 @@
                 </el-form-item>
                 <el-form-item style="float: right;" v-if="user.companyId != '3092'">
                      <el-link type="primary" icon="el-icon-circle-plus-outline" :underline="false" @click="addTask()">新建任务</el-link>
-                     <el-link type="primary" :underline="false" @click="exportTask()" style="margin-left: 20px;" v-loading="exportTaskLoading">导出</el-link>
+                     <el-link type="primary" :underline="false" @click="exportTaskList()" style="margin-left: 20px;" v-loading="exportTaskLoading">导出</el-link>
                 </el-form-item>
             </el-form>
         </el-col>
@@ -784,6 +784,57 @@ import { error } from 'dingtalk-jsapi';
                 }
                 this.addSubProject = true;
             },
+            exportTaskList(){
+                let parameter = {
+                    status: this.searchField,
+                    viewId: this.idx,
+                    pageIndex: this.page,
+                    pageSize: this.size,
+                    // type: this.typeField
+                    projectId: this.screenProjectId,
+                    groupId: this.screenTaskGroupingId,
+                    targetUserId: this.screenPersonnelId
+                }
+                if(this.typeField != 'null' && this.typeField != null && this.typeField != '') {
+                    parameter.type = this.typeField
+                }
+                if(this.dateSelect != null && this.dateSelect.length != 0){
+                    parameter.dateType = this.dateType
+                    parameter.startDate = this.dateSelect[0]
+                    parameter.endDate = this.dateSelect[1]
+                }
+                if(this.deptId.length > 0) {
+                    parameter.deptId = this.deptId[this.deptId.length - 1]
+                } else {
+                    parameter.deptId = ''
+                }
+                this.http.post('/task/exportTaskList', parameter,
+                    res => {
+                    if (res.code == "ok") {
+                        var filePath = res.data;
+                        var fName = '待办任务导出.xlsx'
+                        const a = document.createElement('a'); // 创建a标签
+                        a.setAttribute('download', fName);// download属性
+                        a.setAttribute('href', filePath);// href链接
+                        a.click(); //自执行点击事件
+                        a.remove();
+                        this.exportLoading = false
+                        this.byQuarterDialog  = false
+                        
+                    } else {
+                        this.$message({
+                        message: res.msg,
+                        type: "error"
+                        });
+                    }
+                    },
+                    error => {
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                    });
+                },
             //显示子项目
             subProject(item) {
                 this.subProjectVisible = true;