Merge branch 'huaz' of http://192.168.1.110:5678/r/pms-upgrade into master
10 files added
10 files modified
| | |
| | | public static final String LOCATION_RESULTS_OUTSIDE = "location_results_outside"; |
| | | // 考勤位置状态: 未打卡 |
| | | public static final String LOCATION_RESULTS_NOTSIGNED = "location_results_notSigned"; |
| | | |
| | | //批准状态 |
| | | public static final String APPROVE_STATUS = "approve_status"; |
| | | //批准状态:已承认 |
| | | public static final String APPROVE_STATUS_ACKNOWLEDGED = "approve_status_acknowledged"; |
| | | //批准状态:未承认 |
| | | public static final String APPROVE_STATUS_UNRECOGNIZED = "approve_status_unrecognized"; |
| | | |
| | | //项目状态 |
| | | public static final String PROJECT_STATUS = "project_status"; |
| | | //项目状态:未开始 |
| | | public static final String PROJECT_STATUS_NOT_STARTED = "project_status_not_started"; |
| | | //项目状态:进行中 |
| | | public static final String PROJECT_STATUS_UNDER_WAY = "project_status_under_way"; |
| | | //项目状态:已完成 |
| | | public static final String PROJECT_STATUS_COMPLETED = "project_status_completed"; |
| | | //项目状态:停滞 |
| | | public static final String PROJECT_STATUS_STAGNATION = "project_status_stagnation"; |
| | | |
| | | //项目区分 |
| | | public static final String PROJECT_DISTINGUISH = "project_distinguish"; |
| | | //项目区分: a |
| | | public static final String PROJECT_DISTINGUISH_A = "project_distinguish_a"; |
| | | //项目区分: b |
| | | public static final String PROJECT_DISTINGUISH_B = "project_distinguish_b"; |
| | | |
| | | //单价币种 |
| | | public static final String STANDARD_UNIT_CURRENCY = "standard_unit_currency"; |
| | | //单价币种:人民币 |
| | | public static final String STANDARD_UNIT_CURRENCY_RENMINBI = "standard_unit_currency_renminbi"; |
| | | //单价币种:美元 |
| | | public static final String STANDARD_UNIT_CURRENCY_DOLLAR = "standard_unit_currency_dollar"; |
| | | //单价币种:日元 |
| | | public static final String STANDARD_UNIT_CURRENCY_YEN = "standard_unit_currency_yen"; |
| | | |
| | | //工作单位 |
| | | public static final String STANDARD_WORKLOAD_UNIT = "standard_workload_unit"; |
| | | //工作单位:个 |
| | | public static final String STANDARD_WORKLOAD_UNIT_NUMBER = "standard_workload_unit_number"; |
| | | //工作单位:本 |
| | | public static final String STANDARD_WORKLOAD_UNIT_BOOK = "standard_workload_unit_book"; |
| | | //工作单位:行 |
| | | public static final String STANDARD_WORKLOAD_UNIT_LINE = "standard_workload_unit_line"; |
| | | } |
| 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.project.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 HuaZhe |
| | | * @date 2022-12-16 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="project_task") |
| | | public class ProjectTask 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 = "`name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "名称") |
| | | private String name; |
| | | |
| | | @Column(name = "`task_classification`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "任务分类") |
| | | private String taskClassification; |
| | | |
| | | @Column(name = "`description`") |
| | | @ApiModelProperty(value = "描述") |
| | | private String description; |
| | | |
| | | @Column(name = "`plan_start_time`") |
| | | @ApiModelProperty(value = "计划开始时间") |
| | | private Timestamp planStartTime; |
| | | |
| | | @Column(name = "`plan_end_time`") |
| | | @ApiModelProperty(value = "计划结束时间") |
| | | private Timestamp planEndTime; |
| | | |
| | | @Column(name = "`plan_hours`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "计划工时") |
| | | private Double planHours; |
| | | |
| | | @Column(name = "`plan_workload`") |
| | | @ApiModelProperty(value = "计划工作量") |
| | | private Double planWorkload; |
| | | |
| | | @Column(name = "`plan_workload_unit`") |
| | | @ApiModelProperty(value = "计划工作量单位") |
| | | private String planWorkloadUnit; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(ProjectTask source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.project.repository; |
| | | |
| | | import org.springframework.data.jpa.repository.Query; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | |
| | | * @author 华喆 |
| | | */ |
| | | List<Project> findByName(String name); |
| | | |
| | | @Query(value = "SELECT * FROM project WHERE id = ?1", nativeQuery = true) |
| | | Project findByIdUpdate(Long id); |
| | | } |
| 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.project.repository; |
| | | |
| | | import me.zhengjie.modules.project.domain.ProjectTask; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author HuaZhe |
| | | * @date 2022-12-16 |
| | | **/ |
| | | public interface ProjectTaskRepository extends JpaRepository<ProjectTask, Long>, JpaSpecificationExecutor<ProjectTask> { |
| | | } |
| | |
| | | package me.zhengjie.modules.project.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | |
| | | @ApiOperation("新增项目") |
| | | @PreAuthorize("@el.check('project:add')") |
| | | public ResponseEntity<Object> createProject(@Validated @RequestBody Project resources){ |
| | | resources.setProjectStatus(Constant.PROJECT_STATUS_NOT_STARTED); |
| | | resources.setApproveStatus(Constant.APPROVE_STATUS_UNRECOGNIZED); |
| | | return new ResponseEntity<>(projectService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | |
| | | projectService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping("/admit") |
| | | @Log("修改项目(承认)") |
| | | @ApiOperation("修改项目(承认)") |
| | | @PreAuthorize("@el.check('project:admit')") |
| | | public ResponseEntity<Object> updateProjectAdmit(@RequestBody Long[] ids){ |
| | | projectService.updateProjectAdmit(ids); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | } |
| 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.project.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.project.domain.ProjectTask; |
| | | import me.zhengjie.modules.project.service.ProjectTaskService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectTaskQueryCriteria; |
| | | 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 HuaZhe |
| | | * @date 2022-12-16 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "项目任务管理") |
| | | @RequestMapping("/api/projectTask") |
| | | public class ProjectTaskController { |
| | | |
| | | private final ProjectTaskService projectTaskService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('projectTask:download')") |
| | | public void exportProjectTask(HttpServletResponse response, ProjectTaskQueryCriteria criteria) throws IOException { |
| | | projectTaskService.download(projectTaskService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询项目任务") |
| | | @ApiOperation("查询项目任务") |
| | | @PreAuthorize("@el.check('projectTask:list')") |
| | | public ResponseEntity<Object> queryProjectTask(ProjectTaskQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(projectTaskService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询项目任务") |
| | | @ApiOperation("查询项目任务") |
| | | @PreAuthorize("@el.check('projectTask:list')") |
| | | public ResponseEntity<Object> queryProjectTaskAll(ProjectTaskQueryCriteria criteria){ |
| | | return new ResponseEntity<>(projectTaskService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增项目任务") |
| | | @ApiOperation("新增项目任务") |
| | | @PreAuthorize("@el.check('projectTask:add')") |
| | | public ResponseEntity<Object> createProjectTask(@Validated @RequestBody ProjectTask resources){ |
| | | return new ResponseEntity<>(projectTaskService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改项目任务") |
| | | @ApiOperation("修改项目任务") |
| | | @PreAuthorize("@el.check('projectTask:edit')") |
| | | public ResponseEntity<Object> updateProjectTask(@Validated @RequestBody ProjectTask resources){ |
| | | projectTaskService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除项目任务") |
| | | @ApiOperation("删除项目任务") |
| | | @PreAuthorize("@el.check('projectTask:del')") |
| | | public ResponseEntity<Object> deleteProjectTask(@RequestBody Long[] ids) { |
| | | projectTaskService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 项目承认 |
| | | * @param ids / |
| | | */ |
| | | void updateProjectAdmit(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param 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.project.service; |
| | | |
| | | import me.zhengjie.modules.project.domain.ProjectTask; |
| | | import me.zhengjie.modules.project.service.dto.ProjectTaskDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectTaskQueryCriteria; |
| | | 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 HuaZhe |
| | | * @date 2022-12-16 |
| | | **/ |
| | | public interface ProjectTaskService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ProjectTaskQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ProjectTaskDto> |
| | | */ |
| | | List<ProjectTaskDto> queryAll(ProjectTaskQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return ProjectTaskDto |
| | | */ |
| | | ProjectTaskDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ProjectTaskDto |
| | | */ |
| | | ProjectTaskDto create(ProjectTask resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ProjectTask resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ProjectTaskDto> 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.project.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author HuaZhe |
| | | * @date 2022-12-16 |
| | | **/ |
| | | @Data |
| | | public class ProjectTaskDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 项目ID */ |
| | | private Long projectId; |
| | | |
| | | /** 名称 */ |
| | | private String name; |
| | | |
| | | /** 任务分类 */ |
| | | private String taskClassification; |
| | | |
| | | /** 描述 */ |
| | | private String description; |
| | | |
| | | /** 计划开始时间 */ |
| | | private Timestamp planStartTime; |
| | | |
| | | /** 计划结束时间 */ |
| | | private Timestamp planEndTime; |
| | | |
| | | /** 计划工时 */ |
| | | private Double planHours; |
| | | |
| | | /** 计划工作量 */ |
| | | private Double planWorkload; |
| | | |
| | | /** 计划工作量单位 */ |
| | | private String planWorkloadUnit; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | } |
| 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.project.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author HuaZhe |
| | | * @date 2022-12-16 |
| | | **/ |
| | | @Data |
| | | public class ProjectTaskQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String name; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String taskClassification; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String planStartTime; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String planEndTime; |
| | | } |
| | |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import me.zhengjie.modules.project.repository.ProjectTypeRepository; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import me.zhengjie.modules.system.domain.SysLevel; |
| | | 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.dto.SysLevelDto; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | |
| | | private final ProjectMapper projectMapper; |
| | | private final ProjectTypeRepository projectTypeRepository; |
| | | private final UserRepository userRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable){ |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectDto create(Project resources) { |
| | | checkAddProject(resources); |
| | | if(resources.getPlanStartDate() !=null && resources.getPlanEndDate() != null){ |
| | | checkTime(resources.getPlanStartDate(),resources.getPlanEndDate()); |
| | | } |
| | | return projectMapper.toDto(projectRepository.save(resources)); |
| | | } |
| | | |
| | |
| | | public void update(Project resources) { |
| | | Project project = projectRepository.findById(resources.getId()).orElseGet(Project::new); |
| | | ValidationUtil.isNull( project.getId(),"Project","id",resources.getId()); |
| | | checkUpdateProject(resources); |
| | | if(resources.getPlanStartDate() !=null && resources.getPlanEndDate() != null){ |
| | | checkTime(resources.getPlanStartDate(),resources.getPlanEndDate()); |
| | | } |
| | | project.copy(resources); |
| | | projectRepository.save(project); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateProjectAdmit(Long[] ids){ |
| | | for (Long id : ids) { |
| | | Project project = projectRepository.findByIdUpdate(id); |
| | | project.setApproveStatus(Constant.APPROVE_STATUS_ACKNOWLEDGED); |
| | | update(project); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ProjectDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ProjectDto project : all) { |
| | | String projectDistinguish = project.getProjectDistinguish() != null ? dictDetailRepository.findByDictNameAndValue("project_distinguish", project.getProjectDistinguish()).getLabel() : ""; |
| | | String projectStatus = project.getProjectStatus() != null ? dictDetailRepository.findByDictNameAndValue("project_status", project.getProjectStatus()).getLabel() : ""; |
| | | String approveStatus = project.getApproveStatus() != null ? dictDetailRepository.findByDictNameAndValue("approve_status", project.getApproveStatus()).getLabel() : ""; |
| | | String unitCurrency = project.getUnitCurrency() != null ? dictDetailRepository.findByDictNameAndValue("standard_unit_currency", project.getUnitCurrency()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("名称", project.getName()); |
| | | map.put("项目类型ID", project.getProjectTypeId()); |
| | | map.put("项目区分:", project.getProjectDistinguish()); |
| | | map.put("项目区分:", projectDistinguish); |
| | | map.put("需求说明", project.getRequirement()); |
| | | map.put("单价币种", project.getUnitCurrency()); |
| | | map.put("单价币种", unitCurrency); |
| | | map.put("单价金额", project.getUnitPrice()); |
| | | map.put("报价金额", project.getTotalPrice()); |
| | | map.put("责任人ID", project.getLiableUserId()); |
| | | map.put("计划开始日期", project.getPlanStartDate()); |
| | | map.put("计划结束日期", project.getPlanEndDate()); |
| | | map.put("项目状态", project.getProjectStatus()); |
| | | map.put("批准状态", project.getApproveStatus()); |
| | | map.put("项目状态", projectStatus); |
| | | map.put("批准状态", approveStatus); |
| | | map.put("备注", project.getRemarks()); |
| | | map.put("创建者", project.getCreateBy()); |
| | | map.put("创建时间", project.getCreateTime()); |
| | |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | public void checkTime(Timestamp timestamp,Timestamp time){ |
| | | if(time.before(timestamp)){ |
| | | throw new BadRequestException("计划结束时间不能在计划开始时间之前"); |
| | | } |
| | | } |
| | | |
| | | // 判断是否拥有同名的项目名称 |
| | | public void checkAddProject(Project resources){ |
| | | // 根据项目类型的名称查询项目类型 |
| | | List<Project> opeDeliveryMethodList = projectRepository.findByName(resources.getName()); |
| | | // 判断是否存在同名的项目类型 |
| | | if(opeDeliveryMethodList.size()>0){ |
| | | // 存在返回错误 |
| | | throw new BadRequestException("已存在此项目名称"); |
| | | } |
| | | } |
| | | |
| | | // 判断修改是否拥有同名的项目名称 |
| | | public void checkUpdateProject(Project resources){ |
| | | // 根据项目类型的名称查询项目类型 |
| | | List<Project> opeDeliveryMethodList = projectRepository.findByName(resources.getName()); |
| | | // 判断是否存在同名的项目类型 |
| | | if(opeDeliveryMethodList.size() == 1){ |
| | | // 根据id判断是否是同一条 |
| | | if(opeDeliveryMethodList.get(0).getId() != resources.getId()){ |
| | | // 存在返回错误 |
| | | throw new BadRequestException("已存在此项目名称"); |
| | | } else { |
| | | |
| | | } |
| | | } else if(opeDeliveryMethodList.size()<1) { |
| | | |
| | | } else { |
| | | // 存在返回错误 |
| | | throw new BadRequestException("已存在此项目名称"); |
| | | } |
| | | } |
| | | } |
| 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.project.service.impl; |
| | | |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectTask; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.project.repository.ProjectTaskRepository; |
| | | import me.zhengjie.modules.project.service.ProjectTaskService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectTaskDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectTaskQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectTaskMapper; |
| | | 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 HuaZhe |
| | | * @date 2022-12-16 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ProjectTaskServiceImpl implements ProjectTaskService { |
| | | |
| | | private final ProjectTaskRepository projectTaskRepository; |
| | | private final ProjectTaskMapper projectTaskMapper; |
| | | private final ProjectRepository projectRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectTaskQueryCriteria criteria, Pageable pageable){ |
| | | Page<ProjectTask> page = projectTaskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<ProjectTask, ProjectTaskDto> func = new Function<ProjectTask, ProjectTaskDto>() { |
| | | @Override |
| | | public ProjectTaskDto apply(ProjectTask projectTask) { |
| | | // 将实体类转换成DTO |
| | | ProjectTaskDto projectTaskDto =projectTaskMapper.toDto(projectTask); |
| | | // 根据项目ID查询项目信息 |
| | | Project project = projectRepository.findById(projectTaskDto.getProjectId()).orElseGet(Project::new); |
| | | ValidationUtil.isNull(projectTask.getId(),"Project","id",projectTaskDto.getProjectId()); |
| | | // 项目名称 |
| | | projectTaskDto.setProjectName(project.getName()); |
| | | return projectTaskDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectTaskDto> queryAll(ProjectTaskQueryCriteria criteria){ |
| | | return projectTaskMapper.toDto(projectTaskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ProjectTaskDto findById(Long id) { |
| | | ProjectTask projectTask = projectTaskRepository.findById(id).orElseGet(ProjectTask::new); |
| | | ValidationUtil.isNull(projectTask.getId(),"ProjectTask","id",id); |
| | | return projectTaskMapper.toDto(projectTask); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectTaskDto create(ProjectTask resources) { |
| | | return projectTaskMapper.toDto(projectTaskRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ProjectTask resources) { |
| | | ProjectTask projectTask = projectTaskRepository.findById(resources.getId()).orElseGet(ProjectTask::new); |
| | | ValidationUtil.isNull( projectTask.getId(),"ProjectTask","id",resources.getId()); |
| | | projectTask.copy(resources); |
| | | projectTaskRepository.save(projectTask); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | projectTaskRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ProjectTaskDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ProjectTaskDto projectTask : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("项目ID", projectTask.getProjectId()); |
| | | map.put("名称", projectTask.getName()); |
| | | map.put("任务分类", projectTask.getTaskClassification()); |
| | | map.put("描述", projectTask.getDescription()); |
| | | map.put("计划开始时间", projectTask.getPlanStartTime()); |
| | | map.put("计划结束时间", projectTask.getPlanEndTime()); |
| | | map.put("计划工时", projectTask.getPlanHours()); |
| | | map.put("计划工作量", projectTask.getPlanWorkload()); |
| | | map.put("计划工作量单位", projectTask.getPlanWorkloadUnit()); |
| | | map.put("备注", projectTask.getRemarks()); |
| | | map.put("创建者", projectTask.getCreateBy()); |
| | | map.put("创建时间", projectTask.getCreateTime()); |
| | | map.put("更新者", projectTask.getUpdateBy()); |
| | | map.put("更新时间", projectTask.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| | |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | |
| | | private final ProjectTypeRepository projectTypeRepository; |
| | | private final ProjectTypeMapper projectTypeMapper; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectTypeQueryCriteria criteria, Pageable pageable){ |
| | |
| | | public void download(List<ProjectTypeDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ProjectTypeDto projectType : all) { |
| | | String unitCurrency = projectType.getStandardUnitCurrency() != null ? dictDetailRepository.findByDictNameAndValue("standard_unit_currency", projectType.getStandardUnitCurrency()).getLabel() : ""; |
| | | String workloadUnit = projectType.getStandardWorkloadUnit() != null ? dictDetailRepository.findByDictNameAndValue("standard_workload_unit", projectType.getStandardWorkloadUnit()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("名称", projectType.getName()); |
| | | map.put("标准单价币种", projectType.getStandardUnitCurrency()); |
| | | map.put("标准单价币种", unitCurrency); |
| | | map.put("标准单价金额", projectType.getStandardUnitPrice()); |
| | | map.put("标准利润金额", projectType.getStandardProfitPrice()); |
| | | map.put("标准工作量单位", projectType.getStandardWorkloadUnit()); |
| | | map.put("标准工作量单位", workloadUnit); |
| | | map.put("备注", projectType.getRemarks()); |
| | | map.put("创建者", projectType.getCreateBy()); |
| | | map.put("创建时间", projectType.getCreateTime()); |
| 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.project.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.project.domain.ProjectTask; |
| | | import me.zhengjie.modules.project.service.dto.ProjectTaskDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author HuaZhe |
| | | * @date 2022-12-16 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface ProjectTaskMapper extends BaseMapper<ProjectTaskDto, ProjectTask> { |
| | | |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| | | export function editAdmit(ids) { |
| | | return request({ |
| | | url: 'api/project/admit', |
| | | method: 'put', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del, editAdmit } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/projectTask', |
| | | method: 'post', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/projectTask', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/projectTask/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/projectTask', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| | |
| | | // 考勤位置状态: 缺卡 |
| | | export const LOCATION_RESULTS_NOTSIGNED = 'location_results_notSigned' |
| | | |
| | | // 项目区分 |
| | | export const PROJECT_DISTINGUISH = 'project_distinguish' |
| | | // 项目区分:a |
| | | export const PROJECT_DISTINGUISH_A = 'project_distinguish_a' |
| | | // 项目区分:b |
| | | export const PROJECT_DISTINGUISH_B = 'project_distinguish_b' |
| | | |
| | | export default { |
| | | CONFIG_PROPORTION_BASIC_WAGE, |
| | | CONFIG_PROPORTION_MERIT_WAGE, |
| | |
| | | LOCATION_RESULTS, |
| | | LOCATION_RESULTS_NORMAL, |
| | | LOCATION_RESULTS_OUTSIDE, |
| | | LOCATION_RESULTS_NOTSIGNED |
| | | LOCATION_RESULTS_NOTSIGNED, |
| | | PROJECT_DISTINGUISH, |
| | | PROJECT_DISTINGUISH_A, |
| | | PROJECT_DISTINGUISH_B |
| | | } |
| | |
| | | <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-input v-model="query.name" clearable placeholder="请输入名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.projectTypeId" clearable filterable placeholder="请选择项目类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectTypeList" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.approveStatus" clearable filterable placeholder="请选择" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.approveStatus" clearable filterable placeholder="请选择批准状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[approveStatus]" |
| | | :key="item.id" |
| | |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.admit" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | :disabled="crud.selections.length === 0" |
| | | @click="projectAdmit(crud.selections)" |
| | | >承认</el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <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="100px"> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="项目区分" maxlength="100" prop="projectDistinguish"> |
| | | <el-input v-model="form.projectDistinguish" style="width: 350px;" /> |
| | | <el-select v-model="form.projectDistinguish" clearable filterable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="需求说明"> |
| | | <el-input v-model="form.requirement" :rows="3" type="textarea" style="width: 350px;" /> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="计划开始日期" prop="planStartDate"> |
| | | <el-date-picker v-model="form.planStartDate" style="width: 350px;" type="date" placeholder="选择日期" /> |
| | | <el-date-picker v-model="form.planStartDate" style="width: 350px;" :picker-options="pickerOptionsStart" type="date" placeholder="选择日期" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划结束日期" prop="planEndDate"> |
| | | <el-date-picker v-model="form.planEndDate" type="date" style="width: 350px;" placeholder="选择日期" /> |
| | | <el-date-picker v-model="form.planEndDate" type="date" :picker-options="pickerOptionsEnd" style="width: 350px;" placeholder="选择日期" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目状态" prop="projectStatus"> |
| | | <el-form-item v-if="form.id != null" label="项目状态" prop="projectStatus"> |
| | | <el-select v-model="form.projectStatus" clearable filterable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in dict[projectStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="批准状态" prop="approveStatus"> |
| | | <el-select v-model="form.approveStatus" clearable filterable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in dict[approveStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | |
| | | </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 prop="name" label="名称" show-overflow-tooltip /> |
| | | <el-table-column prop="projectTypeName" label="项目类型"> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 150%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" fixed="left" /> |
| | | <el-table-column prop="name" label="名称" show-overflow-tooltip fixed="left" width="150" /> |
| | | <el-table-column prop="projectTypeName" label="项目类型" width="150"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.projectTypeName }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectDistinguish" label="项目区分" show-overflow-tooltip /> |
| | | <el-table-column prop="requirement" label="需求说明" show-overflow-tooltip /> |
| | | <el-table-column prop="unitCurrency" label="单价币种"> |
| | | <el-table-column prop="projectDistinguish" label="项目区分" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectDistinguish][scope.row.projectDistinguish] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="requirement" label="需求说明" show-overflow-tooltip width="150" /> |
| | | <el-table-column prop="unitCurrency" label="单价币种" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][scope.row.unitCurrency] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unitPrice" label="单价金额" /> |
| | | <el-table-column prop="totalPrice" label="报价金额" /> |
| | | <el-table-column prop="liableUserName" label="责任人"> |
| | | <el-table-column prop="unitPrice" label="单价金额" width="150" /> |
| | | <el-table-column prop="totalPrice" label="报价金额" width="150" /> |
| | | <el-table-column prop="liableUserName" label="责任人" width="150"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.liableUserName }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planStartDate" label="计划开始日期" show-overflow-tooltip> |
| | | <el-table-column prop="planStartDate" label="计划开始日期" width="150"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planStartDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planEndDate" label="计划结束日期" show-overflow-tooltip> |
| | | <el-table-column prop="planEndDate" label="计划结束日期" width="150"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planEndDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectStatus" label="项目状态"> |
| | | <el-table-column prop="projectStatus" label="项目状态" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectStatus][scope.row.projectStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="approveStatus" label="批准状态"> |
| | | <el-table-column prop="approveStatus" label="批准状态" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[approveStatus][scope.row.approveStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','project:edit','project:del'])" label="操作" width="150px" align="center"> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip width="150" /> |
| | | <el-table-column prop="createTime" label="创建时间" width="150" /> |
| | | <el-table-column v-if="checkPer(['admin','project:edit','project:del'])" label="操作" width="225px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | > |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.admit" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | @click="projectAdmit(scope.row)" |
| | | /> |
| | | </udOperation> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | name: 'Project', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.STANDARD_UNIT_CURRENCY, constant.PROJECT_STATUS, constant.APPROVE_STATUS], |
| | | dicts: [constant.STANDARD_UNIT_CURRENCY, constant.PROJECT_DISTINGUISH, constant.PROJECT_STATUS, constant.APPROVE_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '项目', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }}) |
| | | }, |
| | |
| | | add: ['admin', 'project:add'], |
| | | edit: ['admin', 'project:edit'], |
| | | del: ['admin', 'project:del'], |
| | | download: ['admin', 'project:download'] |
| | | download: ['admin', 'project:download'], |
| | | admit: ['admin', 'project:admit'] |
| | | }, |
| | | rules: { |
| | | name: [ |
| | |
| | | projectStatus: constant.PROJECT_STATUS, |
| | | // 批准状态 |
| | | approveStatus: constant.APPROVE_STATUS, |
| | | // 项目区分 |
| | | projectDistinguish: constant.PROJECT_DISTINGUISH, |
| | | // 随机数 |
| | | random: 0, |
| | | // 项目类型列表 |
| | | projectTypeList: [], |
| | | // 用户列表 |
| | | userList: [] |
| | | userList: [], |
| | | // 选中的id |
| | | ids: [], |
| | | // 是否显示 |
| | | disabled: true, |
| | | // 选中结束时间之后不可选 |
| | | pickerOptionsStart: { |
| | | disabledDate: (time) => { |
| | | if (this.form.planEndDate) { |
| | | return time.getTime() > Date.now() || time.getTime() > this.form.planEndDate |
| | | } |
| | | } |
| | | }, |
| | | // 选中开始时间之后不可选 |
| | | pickerOptionsEnd: { |
| | | disabledDate: (time) => { |
| | | return time.getTime() < this.form.planStartDate |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | |
| | | }) |
| | | }, |
| | | // 项目类型改变 |
| | | projectTypeChange() { |
| | | // 通过id获取项目类型信息 |
| | | crudProjectType.getAll({ id: this.form.projectTypeId }).then(res => { |
| | | // 单价币种赋值 |
| | | this.form.unitCurrency = res[0].standardUnitCurrency |
| | | // 单价金额赋值 |
| | | this.form.unitPrice = res[0].standardUnitPrice |
| | | this.random = Math.random() |
| | | }) |
| | | }, |
| | | // 项目承认 |
| | | projectAdmit(row) { |
| | | this.ids = [] |
| | | // 判断是多个项目承认还是单个项目承认 |
| | | if (row.id !== undefined) { |
| | | this.ids.push(row.id) |
| | | } else { |
| | | for (let i = 0; i < row.length; i++) { |
| | | this.ids.push(row[i].id) |
| | | } |
| | | } |
| | | // 项目承认 |
| | | crudProject.editAdmit(this.ids).then(res => { |
| | | // 刷新数据 |
| | | this.crud.refresh() |
| | | }) |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <!-- <el-input v-model="query.projectId" clearable placeholder="项目ID" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> --> |
| | | <el-select v-model="query.projectId" filterable placeholder="项目名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :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.taskClassification" clearable placeholder="任务分类" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[taskClassification]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <!--<el-date-picker v-model="query.planStartTime" type="datetime" clearable placeholder="计划开始时间" style="width: 185px;" value-format="yyyy-MM-dd HH:mm:ss" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.planEndTime" type="datetime" clearable placeholder="计划结束时间" style="width: 185px;" value-format="yyyy-MM-dd HH:mm:ss" class="filter-item" @keyup.enter.native="crud.toQuery" /> --> |
| | | <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="projectId"> |
| | | <el-select v-model="form.projectId" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :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="任务分类" prop="taskClassification"> |
| | | <el-select v-model="form.taskClassification" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in dict[taskClassification]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input v-model="form.description" :rows="3" type="textarea" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划开始时间"> |
| | | <el-date-picker v-model="form.planStartTime" type="datetime" :picker-options="pickerOptionsStart" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划结束时间"> |
| | | <el-date-picker v-model="form.planEndTime" type="datetime" :picker-options="pickerOptionsEnd" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工时" prop="planHours"> |
| | | <el-input v-model="form.planHours" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量"> |
| | | <el-input v-model="form.planWorkload" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量单位"> |
| | | <el-select v-model="form.planWorkloadUnit" 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="备注"> |
| | | <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 prop="projectName" label="项目名称" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.projectName }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="名称" /> |
| | | <el-table-column prop="taskClassification" label="任务分类"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskClassification][scope.row.taskClassification] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="description" label="描述" show-overflow-tooltip /> |
| | | <el-table-column prop="planStartTime" label="计划开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="planEndTime" label="计划结束时间" show-overflow-tooltip /> |
| | | <el-table-column prop="planHours" label="计划工时" /> |
| | | <el-table-column prop="planWorkload" label="计划工作量" /> |
| | | <el-table-column prop="planWorkloadUnit" label="计划工作量单位"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="dict.label[standardWorkloadUnit][scope.row.planWorkloadUnit]!=null">{{ dict.label[standardWorkloadUnit][scope.row.planWorkloadUnit] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','projectTask:edit','projectTask: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 crudProjectTask from '@/api/project/projectTask' |
| | | import crudProject from '@/api/project/project' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, projectId: null, name: 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: 'ProjectTask', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.TAST_CLASSIFICATION, constant.STANDARD_WORKLOAD_UNIT], |
| | | cruds() { |
| | | return CRUD({ title: '项目任务', url: 'api/projectTask', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectTask }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'projectTask:add'], |
| | | edit: ['admin', 'projectTask:edit'], |
| | | del: ['admin', 'projectTask:del'], |
| | | download: ['admin', 'projectTask:download'] |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | | { required: true, message: '项目名称不能为空', trigger: 'blur' } |
| | | ], |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' } |
| | | ], |
| | | taskClassification: [ |
| | | { required: true, message: '任务分类不能为空', trigger: 'blur' } |
| | | ], |
| | | planHours: [ |
| | | { required: true, message: '计划工时不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectId', display_name: '项目名称' }, |
| | | { key: 'name', display_name: '名称' }, |
| | | { key: 'taskClassification', display_name: '任务分类' }, |
| | | { key: 'planStartTime', display_name: '计划开始时间' }, |
| | | { key: 'planEndTime', display_name: '计划结束时间' } |
| | | ], |
| | | // 字典:任务分类 |
| | | taskClassification: constant.TAST_CLASSIFICATION, |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 项目列表 |
| | | projectList: [], |
| | | pickerOptionsStart: { |
| | | disabledDate: (time) => { |
| | | if (this.form.planEndTime) { |
| | | return time.getTime() > Date.now() || time.getTime() > this.form.planEndTime |
| | | } |
| | | } |
| | | }, |
| | | pickerOptionsEnd: { |
| | | disabledDate: (time) => { |
| | | return time.getTime() < this.form.planStartTime |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | this.getprojectAll() |
| | | }, |
| | | // 获取信息项目列表 |
| | | getprojectAll() { |
| | | crudProject.getAll().then(res => { |
| | | this.projectList = res |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','projectType:edit','projectType:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |