10 files added
7 files modified
| 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-23 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="project_progress") |
| | | public class ProjectProgress 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 = "`project_progress`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "项目进度") |
| | | private Double projectProgress; |
| | | |
| | | @Column(name = "`settlement_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "结算状态") |
| | | private String settlementStatus; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(ProjectProgress 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.project.repository; |
| | | |
| | | import me.zhengjie.modules.project.domain.ProjectProgress; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author HuaZhe |
| | | * @date 2022-12-23 |
| | | **/ |
| | | public interface ProjectProgressRepository extends JpaRepository<ProjectProgress, Long>, JpaSpecificationExecutor<ProjectProgress> { |
| | | |
| | | |
| | | @Query(value = "SELECT * FROM project_progress WHERE project_id = ?1 ORDER BY create_time DESC", nativeQuery = true) |
| | | List<ProjectProgress> findByProjectId(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.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.project.domain.ProjectProgress; |
| | | import me.zhengjie.modules.project.service.ProjectProgressService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectProgressQueryCriteria; |
| | | 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-23 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "项目进度管理") |
| | | @RequestMapping("/api/projectProgress") |
| | | public class ProjectProgressController { |
| | | |
| | | private final ProjectProgressService projectProgressService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('projectProgress:download')") |
| | | public void exportProjectProgress(HttpServletResponse response, ProjectProgressQueryCriteria criteria) throws IOException { |
| | | projectProgressService.download(projectProgressService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询项目进度") |
| | | @ApiOperation("查询项目进度") |
| | | @PreAuthorize("@el.check('projectProgress:list')") |
| | | public ResponseEntity<Object> queryProjectProgress(ProjectProgressQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(projectProgressService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询项目进度") |
| | | @ApiOperation("查询项目进度") |
| | | @PreAuthorize("@el.check('projectProgress:list')") |
| | | public ResponseEntity<Object> queryProjectProgressAll(ProjectProgressQueryCriteria criteria){ |
| | | return new ResponseEntity<>(projectProgressService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增项目进度") |
| | | @ApiOperation("新增项目进度") |
| | | @PreAuthorize("@el.check('projectProgress:add')") |
| | | public ResponseEntity<Object> createProjectProgress(@Validated @RequestBody ProjectProgress resources){ |
| | | return new ResponseEntity<>(projectProgressService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改项目进度") |
| | | @ApiOperation("修改项目进度") |
| | | @PreAuthorize("@el.check('projectProgress:edit')") |
| | | public ResponseEntity<Object> updateProjectProgress(@Validated @RequestBody ProjectProgress resources){ |
| | | projectProgressService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除项目进度") |
| | | @ApiOperation("删除项目进度") |
| | | @PreAuthorize("@el.check('projectProgress:del')") |
| | | public ResponseEntity<Object> deleteProjectProgress(@RequestBody Long[] ids) { |
| | | projectProgressService.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.project.service; |
| | | |
| | | import me.zhengjie.modules.project.domain.ProjectProgress; |
| | | import me.zhengjie.modules.project.service.dto.ProjectProgressDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectProgressQueryCriteria; |
| | | 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-23 |
| | | **/ |
| | | public interface ProjectProgressService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ProjectProgressQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ProjectProgressDto> |
| | | */ |
| | | List<ProjectProgressDto> queryAll(ProjectProgressQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return ProjectProgressDto |
| | | */ |
| | | ProjectProgressDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ProjectProgressDto |
| | | */ |
| | | ProjectProgressDto create(ProjectProgress resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ProjectProgress resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ProjectProgressDto> 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-23 |
| | | **/ |
| | | @Data |
| | | public class ProjectProgressDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 项目ID */ |
| | | private Long projectId; |
| | | |
| | | /** 项目进度 */ |
| | | private Double projectProgress; |
| | | |
| | | /** 结算状态 */ |
| | | private String settlementStatus; |
| | | |
| | | /** 备注 */ |
| | | 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.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author HuaZhe |
| | | * @date 2022-12-23 |
| | | **/ |
| | | @Data |
| | | public class ProjectProgressQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String settlementStatus; |
| | | } |
| | |
| | | private Long liableUserId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String planStartDate; |
| | | @Query(type = Query.Type.BETWEEN) |
| | | private List<String> planStartDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String planEndDate; |
| | | @Query(type = Query.Type.BETWEEN) |
| | | private List<String> planEndDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| 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.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectProgress; |
| | | 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.project.service.dto.ProjectTaskDto; |
| | | import me.zhengjie.modules.system.domain.Job; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.project.repository.ProjectProgressRepository; |
| | | import me.zhengjie.modules.project.service.ProjectProgressService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectProgressDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectProgressQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectProgressMapper; |
| | | 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-23 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ProjectProgressServiceImpl implements ProjectProgressService { |
| | | |
| | | private final ProjectProgressRepository projectProgressRepository; |
| | | private final ProjectProgressMapper projectProgressMapper; |
| | | private final ProjectRepository projectRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectProgressQueryCriteria criteria, Pageable pageable){ |
| | | Page<ProjectProgress> page = projectProgressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<ProjectProgress, ProjectProgressDto> func = new Function<ProjectProgress, ProjectProgressDto>() { |
| | | @Override |
| | | public ProjectProgressDto apply(ProjectProgress projectProgress) { |
| | | // 将实体类转换成DTO |
| | | ProjectProgressDto projectProgressDto =projectProgressMapper.toDto(projectProgress); |
| | | // 根据项目ID查询项目信息 |
| | | Project project = projectRepository.findById(projectProgressDto.getProjectId()).orElseGet(Project::new); |
| | | ValidationUtil.isNull(projectProgress.getId(),"Project","id",projectProgressDto.getProjectId()); |
| | | // 项目名称 |
| | | projectProgressDto.setProjectName(project.getName()); |
| | | return projectProgressDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectProgressDto> queryAll(ProjectProgressQueryCriteria criteria){ |
| | | return projectProgressMapper.toDto(projectProgressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ProjectProgressDto findById(Long id) { |
| | | ProjectProgress projectProgress = projectProgressRepository.findById(id).orElseGet(ProjectProgress::new); |
| | | ValidationUtil.isNull(projectProgress.getId(),"ProjectProgress","id",id); |
| | | return projectProgressMapper.toDto(projectProgress); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectProgressDto create(ProjectProgress resources) { |
| | | checkProjectProgress(resources); |
| | | return projectProgressMapper.toDto(projectProgressRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ProjectProgress resources) { |
| | | checkProjectProgress(resources); |
| | | ProjectProgress projectProgress = projectProgressRepository.findById(resources.getId()).orElseGet(ProjectProgress::new); |
| | | ValidationUtil.isNull( projectProgress.getId(),"ProjectProgress","id",resources.getId()); |
| | | projectProgress.copy(resources); |
| | | projectProgressRepository.save(projectProgress); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | projectProgressRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ProjectProgressDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ProjectProgressDto projectProgress : all) { |
| | | String projectName = projectProgress.getProjectId() != null ? projectRepository.findById(projectProgress.getProjectId()).orElseGet(Project::new).getName() : ""; |
| | | String settlemtnStatus= projectProgress.getSettlementStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.SETTLEMENT_STATUS, projectProgress.getSettlementStatus()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("项目", projectName); |
| | | map.put("项目进度", projectProgress.getProjectProgress()); |
| | | map.put("结算状态", settlemtnStatus); |
| | | map.put("备注", projectProgress.getRemarks()); |
| | | map.put("创建者", projectProgress.getCreateBy()); |
| | | map.put("创建时间", projectProgress.getCreateTime()); |
| | | map.put("更新者", projectProgress.getUpdateBy()); |
| | | map.put("更新时间", projectProgress.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | public void checkProjectProgress(ProjectProgress resources){ |
| | | List<ProjectProgress> list = projectProgressRepository.findByProjectId(resources.getProjectId()); |
| | | if(list.size()>0){ |
| | | if(resources.getProjectProgress()<=list.get(0).getProjectProgress()){ |
| | | throw new BadRequestException("项目进度必须大于上一次的项目进度"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | 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() : ""; |
| | | String projectTypeName = project.getProjectTypeId() != null ? projectTypeRepository.findById(project.getProjectTypeId()).orElseGet(ProjectType::new).getName() : ""; |
| | | String projectDistinguish = project.getProjectDistinguish() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PROJECT_DISTINGUISH, project.getProjectDistinguish()).getLabel() : ""; |
| | | String projectStatus = project.getProjectStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PROJECT_STATUS, project.getProjectStatus()).getLabel() : ""; |
| | | String approveStatus = project.getApproveStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVE_STATUS, project.getApproveStatus()).getLabel() : ""; |
| | | String unitCurrency = project.getUnitCurrency() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_UNIT_CURRENCY, project.getUnitCurrency()).getLabel() : ""; |
| | | String getLiableUser = project.getLiableUserId() != null ? userRepository.findById(project.getLiableUserId()).orElseGet(User::new).getNickName() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("名称", project.getName()); |
| | | map.put("项目类型ID", project.getProjectTypeId()); |
| | | map.put("项目类型",projectTypeName); |
| | | map.put("项目区分:", projectDistinguish); |
| | | map.put("需求说明", project.getRequirement()); |
| | | map.put("单价币种", unitCurrency); |
| | | map.put("单价金额", project.getUnitPrice()); |
| | | map.put("报价金额", project.getTotalPrice()); |
| | | map.put("责任人ID", project.getLiableUserId()); |
| | | map.put("责任人", project.getLiableUserId()); |
| | | map.put("计划开始日期", project.getPlanStartDate()); |
| | | map.put("计划结束日期", project.getPlanEndDate()); |
| | | map.put("项目状态", projectStatus); |
| | |
| | | */ |
| | | 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.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.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | private final ProjectTaskRepository projectTaskRepository; |
| | | private final ProjectTaskMapper projectTaskMapper; |
| | | private final ProjectRepository projectRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectTaskQueryCriteria criteria, Pageable pageable){ |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectTaskDto create(ProjectTask resources) { |
| | | Project project = projectRepository.findByIdUpdate(resources.getProjectId()); |
| | | if(project.getApproveStatus().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){ |
| | | throw new BadRequestException("项目已承认无法新增项目"); |
| | | } |
| | | return projectTaskMapper.toDto(projectTaskRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ProjectTask resources) { |
| | | Project project = projectRepository.findByIdUpdate(resources.getProjectId()); |
| | | if(project.getApproveStatus().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){ |
| | | throw new BadRequestException("项目已承认无法修改项目"); |
| | | } |
| | | ProjectTask projectTask = projectTaskRepository.findById(resources.getId()).orElseGet(ProjectTask::new); |
| | | ValidationUtil.isNull( projectTask.getId(),"ProjectTask","id",resources.getId()); |
| | | projectTask.copy(resources); |
| | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | ProjectTask projectTask = projectTaskRepository.findById(id).orElseGet(ProjectTask::new); |
| | | Project project = projectRepository.findByIdUpdate(projectTask.getProjectId()); |
| | | if(project.getApproveStatus().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){ |
| | | throw new BadRequestException("项目已承认无法删除项目"); |
| | | } |
| | | projectTaskRepository.deleteById(id); |
| | | } |
| | | } |
| | |
| | | public void download(List<ProjectTaskDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ProjectTaskDto projectTask : all) { |
| | | String taskClassfication = projectTask.getTaskClassification() != null ? dictDetailRepository.findByDictNameAndValue(Constant.TASK_CLASSIFICATION,projectTask.getTaskClassification()).getLabel() : ""; |
| | | String workloadUnit = projectTask.getPlanWorkloadUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_WORKLOAD_UNIT,projectTask.getPlanWorkloadUnit()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("项目ID", projectTask.getProjectId()); |
| | | map.put("名称", projectTask.getName()); |
| | | map.put("任务分类", projectTask.getTaskClassification()); |
| | | map.put("任务分类", taskClassfication); |
| | | 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("计划工作量单位", workloadUnit); |
| | | map.put("备注", projectTask.getRemarks()); |
| | | map.put("创建者", projectTask.getCreateBy()); |
| | | map.put("创建时间", projectTask.getCreateTime()); |
| | |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | |
| | | 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() : ""; |
| | | String unitCurrency = projectType.getStandardUnitCurrency() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_UNIT_CURRENCY, projectType.getStandardUnitCurrency()).getLabel() : ""; |
| | | String workloadUnit = projectType.getStandardWorkloadUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_WORKLOAD_UNIT, projectType.getStandardWorkloadUnit()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("名称", projectType.getName()); |
| | | map.put("标准单价币种", unitCurrency); |
| 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.ProjectProgress; |
| | | import me.zhengjie.modules.project.service.dto.ProjectProgressDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author HuaZhe |
| | | * @date 2022-12-23 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface ProjectProgressMapper extends BaseMapper<ProjectProgressDto, ProjectProgress> { |
| | | |
| | | } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/projectProgress/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/projectProgress', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/projectProgress/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/projectProgress', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/projectTask', |
| | | url: 'api/projectTask/all', |
| | | method: 'post', |
| | | params |
| | | }) |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-date-picker |
| | | v-model="query.planStartDate" |
| | | clearable |
| | | placeholder="请选择计划开始日期" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.planEndDate" |
| | | clearable |
| | | placeholder="请选择计划结束日期" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-select v-model="query.projectStatus" clearable filterable placeholder="请选择项目状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[projectStatus]" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-date-picker |
| | | v-model="query.planStartDate" |
| | | type="daterange" |
| | | range-separator=":" |
| | | value-format="yyyy-MM-dd" |
| | | class="filter-item" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.planEndDate" |
| | | type="daterange" |
| | | range-separator=":" |
| | | value-format="yyyy-MM-dd" |
| | | class="filter-item" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | |
| | | <!--表格渲染--> |
| | | <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"> |
| | | <el-table-column prop="name" label="名称" show-overflow-tooltip fixed="left" width="130" /> |
| | | <el-table-column prop="projectTypeName" label="项目类型" width="130"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.projectTypeName }} |
| | | <el-tag>{{ scope.row.projectTypeName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectDistinguish" label="项目区分" width="150"> |
| | | <el-table-column prop="projectDistinguish" label="项目区分" width="130"> |
| | | <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"> |
| | | <el-table-column prop="unitCurrency" label="单价币种" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][scope.row.unitCurrency] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unitPrice" label="单价金额" width="150" /> |
| | | <el-table-column prop="totalPrice" label="报价金额" width="150" /> |
| | | <el-table-column prop="liableUserName" label="责任人" width="150"> |
| | | <el-table-column prop="unitPrice" label="单价金额" width="120"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.unitPrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="totalPrice" label="报价金额" width="120"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.totalPrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="liableUserName" label="责任人" width="80"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.liableUserName }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planStartDate" label="计划开始日期" width="150"> |
| | | <el-table-column prop="planStartDate" label="计划开始日期" width="120"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planStartDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planEndDate" label="计划结束日期" width="150"> |
| | | <el-table-column prop="planEndDate" label="计划结束日期" width="120"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planEndDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectStatus" label="项目状态" width="150"> |
| | | <el-table-column prop="projectStatus" label="项目状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectStatus][scope.row.projectStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="approveStatus" label="批准状态" width="150"> |
| | | <el-table-column prop="approveStatus" label="批准状态" width="80"> |
| | | <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 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"> |
| | | <el-table-column prop="createTime" label="创建时间" width="140" /> |
| | | <el-table-column v-if="checkPer(['admin','project:edit','project:del'])" label="操作" width="225px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | > |
| | | <el-button |
| | | slot="right" |
| | | <el-popover |
| | | slot="left" |
| | | :ref="`popover_${scope.row.id}`" |
| | | v-permission="permission.admit" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | @click="projectAdmit(scope.row)" |
| | | /> |
| | | width="160" |
| | | placement="top" |
| | | > |
| | | <p>确定承认此项目吗?</p> |
| | | <div style="text-align: right; margin: 0"> |
| | | <el-button size="mini" type="text" @click="canel(scope.row)">取消</el-button> |
| | | <el-button type="primary" size="mini" @click="projectAdmit(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button slot="reference" type="primary" icon="el-icon-share" size="mini" /> |
| | | </el-popover> |
| | | </udOperation> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | { required: true, message: '项目类型不能为空', trigger: 'change' } |
| | | ], |
| | | projectDistinguish: [ |
| | | { required: true, message: '项目区分不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | { required: true, message: '项目区分不能为空', trigger: 'change' } |
| | | ], |
| | | unitCurrency: [ |
| | | { required: true, message: '单价币种不能为空', trigger: 'change' } |
| | |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | this.getPackageTypeAll() |
| | | }, |
| | | // 获取项目类型 |
| | | getPackageTypeAll() { |
| | |
| | | this.random = Math.random() |
| | | }) |
| | | }, |
| | | // 取消 |
| | | canel(data) { |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | }, |
| | | // 项目承认 |
| | | projectAdmit(row) { |
| | | this.ids = [] |
| | | // 判断是多个项目承认还是单个项目承认 |
| | | if (row.id !== undefined) { |
| | | this.$refs[`popover_${row.id}`].showPopper = false |
| | | this.ids.push(row.id) |
| | | // 项目承认 |
| | | crudProject.editAdmit(this.ids).then(res => { |
| | | // 刷新数据 |
| | | this.crud.refresh() |
| | | }) |
| | | } else { |
| | | for (let i = 0; i < row.length; i++) { |
| | | this.ids.push(row[i].id) |
| | | } |
| | | this.$confirm('此操作将承认' + row.length + '个项目, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'success' |
| | | }).then(() => { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '项目已承认!' |
| | | }) |
| | | for (let i = 0; i < row.length; i++) { |
| | | this.ids.push(row[i].id) |
| | | } |
| | | // 项目承认 |
| | | crudProject.editAdmit(this.ids).then(res => { |
| | | // 刷新数据 |
| | | this.crud.refresh() |
| | | }) |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消项目承认' |
| | | }) |
| | | }) |
| | | } |
| | | // 项目承认 |
| | | 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-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 projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.settlementStatus" filterable clearable placeholder="请选择结算状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[settlementStatus]" |
| | | :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="80px"> |
| | | <el-form-item label="项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabled"> |
| | | <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="projectProgress"> |
| | | <el-input v-model="form.projectProgress" style="width: 370px;" :disabled="disabled" /> |
| | | </el-form-item> |
| | | <el-form-item label="结算状态" prop="settlementStatus"> |
| | | <el-select v-model="form.settlementStatus" filterable clearable :disabled="disabled" placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[settlementStatus]" |
| | | :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: 370px;" :disabled="disabled" /> |
| | | </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="项目" /> |
| | | <el-table-column prop="projectProgress" label="项目进度" /> |
| | | <el-table-column prop="settlementStatus" label="结算状态"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label[settlementStatus][scope.row.settlementStatus] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column v-if="checkPer(['admin','projectProgress:edit','projectProgress: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 crudProjectProgress from '@/api/project/projectProgress' |
| | | 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, projectProgress: null, settlementStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'ProjectProgress', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.SETTLEMENT_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '项目进度', url: 'api/projectProgress', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectProgress }}) |
| | | }, |
| | | data() { |
| | | var checkProjectProgress = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('项目进度必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('项目进度必须大于0')) |
| | | } else if (!/^\d{0,3}(\.\d{1,2})?$/.test(value)) { |
| | | callback(new Error('计划工时最多位三位整数,两位小数')) |
| | | } else if (value > 100) { |
| | | callback(new Error('项目进度必须小于等于100')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('项目进度不能为空')) |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'projectProgress:add'], |
| | | edit: ['admin', 'projectProgress:edit'], |
| | | del: ['admin', 'projectProgress:del'], |
| | | download: ['admin', 'projectProgress:download'] |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | | { required: true, message: '项目不能为空', trigger: 'blur' } |
| | | ], |
| | | projectProgress: [ |
| | | { required: true, validator: checkProjectProgress, trigger: 'blur' } |
| | | ], |
| | | settlementStatus: [ |
| | | { required: true, message: '结算状态不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectId', display_name: '项目' }, |
| | | { key: 'settlementStatus', display_name: '结算状态' } |
| | | ], |
| | | // 项目 |
| | | projectList: [], |
| | | // 禁用状态 |
| | | disabled: false, |
| | | // 结算状态 |
| | | settlementStatus: constant.SETTLEMENT_STATUS, |
| | | // 结算状态:已结算 |
| | | settlementStatusSettled: constant.SETTLEMENT_STATUS_SETTLED, |
| | | // 结算状态:未结算 |
| | | settlementStatusUnsettled: constant.SETTLEMENT_STATUS_UNSETTLED |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getProject() |
| | | return true |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | this.getDisabled() |
| | | }, |
| | | // 获取项目信息 |
| | | getProject() { |
| | | crudProject.getAll().then(res => { |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | // 是否可以修改 |
| | | getDisabled() { |
| | | if (this.form.settlementStatus === this.settlementStatusSettled) { |
| | | this.disabled = true |
| | | } else if (this.form.settlementStatus === this.settlementStatusUnsettled) { |
| | | this.disabled = false |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | <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-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 placeholder="项目名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | |
| | | :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]" |
| | |
| | | <!--表单组件--> |
| | | <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" maxlength="100" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目名称" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.approveStatus == approveStatusAcknowledged" |
| | | /> |
| | | </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-form-item label="计划工时" prop="planHours"> |
| | | <el-input v-model="form.planHours" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量"> |
| | | <el-form-item label="计划工作量" prop="planWorkload"> |
| | | <el-input v-model="form.planWorkload" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量单位"> |
| | |
| | | <!--表格渲染--> |
| | | <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="名称" /> |
| | | <el-table-column prop="projectName" label="项目名称" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.projectName }} |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="名称" /> |
| | | <el-table-column prop="taskClassification" label="任务分类"> |
| | | <el-table-column prop="taskClassification" label="任务分类" width="80"> |
| | | <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="计划工作量单位"> |
| | | <el-table-column prop="planStartTime" label="计划开始时间" show-overflow-tooltip width="150" /> |
| | | <el-table-column prop="planEndTime" label="计划结束时间" show-overflow-tooltip width="150" /> |
| | | <el-table-column prop="planHours" label="计划工时" width="80" /> |
| | | <el-table-column prop="planWorkload" label="计划工作量" width="100" /> |
| | | <el-table-column prop="planWorkloadUnit" label="计划工作量单位" width="120"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="dict.label[standardWorkloadUnit][scope.row.planWorkloadUnit]!=null">{{ dict.label[standardWorkloadUnit][scope.row.planWorkloadUnit] }}</el-tag> |
| | | </template> |
| | |
| | | return CRUD({ title: '项目任务', url: 'api/projectTask', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectTask }}) |
| | | }, |
| | | data() { |
| | | var planTime = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('计划工时必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('计划工时必须大于0')) |
| | | } else if (!/^\d{0,4}(\.\d{1,2})?$/.test(value)) { |
| | | callback(new Error('计划工时最多位四位整数,两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('计划工时不能为空')) |
| | | } |
| | | } |
| | | var planWorkload = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('计划工作量必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('计划工作量必须大于0')) |
| | | } else if (!/^\d{0,4}(\.\d{1,2})?$/.test(value)) { |
| | | callback(new Error('计划工作量最多位四位整数,两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'projectTask:add'], |
| | |
| | | download: ['admin', 'projectTask:download'] |
| | | }, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '项目名称不能为空', trigger: 'blur' } |
| | | ], |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' } |
| | | ], |
| | | taskClassification: [ |
| | | { required: true, message: '任务分类不能为空', trigger: 'blur' } |
| | | ], |
| | | planHours: [ |
| | | { required: true, message: '计划工时不能为空', trigger: 'blur' } |
| | | { required: true, validator: planTime, trigger: 'blur' } |
| | | ], |
| | | planWorkload: [ |
| | | { validator: planWorkload, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | |
| | | taskClassification: constant.TAST_CLASSIFICATION, |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 已承认 |
| | | approveStatusAcknowledged: constant.APPROVE_STATUS_ACKNOWLEDGED, |
| | | // 项目列表 |
| | | projectList: [], |
| | | pickerOptionsStart: { |
| | |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getprojectAll() |
| | | return true |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | this.getprojectAll() |
| | | }, |
| | | // 获取信息项目列表 |
| | | getprojectAll() { |