10 files added
3 files modified
| | |
| | | public static final String PRIORITY_MIDDLE = "priority_middle"; |
| | | // 优先度:高 |
| | | public static final String PRIORITY_HIGH = "priority_high"; |
| | | |
| | | // 任务状态 |
| | | public static final String TASK_STATUS = "task_status"; |
| | | // 任务状态:未开始 |
| | | public static final String TASK_STATUS_NOT_STARTED = "task_status_not_started"; |
| | | // 任务状态:进行中 |
| | | public static final String TASK_STATUS_IN_HAND = "task_status_in_hand"; |
| | | // 任务状态:已完成 |
| | | public static final String TASK_STATUS_COMPLETED = "task_status_completed"; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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-28 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="task_user") |
| | | public class TaskUser 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 = "`task_start_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "任务开始时间") |
| | | private Timestamp taskStartDate; |
| | | |
| | | @Column(name = "`task_end_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "任务结束时间") |
| | | private Timestamp taskEndDate; |
| | | |
| | | @Column(name = "`task_hours`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "任务工时") |
| | | private Double taskHours; |
| | | |
| | | @Column(name = "`task_workload`") |
| | | @ApiModelProperty(value = "任务工作量") |
| | | private Double taskWorkload; |
| | | |
| | | @Column(name = "`task_workload_unit`") |
| | | @ApiModelProperty(value = "任务工作量单位") |
| | | private String taskWorkloadUnit; |
| | | |
| | | @Column(name = "`task_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "任务状态") |
| | | private String taskStatus; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(TaskUser source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.TaskUser; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2022-12-28 |
| | | **/ |
| | | public interface TaskUserRepository extends JpaRepository<TaskUser, Long>, JpaSpecificationExecutor<TaskUser> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.TaskUser; |
| | | import me.zhengjie.modules.task.service.TaskUserService; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserQueryCriteria; |
| | | 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-28 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "任务分配管理") |
| | | @RequestMapping("/api/taskUser") |
| | | public class TaskUserController { |
| | | |
| | | private final TaskUserService taskUserService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('taskUser:download')") |
| | | public void exportTaskUser(HttpServletResponse response, TaskUserQueryCriteria criteria) throws IOException { |
| | | taskUserService.download(taskUserService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询任务分配") |
| | | @ApiOperation("查询任务分配") |
| | | @PreAuthorize("@el.check('taskUser:list')") |
| | | public ResponseEntity<Object> queryTaskUser(TaskUserQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(taskUserService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询任务分配") |
| | | @ApiOperation("查询任务分配") |
| | | @PreAuthorize("@el.check('taskUser:list')") |
| | | public ResponseEntity<Object> queryTaskUser(TaskUserQueryCriteria criteria){ |
| | | return new ResponseEntity<>(taskUserService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增任务分配") |
| | | @ApiOperation("新增任务分配") |
| | | @PreAuthorize("@el.check('taskUser:add')") |
| | | public ResponseEntity<Object> createTaskUser(@Validated @RequestBody TaskUser resources){ |
| | | return new ResponseEntity<>(taskUserService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改任务分配") |
| | | @ApiOperation("修改任务分配") |
| | | @PreAuthorize("@el.check('taskUser:edit')") |
| | | public ResponseEntity<Object> updateTaskUser(@Validated @RequestBody TaskUser resources){ |
| | | taskUserService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除任务分配") |
| | | @ApiOperation("删除任务分配") |
| | | @PreAuthorize("@el.check('taskUser:del')") |
| | | public ResponseEntity<Object> deleteTaskUser(@RequestBody Long[] ids) { |
| | | taskUserService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.TaskUser; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserQueryCriteria; |
| | | 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-28 |
| | | **/ |
| | | public interface TaskUserService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(TaskUserQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<TaskUserDto> |
| | | */ |
| | | List<TaskUserDto> queryAll(TaskUserQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return TaskUserDto |
| | | */ |
| | | TaskUserDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return TaskUserDto |
| | | */ |
| | | TaskUserDto create(TaskUser resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(TaskUser resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<TaskUserDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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-28 |
| | | **/ |
| | | @Data |
| | | public class TaskUserDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 项目ID */ |
| | | private Long projectId; |
| | | |
| | | /** 任务ID */ |
| | | private Long taskId; |
| | | |
| | | /** 用户ID */ |
| | | private Long userId; |
| | | |
| | | /** 任务开始时间 */ |
| | | private Timestamp taskStartDate; |
| | | |
| | | /** 任务结束时间 */ |
| | | private Timestamp taskEndDate; |
| | | |
| | | /** 任务工时 */ |
| | | private Double taskHours; |
| | | |
| | | /** 任务工作量 */ |
| | | private Double taskWorkload; |
| | | |
| | | /** 任务工作量单位 */ |
| | | private String taskWorkloadUnit; |
| | | |
| | | /** 任务状态 */ |
| | | private String taskStatus; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | |
| | | /** 任务名称 */ |
| | | private String taskName; |
| | | |
| | | /** 用户昵称 */ |
| | | private String userNickName; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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-28 |
| | | **/ |
| | | @Data |
| | | public class TaskUserQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long taskId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long userId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String taskStatus; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.constant.Constant; |
| | | 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.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskUser; |
| | | 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.TaskUserRepository; |
| | | import me.zhengjie.modules.task.service.TaskUserService; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserQueryCriteria; |
| | | import me.zhengjie.modules.task.service.mapstruct.TaskUserMapper; |
| | | 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-28 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class TaskUserServiceImpl implements TaskUserService { |
| | | |
| | | private final TaskUserRepository taskUserRepository; |
| | | private final TaskUserMapper taskUserMapper; |
| | | private final ProjectRepository projectRepository; |
| | | private final TaskRepository taskRepository; |
| | | private final UserRepository userRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(TaskUserQueryCriteria criteria, Pageable pageable){ |
| | | Page<TaskUser> page = taskUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<TaskUser, TaskUserDto> func = new Function<TaskUser, TaskUserDto>(){ |
| | | @Override |
| | | public TaskUserDto apply(TaskUser t) { |
| | | // 将实体类转换成DTO |
| | | TaskUserDto taskUserDto = taskUserMapper.toDto(t); |
| | | // 根据项目ID查询项目信息 |
| | | Project project = projectRepository.findById(taskUserDto.getProjectId()).orElseGet(Project::new); |
| | | ValidationUtil.isNull(project.getId(),"Project","id",taskUserDto.getProjectId()); |
| | | // 项目名称 |
| | | taskUserDto.setProjectName(project.getName()); |
| | | // 根据任务ID查询任务信息 |
| | | Task task = taskRepository.findById(taskUserDto.getTaskId()).orElseGet(Task::new); |
| | | ValidationUtil.isNull(task.getId(),"Task","id",taskUserDto.getTaskId()); |
| | | // 任务名称 |
| | | taskUserDto.setTaskName(task.getName()); |
| | | // 根据用户ID查询用户信息 |
| | | User user = userRepository.findById(taskUserDto.getUserId()).orElseGet(User::new); |
| | | ValidationUtil.isNull(user.getId(),"User","id",taskUserDto.getUserId()); |
| | | // 用户昵称 |
| | | taskUserDto.setUserNickName(user.getNickName()); |
| | | // 返回处理好的DTO |
| | | return taskUserDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<TaskUserDto> queryAll(TaskUserQueryCriteria criteria){ |
| | | return taskUserMapper.toDto(taskUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public TaskUserDto findById(Long id) { |
| | | TaskUser taskUser = taskUserRepository.findById(id).orElseGet(TaskUser::new); |
| | | ValidationUtil.isNull(taskUser.getId(),"TaskUser","id",id); |
| | | return taskUserMapper.toDto(taskUser); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public TaskUserDto create(TaskUser resources) { |
| | | return taskUserMapper.toDto(taskUserRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(TaskUser resources) { |
| | | TaskUser taskUser = taskUserRepository.findById(resources.getId()).orElseGet(TaskUser::new); |
| | | ValidationUtil.isNull( taskUser.getId(),"TaskUser","id",resources.getId()); |
| | | taskUser.copy(resources); |
| | | taskUserRepository.save(taskUser); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | taskUserRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<TaskUserDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (TaskUserDto taskUser : all) { |
| | | String projectName = taskUser.getProjectId() != null ? projectRepository.findById(taskUser.getProjectId()).orElseGet(Project::new).getName() : ""; |
| | | String taskName = taskUser.getTaskId() != null ? taskRepository.findById(taskUser.getTaskId()).orElseGet(Task::new).getName() : ""; |
| | | String userNickName = taskUser.getUserId() != null ? userRepository.findById(taskUser.getUserId()).orElseGet(User::new).getNickName() : ""; |
| | | String taskStatus = taskUser.getTaskStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.TASK_STATUS, taskUser.getTaskStatus()).getLabel() : ""; |
| | | String taskWorkloadUnit = taskUser.getTaskWorkloadUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_WORKLOAD_UNIT, taskUser.getTaskWorkloadUnit()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("项目名称", projectName); |
| | | map.put("任务名称", taskName); |
| | | map.put("用户姓名", userNickName); |
| | | map.put("任务开始时间", taskUser.getTaskStartDate()); |
| | | map.put("任务结束时间", taskUser.getTaskEndDate()); |
| | | map.put("任务工时", taskUser.getTaskHours()); |
| | | map.put("任务工作量", taskUser.getTaskWorkload()); |
| | | map.put("任务工作量单位", taskWorkloadUnit); |
| | | map.put("任务状态", taskStatus); |
| | | map.put("备注", taskUser.getRemarks()); |
| | | map.put("创建者", taskUser.getCreateBy()); |
| | | map.put("创建时间", taskUser.getCreateTime()); |
| | | map.put("更新者", taskUser.getUpdateBy()); |
| | | map.put("更新时间", taskUser.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.TaskUser; |
| | | import me.zhengjie.modules.task.service.dto.TaskUserDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author 赵士淞 |
| | | * @date 2022-12-28 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface TaskUserMapper extends BaseMapper<TaskUserDto, TaskUser> { |
| | | |
| | | } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/taskUser/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/taskUser', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/taskUser/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/taskUser', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| | |
| | | // 优先度:高 |
| | | export const PRIORITY_HIGH = 'priority_high' |
| | | |
| | | // 任务状态 |
| | | export const TASK_STATUS = 'task_status' |
| | | // 任务状态:未开始 |
| | | export const TASK_STATUS_NOT_STARTED = 'task_status_not_started' |
| | | // 任务状态:进行中 |
| | | export const TASK_STATUS_IN_HAND = 'task_status_in_hand' |
| | | // 任务状态:已完成 |
| | | export const TASK_STATUS_COMPLETED = 'task_status_completed' |
| | | |
| | | export default { |
| | | CONFIG_PROPORTION_BASIC_WAGE, |
| | | CONFIG_PROPORTION_MERIT_WAGE, |
| | |
| | | PRIORITY, |
| | | PRIORITY_LOW, |
| | | PRIORITY_MIDDLE, |
| | | PRIORITY_HIGH |
| | | PRIORITY_HIGH, |
| | | TASK_STATUS, |
| | | TASK_STATUS_NOT_STARTED, |
| | | TASK_STATUS_IN_HAND, |
| | | TASK_STATUS_COMPLETED |
| | | } |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projects" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.priority" filterable clearable placeholder="优先度" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[priority]" |
| | |
| | | <!--表单组件--> |
| | | <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="name"> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" @change="projectChange"> |
| | | <el-option |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="父级任务"> |
| | | <el-select v-model="form.pid" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" row-key="id" lazy :load="load" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" fixed="left" width="180"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="180" /> |
| | | <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="name" label="名称" fixed="left" width="180" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="priority" label="优先度" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[priority][scope.row.priority] }}</el-tag> |
| | |
| | | import constant from '../../../utils/constant' |
| | | import crudProject from '@/api/project/project' |
| | | |
| | | const defaultForm = { id: null, projectId: null, pid: null, name: null, priority: null, taskClassification: null, description: null, planStartTime: null, planEndTime: null, planHours: null, planWorkload: null, planWorkloadUnit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, name: null, projectId: null, pid: null, priority: null, taskClassification: null, description: null, planStartTime: null, planEndTime: null, planHours: null, planWorkload: null, planWorkloadUnit: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'Task', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | download: ['admin', 'task:download'] |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | ], |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | ], |
| | | priority: [ |
| | | { required: true, message: '优先度不能为空', trigger: 'change' } |
| | |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'name', display_name: '名称' }, |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'priority', display_name: '优先度' }, |
| | | { key: 'taskClassification', display_name: '任务分类' } |
| | | ], |
| | |
| | | projectChange() { |
| | | // 表单赋值 |
| | | this.form.pid = null |
| | | // 判断表单项目是否为空 |
| | | if (this.form.projectId == null || this.form.projectId === '') { |
| | | // 父级任务列表 |
| | | this.pidTasks = [] |
| | | } else { |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 父级任务列表 |
| | | this.pidTasks = res |
| | | }) |
| | | } |
| | | }, |
| | | // 树形表数据加载 |
| | | load(tree, treeNode, resolve) { |
| New file |
| | |
| | | <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 projects" |
| | | :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> |
| | | <el-select v-model="query.taskStatus" filterable clearable placeholder="任务状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </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="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <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 projects" |
| | | :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;"> |
| | | <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="taskStartDate"> |
| | | <el-date-picker v-model="form.taskStartDate" type="datetime" :picker-options="taskStartDatePickerOptions" :disabled="crud.status.edit == crudStatusPrepared" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务结束时间" prop="taskEndDate"> |
| | | <el-date-picker v-model="form.taskEndDate" type="datetime" :picker-options="taskEndDatePickerOptions" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工时" prop="taskHours"> |
| | | <el-input v-model="form.taskHours" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工作量" prop="taskWorkload"> |
| | | <el-input v-model="form.taskWorkload" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工作量单位" prop="taskWorkloadUnit"> |
| | | <el-select v-model="form.taskWorkloadUnit" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[standardWorkloadUnit]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务状态" prop="taskStatus"> |
| | | <el-select v-model="form.taskStatus" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </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="userNickName" label="所属用户" fixed="left" 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="taskName" label="所属任务" fixed="left" 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="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="taskStartDate" label="任务开始时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskEndDate" label="任务结束时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskHours" label="任务工时" width="80" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskWorkload" label="任务工作量" width="80" /> |
| | | <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 :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" width="140" /> |
| | | <el-table-column v-if="checkPer(['admin','taskUser:edit','taskUser:del'])" label="操作" width="150px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudTaskUser from '@/api/task/taskUser' |
| | | 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 crudProject from '@/api/project/project' |
| | | import crudTask from '@/api/task/task' |
| | | import crudUser from '@/api/system/user' |
| | | |
| | | const defaultForm = { id: null, userId: null, projectId: null, taskId: null, taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskWorkloadUnit: null, taskStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'TaskUser', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.TASK_STATUS, constant.STANDARD_WORKLOAD_UNIT], |
| | | cruds() { |
| | | return CRUD({ title: '任务分配', url: 'api/taskUser', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTaskUser }}) |
| | | }, |
| | | data() { |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 时长(千内)验证 |
| | | 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', 'taskUser:add'], |
| | | edit: ['admin', 'taskUser:edit'], |
| | | del: ['admin', 'taskUser:del'], |
| | | download: ['admin', 'taskUser:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '所属用户不能为空', trigger: 'blur' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'blur' } |
| | | ], |
| | | taskId: [ |
| | | { required: true, message: '所属任务不能为空', trigger: 'blur' } |
| | | ], |
| | | taskStartDate: [ |
| | | { required: true, message: '任务开始时间不能为空', trigger: 'blur' } |
| | | ], |
| | | taskEndDate: [ |
| | | { required: true, message: '任务结束时间不能为空', trigger: 'blur' } |
| | | ], |
| | | taskHours: [ |
| | | { required: true, message: '任务工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | taskWorkload: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | taskStatus: [ |
| | | { required: true, message: '任务状态不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '所属用户' }, |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'taskId', display_name: '所属任务' }, |
| | | { key: 'taskStatus', display_name: '任务状态' } |
| | | ], |
| | | // 任务开始时间选项 |
| | | taskStartDatePickerOptions: { |
| | | // 禁用日期 |
| | | disabledDate(time) { |
| | | return _this.form.taskEndDate != null && _this.form.taskEndDate !== '' ? time.getTime() > _this.form.taskEndDate : false |
| | | } |
| | | }, |
| | | // 任务结束时间选项 |
| | | taskEndDatePickerOptions: { |
| | | // 禁用日期 |
| | | disabledDate(time) { |
| | | return _this.form.taskStartDate != null && _this.form.taskStartDate !== '' ? time.getTime() < _this.form.taskStartDate - (86400000 - 1) : false |
| | | } |
| | | }, |
| | | // 字典:任务状态 |
| | | taskStatus: constant.TASK_STATUS, |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // CRUD状态 |
| | | crudStatusPrepared: CRUD.STATUS.PREPARED, |
| | | // 项目列表 |
| | | projects: [], |
| | | // 检索任务列表 |
| | | queryTasks: [], |
| | | // 表单任务列表 |
| | | formTasks: [], |
| | | // 用户列表 |
| | | users: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取项目 |
| | | this.getProject() |
| | | // 获取用户 |
| | | this.getUser() |
| | | return true |
| | | }, |
| | | // 获取项目 |
| | | getProject() { |
| | | // 获取项目 |
| | | crudProject.getAll({ approveStatus: constant.APPROVE_STATUS_ACKNOWLEDGED }).then(res => { |
| | | // 项目列表 |
| | | this.projects = res |
| | | }) |
| | | }, |
| | | // 获取用户 |
| | | getUser() { |
| | | // 获取用户 |
| | | crudUser.getAll().then(res => { |
| | | // 用户列表 |
| | | this.users = 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 |
| | | }) |
| | | } |
| | | }, |
| | | // 表单项目变更 |
| | | formProjectChange() { |
| | | // 表单赋值 |
| | | this.form.taskId = null |
| | | // 判断表单项目是否为空 |
| | | if (this.form.projectId == null || this.form.projectId === '') { |
| | | // 表单任务列表 |
| | | this.formTasks = [] |
| | | } else { |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 表单任务列表 |
| | | this.formTasks = res |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |