From 0879742c99224f15dab714bec2ad98706f0e01be Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Fri, 30 Dec 2022 08:04:13 +0000
Subject: [PATCH] 任务日报
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectService.java | 7
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskDaliyService.java | 83 ++++
eladmin-web-master/src/api/task/taskDaliy.js | 35 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java | 19
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDaliyDto.java | 68 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskService.java | 7
eladmin-web-master/src/views/task/taskDaliy/index.vue | 308 +++++++++++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDaliyQueryCriteria.java | 41 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskQueryCriteria.java | 6
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java | 30 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java | 16
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectQueryCriteria.java | 6
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/mapstruct/TaskDaliyMapper.java | 32 +
eladmin-web-master/src/api/task/task.js | 10
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDaliy.java | 82 ++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java | 154 ++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectController.java | 8
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java | 28 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskController.java | 8
eladmin-web-master/src/api/project/project.js | 10
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskDaliyController.java | 95 +++++
21 files changed, 1,038 insertions(+), 15 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectController.java
index 296b03a..5c2a164 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectController.java
@@ -104,4 +104,12 @@
projectService.updateProjectAdmit(ids);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
+
+ @GetMapping(value = "/partake")
+ @Log("查询参与的项目")
+ @ApiOperation("查询参与的项目")
+ @PreAuthorize("@el.check('project:list')")
+ public ResponseEntity<Object> queryPartakeProjectAll(ProjectQueryCriteria criteria){
+ return new ResponseEntity<>(projectService.queryPartakeAll(criteria),HttpStatus.OK);
+ }
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectService.java
index 2a2f961..29d9ff8 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectService.java
@@ -86,4 +86,11 @@
* @throws IOException /
*/
void download(List<ProjectDto> all, HttpServletResponse response) throws IOException;
+
+ /**
+ * 查询所有参与的数据不分页
+ * @param criteria 条件参数
+ * @return List<ProjectDto>
+ */
+ List<ProjectDto> queryPartakeAll(ProjectQueryCriteria criteria);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectQueryCriteria.java
index b828155..291afc2 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectQueryCriteria.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectQueryCriteria.java
@@ -67,4 +67,10 @@
/** 精确 */
@Query
private String approveStatus;
+
+ /** 精确 */
+ @Query(propName = "id", type = Query.Type.IN)
+ private List<Long> idInList;
+
+ private Long taskUserId;
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java
index f32af30..47af7ee 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java
@@ -27,13 +27,15 @@
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.modules.system.repository.DictDetailRepository;
import me.zhengjie.modules.system.repository.UserRepository;
+import me.zhengjie.modules.system.service.RoleService;
+import me.zhengjie.modules.system.service.dto.RoleSmallDto;
import me.zhengjie.modules.system.service.dto.SysLevelDto;
import me.zhengjie.modules.task.domain.Task;
+import me.zhengjie.modules.task.repository.TaskUserRepository;
import me.zhengjie.modules.task.rest.TaskController;
import me.zhengjie.modules.task.service.TaskService;
import me.zhengjie.modules.task.service.impl.TaskServiceImpl;
-import me.zhengjie.utils.ValidationUtil;
-import me.zhengjie.utils.FileUtil;
+import me.zhengjie.utils.*;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.project.repository.ProjectRepository;
import me.zhengjie.modules.project.service.ProjectService;
@@ -44,17 +46,13 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
-import me.zhengjie.utils.PageUtil;
-import me.zhengjie.utils.QueryHelp;
import java.sql.Timestamp;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
import java.util.function.Function;
+import java.util.stream.Collectors;
/**
* @website https://eladmin.vip
@@ -73,7 +71,8 @@
private final DictDetailRepository dictDetailRepository;
private final ProjectTaskRepository projectTaskRepository;
private final TaskService taskService;
- private final TaskController taskController;
+ private final RoleService roleService;
+ private final TaskUserRepository taskUserRepository;
@Override
public Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable){
@@ -204,4 +203,17 @@
}
FileUtil.downloadExcel(list, response);
}
+
+ @Override
+ public List<ProjectDto> queryPartakeAll(ProjectQueryCriteria criteria){
+ // 根据用户ID查询项目ID
+ List<Long> partakeProjectIds = taskUserRepository.findProjectIdByUserId(criteria.getTaskUserId());
+ // 判断长度
+ if (partakeProjectIds.size() == 0) {
+ return new ArrayList<>();
+ }
+ // 项目检索条件
+ criteria.setIdInList(partakeProjectIds);
+ return projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDaliy.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDaliy.java
new file mode 100644
index 0000000..b56fd94
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/domain/TaskDaliy.java
@@ -0,0 +1,82 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.task.domain;
+
+import lombok.Data;
+import cn.hutool.core.bean.BeanUtil;
+import io.swagger.annotations.ApiModelProperty;
+import cn.hutool.core.bean.copier.CopyOptions;
+import me.zhengjie.base.BaseEntity;
+
+import javax.persistence.*;
+import javax.validation.constraints.*;
+import java.sql.Timestamp;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2022-12-30
+**/
+@Entity
+@Data
+@Table(name="task_daliy")
+public class TaskDaliy extends BaseEntity implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "`id`")
+ @ApiModelProperty(value = "ID")
+ private Long id;
+
+ @Column(name = "`project_id`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "项目ID")
+ private Long projectId;
+
+ @Column(name = "`task_id`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "任务ID")
+ private Long taskId;
+
+ @Column(name = "`user_id`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "员工ID")
+ private Long userId;
+
+ @Column(name = "`fill_date`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "填写日期")
+ private Timestamp fillDate;
+
+ @Column(name = "`consumed_hours`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "消耗工时")
+ private Double consumedHours;
+
+ @Column(name = "`consumed_workload`")
+ @ApiModelProperty(value = "消耗工作量")
+ private Double consumedWorkload;
+
+ @Column(name = "`remarks`")
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+ public void copy(TaskDaliy source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
new file mode 100644
index 0000000..25bdeb9
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
@@ -0,0 +1,28 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.task.repository;
+
+import me.zhengjie.modules.task.domain.TaskDaliy;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2022-12-30
+**/
+public interface TaskDaliyRepository extends JpaRepository<TaskDaliy, Long>, JpaSpecificationExecutor<TaskDaliy> {
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java
index e054013..2e35677 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskUserRepository.java
@@ -52,4 +52,20 @@
*/
@Query(value = "SELECT user_id FROM task_user WHERE task_id = ?1", nativeQuery = true)
List<Long> findUserIdByTaskId(Long taskId);
+
+ /**
+ * 根据用户ID查询项目ID
+ * @param userId
+ * @return
+ */
+ @Query(value = "SELECT project_id FROM task_user WHERE user_id = ?1", nativeQuery = true)
+ List<Long> findProjectIdByUserId(Long userId);
+
+ /**
+ * 根据用户ID、项目ID查询任务ID
+ * @param userId
+ * @return
+ */
+ @Query(value = "SELECT task_id FROM task_user WHERE user_id = ?1 AND project_id = ?2", nativeQuery = true)
+ List<Long> findTaskIdByUserIdAndProjectId(Long userId, Long projectId);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskController.java
index 08a983d..2750720 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskController.java
@@ -112,4 +112,12 @@
taskUserService.divide(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
+
+ @GetMapping(value = "/partake")
+ @Log("查询参与的任务")
+ @ApiOperation("查询参与的任务")
+ @PreAuthorize("@el.check('task:list')")
+ public ResponseEntity<Object> queryPartakeTaskAll(TaskQueryCriteria criteria){
+ return new ResponseEntity<>(taskService.queryPartakeAll(criteria),HttpStatus.OK);
+ }
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskDaliyController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskDaliyController.java
new file mode 100644
index 0000000..d1c9daf
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/rest/TaskDaliyController.java
@@ -0,0 +1,95 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.task.rest;
+
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.task.domain.TaskDaliy;
+import me.zhengjie.modules.task.service.TaskDaliyService;
+import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.*;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2022-12-30
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "任务日报管理")
+@RequestMapping("/api/taskDaliy")
+public class TaskDaliyController {
+
+ private final TaskDaliyService taskDaliyService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('taskDaliy:download')")
+ public void exportTaskDaliy(HttpServletResponse response, TaskDaliyQueryCriteria criteria) throws IOException {
+ taskDaliyService.download(taskDaliyService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询任务日报")
+ @ApiOperation("查询任务日报")
+ @PreAuthorize("@el.check('taskDaliy:list')")
+ public ResponseEntity<Object> queryTaskDaliy(TaskDaliyQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(taskDaliyService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @GetMapping(value = "/all")
+ @Log("查询任务日报")
+ @ApiOperation("查询任务日报")
+ @PreAuthorize("@el.check('taskDaliy:list')")
+ public ResponseEntity<Object> queryTaskDaliy(TaskDaliyQueryCriteria criteria){
+ return new ResponseEntity<>(taskDaliyService.queryAll(criteria),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增任务日报")
+ @ApiOperation("新增任务日报")
+ @PreAuthorize("@el.check('taskDaliy:add')")
+ public ResponseEntity<Object> createTaskDaliy(@Validated @RequestBody TaskDaliy resources){
+ return new ResponseEntity<>(taskDaliyService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改任务日报")
+ @ApiOperation("修改任务日报")
+ @PreAuthorize("@el.check('taskDaliy:edit')")
+ public ResponseEntity<Object> updateTaskDaliy(@Validated @RequestBody TaskDaliy resources){
+ taskDaliyService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除任务日报")
+ @ApiOperation("删除任务日报")
+ @PreAuthorize("@el.check('taskDaliy:del')")
+ public ResponseEntity<Object> deleteTaskDaliy(@RequestBody Long[] ids) {
+ taskDaliyService.deleteAll(ids);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskDaliyService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskDaliyService.java
new file mode 100644
index 0000000..24b83ee
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskDaliyService.java
@@ -0,0 +1,83 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.task.service;
+
+import me.zhengjie.modules.task.domain.TaskDaliy;
+import me.zhengjie.modules.task.service.dto.TaskDaliyDto;
+import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import java.util.Map;
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @description 服务接口
+* @author 赵士淞
+* @date 2022-12-30
+**/
+public interface TaskDaliyService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(TaskDaliyQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<TaskDaliyDto>
+ */
+ List<TaskDaliyDto> queryAll(TaskDaliyQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return TaskDaliyDto
+ */
+ TaskDaliyDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return TaskDaliyDto
+ */
+ TaskDaliyDto create(TaskDaliy resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(TaskDaliy resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<TaskDaliyDto> all, HttpServletResponse response) throws IOException;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskService.java
index 1052e63..e10088d 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/TaskService.java
@@ -87,4 +87,11 @@
* @throws IOException /
*/
void download(List<TaskDto> all, HttpServletResponse response) throws IOException;
+
+ /**
+ * 查询所有参与的数据不分页
+ * @param criteria 条件参数
+ * @return List<ProjectDto>
+ */
+ List<TaskDto> queryPartakeAll(TaskQueryCriteria criteria);
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDaliyDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDaliyDto.java
new file mode 100644
index 0000000..b1e9eb4
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDaliyDto.java
@@ -0,0 +1,68 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.task.service.dto;
+
+import lombok.Data;
+import me.zhengjie.base.BaseDTO;
+
+import java.sql.Timestamp;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2022-12-30
+**/
+@Data
+public class TaskDaliyDto extends BaseDTO implements Serializable {
+
+ /** ID */
+ private Long id;
+
+ /** 项目ID */
+ private Long projectId;
+
+ /** 任务ID */
+ private Long taskId;
+
+ /** 员工ID */
+ private Long userId;
+
+ /** 填写日期 */
+ private Timestamp fillDate;
+
+ /** 消耗工时 */
+ private Double consumedHours;
+
+ /** 消耗工作量 */
+ private Double consumedWorkload;
+
+ /** 备注 */
+ private String remarks;
+
+ /** 项目名称 */
+ private String projectName;
+
+ /** 任务名称 */
+ private String taskName;
+
+ /** 任务工作量单位 */
+ private String taskWorkloadUnit;
+
+ /** 用户昵称 */
+ private String userNickName;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDaliyQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDaliyQueryCriteria.java
new file mode 100644
index 0000000..f39e733
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskDaliyQueryCriteria.java
@@ -0,0 +1,41 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.task.service.dto;
+
+import lombok.Data;
+import java.util.List;
+import me.zhengjie.annotation.Query;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2022-12-30
+**/
+@Data
+public class TaskDaliyQueryCriteria{
+
+ /** 精确 */
+ @Query
+ private Long userId;
+
+ /** 精确 */
+ @Query
+ private Long projectId;
+
+ /** 精确 */
+ @Query
+ private Long taskId;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskQueryCriteria.java
index ed7ea0c..569bb59 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskQueryCriteria.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/dto/TaskQueryCriteria.java
@@ -50,4 +50,10 @@
/** 不为空 */
@Query(type = Query.Type.IS_NULL, propName = "pid")
private Boolean pidIsNull;
+
+ /** 精确 */
+ @Query(propName = "id", type = Query.Type.IN)
+ private List<Long> idInList;
+
+ private Long taskUserId;
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java
new file mode 100644
index 0000000..c708aa1
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java
@@ -0,0 +1,154 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.task.service.impl;
+
+import me.zhengjie.modules.project.domain.Project;
+import me.zhengjie.modules.project.repository.ProjectRepository;
+import me.zhengjie.modules.system.domain.User;
+import me.zhengjie.modules.system.repository.UserRepository;
+import me.zhengjie.modules.task.domain.Task;
+import me.zhengjie.modules.task.domain.TaskDaliy;
+import me.zhengjie.modules.task.repository.TaskRepository;
+import me.zhengjie.utils.ValidationUtil;
+import me.zhengjie.utils.FileUtil;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.task.repository.TaskDaliyRepository;
+import me.zhengjie.modules.task.service.TaskDaliyService;
+import me.zhengjie.modules.task.service.dto.TaskDaliyDto;
+import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria;
+import me.zhengjie.modules.task.service.mapstruct.TaskDaliyMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import me.zhengjie.utils.PageUtil;
+import me.zhengjie.utils.QueryHelp;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.function.Function;
+
+/**
+* @website https://eladmin.vip
+* @description 服务实现
+* @author 赵士淞
+* @date 2022-12-30
+**/
+@Service
+@RequiredArgsConstructor
+public class TaskDaliyServiceImpl implements TaskDaliyService {
+
+ private final TaskDaliyRepository taskDaliyRepository;
+ private final TaskDaliyMapper taskDaliyMapper;
+ private final ProjectRepository projectRepository;
+ private final TaskRepository taskRepository;
+ private final UserRepository userRepository;
+
+ @Override
+ public Map<String,Object> queryAll(TaskDaliyQueryCriteria criteria, Pageable pageable){
+ Page<TaskDaliy> page = taskDaliyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ // 将实体类转换为DTO(重写)
+ Function<TaskDaliy, TaskDaliyDto> func = new Function<TaskDaliy, TaskDaliyDto>(){
+ @Override
+ public TaskDaliyDto apply(TaskDaliy t) {
+ // 将实体类转换成DTO
+ TaskDaliyDto taskDaliyDto = taskDaliyMapper.toDto(t);
+ // 根据项目ID查询项目信息
+ Project project = projectRepository.findById(taskDaliyDto.getProjectId()).orElseGet(Project::new);
+ ValidationUtil.isNull(project.getId(),"Project","id",taskDaliyDto.getProjectId());
+ // 项目名称
+ taskDaliyDto.setProjectName(project.getName());
+ // 根据任务ID查询任务信息
+ Task task = taskRepository.findById(taskDaliyDto.getTaskId()).orElseGet(Task::new);
+ ValidationUtil.isNull(task.getId(),"Task","id",taskDaliyDto.getTaskId());
+ // 任务名称
+ taskDaliyDto.setTaskName(task.getName());
+ // 任务工作量单位
+ taskDaliyDto.setTaskWorkloadUnit(task.getPlanWorkloadUnit());
+ // 根据用户ID查询用户信息
+ User user = userRepository.findById(taskDaliyDto.getUserId()).orElseGet(User::new);
+ ValidationUtil.isNull(user.getId(),"User","id",taskDaliyDto.getUserId());
+ // 用户昵称
+ taskDaliyDto.setUserNickName(user.getNickName());
+ // 返回处理好的DTO
+ return taskDaliyDto;
+ }
+ };
+ return PageUtil.toPage(page.map(func));
+ }
+
+ @Override
+ public List<TaskDaliyDto> queryAll(TaskDaliyQueryCriteria criteria){
+ return taskDaliyMapper.toDto(taskDaliyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public TaskDaliyDto findById(Long id) {
+ TaskDaliy taskDaliy = taskDaliyRepository.findById(id).orElseGet(TaskDaliy::new);
+ ValidationUtil.isNull(taskDaliy.getId(),"TaskDaliy","id",id);
+ return taskDaliyMapper.toDto(taskDaliy);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public TaskDaliyDto create(TaskDaliy resources) {
+ return taskDaliyMapper.toDto(taskDaliyRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(TaskDaliy resources) {
+ TaskDaliy taskDaliy = taskDaliyRepository.findById(resources.getId()).orElseGet(TaskDaliy::new);
+ ValidationUtil.isNull( taskDaliy.getId(),"TaskDaliy","id",resources.getId());
+ taskDaliy.copy(resources);
+ taskDaliyRepository.save(taskDaliy);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ taskDaliyRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<TaskDaliyDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (TaskDaliyDto taskDaliy : all) {
+ String projectName = taskDaliy.getProjectId() != null ? projectRepository.findById(taskDaliy.getProjectId()).orElseGet(Project::new).getName() : "";
+ String taskName = taskDaliy.getTaskId() != null ? taskRepository.findById(taskDaliy.getTaskId()).orElseGet(Task::new).getName() : "";
+ String userNickName = taskDaliy.getUserId() != null ? userRepository.findById(taskDaliy.getUserId()).orElseGet(User::new).getNickName() : "";
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("填写日期", taskDaliy.getFillDate());
+ map.put("项目名称", projectName);
+ map.put("任务名称", taskName);
+ map.put("员工姓名", userNickName);
+ map.put("消耗工时", taskDaliy.getConsumedHours());
+ map.put("消耗工作量", taskDaliy.getConsumedWorkload());
+ map.put("备注", taskDaliy.getRemarks());
+ map.put("创建者", taskDaliy.getCreateBy());
+ map.put("创建时间", taskDaliy.getCreateTime());
+ map.put("更新者", taskDaliy.getUpdateBy());
+ map.put("更新时间", taskDaliy.getUpdateTime());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java
index dbd8f00..a917d85 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java
@@ -21,8 +21,7 @@
import me.zhengjie.modules.system.repository.DictDetailRepository;
import me.zhengjie.modules.task.domain.Task;
import me.zhengjie.modules.task.repository.TaskUserRepository;
-import me.zhengjie.utils.ValidationUtil;
-import me.zhengjie.utils.FileUtil;
+import me.zhengjie.utils.*;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.task.repository.TaskRepository;
import me.zhengjie.modules.task.service.TaskService;
@@ -33,8 +32,7 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
-import me.zhengjie.utils.PageUtil;
-import me.zhengjie.utils.QueryHelp;
+
import java.util.List;
import java.util.Map;
import java.io.IOException;
@@ -199,4 +197,17 @@
}
FileUtil.downloadExcel(list, response);
}
+
+ @Override
+ public List<TaskDto> queryPartakeAll(TaskQueryCriteria criteria){
+ // 根据用户ID、项目ID查询任务ID
+ List<Long> partakeTaskIds = taskUserRepository.findTaskIdByUserIdAndProjectId(criteria.getTaskUserId(), criteria.getProjectId());
+ // 判断长度
+ if (partakeTaskIds.size() == 0) {
+ return new ArrayList<>();
+ }
+ // 项目检索条件
+ criteria.setIdInList(partakeTaskIds);
+ return taskMapper.toDto(taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/mapstruct/TaskDaliyMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/mapstruct/TaskDaliyMapper.java
new file mode 100644
index 0000000..0fd6a28
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/mapstruct/TaskDaliyMapper.java
@@ -0,0 +1,32 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.task.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.task.domain.TaskDaliy;
+import me.zhengjie.modules.task.service.dto.TaskDaliyDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2022-12-30
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface TaskDaliyMapper extends BaseMapper<TaskDaliyDto, TaskDaliy> {
+
+}
\ No newline at end of file
diff --git a/eladmin-web-master/src/api/project/project.js b/eladmin-web-master/src/api/project/project.js
index 44f2feb..4933103 100644
--- a/eladmin-web-master/src/api/project/project.js
+++ b/eladmin-web-master/src/api/project/project.js
@@ -40,4 +40,12 @@
})
}
-export default { getAll, add, edit, del, editAdmit }
+export function getPartake(params) {
+ return request({
+ url: 'api/project/partake',
+ method: 'get',
+ params
+ })
+}
+
+export default { getAll, add, edit, del, editAdmit, getPartake }
diff --git a/eladmin-web-master/src/api/task/task.js b/eladmin-web-master/src/api/task/task.js
index fb40f76..067af7f 100644
--- a/eladmin-web-master/src/api/task/task.js
+++ b/eladmin-web-master/src/api/task/task.js
@@ -48,4 +48,12 @@
})
}
-export default { getAll, getChildren, add, edit, del, divide }
+export function getPartake(params) {
+ return request({
+ url: 'api/task/partake',
+ method: 'get',
+ params
+ })
+}
+
+export default { getAll, getChildren, add, edit, del, divide, getPartake }
diff --git a/eladmin-web-master/src/api/task/taskDaliy.js b/eladmin-web-master/src/api/task/taskDaliy.js
new file mode 100644
index 0000000..34b2b9b
--- /dev/null
+++ b/eladmin-web-master/src/api/task/taskDaliy.js
@@ -0,0 +1,35 @@
+import request from '@/utils/request'
+
+export function getAll(params) {
+ return request({
+ url: 'api/taskDaliy/all',
+ method: 'get',
+ params
+ })
+}
+
+export function add(data) {
+ return request({
+ url: 'api/taskDaliy',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/taskDaliy/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/taskDaliy',
+ method: 'put',
+ data
+ })
+}
+
+export default { getAll, add, edit, del }
diff --git a/eladmin-web-master/src/views/task/taskDaliy/index.vue b/eladmin-web-master/src/views/task/taskDaliy/index.vue
new file mode 100644
index 0000000..f90fdd5
--- /dev/null
+++ b/eladmin-web-master/src/views/task/taskDaliy/index.vue
@@ -0,0 +1,308 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <div class="head-container">
+ <div v-if="crud.props.searchToggle">
+ <!-- 搜索 -->
+ <el-select v-model="query.userId" filterable clearable placeholder="所属用户" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+ <el-option
+ v-for="item in users"
+ :key="item.id"
+ :label="item.nickName"
+ :value="item.id"
+ />
+ </el-select>
+ <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @change="queryProjectChange" @keyup.enter.native="crud.toQuery">
+ <el-option
+ v-for="item in queryProjects"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </el-select>
+ <el-select v-model="query.taskId" filterable clearable placeholder="所属任务" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
+ <el-option
+ v-for="item in queryTasks"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </el-select>
+ <rrOperation :crud="crud" />
+ </div>
+ <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
+ <crudOperation :permission="permission" />
+ <!--表单组件-->
+ <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
+ <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px">
+ <el-form-item label="填写日期" prop="fillDate">
+ <el-date-picker v-model="form.fillDate" type="date" style="width: 340px;" />
+ </el-form-item>
+ <el-form-item label="所属用户" prop="userId">
+ <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" @change="formUserChange">
+ <el-option
+ v-for="item in users"
+ :key="item.id"
+ :label="item.nickName"
+ :value="item.id"
+ :disabled="!item.enabled"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="所属项目" prop="projectId">
+ <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" @change="formProjectChange">
+ <el-option
+ v-for="item in formProjects"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="所属任务" prop="taskId">
+ <el-select v-model="form.taskId" filterable clearable placeholder="请选择" style="width: 340px;" @change="formTaskChange">
+ <el-option
+ v-for="item in formTasks"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="消耗工时" prop="consumedHours">
+ <el-input v-model="form.consumedHours" style="width: 340px;" />
+ </el-form-item>
+ <el-form-item label="消耗工作量" prop="consumedWorkload">
+ <el-input v-model="form.consumedWorkload" style="width: 340px;" />
+ </el-form-item>
+ <el-form-item label="消耗工作量单位" prop="consumedWorkloadUnit">
+ {{ dict.label[standardWorkloadUnit][form.consumedWorkloadUnit] }}
+ </el-form-item>
+ <el-form-item label="备注">
+ <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" />
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="text" @click="crud.cancelCU">取消</el-button>
+ <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
+ </div>
+ </el-dialog>
+ <!--表格渲染-->
+ <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
+ <el-table-column type="selection" width="55" />
+ <el-table-column :show-overflow-tooltip="true" prop="fillDate" label="填写日期">
+ <template slot-scope="scope">
+ {{ crud.toDate(scope.row.fillDate) }}
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属用户" width="100">
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.userNickName }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" width="140">
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.projectName }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="taskName" label="所属任务" width="180">
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.taskName }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column :show-overflow-tooltip="true" prop="consumedHours" label="消耗工时" />
+ <el-table-column :show-overflow-tooltip="true" prop="consumedWorkload" label="消耗工作量" />
+ <el-table-column :show-overflow-tooltip="true" prop="taskWorkloadUnit" label="消耗工作量单位" width="110">
+ <template slot-scope="scope">
+ <el-tag v-if="scope.row.taskWorkloadUnit != null && scope.row.taskWorkloadUnit != ''">{{ dict.label[standardWorkloadUnit][scope.row.taskWorkloadUnit] }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="remarks" label="备注" width="140" />
+ <el-table-column prop="createTime" label="创建时间" width="140" />
+ <el-table-column v-if="checkPer(['admin','taskDaliy:edit','taskDaliy:del'])" label="操作" width="150px" align="center">
+ <template slot-scope="scope">
+ <udOperation
+ :data="scope.row"
+ :permission="permission"
+ />
+ </template>
+ </el-table-column>
+ </el-table>
+ <!--分页组件-->
+ <pagination />
+ </div>
+ </div>
+</template>
+
+<script>
+import crudTaskDaliy from '@/api/task/taskDaliy'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import rrOperation from '@crud/RR.operation'
+import crudOperation from '@crud/CRUD.operation'
+import udOperation from '@crud/UD.operation'
+import pagination from '@crud/Pagination'
+import constant from '../../../utils/constant'
+import crudUser from '@/api/system/user'
+import crudProject from '@/api/project/project'
+import crudTask from '@/api/task/task'
+
+const defaultForm = { id: null, projectId: null, taskId: null, userId: null, fillDate: null, consumedHours: null, consumedWorkload: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
+export default {
+ name: 'TaskDaliy',
+ components: { pagination, crudOperation, rrOperation, udOperation },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ dicts: [constant.STANDARD_WORKLOAD_UNIT],
+ cruds() {
+ return CRUD({ title: '任务日报', url: 'api/taskDaliy', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTaskDaliy }})
+ },
+ data() {
+ // 时长(千内)验证
+ var durationValidate = (rule, value, callback) => {
+ const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/
+ if (value != null && value !== '' && !reg.test(value)) {
+ callback(new Error('请输入 一千 以内的正整数或两位小数'))
+ } else {
+ callback()
+ }
+ }
+ return {
+ permission: {
+ add: ['admin', 'taskDaliy:add'],
+ edit: ['admin', 'taskDaliy:edit'],
+ del: ['admin', 'taskDaliy:del'],
+ download: ['admin', 'taskDaliy:download']
+ },
+ rules: {
+ fillDate: [
+ { required: true, message: '填写日期不能为空', trigger: 'change' }
+ ],
+ userId: [
+ { required: true, message: '所属员工不能为空', trigger: 'change' }
+ ],
+ projectId: [
+ { required: true, message: '所属项目不能为空', trigger: 'change' }
+ ],
+ taskId: [
+ { required: true, message: '所属任务不能为空', trigger: 'change' }
+ ],
+ consumedHours: [
+ { required: true, message: '消耗工时不能为空', trigger: 'blur' },
+ { validator: durationValidate, trigger: 'blur' }
+ ],
+ consumedWorkload: [
+ { validator: durationValidate, trigger: 'blur' }
+ ]
+ },
+ queryTypeOptions: [
+ { key: 'userId', display_name: '所属用户' },
+ { key: 'projectId', display_name: '所属项目' },
+ { key: 'taskId', display_name: '所属任务' }
+ ],
+ // 字典:标准工作量单位
+ standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT,
+ // 用户列表
+ users: [],
+ // 检索项目列表
+ queryProjects: [],
+ // 检索任务列表
+ queryTasks: [],
+ // 表单项目列表
+ formProjects: [],
+ // 表单任务列表
+ formTasks: []
+ }
+ },
+ methods: {
+ // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+ [CRUD.HOOK.beforeRefresh]() {
+ // 获取用户
+ this.getUser()
+ // 获取检索项目
+ this.getQueryProject()
+ return true
+ },
+ // 获取用户
+ getUser() {
+ // 获取用户
+ crudUser.getAll().then(res => {
+ // 用户列表
+ this.users = res
+ })
+ },
+ // 获取检索项目
+ getQueryProject() {
+ // 获取项目
+ crudProject.getAll({ approveStatus: constant.APPROVE_STATUS_ACKNOWLEDGED }).then(res => {
+ // 检索项目列表
+ this.queryProjects = res
+ })
+ },
+ // 检索项目变更
+ queryProjectChange() {
+ // 检索赋值
+ this.$set(this.query, 'taskId', null)
+ // 判断检索项目是否为空
+ if (this.query.projectId == null || this.query.projectId === '') {
+ // 检索任务列表
+ this.queryTasks = []
+ } else {
+ // 获取任务
+ crudTask.getAll({ projectId: this.query.projectId }).then(res => {
+ // 检索任务列表
+ this.queryTasks = res
+ })
+ }
+ },
+ // 表单用户变更
+ formUserChange() {
+ // 表单赋值
+ this.form.projectId = null
+ this.form.taskId = null
+ // 判断表单用户是否为空
+ if (this.form.userId == null || this.form.userId === '') {
+ // 表单项目列表
+ this.formProjects = []
+ // 表单任务列表
+ this.formTasks = []
+ } else {
+ // 获取项目
+ crudProject.getPartake({ taskUserId: this.form.userId, approveStatus: constant.APPROVE_STATUS_ACKNOWLEDGED }).then(res => {
+ // 表单项目列表
+ this.formProjects = res
+ })
+ }
+ },
+ // 表单项目变更
+ formProjectChange() {
+ // 表单赋值
+ this.form.taskId = null
+ // 判断表单项目是否为空
+ if (this.form.projectId == null || this.form.projectId === '') {
+ // 表单任务列表
+ this.formTasks = []
+ } else {
+ // 获取任务
+ crudTask.getPartake({ taskUserId: this.form.userId, projectId: this.form.projectId }).then(res => {
+ // 表单任务列表
+ this.formTasks = res
+ })
+ }
+ },
+ // 表单任务变更
+ formTaskChange() {
+ // 循环表单任务列表
+ for (let i = 0; i < this.formTasks.length; i++) {
+ // 判断是否为选中任务
+ if (this.formTasks[i].id === this.form.taskId) {
+ // 表单赋值
+ this.form.consumedWorkloadUnit = this.formTasks[i].planWorkloadUnit
+ }
+ }
+ }
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
--
Gitblit v1.9.3