소스 검색

修改切换任务组和视图时传递的isDesc参数, 修复首次加载列表中的任务顺序不对问题

seyason 4 년 전
부모
커밋
f2403646f3

+ 8 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -85,7 +85,8 @@ public class ReportController {
                                   String[] endTime,
                                   Integer[] reportTimeType,
                                   String[] createDate,
-                                  Integer[] taskId) {
+                                  Integer[] taskId,
+                                  Integer[] isOvertime) {
         List<Report> reportList = new ArrayList<>();
         String token = request.getHeader("Token");
         BigDecimal hourCost = userService.getById(token).getCost();
@@ -96,17 +97,21 @@ public class ReportController {
             System.out.println("reportTimeType.length=="+reportTimeType.length);
             System.out.println("content.length=="+content.length);
             for (int i = 0; i < id.length; i++) {
-                System.out.println("任务ID=="+taskId[i]);
                 Report report = new Report()
                         .setId(id[i] == -1 ? null : id[i])
                         .setProjectId(projectId[i])
                         .setSubProjectId(subProjectId[i] == 0?null:subProjectId[i])
-                        .setTaskId(taskId[i] == null||taskId[i] == 0?null:taskId[i])
                         .setReportTimeType(reportTimeType[i])
                         .setContent(content[i])
                         .setState(0)
                         .setCreateDate(LocalDate.parse(createDate[i], DateTimeFormatter.ofPattern("yyyy-MM-dd")))
                         .setCreatorId(token);
+                if (taskId != null && taskId[i] != null && taskId[i] != 0) {
+                    report.setTaskId(taskId[i]);
+                }
+                if (isOvertime != null && isOvertime[i] != null) {
+                    report.setTaskId(taskId[i]);
+                }
                 if (report.getReportTimeType() == 0) {
                     report.setWorkingTime(workingTime[i])
                             .setCost(hourCost.multiply(new BigDecimal(workingTime[i])))

+ 6 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/StagesController.java

@@ -152,7 +152,12 @@ public class StagesController {
         //按任务分组查看
         queryWrapper.eq("group_id", item.getGroupId());
         queryWrapper.isNull("parent_tid");
-        queryWrapper.orderByAsc("seq");
+        //排序根据前端传过来的字段
+        if (isDesc) {
+            queryWrapper.orderByDesc(order);
+        } else {
+            queryWrapper.orderByAsc(order);
+        }
         List<Task> tasks = taskService.list(queryWrapper);
         List<Task> subTasks = new ArrayList<>();
         if (tasks.size() > 0) {

+ 13 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskGroupController.java

@@ -43,10 +43,19 @@ public class TaskGroupController {
     @RequestMapping("/save")
     public HttpRespMsg save(TaskGroup item) {
         HttpRespMsg msg = new HttpRespMsg();
+        if (item.getId() == null) {
+            item.setNew(true);
+        }
         taskGroupService.saveOrUpdate(item);
         QueryWrapper<TaskGroup> queryWrapper = new QueryWrapper<TaskGroup>();
         queryWrapper.eq("project_id", item.getProjectId());
-        msg.data = taskGroupService.list(queryWrapper);
+        List<TaskGroup> groupList = taskGroupService.list(queryWrapper);
+        groupList.stream().forEach(g->{
+            if (g.getId().equals(item.getId())) {
+                g.setNew(item.isNew());
+            }
+        });
+        msg.data = groupList;
         return msg;
     }
 
@@ -134,8 +143,9 @@ public class TaskGroupController {
             batchList.add(item);
         });
         stagesService.saveBatch(batchList);
-
-        return new HttpRespMsg();
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.data = taskGroup;
+        return msg;
     }
 
 }

+ 9 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Report.java

@@ -1,8 +1,6 @@
 package com.management.platform.entity;
 
 import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import java.time.LocalDate;
@@ -22,7 +20,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2021-04-27
+ * @since 2021-05-09
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -118,9 +116,16 @@ public class Report extends Model<Report> {
     /**
      * 任务id
      */
-    @TableField(value = "task_id")
+    @TableField("task_id")
     private Integer taskId;
 
+    /**
+     * 是否是加班
+     */
+    @TableField("is_overtime")
+    private Integer isOvertime;
+
+
     @TableField(exist = false)
     private List<SubProject> subProjectList;
     @TableField(exist = false)

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TaskGroup.java

@@ -36,6 +36,8 @@ public class TaskGroup extends Model<TaskGroup> {
     @TableField("name")
     private String name;
 
+    @TableField(exist = false)
+    private boolean isNew;
 
     @Override
     protected Serializable pkVal() {

+ 1 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/resources/application.yml

@@ -14,12 +14,9 @@ spring:
       location: C:/upload/
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://47.100.37.243:7644/man_hour_manager?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+    url: jdbc:mysql://47.100.37.243:7644/man_dev?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
     username: root
     password: Ziyu1026!@
-#    url: jdbc:mysql://47.100.37.243:7644/man_dev?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-#    username: root
-#    password: Ziyu1026!@
     hikari:
       maximum-pool-size: 10
       minimum-idle: 3

+ 6 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -19,18 +19,18 @@
         <result column="report_time_type" property="reportTimeType" />
         <result column="sub_project_id" property="subProjectId" />
         <result column="task_id" property="taskId" />
+        <result column="is_overtime" property="isOvertime" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, creator_id, project_id, create_date, working_time, content, state, create_time, time_type, cost, start_time, end_time, report_time_type, sub_project_id, task_id
+        id, creator_id, project_id, create_date, working_time, content, state, create_time, time_type, cost, start_time, end_time, report_time_type, sub_project_id, task_id, is_overtime
     </sql>
-
     <!--根据日期获取全部报告信息-->
     <select id="getAllReportByDate" resultType="java.util.Map">
         SELECT c.name, b.project_name AS project, a.working_time AS duration, a.content, a.create_time AS time,
         a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType, a.start_time as startTime,
-        a.end_time as endTime, d.name as subProjectName,a.task_id as taskId, task.name as taskName
+        a.end_time as endTime, d.name as subProjectName,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime
         FROM report AS a
         JOIN project AS b ON a.project_id=b.id
         LEFT JOIN user AS c ON a.creator_id=c.id
@@ -53,7 +53,7 @@
     <select id="getReportByDate" resultType="java.util.Map">
         SELECT a.id, b.project_name AS project, a.working_time AS time, a.content, a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType, a.start_time as startTime,
         a.end_time as endTime, b.incharger_id as inchargerId,
-        a.creator_id as creatorId, d.name as subProjectName,a.task_id as taskId, task.name as taskName
+        a.creator_id as creatorId, d.name as subProjectName,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime
         FROM report AS a
         JOIN project AS b ON a.project_id=b.id
         left join sub_project as d on d.id = a.sub_project_id
@@ -71,7 +71,7 @@
         SELECT a.id, b.project_name AS project, a.working_time AS time, a.content, a.state, a.time_type as timeType,
         a.cost, a.report_time_type as reportTimeType, a.start_time as startTime,
         a.end_time as endTime, b.incharger_id as inchargerId,
-        a.creator_id as creatorId, d.name as subProjectName,a.task_id as taskId, task.name as taskName
+        a.creator_id as creatorId, d.name as subProjectName,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime
         FROM report AS a
         JOIN project AS b ON a.project_id=b.id
         left join sub_project as d on d.id = a.sub_project_id
@@ -90,7 +90,7 @@
     <!-- 批量获取员工某天的报告 -->
     <select id="getUserReportByDate" resultType="java.util.Map">
         SELECT a.id, b.project_name AS project, a.working_time AS time, a.content, a.state, a.time_type as timeType, a.creator_id as creatorId, a.cost, a.report_time_type as reportTimeType, a.start_time as startTime,
-        a.end_time as endTime, d.name as subProjectName,a.task_id as taskId, task.name as taskName
+        a.end_time as endTime, d.name as subProjectName,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime
         FROM report AS a
         JOIN project AS b ON a.project_id=b.id
         left join sub_project as d on d.id = a.sub_project_id

+ 4 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/project/projectInside.vue

@@ -431,7 +431,7 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
                                 {id:"end_date",name:"截止时间最晚",isDesc:true},
                                 {id:"task_level",name:"优先级最高",isDesc:true}],
                 order:"seq",
-                isDesc:true,
+                isDesc:false,
                 taskDataList:[],
                 displayTable: false,
                 viewList: [{id:1,name:"全部任务"},{id:2,name:"进行中的任务"},{id:3,name:"已完成的任务"},{id:4,name:"待安排任务"},
@@ -700,6 +700,7 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
             },
             //排序发生改变
             orderChange() {
+                this.isDesc = this.orderList.filter(o=>o.id == this.order)[0].isDesc;
                 if (this.groupType == 0) {
                     this.getStageList();
                 } else {
@@ -877,7 +878,7 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
             },
             //加载项目内的任务列表
             getStageList() {
-                this.http.post('/stages/list',{groupId: this.selectedGroup.id, projectId: this.selectedGroup.projectId},
+                this.http.post('/stages/list',{groupId: this.selectedGroup.id, projectId: this.selectedGroup.projectId, order: this.order, isDesc: this.isDesc},
                 res => {
                     if (res.code == "ok") {
                         this.stageList = res.data;
@@ -925,6 +926,7 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
                 console.log(index);
                 this.groupType = 1;
                 this.order = "create_date";
+                this.isDesc = true;
                 this.selectedGroup = this.viewList.filter(g=>g.id == index)[0];
                 this.getViewTaskList();
                 this.displayTable = true;

BIN
fhKeeper/formulahousekeeper/timesheet/static/upload/222.pdf