10 files added
6 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.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author HuaZhe |
| | | * @date 2022-12-15 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="project") |
| | | public class Project extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "名称") |
| | | private String name; |
| | | |
| | | @Column(name = "`project_type_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "项目类型ID") |
| | | private Long projectTypeId; |
| | | |
| | | @Column(name = "`project_distinguish`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "项目区分") |
| | | private String projectDistinguish; |
| | | |
| | | @Column(name = "`requirement`") |
| | | @ApiModelProperty(value = "需求说明") |
| | | private String requirement; |
| | | |
| | | @Column(name = "`unit_currency`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "单价币种") |
| | | private String unitCurrency; |
| | | |
| | | @Column(name = "`unit_price`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "单价金额") |
| | | private BigDecimal unitPrice; |
| | | |
| | | @Column(name = "`total_price`") |
| | | @ApiModelProperty(value = "报价金额") |
| | | private BigDecimal totalPrice; |
| | | |
| | | @Column(name = "`liable_user_id`") |
| | | @ApiModelProperty(value = "责任人ID") |
| | | private Long liableUserId; |
| | | |
| | | @Column(name = "`plan_start_date`") |
| | | @ApiModelProperty(value = "计划开始日期") |
| | | private Timestamp planStartDate; |
| | | |
| | | @Column(name = "`plan_end_date`") |
| | | @ApiModelProperty(value = "计划结束日期") |
| | | private Timestamp planEndDate; |
| | | |
| | | @Column(name = "`project_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "项目状态") |
| | | private String projectStatus; |
| | | |
| | | @Column(name = "`approve_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "批准状态") |
| | | private String approveStatus; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(Project 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.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author HuaZhe |
| | | * @date 2022-12-15 |
| | | **/ |
| | | public interface ProjectRepository extends JpaRepository<Project, Long>, JpaSpecificationExecutor<Project> { |
| | | |
| | | /** |
| | | * 根据名称查询数据 |
| | | * @return |
| | | * @author 华喆 |
| | | */ |
| | | List<Project> findByName(String name); |
| | | } |
| 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.Project; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | | 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-15 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "项目管理") |
| | | @RequestMapping("/api/project") |
| | | public class ProjectController { |
| | | |
| | | private final ProjectService projectService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('project:download')") |
| | | public void exportProject(HttpServletResponse response, ProjectQueryCriteria criteria) throws IOException { |
| | | projectService.download(projectService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询项目") |
| | | @ApiOperation("查询项目") |
| | | @PreAuthorize("@el.check('project:list')") |
| | | public ResponseEntity<Object> queryProject(ProjectQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(projectService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询项目") |
| | | @ApiOperation("查询项目") |
| | | @PreAuthorize("@el.check('project:list')") |
| | | public ResponseEntity<Object> queryProjectAll(ProjectQueryCriteria criteria){ |
| | | return new ResponseEntity<>(projectService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增项目") |
| | | @ApiOperation("新增项目") |
| | | @PreAuthorize("@el.check('project:add')") |
| | | public ResponseEntity<Object> createProject(@Validated @RequestBody Project resources){ |
| | | return new ResponseEntity<>(projectService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改项目") |
| | | @ApiOperation("修改项目") |
| | | @PreAuthorize("@el.check('project:edit')") |
| | | public ResponseEntity<Object> updateProject(@Validated @RequestBody Project resources){ |
| | | projectService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除项目") |
| | | @ApiOperation("删除项目") |
| | | @PreAuthorize("@el.check('project:del')") |
| | | public ResponseEntity<Object> deleteProject(@RequestBody Long[] ids) { |
| | | projectService.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.Project; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | | 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-15 |
| | | **/ |
| | | public interface ProjectService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ProjectDto> |
| | | */ |
| | | List<ProjectDto> queryAll(ProjectQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return ProjectDto |
| | | */ |
| | | ProjectDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ProjectDto |
| | | */ |
| | | ProjectDto create(Project resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(Project resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ProjectDto> 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.math.BigDecimal; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author HuaZhe |
| | | * @date 2022-12-15 |
| | | **/ |
| | | @Data |
| | | public class ProjectDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 名称 */ |
| | | private String name; |
| | | |
| | | /** 项目类型ID */ |
| | | private Long projectTypeId; |
| | | |
| | | /** 项目区分 */ |
| | | private String projectDistinguish; |
| | | |
| | | /** 需求说明 */ |
| | | private String requirement; |
| | | |
| | | /** 单价币种 */ |
| | | private String unitCurrency; |
| | | |
| | | /** 单价金额 */ |
| | | private BigDecimal unitPrice; |
| | | |
| | | /** 报价金额 */ |
| | | private BigDecimal totalPrice; |
| | | |
| | | /** 责任人ID */ |
| | | private Long liableUserId; |
| | | |
| | | /** 计划开始日期 */ |
| | | private Timestamp planStartDate; |
| | | |
| | | /** 计划结束日期 */ |
| | | private Timestamp planEndDate; |
| | | |
| | | /** 项目状态 */ |
| | | private String projectStatus; |
| | | |
| | | /** 批准状态 */ |
| | | private String approveStatus; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 项目类型名称 */ |
| | | private String projectTypeName; |
| | | |
| | | /** 负责人名称 */ |
| | | private String liableUserName; |
| | | } |
| 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-15 |
| | | **/ |
| | | @Data |
| | | public class ProjectQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query(type = Query.Type.EQUAL) |
| | | private Long id; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String name; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private Long projectTypeId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String projectDistinguish; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String unitCurrency; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long liableUserId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String planStartDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String planEndDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String projectStatus; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private String approveStatus; |
| | | } |
| | |
| | | @Data |
| | | public class ProjectTypeQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query(type = Query.Type.EQUAL) |
| | | private Long id; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String name; |
| 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.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.UserRepository; |
| | | import me.zhengjie.modules.system.service.dto.SysLevelDto; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectMapper; |
| | | 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.sql.Timestamp; |
| | | 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-15 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ProjectServiceImpl implements ProjectService { |
| | | |
| | | private final ProjectRepository projectRepository; |
| | | private final ProjectMapper projectMapper; |
| | | private final ProjectTypeRepository projectTypeRepository; |
| | | private final UserRepository userRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable){ |
| | | Page<Project> page = projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<Project, ProjectDto> func = new Function<Project, ProjectDto>(){ |
| | | @Override |
| | | public ProjectDto apply(Project project) { |
| | | // 将实体类转换成DTO |
| | | ProjectDto projectDto = projectMapper.toDto(project); |
| | | // 根据项目类型ID查询项目类型信息 |
| | | ProjectType projectType = projectTypeRepository.findById(projectDto.getProjectTypeId()).orElseGet(ProjectType::new); |
| | | ValidationUtil.isNull(project.getId(),"ProjectType","id",projectDto.getProjectTypeId()); |
| | | // 项目类型名称 |
| | | projectDto.setProjectTypeName(projectType.getName()); |
| | | // 判断是否有负责人 |
| | | if(projectDto.getLiableUserId() != null){ |
| | | // 根据负责人ID查询用户信息 |
| | | User user = userRepository.findById(projectDto.getLiableUserId()).orElseGet(User::new); |
| | | ValidationUtil.isNull(project.getId(),"User","id",projectDto.getLiableUserId()); |
| | | // 负责人名称 |
| | | projectDto.setLiableUserName(user.getNickName()); |
| | | } |
| | | // 返回处理好的Dto |
| | | return projectDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectDto> queryAll(ProjectQueryCriteria criteria){ |
| | | return projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ProjectDto findById(Long id) { |
| | | Project project = projectRepository.findById(id).orElseGet(Project::new); |
| | | ValidationUtil.isNull(project.getId(),"Project","id",id); |
| | | return projectMapper.toDto(project); |
| | | } |
| | | |
| | | @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)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | 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 deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | projectRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ProjectDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ProjectDto project : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("名称", project.getName()); |
| | | map.put("项目类型ID", project.getProjectTypeId()); |
| | | map.put("项目区分:", project.getProjectDistinguish()); |
| | | map.put("需求说明", project.getRequirement()); |
| | | map.put("单价币种", project.getUnitCurrency()); |
| | | 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("备注", project.getRemarks()); |
| | | map.put("创建者", project.getCreateBy()); |
| | | map.put("创建时间", project.getCreateTime()); |
| | | map.put("更新者", project.getUpdateBy()); |
| | | map.put("更新时间", project.getUpdateTime()); |
| | | 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.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author HuaZhe |
| | | * @date 2022-12-15 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface ProjectMapper extends BaseMapper<ProjectDto, Project> { |
| | | |
| | | } |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.config.RsaProperties; |
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.Dept; |
| | | import me.zhengjie.modules.system.service.DataService; |
| | | import me.zhengjie.modules.system.domain.User; |
| | |
| | | userService.download(userService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询用户") |
| | | @ApiOperation("查询用户") |
| | | @PreAuthorize("@el.check('user:list')") |
| | | public ResponseEntity<Object> queryUserAll(UserQueryCriteria criteria){ |
| | | return new ResponseEntity<>(userService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("查询用户") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check('user:list')") |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/project/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/project', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/project/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/project', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del } |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(data) { |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/projectType/all', |
| | | method: 'get', |
| | | data |
| | | params |
| | | }) |
| | | } |
| | | |
| | |
| | | import request from '@/utils/request' |
| | | import { encrypt } from '@/utils/rsaEncrypt' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/users/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/users', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | | |
| | | export default { getAll, add, edit, del } |
| | |
| | | // 批准状态:未承认 |
| | | export const APPROVE_STATUS_UNRECOGNIZED = 'approve_status_unrecognized' |
| | | |
| | | // 任务分类 |
| | | export const TAST_CLASSIFICATION = 'task_classification' |
| | | // 任务分类:功能 |
| | | export const TASk_CLASSIFICATION_FUNCTION = 'task_classification_function' |
| | | // 任务分类:障碍 |
| | | export const TASK_CLASSIFICATION_OBSTACLE = 'task_classification_obstacle' |
| | | |
| | | export default { |
| | | CONFIG_PROPORTION_BASIC_WAGE, |
| | | CONFIG_PROPORTION_MERIT_WAGE, |
| | |
| | | PROJECT_STATUS_STAGNATION, |
| | | APPROVE_STATUS, |
| | | APPROVE_STATUS_ACKNOWLEDGED, |
| | | APPROVE_STATUS_UNRECOGNIZED |
| | | APPROVE_STATUS_UNRECOGNIZED, |
| | | TAST_CLASSIFICATION, |
| | | TASk_CLASSIFICATION_FUNCTION, |
| | | TASK_CLASSIFICATION_OBSTACLE |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.projectTypeId" clearable filterable placeholder="请选择项目类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectTypeList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.unitCurrency" clearable filterable placeholder="请选择单价币种" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.liableUserId" clearable filterable placeholder="请选择责任人" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :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]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :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-option |
| | | v-for="item in dict[approveStatus]" |
| | | :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="100px"> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" maxlength="100" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目类型" prop="projectTypeId"> |
| | | <el-select v-model="form.projectTypeId" clearable filterable placeholder="请选择" style="width: 350px;" @change="projectTypeChange"> |
| | | <el-option |
| | | v-for="item in projectTypeList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="项目区分" maxlength="100" prop="projectDistinguish"> |
| | | <el-input v-model="form.projectDistinguish" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="需求说明"> |
| | | <el-input v-model="form.requirement" :rows="3" type="textarea" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="单价币种" prop="unitCurrency"> |
| | | <el-select v-model="form.unitCurrency" clearable filterable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="单价金额" prop="unitPrice"> |
| | | <money-input :key="random" v-model="form.unitPrice" :width="350" /> |
| | | </el-form-item> |
| | | <el-form-item label="报价金额" prop="totalPrice"> |
| | | <money-input :key="random" v-model="form.totalPrice" :width="350" /> |
| | | </el-form-item> |
| | | <el-form-item label="责任人"> |
| | | <el-select v-model="form.liableUserId" clearable filterable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </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-form-item> |
| | | <el-form-item label="计划结束日期" prop="planEndDate"> |
| | | <el-date-picker v-model="form.planEndDate" type="date" style="width: 350px;" placeholder="选择日期" /> |
| | | </el-form-item> |
| | | <el-form-item 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" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remarks"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 350px;" /> |
| | | </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="name" label="名称" show-overflow-tooltip /> |
| | | <el-table-column prop="projectTypeName" label="项目类型"> |
| | | <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="单价币种"> |
| | | <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="责任人"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.liableUserName }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planStartDate" label="计划开始日期" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planStartDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planEndDate" label="计划结束日期" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planEndDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectStatus" label="项目状态"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectStatus][scope.row.projectStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="approveStatus" label="批准状态"> |
| | | <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"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudProject from '@/api/project/project' |
| | | import crudUser from '@/api/system/user' |
| | | import crudProjectType from '@/api/project/projectType' |
| | | 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 moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import constant from '../../../utils/constant' |
| | | |
| | | const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, requirement: null, unitCurrency: null, unitPrice: null, totalPrice: null, liableUserId: null, planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | 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], |
| | | cruds() { |
| | | return CRUD({ title: '项目', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }}) |
| | | }, |
| | | data() { |
| | | var checkUnitPrice = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('单价金额必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('单价金额必须大于0')) |
| | | } else if (value >= 10000000000) { |
| | | callback(new Error('单价金额必须小于1百亿')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('单价金额不能为空')) |
| | | } |
| | | } |
| | | var checkTotalPrice = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('报价金额必须是数字')) |
| | | } else { |
| | | if (value < 0) { |
| | | callback(new Error('报价金额必须大于0')) |
| | | } else if (value >= 10000000000) { |
| | | callback(new Error('报价金额必须小于1百亿')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'project:add'], |
| | | edit: ['admin', 'project:edit'], |
| | | del: ['admin', 'project:del'], |
| | | download: ['admin', 'project:download'] |
| | | }, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | projectTypeId: [ |
| | | { required: true, message: '项目类型不能为空', trigger: 'change' } |
| | | ], |
| | | projectDistinguish: [ |
| | | { required: true, message: '项目区分不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | unitCurrency: [ |
| | | { required: true, message: '单价币种不能为空', trigger: 'change' } |
| | | ], |
| | | unitPrice: [ |
| | | { required: true, validator: checkUnitPrice, trigger: 'blur' } |
| | | ], |
| | | totalPrice: [ |
| | | { validator: checkTotalPrice, trigger: 'blur' } |
| | | ], |
| | | projectStatus: [ |
| | | { required: true, message: '项目状态不能为空', trigger: 'change' } |
| | | ], |
| | | approveStatus: [ |
| | | { required: true, message: '批准状态不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'name', display_name: '名称' }, |
| | | { key: 'projectTypeId', display_name: '项目类型' }, |
| | | { key: 'projectDistinguish', display_name: '项目区分' }, |
| | | { key: 'unitCurrency', display_name: '单价币种' }, |
| | | { key: 'liableUserId', display_name: '责任人' }, |
| | | { key: 'planStartDate', display_name: '计划开始日期' }, |
| | | { key: 'planEndDate', display_name: '计划结束日期' }, |
| | | { key: 'projectStatus', display_name: '项目状态' }, |
| | | { key: 'approveStatus', display_name: '批准状态' } |
| | | ], |
| | | // 标准单价币种 |
| | | standardUnitCurrency: constant.STANDARD_UNIT_CURRENCY, |
| | | // 项目状态 |
| | | projectStatus: constant.PROJECT_STATUS, |
| | | // 批准状态 |
| | | approveStatus: constant.APPROVE_STATUS, |
| | | // 随机数 |
| | | random: 0, |
| | | // 项目类型列表 |
| | | projectTypeList: [], |
| | | // 用户列表 |
| | | userList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getPackageTypeAll() |
| | | this.getUserListAll() |
| | | return true |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | this.getPackageTypeAll() |
| | | }, |
| | | // 获取项目类型 |
| | | getPackageTypeAll() { |
| | | crudProjectType.getAll().then(res => { |
| | | this.projectTypeList = res |
| | | }).catch(() => { |
| | | |
| | | }) |
| | | }, |
| | | // 获取责任人 |
| | | getUserListAll() { |
| | | crudUser.getAll().then(res => { |
| | | this.userList = res |
| | | }).catch(() => { |
| | | |
| | | }) |
| | | }, |
| | | projectTypeChange() { |
| | | crudProjectType.getAll({ id: this.form.projectTypeId }).then(res => { |
| | | this.form.unitCurrency = res[0].standardUnitCurrency |
| | | this.form.unitPrice = res[0].standardUnitPrice |
| | | this.random = Math.random() |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | name: 'ProjectType', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: ['standard_unit_currency', 'standard_workload_unit'], |
| | | dicts: [constant.STANDARD_UNIT_CURRENCY, constant.STANDARD_WORKLOAD_UNIT], |
| | | cruds() { |
| | | return CRUD({ title: '项目类型', url: 'api/projectType', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectType }}) |
| | | }, |
| | |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | { min: 1, max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | standardUnitCurrency: [ |
| | | { required: true, message: '标准单价币种不能为空', trigger: 'blur' } |