20 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 me.zhengjie.base.BaseEntity; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="project_performance") |
| | | public class ProjectPerformance 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 = "`start_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "结算开始日") |
| | | private Timestamp startDate; |
| | | |
| | | @Column(name = "`end_date`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "结算终了日") |
| | | private Timestamp endDate; |
| | | |
| | | @Column(name = "`year_month`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "绩效年月") |
| | | private Timestamp yearMonth; |
| | | |
| | | public void copy(ProjectPerformance 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.domain; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseEntity; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="project_performance_detail") |
| | | public class ProjectPerformanceDetail extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "员工ID") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`performance_hours`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "绩效工时") |
| | | private Double performanceHours; |
| | | |
| | | @Column(name = "`project_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "项目ID") |
| | | private Long projectId; |
| | | |
| | | @Column(name = "`year_month`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "绩效年月") |
| | | private Timestamp yearMonth; |
| | | |
| | | public void copy(ProjectPerformanceDetail 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.ProjectPerformanceDetail; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.Optional; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | public interface ProjectPerformanceDetailRepository extends JpaRepository<ProjectPerformanceDetail, Long>, JpaSpecificationExecutor<ProjectPerformanceDetail> { |
| | | |
| | | Optional<ProjectPerformanceDetail> findByProjectIdAndUserIdAndYearMonth(Long projectId, Long key, Timestamp yearMonth); |
| | | } |
| 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.ProjectPerformance; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | public interface ProjectPerformanceRepository extends JpaRepository<ProjectPerformance, Long>, JpaSpecificationExecutor<ProjectPerformance> { |
| | | |
| | | // 根据项目查询绩效表 |
| | | @Query(value = "SELECT * FROM `project_performance` WHERE project_id = ?", nativeQuery = true) |
| | | ProjectPerformance 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.ProjectPerformance; |
| | | import me.zhengjie.modules.project.service.ProjectPerformanceService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceQueryCriteria; |
| | | 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 YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "项目绩效管理") |
| | | @RequestMapping("/api/projectPerformance") |
| | | public class ProjectPerformanceController { |
| | | |
| | | private final ProjectPerformanceService projectPerformanceService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('projectPerformance:download')") |
| | | public void exportProjectPerformance(HttpServletResponse response, ProjectPerformanceQueryCriteria criteria) throws IOException { |
| | | projectPerformanceService.download(projectPerformanceService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询项目绩效") |
| | | @ApiOperation("查询项目绩效") |
| | | @PreAuthorize("@el.check('projectPerformance:list')") |
| | | public ResponseEntity<Object> queryProjectPerformance(ProjectPerformanceQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(projectPerformanceService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询项目绩效") |
| | | @ApiOperation("查询项目绩效") |
| | | @PreAuthorize("@el.check('projectPerformance:list')") |
| | | public ResponseEntity<Object> queryProjectPerformance(ProjectPerformanceQueryCriteria criteria){ |
| | | return new ResponseEntity<>(projectPerformanceService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增项目绩效") |
| | | @ApiOperation("新增项目绩效") |
| | | @PreAuthorize("@el.check('projectPerformance:add')") |
| | | public ResponseEntity<Object> createProjectPerformance(@Validated @RequestBody ProjectPerformance resources){ |
| | | return new ResponseEntity<>(projectPerformanceService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改项目绩效") |
| | | @ApiOperation("修改项目绩效") |
| | | @PreAuthorize("@el.check('projectPerformance:edit')") |
| | | public ResponseEntity<Object> updateProjectPerformance(@Validated @RequestBody ProjectPerformance resources){ |
| | | projectPerformanceService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除项目绩效") |
| | | @ApiOperation("删除项目绩效") |
| | | @PreAuthorize("@el.check('projectPerformance:del')") |
| | | public ResponseEntity<Object> deleteProjectPerformance(@RequestBody Long[] ids) { |
| | | projectPerformanceService.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.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformanceDetail; |
| | | import me.zhengjie.modules.project.service.ProjectPerformanceDetailService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailQueryCriteria; |
| | | 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 java.text.ParseException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "项目绩效详细管理") |
| | | @RequestMapping("/api/projectPerformanceDetail") |
| | | public class ProjectPerformanceDetailController { |
| | | |
| | | private final ProjectPerformanceDetailService projectPerformanceDetailService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('projectPerformanceDetail:list')") |
| | | public void exportProjectPerformanceDetail(HttpServletResponse response, ProjectPerformanceDetailQueryCriteria criteria) throws IOException { |
| | | projectPerformanceDetailService.download(projectPerformanceDetailService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询项目绩效详细") |
| | | @ApiOperation("查询项目绩效详细") |
| | | @PreAuthorize("@el.check('projectPerformanceDetail:list')") |
| | | public ResponseEntity<Object> queryProjectPerformanceDetail(ProjectPerformanceDetailQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(projectPerformanceDetailService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增项目绩效详细") |
| | | @ApiOperation("新增项目绩效详细") |
| | | @PreAuthorize("@el.check('projectPerformanceDetail:add')") |
| | | public ResponseEntity<Object> createProjectPerformanceDetail(@Validated @RequestBody ProjectPerformanceDetail resources) throws ParseException { |
| | | return new ResponseEntity<>(projectPerformanceDetailService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改项目绩效详细") |
| | | @ApiOperation("修改项目绩效详细") |
| | | @PreAuthorize("@el.check('projectPerformanceDetail:edit')") |
| | | public ResponseEntity<Object> updateProjectPerformanceDetail(@Validated @RequestBody ProjectPerformanceDetail resources){ |
| | | projectPerformanceDetailService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除项目绩效详细") |
| | | @ApiOperation("删除项目绩效详细") |
| | | @PreAuthorize("@el.check('projectPerformanceDetail:del')") |
| | | public ResponseEntity<Object> deleteProjectPerformanceDetail(@RequestBody Long[] ids) { |
| | | projectPerformanceDetailService.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.ProjectPerformanceDetail; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | public interface ProjectPerformanceDetailService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ProjectPerformanceDetailQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ProjectPerformanceDetailDto> |
| | | */ |
| | | List<ProjectPerformanceDetailDto> queryAll(ProjectPerformanceDetailQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return ProjectPerformanceDetailDto |
| | | */ |
| | | ProjectPerformanceDetailDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ProjectPerformanceDetailDto |
| | | */ |
| | | ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources) throws ParseException; |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ProjectPerformanceDetail resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ProjectPerformanceDetailDto> 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; |
| | | |
| | | import me.zhengjie.modules.project.domain.ProjectPerformance; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceQueryCriteria; |
| | | 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 YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | public interface ProjectPerformanceService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ProjectPerformanceQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ProjectPerformanceDto> |
| | | */ |
| | | List<ProjectPerformanceDto> queryAll(ProjectPerformanceQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return ProjectPerformanceDto |
| | | */ |
| | | ProjectPerformanceDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ProjectPerformanceDto |
| | | */ |
| | | ProjectPerformanceDto create(ProjectPerformance resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ProjectPerformance resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ProjectPerformanceDto> 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 YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Data |
| | | public class ProjectPerformanceDetailDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 员工ID */ |
| | | private Long userId; |
| | | |
| | | /** 绩效工时 */ |
| | | private Double performanceHours; |
| | | |
| | | /** 项目ID */ |
| | | private Long projectId; |
| | | |
| | | /** 绩效年月 */ |
| | | private Timestamp yearMonth; |
| | | |
| | | /** 员工姓名 */ |
| | | private String userName; |
| | | |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.project.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Data |
| | | public class ProjectPerformanceDetailQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long userId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp yearMonth; |
| | | } |
| 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 YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Data |
| | | public class ProjectPerformanceDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 项目ID */ |
| | | private Long projectId; |
| | | |
| | | /** 结算开始日 */ |
| | | private Timestamp startDate; |
| | | |
| | | /** 结算终了日 */ |
| | | private Timestamp endDate; |
| | | |
| | | /** 绩效年月 */ |
| | | private Timestamp yearMonth; |
| | | |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.project.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.sql.Timestamp; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Data |
| | | public class ProjectPerformanceQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long projectId; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp startDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp endDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp yearMonth; |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectCostDto create(ProjectCost resources) { |
| | | Project project = projectRepository.findByIdUpdate(resources.getProjectId()); |
| | | if(project.getApproveStatus().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){ |
| | | throw new BadRequestException("项目已承认无法新增项目成本"); |
| | | } |
| | | return projectCostMapper.toDto(projectCostRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ProjectCost resources) { |
| | | Project project = projectRepository.findByIdUpdate(resources.getProjectId()); |
| | | if(project.getApproveStatus().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){ |
| | | throw new BadRequestException("项目已承认无法修改项目成本"); |
| | | } |
| | | ProjectCost projectCost = projectCostRepository.findById(resources.getId()).orElseGet(ProjectCost::new); |
| | | ValidationUtil.isNull( projectCost.getId(),"ProjectCost","id",resources.getId()); |
| | | projectCost.copy(resources); |
| | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | ProjectCost projectCost = projectCostRepository.findById(id).orElseGet(ProjectCost::new); |
| | | Project project = projectRepository.findByIdUpdate(projectCost.getProjectId()); |
| | | if(project.getApproveStatus().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){ |
| | | throw new BadRequestException("项目已承认无法删除项目成本"); |
| | | } |
| | | projectCostRepository.deleteById(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.service.impl; |
| | | |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformance; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformanceDetail; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDto; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.project.repository.ProjectPerformanceDetailRepository; |
| | | import me.zhengjie.modules.project.service.ProjectPerformanceDetailService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectPerformanceDetailMapper; |
| | | 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.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ProjectPerformanceDetailServiceImpl implements ProjectPerformanceDetailService { |
| | | |
| | | private final ProjectPerformanceDetailRepository projectPerformanceDetailRepository; |
| | | private final ProjectPerformanceDetailMapper projectPerformanceDetailMapper; |
| | | private final UserRepository userRepository; |
| | | private final ProjectRepository projectRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectPerformanceDetailQueryCriteria criteria, Pageable pageable){ |
| | | Page<ProjectPerformanceDetail> page = projectPerformanceDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | //将实体转换为Dto(重写) |
| | | Function<ProjectPerformanceDetail, ProjectPerformanceDetailDto> func = new Function<ProjectPerformanceDetail, ProjectPerformanceDetailDto>(){ |
| | | |
| | | @Override |
| | | public ProjectPerformanceDetailDto apply(ProjectPerformanceDetail projectPerformanceDetail) { |
| | | // 将实体类转换成DTO |
| | | ProjectPerformanceDetailDto projectPerformanceDetailDto = projectPerformanceDetailMapper.toDto(projectPerformanceDetail); |
| | | //查询用户名称 |
| | | User user = userRepository.findById(projectPerformanceDetailDto.getUserId()).orElseGet(User::new); |
| | | projectPerformanceDetailDto.setUserName(user.getNickName()); |
| | | //查询项目名称 |
| | | Project project = projectRepository.findById(projectPerformanceDetailDto.getProjectId()).orElseGet(Project::new); |
| | | projectPerformanceDetailDto.setProjectName(project.getName()); |
| | | return projectPerformanceDetailDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectPerformanceDetailDto> queryAll(ProjectPerformanceDetailQueryCriteria criteria){ |
| | | return projectPerformanceDetailMapper.toDto(projectPerformanceDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ProjectPerformanceDetailDto findById(Long id) { |
| | | ProjectPerformanceDetail projectPerformanceDetail = projectPerformanceDetailRepository.findById(id).orElseGet(ProjectPerformanceDetail::new); |
| | | ValidationUtil.isNull(projectPerformanceDetail.getId(),"ProjectPerformanceDetail","id",id); |
| | | return projectPerformanceDetailMapper.toDto(projectPerformanceDetail); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources) throws ParseException { |
| | | return projectPerformanceDetailMapper.toDto(projectPerformanceDetailRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ProjectPerformanceDetail resources) { |
| | | ProjectPerformanceDetail projectPerformanceDetail = projectPerformanceDetailRepository.findById(resources.getId()).orElseGet(ProjectPerformanceDetail::new); |
| | | ValidationUtil.isNull( projectPerformanceDetail.getId(),"ProjectPerformanceDetail","id",resources.getId()); |
| | | projectPerformanceDetail.copy(resources); |
| | | projectPerformanceDetailRepository.save(projectPerformanceDetail); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | projectPerformanceDetailRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ProjectPerformanceDetailDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ProjectPerformanceDetailDto projectPerformanceDetail : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("员工ID", projectPerformanceDetail.getUserId()); |
| | | map.put("绩效工时", projectPerformanceDetail.getPerformanceHours()); |
| | | map.put("项目ID", projectPerformanceDetail.getProjectId()); |
| | | map.put("绩效年月", projectPerformanceDetail.getYearMonth()); |
| | | map.put("创建者", projectPerformanceDetail.getCreateBy()); |
| | | map.put("创建时间", projectPerformanceDetail.getCreateTime()); |
| | | map.put("更新者", projectPerformanceDetail.getUpdateBy()); |
| | | map.put("更新时间", projectPerformanceDetail.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Function; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceBusinessTravel; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceBusinessTravelDto; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.system.domain.SysConfigProportion; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformance; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformanceDetail; |
| | | import me.zhengjie.modules.project.repository.ProjectPerformanceDetailRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectPerformanceRepository; |
| | | import me.zhengjie.modules.project.service.ProjectPerformanceService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectPerformanceMapper; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskUser; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskUserRepository; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ProjectPerformanceServiceImpl implements ProjectPerformanceService { |
| | | |
| | | private final ProjectPerformanceRepository projectPerformanceRepository; |
| | | private final ProjectPerformanceMapper projectPerformanceMapper; |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final TaskUserRepository taskUserRepository; |
| | | private final ProjectPerformanceDetailRepository projectPerformanceDetailRepository; |
| | | private final ProjectRepository projectRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectPerformanceQueryCriteria criteria, Pageable pageable){ |
| | | Page<ProjectPerformance> page = projectPerformanceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | //将实体转换为Dto(重写) |
| | | Function<ProjectPerformance, ProjectPerformanceDto> func = new Function<ProjectPerformance, ProjectPerformanceDto>(){ |
| | | |
| | | @Override |
| | | public ProjectPerformanceDto apply(ProjectPerformance projectPerformance) { |
| | | // 将实体类转换成DTO |
| | | ProjectPerformanceDto projectPerformanceDto = projectPerformanceMapper.toDto(projectPerformance); |
| | | //查询项目名称 |
| | | Project project = projectRepository.findById(projectPerformanceDto.getProjectId()).orElseGet(Project::new); |
| | | projectPerformanceDto.setProjectName(project.getName()); |
| | | return projectPerformanceDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProjectPerformanceDto> queryAll(ProjectPerformanceQueryCriteria criteria){ |
| | | return projectPerformanceMapper.toDto(projectPerformanceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ProjectPerformanceDto findById(Long id) { |
| | | ProjectPerformance projectPerformance = projectPerformanceRepository.findById(id).orElseGet(ProjectPerformance::new); |
| | | ValidationUtil.isNull(projectPerformance.getId(),"ProjectPerformance","id",id); |
| | | return projectPerformanceMapper.toDto(projectPerformance); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectPerformanceDto create(ProjectPerformance resources) { |
| | | //判断项目名称是否存在 |
| | | getInfo(resources,null); |
| | | return projectPerformanceMapper.toDto(projectPerformanceRepository.save(resources)); |
| | | } |
| | | |
| | | // @Override |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | // public ProjectPerformanceDto create(ProjectPerformance resources) { |
| | | // |
| | | // List<TaskDailyInterface> taskDailyInterfaceList = taskDaliyRepository.collectCostByProjectIdAndFillDateBetweenGroupUserAndTaskId(resources.getProjectId(), resources.getStartDate(), resources.getEndDate()); |
| | | // Map<Long, Double> userPerformanceMap = new HashMap<Long, Double>(); |
| | | // for (TaskDailyInterface taskDailyInterface : taskDailyInterfaceList) { |
| | | // TaskUser taskUser = taskUserRepository.findByTaskIdAndUserId(taskDailyInterface.getTaskId(), taskDailyInterface.getUserId()); |
| | | // userPerformanceMap.put(taskDailyInterface.getUserId(), userPerformanceMap.getOrDefault(taskDailyInterface.getUserId(), 0.0) + (taskUser.getTaskHours() * taskDailyInterface.getTaskProgress() / 100)); |
| | | // } |
| | | // |
| | | // DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | // |
| | | // ProjectPerformance projectPerformance = new ProjectPerformance(); |
| | | // projectPerformance.setProjectId(resources.getProjectId()); |
| | | // |
| | | // projectPerformance.setStartDate(resources.getStartDate()); |
| | | // projectPerformance.setEndDate(resources.getEndDate()); |
| | | // |
| | | // projectPerformance.setYearMonth(resources.getYearMonth()); |
| | | // projectPerformanceRepository.save(projectPerformance); |
| | | // |
| | | // for (Entry<Long, Double> entry : userPerformanceMap.entrySet()) { |
| | | // |
| | | // ProjectPerformanceDetail projectPerformanceDetailLast = |
| | | // projectPerformanceDetailRepository.findByProjectIdAndUserIdAndYearMonth(resources.getProjectId(), entry.getKey(), resources.getYearMonth()).orElse(ProjectPerformanceDetail::new); |
| | | // |
| | | // ProjectPerformanceDetail projectPerformanceDetail = new ProjectPerformanceDetail(); |
| | | // |
| | | // projectPerformanceDetail.setProjectId(resources.getProjectId()); |
| | | // projectPerformanceDetail.setYearMonth(projectPerformance.getYearMonth()); |
| | | // projectPerformanceDetail.setUserId(entry.getKey()); |
| | | // |
| | | // if (projectPerformanceDetailLast.getPerformanceHours() == null) { |
| | | // projectPerformanceDetail.setPerformanceHours(entry.getValue()); |
| | | // } else { |
| | | // projectPerformanceDetail.setPerformanceHours(entry.getValue() - projectPerformanceDetailLast.getPerformanceHours()); |
| | | // } |
| | | // |
| | | // projectPerformanceDetailRepository.save(projectPerformanceDetail); |
| | | // } |
| | | // |
| | | // return projectPerformanceMapper.toDto(projectPerformanceRepository.save(resources)); |
| | | // } |
| | | |
| | | // public Double queryComplianceWork(Long userId, String yearMonth) { |
| | | // // 已达标工时 |
| | | // Double complianceWork = 0D; |
| | | // |
| | | // List<ProjectPerformanceDetail> projectPerformanceDetailList = projectPerformanceDetailRepository.findByUserIdAndYearMonth(userId, yearMonth); |
| | | // for (ProjectPerformanceDetail projectPerformanceDetail : projectPerformanceDetailList) { |
| | | // complianceWork += projectPerformanceDetail.getPerformanceHours(); |
| | | // } |
| | | // return complianceWork; |
| | | // } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ProjectPerformance resources) { |
| | | ProjectPerformance projectPerformance = projectPerformanceRepository.findById(resources.getId()).orElseGet(ProjectPerformance::new); |
| | | ValidationUtil.isNull( projectPerformance.getId(),"ProjectPerformance","id",resources.getId()); |
| | | //判断项目名称是否存在 |
| | | getInfo(resources,projectPerformance); |
| | | projectPerformance.copy(resources); |
| | | projectPerformanceRepository.save(projectPerformance); |
| | | } |
| | | |
| | | /** |
| | | * 重名验证 |
| | | * @param / |
| | | */ |
| | | public void getInfo(ProjectPerformance resources, ProjectPerformance projectPerformance){ |
| | | //查询项目绩效表 |
| | | ProjectPerformance projectPerformance1 = projectPerformanceRepository.findByProjectId(resources.getProjectId()); |
| | | if(ObjectUtils.isNotEmpty(resources.getId())){ |
| | | if(projectPerformance1 != null && projectPerformance1.getId() != projectPerformance.getId()){ |
| | | throw new BadRequestException("项目名称已存在"); |
| | | } |
| | | }else{ |
| | | if(projectPerformance1 != null){ |
| | | throw new BadRequestException("标题项目名称已存在"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | projectPerformanceRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ProjectPerformanceDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ProjectPerformanceDto projectPerformance : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("项目ID", projectPerformance.getProjectId()); |
| | | map.put("结算开始日", projectPerformance.getStartDate()); |
| | | map.put("结算终了日", projectPerformance.getEndDate()); |
| | | map.put("绩效年月", projectPerformance.getYearMonth()); |
| | | map.put("创建者", projectPerformance.getCreateBy()); |
| | | map.put("创建时间", projectPerformance.getCreateTime()); |
| | | map.put("更新者", projectPerformance.getUpdateBy()); |
| | | map.put("更新时间", projectPerformance.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.project.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformanceDetail; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface ProjectPerformanceDetailMapper extends BaseMapper<ProjectPerformanceDetailDto, ProjectPerformanceDetail> { |
| | | |
| | | } |
| 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.ProjectPerformance; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author YaoZengChun |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface ProjectPerformanceMapper extends BaseMapper<ProjectPerformanceDto, ProjectPerformance> { |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT user_id AS userId, task_id AS taskId, COALESCE(MAX(task_progress), 0) AS TaskProgress FROM task_daliy WHERE project_id = ?1 AND fill_date BETWEEN ?2 AND ?3 GROUP BY user_id, task_id", nativeQuery = true) |
| | | List<TaskDailyInterface> collectCostByProjectIdAndFillDateBetweenGroupUserAndTaskId(Long projectId, String sdate, String edate); |
| | | List<TaskDailyInterface> collectCostByProjectIdAndFillDateBetweenGroupUserAndTaskId(Long projectId, Timestamp sdate, Timestamp edate); |
| | | |
| | | |
| | | /** |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/projectPerformance/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/projectPerformance', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/projectPerformance/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/projectPerformance', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/projectPerformanceDetail', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/projectPerformanceDetail/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/projectPerformanceDetail', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | icon="el-icon-view" |
| | | :disabled="crud.selections.length !== 1" |
| | | style="margin-left: 4px !important;" |
| | | @click="toSeeTask(crud.selections[0])" |
| | | > |
| | | 查看任务 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.seeCost" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-view" |
| | | :disabled="crud.selections.length !== 1" |
| | | style="margin-left: 4px !important;" |
| | | @click="toSeeCost(crud.selections[0])" |
| | | > |
| | | 查看成本 |
| | | </el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | |
| | | <el-input v-model="form.name" style="width: 523px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目类型" prop="projectTypeId"> |
| | | <el-select v-model="form.projectTypeId" clearable filterable placeholder="请选择" style="width: 200px;" @change="projectTypeChange"> |
| | | <el-select v-model="form.projectTypeId" clearable filterable placeholder="请选择" style="width: 200px;" :disabled="disabledFlagByApprove" @change="projectTypeChange"> |
| | | <el-option |
| | | v-for="item in projectTypeList" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="项目区分" prop="projectDistinguish"> |
| | | <el-select v-model="form.projectDistinguish" clearable filterable placeholder="请选择" style="width: 200px;"> |
| | | <el-select v-model="form.projectDistinguish" clearable filterable placeholder="请选择" style="width: 200px;" :disabled="disabledFlagByApprove"> |
| | | <el-option |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | |
| | | <el-input v-model="form.requirement" :rows="3" type="textarea" style="width: 523px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="报价单金" prop="quotationPrice"> |
| | | <money-input :key="random" v-model="form.quotationPrice" :width="200" /> |
| | | <money-input :key="random" v-model="form.quotationPrice" :width="200" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="报价币种" prop="unitCurrency"> |
| | | <el-select v-model="form.unitCurrency" clearable filterable placeholder="请选择" style="width: 200px;"> |
| | | <el-select v-model="form.unitCurrency" clearable filterable placeholder="请选择" style="width: 200px;" :disabled="disabledFlagByApprove"> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效单金" prop="performancePrice"> |
| | | <money-input :key="random" v-model="form.performancePrice" :width="200" /> |
| | | <money-input :key="random" v-model="form.performancePrice" :width="200" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效币种"> |
| | | <el-select v-model="standardUnitCurrencyRenminbi" clearable filterable placeholder="请选择" style="width: 200px;" disabled> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效目标" prop="performanceObjectives"> |
| | | <el-input :key="random" v-model="form.performanceObjectives" style="width: 200px;"> |
| | | <el-input :key="random" v-model="form.performanceObjectives" style="width: 200px;" :disabled="disabledFlagByApprove"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="合同总金额" prop="contractPrice"> |
| | | <money-input :key="random" v-model="form.contractPrice" :width="200" /> |
| | | <money-input :key="random" v-model="form.contractPrice" :width="200" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划开始日期" prop="planStartDate"> |
| | | <el-date-picker v-model="form.planStartDate" type="date" :picker-options="pickerOptionsStart" placeholder="选择日期" style="width: 200px;" /> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | del: ['admin', 'project:del'], |
| | | download: ['admin', 'project:download'], |
| | | admit: ['admin', 'project:admit'], |
| | | seeTask: ['admin', 'project:seeTask'] |
| | | seeTask: ['admin', 'project:seeTask'], |
| | | seeCost: ['admin', 'project:seeCost'] |
| | | }, |
| | | rules: { |
| | | name: [ |
| | |
| | | disabledDate: (time) => { |
| | | return _this.form.planStartDate != null && _this.form.planStartDate !== '' ? time.getTime() < new Date(_this.form.planStartDate).getTime() : false |
| | | } |
| | | } |
| | | }, |
| | | // 表单禁用标记(承认状态) |
| | | disabledFlagByApprove: false |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | // 判断表单承认状态 |
| | | if (this.form.approveStatus === constant.APPROVE_STATUS_ACKNOWLEDGED) { |
| | | // 表单禁用标记(承认状态) |
| | | this.disabledFlagByApprove = true |
| | | } else { |
| | | // 表单禁用标记(承认状态) |
| | | this.disabledFlagByApprove = false |
| | | } |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | |
| | | projectId: data.id |
| | | } |
| | | }) |
| | | }, |
| | | // 查看成本 |
| | | toSeeCost(data) { |
| | | // 跳转页面 |
| | | this.$router.push({ |
| | | name: 'ProjectCost', |
| | | params: { |
| | | projectId: data.id |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.projectId" clearable filterable placeholder="请选择项目" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.projectId" clearable filterable placeholder="所属项目" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.userId" clearable filterable placeholder="请选择用户" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.userId" clearable filterable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" clearable filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" clearable filterable placeholder="请选择" style="width: 340px;" :disabled="disabledFlagByApprove"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.approveStatus == approveStatusAcknowledged" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="用户" prop="userId"> |
| | | <el-select v-model="form.userId" clearable filterable placeholder="请选择" style="width: 340px;" @change="timeChange"> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" clearable filterable placeholder="请选择" style="width: 340px;" :disabled="disabledFlagByApprove" @change="getProjectCost"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="进入项目时间" prop="enterProjectTime"> |
| | | <el-date-picker v-model="form.enterProjectTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" style="width: 340px;" @change="timeChange" /> |
| | | <el-date-picker v-model="form.enterProjectTime" type="datetime" :picker-options="pickerOptionsStart" style="width: 340px;" :disabled="disabledFlagByApprove" @change="getProjectCost" /> |
| | | </el-form-item> |
| | | <el-form-item label="退出项目时间" prop="exitProjectTime"> |
| | | <el-date-picker v-model="form.exitProjectTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" style="width: 340px;" @change="timeChange" /> |
| | | <el-date-picker v-model="form.exitProjectTime" type="datetime" :picker-options="pickerOptionsEnd" style="width: 340px;" :disabled="disabledFlagByApprove" @change="getProjectCost" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目成本" prop="projectCost"> |
| | | <!-- <el-input v-model="form.projectCost" style="width: 340px;" /> --> |
| | | <money-input :key="random" v-model="form.projectCost" :width="340" /> |
| | | <money-input :key="random" v-model="form.projectCost" :width="340" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" /> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="projectName" label="项目" show-overflow-tooltip> |
| | | <el-table-column prop="projectName" label="所属项目" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="userName" label="用户" show-overflow-tooltip> |
| | | <el-table-column prop="userName" label="所属员工" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userName }}</el-tag> |
| | | </template> |
| | |
| | | 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, projectId: null, userId: null, enterProjectTime: null, exitProjectTime: null, projectCost: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | |
| | | return CRUD({ title: '项目成本', url: 'api/projectCost', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectCost }}) |
| | | }, |
| | | data() { |
| | | // 指针重指向 |
| | | const _this = this |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'projectCost:add'], |
| | |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | | { required: true, message: '项目不能为空', trigger: 'blur' } |
| | | { required: true, message: '所属项目不能为空', trigger: 'blur' } |
| | | ], |
| | | userId: [ |
| | | { required: true, message: '用户不能为空', trigger: 'blur' } |
| | | { required: true, message: '所属员工不能为空', trigger: 'blur' } |
| | | ], |
| | | enterProjectTime: [ |
| | | { required: true, message: '进入项目时间不能为空', trigger: 'blur' } |
| | |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectId', display_name: '项目' }, |
| | | { key: 'userId', display_name: '用户' }, |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'userId', display_name: '所属员工' }, |
| | | { key: 'enterProjectTime', display_name: '进入项目时间' }, |
| | | { key: 'exitProjectTime', display_name: '退出项目时间' } |
| | | ], |
| | | // 承认状态:已承认 |
| | | approveStatusAcknowledged: constant.APPROVE_STATUS_ACKNOWLEDGED, |
| | | // 用户列表 |
| | | userList: [], |
| | | // 项目列表 |
| | | projectList: [], |
| | | // 随机数 |
| | | random: 0, |
| | | // 选中结束时间之后不可选 |
| | | pickerOptionsStart: { |
| | | disabledDate: (time) => { |
| | | if (this.form.exitProjectTime) { |
| | | return time.getTime() > this.form.exitProjectTime |
| | | } |
| | | return _this.form.exitProjectTime != null && _this.form.exitProjectTime !== '' ? time.getTime() > new Date(_this.form.exitProjectTime).getTime() : false |
| | | } |
| | | }, |
| | | // 选中开始时间之后不可选 |
| | | pickerOptionsEnd: { |
| | | disabledDate: (time) => { |
| | | return time.getTime() < this.form.enterProjectTime |
| | | return _this.form.enterProjectTime != null && _this.form.enterProjectTime !== '' ? time.getTime() < new Date(_this.form.enterProjectTime).getTime() - (86400000 - 1) : false |
| | | } |
| | | } |
| | | }, |
| | | // 表单禁用标记(承认状态) |
| | | disabledFlagByApprove: false |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 判断传参是否为空 |
| | | if (this.$route.params.projectId != null && this.$route.params.projectId !== '' && this.crud.query.projectId === undefined) { |
| | | // 检索条件赋值 |
| | | this.$set(this.crud.query, 'projectId', Number(this.$route.params.projectId)) |
| | | } |
| | | // 获取用户列表 |
| | | this.getUserList() |
| | | // 获取项目列表 |
| | | this.getProjectList() |
| | | return true |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | // 表单禁用标记(承认状态) |
| | | this.disabledFlagByApprove = false |
| | | // 循环项目列表 |
| | | for (let i = 0; i < this.projectList.length; i++) { |
| | | // 判断是否为同一项目 |
| | | if (this.form.projectId === this.projectList[i].id && this.projectList[i].approveStatus === constant.APPROVE_STATUS_ACKNOWLEDGED) { |
| | | // 表单禁用标记(承认状态) |
| | | this.disabledFlagByApprove = true |
| | | } |
| | | } |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | // 获取用户列表 |
| | | getUserList() { |
| | | // 获取用户列表 |
| | | crudUser.getAll().then(res => { |
| | | // 用户列表 |
| | | this.userList = res |
| | | }).catch(() => { |
| | | |
| | | }) |
| | | }, |
| | | // 获取项目列表 |
| | | getProjectList() { |
| | | // 获取项目列表 |
| | | crudProject.getAll().then(res => { |
| | | // 项目列表 |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | timeChange() { |
| | | if (this.form.enterProjectTime != null && this.form.exitProjectTime != null) { |
| | | this.getProjectCost() |
| | | } |
| | | }, |
| | | // 获取项目成本 |
| | | getProjectCost() { |
| | | if (this.form.userId != null) { |
| | | // 判断所属员工、进入项目时间、离开项目时间是否为空 |
| | | if (this.form.userId != null && this.form.enterProjectTime != null && this.form.exitProjectTime != null) { |
| | | // 获取项目成本 |
| | | crudProjectCost.getCost({ |
| | | userId: this.form.userId, |
| | | enterProjectTime: this.form.enterProjectTime, |
| | | exitProjectTime: this.form.exitProjectTime |
| | | }).then(res => { |
| | | // 项目成本 |
| | | this.form.projectCost = res.projectCost |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }) |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.projectId" filterable placeholder="项目名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-date-picker v-model="query.startDate" type="date" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="结算开始日" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.endDate" type="date" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="结算结束日" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.yearMonth" type="month" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="绩效年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px"> |
| | | <el-form-item label="项目名称" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable placeholder="请选择项目" style="width: 350px;" class="filter-item"> |
| | | <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="startDate"> |
| | | <el-date-picker v-model="form.startDate" style="width: 350px;" :picker-options="pickerOptionsStart" type="date" placeholder="选择日期" /> |
| | | </el-form-item> |
| | | <el-form-item label="结算终了日" prop="endDate"> |
| | | <el-date-picker v-model="form.endDate" type="date" :picker-options="pickerOptionsEnd" style="width: 350px;" placeholder="选择日期" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效年月" prop="yearMonth"> |
| | | <el-date-picker v-model="form.yearMonth" type="month" value-format="yyyy-MM-dd" clearable placeholder="绩效年月" style="width: 350px;" class="filter-item" /> |
| | | </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" show-overflow-tooltip /> |
| | | <el-table-column prop="projectId" label="项目名称" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="startDate" label="结算开始日" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.startDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="endDate" label="结算终了日" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.endDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="yearMonth" label="绩效年月" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ substr(scope.row.yearMonth) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','projectPerformance:edit','projectPerformance: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 crudProjectPerformance from '@/api/project/projectPerformance' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, projectId: null, startDate: null, endDate: null, yearMonth: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'ProjectPerformance', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '项目绩效', url: 'api/projectPerformance', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectPerformance }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'projectPerformance:add'], |
| | | edit: ['admin', 'projectPerformance:edit'], |
| | | del: ['admin', 'projectPerformance:del'], |
| | | download: ['admin', 'projectPerformance:download'] |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | | { required: true, message: '项目名称不能为空', trigger: 'change' } |
| | | ], |
| | | startDate: [ |
| | | { required: true, message: '结算开始日不能为空', trigger: 'change' } |
| | | ], |
| | | endDate: [ |
| | | { required: true, message: '结算终了日不能为空', trigger: 'change' } |
| | | ], |
| | | yearMonth: [ |
| | | { required: true, message: '绩效年月不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | // 选中结束时间之后不可选 |
| | | pickerOptionsStart: { |
| | | disabledDate: (time) => { |
| | | if (this.form.endDate) { |
| | | return time.getTime() > Date.now() || time.getTime() > this.form.endDate |
| | | } |
| | | } |
| | | }, |
| | | // 选中开始时间之后不可选 |
| | | pickerOptionsEnd: { |
| | | disabledDate: (time) => { |
| | | return time.getTime() > Date.now() || time.getTime() < this.form.startDate |
| | | } |
| | | }, |
| | | // 项目列表 |
| | | projectList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getprojectAll() |
| | | return true |
| | | }, |
| | | // 获取信息项目列表 |
| | | getprojectAll() { |
| | | crudProject.getAll().then(res => { |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | // 截取年月 |
| | | substr(data) { |
| | | return data.substring(0,7) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.userId" 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-select v-model="query.projectId" filterable placeholder="项目名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-date-picker v-model="query.yearMonth" type="month" value-format="yyyy-MM-dd HH:mm:ss" clearable placeholder="绩效年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择员工" style="width: 370px;"> |
| | | <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="performanceHours"> |
| | | <el-input v-model="form.performanceHours" style="width: 370px;"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="项目名称" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择项目名称" style="width: 370px;"> |
| | | <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="yearMonth"> |
| | | <el-date-picker v-model="form.yearMonth" type="month" value-format="yyyy-MM-dd" clearable placeholder="绩效年月" style="width: 370px;" class="filter-item" /> |
| | | </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="userId" label="员工" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceHours" label="绩效工时" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.performanceHours + '(时)' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectId" label="项目名称" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="yearMonth" label="绩效年月" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ substr(scope.row.yearMonth) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','projectPerformanceDetail:edit','projectPerformanceDetail: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 crudProjectPerformanceDetail from '@/api/project/projectPerformanceDetail' |
| | | import crudProject from '@/api/project/project' |
| | | import crudUser from '@/api/system/user' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, userId: null, performanceHours: null, projectId: null, yearMonth: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'ProjectPerformanceDetail', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '项目绩效详细', url: 'api/projectPerformanceDetail', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectPerformanceDetail }}) |
| | | }, |
| | | data() { |
| | | // 时长(千内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'projectPerformanceDetail:add'], |
| | | edit: ['admin', 'projectPerformanceDetail:edit'], |
| | | del: ['admin', 'projectPerformanceDetail:del'], |
| | | download: ['admin', 'projectPerformanceDetail:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '员工ID不能为空', trigger: 'change' } |
| | | ], |
| | | performanceHours: [ |
| | | { required: true, message: '绩效工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '项目ID不能为空', trigger: 'change' } |
| | | ], |
| | | yearMonth: [ |
| | | { required: true, message: '绩效年月不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '员工ID' }, |
| | | { key: 'projectId', display_name: '项目ID' }, |
| | | { key: 'yearMonth', display_name: '绩效年月' } |
| | | ], |
| | | projectList: [], |
| | | userList: [] |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getprojectAll() |
| | | this.getUser() |
| | | return true |
| | | }, |
| | | // 获取信息项目列表 |
| | | getprojectAll() { |
| | | crudProject.getAll().then(res => { |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | // 获取员工信息 |
| | | getUser() { |
| | | crudUser.getAll().then(res => { |
| | | this.userList = res |
| | | }) |
| | | }, |
| | | // 截取年月 |
| | | substr(data) { |
| | | return data.substring(0,7) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.blurry" clearable placeholder="请输入项目名" style="width: 185px" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.distinguish" filterable clearable placeholder="请选择项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.belongYear" filterable clearable placeholder="请选择年度" style="width: 185px;" class="filter-item"> |
| | | <el-select v-model="query.belongYear" filterable clearable placeholder="年度" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in belongYearList" |
| | | :key="item" |
| | |
| | | :value="item" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.belongWeek" filterable clearable placeholder="请选择周数" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.belongWeek" filterable clearable placeholder="周数" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in belongWeekList" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | /> |
| | | </el-select> |
| | | <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.distinguish" filterable clearable placeholder="项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <rrOperation :crud="crud" /> |
| | |
| | | <!--表单组件--> |
| | | <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="project.id"> |
| | | <el-form-item label="所属项目" prop="project.id"> |
| | | <el-select v-model="form.project.id" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabled || crud.status.add !== 1"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="年度" prop="belongYear"> |
| | | <el-select v-model="form.belongYear" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabled || crud.status.add !== 1"> |
| | | <el-option |
| | | v-for="item in belongYearList" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="form.belongYear" style="width: 370px;" :disabled="disabled || crud.status.add !== 1" /> |
| | | </el-form-item> |
| | | <el-form-item label="周数" prop="belongWeek"> |
| | | <el-select v-model="form.belongWeek" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabled || crud.status.add !== 1"> |
| | | <el-option |
| | | v-for="item in belongWeekList2" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | :disabled="item.approveStatus == approveStatusUnsettled" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="form.belongWeek" style="width: 370px;" :disabled="disabled || crud.status.add !== 1" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目进度" prop="projectProgress"> |
| | | <el-input v-model="form.projectProgress" style="width: 370px;" :disabled="disabled"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="批准状态" prop="approveStatus"> |
| | | <el-form-item label="承认状态" prop="approveStatus"> |
| | | <el-select v-model="form.approveStatus" filterable clearable :disabled="disabled" placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[approveStatus]" |
| | |
| | | <!--表格渲染--> |
| | | <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="belongYear" label="年度" width="70" /> |
| | | <el-table-column prop="belongWeek" label="周数" width="50" /> |
| | | <el-table-column prop="projectName" label="项目" show-overflow-tooltip width="170"> |
| | | <el-table-column show-overflow-tooltip prop="belongYear" label="年度" /> |
| | | <el-table-column show-overflow-tooltip prop="belongWeek" label="周数" /> |
| | | <el-table-column show-overflow-tooltip prop="projectName" label="所属项目" width="140"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.project.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="lastedProgress" label="预计进度" show-overflow-tooltip width="70"> |
| | | <el-table-column show-overflow-tooltip prop="lastedProgress" label="预计进度"> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.lastedProgress ? scope.row.lastedProgress : 0) + '%' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectProgress" label="实际进度" show-overflow-tooltip width="70"> |
| | | <el-table-column show-overflow-tooltip prop="projectProgress" label="实际进度"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.lastedProgress > scope.row.projectProgress" type="danger">{{ (scope.row.projectProgress ? scope.row.projectProgress : 0) + '%' }}</el-tag> |
| | | <el-tag v-else>{{ (scope.row.projectProgress ? scope.row.projectProgress : 0) + '%' }}</el-tag> |
| | | <span :style="{ color: scope.row.lastedProgress > scope.row.projectProgress ? 'red' : '' }">{{ (scope.row.projectProgress ? scope.row.projectProgress : 0) + '%' }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="approveStatus" label="批准状态" width="80"> |
| | | <el-table-column show-overflow-tooltip 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="moneyTotalInit" label="计划总成本" align="center" width="100"> |
| | | <el-table-column show-overflow-tooltip prop="moneyTotalInit" label="计划总成本"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.moneyTotalInit != null && scope.row.moneyTotalInit != '' ? crud.toMoney(scope.row.moneyTotalInit) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.moneyTotalInit != null && scope.row.lastProjectProcess.moneyTotalInit != '' ? crud.toMoney(scope.row.moneyTotalInit - scope.row.lastProjectProcess.moneyTotalInit) : 0 }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="moneyTotalCost" label="总消耗成本" align="center" width="100"> |
| | | <el-table-column show-overflow-tooltip prop="moneyTotalCost" label="总消耗成本"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.moneyTotalCost != null && scope.row.moneyTotalCost != '' ? crud.toMoney(scope.row.moneyTotalCost) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.moneyTotalCost != null && scope.row.lastProjectProcess.moneyTotalCost != '' ? crud.toMoney(scope.row.moneyTotalCost - scope.row.lastProjectProcess.moneyTotalCost) : 0 }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="realLastCost" label="本周消化工时" align="center" width="100" /> |
| | | <el-table-column prop="workTotalInit" label="总工作量" align="center" width="100"> |
| | | <el-table-column show-overflow-tooltip prop="realLastCost" label="本周消化工时" /> |
| | | <el-table-column show-overflow-tooltip prop="workTotalInit" label="总工作量"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.workTotalInit != null && scope.row.workTotalInit != '' ? crud.toMoney(scope.row.workTotalInit) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.workTotalInit != null && scope.row.lastProjectProcess.workTotalInit != '' ? crud.toMoney(scope.row.workTotalInit - scope.row.lastProjectProcess.workTotalInit) : 0 }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="workTotalCost" label="总消耗工作量" align="center" width="100"> |
| | | <el-table-column show-overflow-tooltip prop="workTotalCost" label="总消耗工作量"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.workTotalCost != null && scope.row.workTotalCost != '' ? crud.toMoney(scope.row.workTotalCost) : 0 }} |
| | | ({{ scope.row.lastProjectProcess.workTotalCost != null && scope.row.lastProjectProcess.workTotalCost != '' ? crud.toMoney(scope.row.workTotalCost - scope.row.lastProjectProcess.workTotalCost) : 0 }}) |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column show-overflow-tooltip prop="remarks" label="备注" width="140" /> |
| | | <el-table-column show-overflow-tooltip prop="createTime" label="创建时间" width="140" /> |
| | | <el-table-column v-if="checkPer(['admin','projectProgress:edit','projectProgress:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | <el-input v-model="form.name" style="width: 340px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" clearable filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-model="form.projectId" clearable filterable placeholder="请选择" style="width: 340px;" :disabled="disabledFlagByApprove"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务分类" prop="taskClassification"> |
| | | <el-select v-model="form.taskClassification" clearable filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-model="form.taskClassification" clearable filterable placeholder="请选择" style="width: 340px;" :disabled="disabledFlagByApprove"> |
| | | <el-option |
| | | v-for="item in dict[taskClassification]" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input v-model="form.description" :rows="3" type="textarea" style="width: 340px;" /> |
| | | <el-input v-model="form.description" :rows="3" type="textarea" style="width: 340px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划开始时间"> |
| | | <el-date-picker v-model="form.planStartTime" type="datetime" :picker-options="pickerOptionsStart" style="width: 340px;" /> |
| | | <el-date-picker v-model="form.planStartTime" type="datetime" :picker-options="pickerOptionsStart" style="width: 340px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划结束时间"> |
| | | <el-date-picker v-model="form.planEndTime" type="datetime" :picker-options="pickerOptionsEnd" style="width: 340px;" /> |
| | | <el-date-picker v-model="form.planEndTime" type="datetime" :picker-options="pickerOptionsEnd" style="width: 340px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工时" prop="planHours"> |
| | | <el-input v-model="form.planHours" style="width: 340px;" /> |
| | | <el-input v-model="form.planHours" style="width: 340px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量" prop="planWorkload"> |
| | | <el-input v-model="form.planWorkload" style="width: 340px;" /> |
| | | <el-input v-model="form.planWorkload" style="width: 340px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量单位"> |
| | | <el-select v-model="form.planWorkloadUnit" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-model="form.planWorkloadUnit" filterable placeholder="请选择" style="width: 340px;" :disabled="disabledFlagByApprove"> |
| | | <el-option |
| | | v-for="item in dict[standardWorkloadUnit]" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" /> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | disabledDate: (time) => { |
| | | return _this.form.planStartTime != null && _this.form.planStartTime !== '' ? time.getTime() < new Date(_this.form.planStartTime).getTime() - (86400000 - 1) : false |
| | | } |
| | | } |
| | | }, |
| | | // 表单禁用标记(承认状态) |
| | | disabledFlagByApprove: false |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | // 表单禁用标记(承认状态) |
| | | this.disabledFlagByApprove = false |
| | | // 循环项目列表 |
| | | for (let i = 0; i < this.projectList.length; i++) { |
| | | // 判断是否为同一项目 |
| | | if (this.form.projectId === this.projectList[i].id && this.projectList[i].approveStatus === constant.APPROVE_STATUS_ACKNOWLEDGED) { |
| | | // 表单禁用标记(承认状态) |
| | | this.disabledFlagByApprove = true |
| | | } |
| | | } |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.name" clearable placeholder="请输入名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | |
| | | <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="120px"> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" maxlength="100" style="width: 330px;" /> |
| | | <el-input v-model="form.name" style="width: 330px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="标准单价币种" prop="standardUnitCurrency"> |
| | | <el-form-item label="标准报价单金" prop="standardQuotationPrice"> |
| | | <money-input :key="random" v-model="form.standardQuotationPrice" :width="330" /> |
| | | </el-form-item> |
| | | <el-form-item label="标准报价币种" prop="standardUnitCurrency"> |
| | | <el-select v-model="form.standardUnitCurrency" filterable placeholder="请选择" style="width: 330px;"> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="标准报价单金" prop="standardQuotationPrice"> |
| | | <money-input :key="random" v-model="form.standardQuotationPrice" :width="330" /> |
| | | </el-form-item> |
| | | <el-form-item label="标准绩效单金" prop="standardPerformancePrice"> |
| | | <money-input :key="random" v-model="form.standardPerformancePrice" :width="330" /> |
| | | </el-form-item> |
| | | <el-form-item label="标准绩效币种"> |
| | | <el-select v-model="standardUnitCurrencyRenminbi" filterable placeholder="请选择" style="width: 330px;" disabled> |
| | | <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="standardPerformanceObjectives"> |
| | | <el-input v-model="form.standardPerformanceObjectives" filterable placeholder="请输入绩效目标" style="width: 330px;"> |
| | | <el-input v-model="form.standardPerformanceObjectives" style="width: 330px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | <!--表格渲染--> |
| | | <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="standardUnitCurrency" label="标准单价币种"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][scope.row.standardUnitCurrency] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="standardQuotationPrice" label="标准报价单金"> |
| | | <el-table-column show-overflow-tooltip prop="name" label="名称" /> |
| | | <el-table-column show-overflow-tooltip prop="standardQuotationPrice" label="标准报价单金"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.standardQuotationPrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="standardPerformancePrice" label="标准绩效单金"> |
| | | <el-table-column show-overflow-tooltip prop="standardUnitCurrency" label="标准报价币种"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][scope.row.standardUnitCurrency] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="standardPerformancePrice" label="标准绩效单金"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.standardPerformancePrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="standardPerformanceObjectives" label="标准绩效目标"> |
| | | <el-table-column show-overflow-tooltip label="标准绩效币种"> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][standardUnitCurrencyRenminbi] }}</el-tag> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="standardPerformanceObjectives" label="标准绩效目标"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.standardPerformanceObjectives }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="standardWorkloadUnit" label="标准工作量单位"> |
| | | <el-table-column show-overflow-tooltip prop="standardWorkloadUnit" label="标准工作量单位"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[standardWorkloadUnit][scope.row.standardWorkloadUnit] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column show-overflow-tooltip prop="remarks" label="备注" /> |
| | | <el-table-column show-overflow-tooltip prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','projectType:edit','projectType:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | |
| | | return CRUD({ title: '项目类型', url: 'api/projectType', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectType }}) |
| | | }, |
| | | data() { |
| | | var checkStandardQuotationPrice = (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百亿')) |
| | | // 金额(十亿内)验证 |
| | | var priceValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 1000000000)) { |
| | | callback(new Error('请输入 十亿 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('标准报价单金不能为空')) |
| | | } |
| | | } |
| | | var checkStandardPerformancePrice = (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('标准绩效单金不能为空')) |
| | | } |
| | | } |
| | | // 比例(百内)验证 |
| | |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | standardUnitCurrency: [ |
| | | { required: true, message: '标准单价币种不能为空', trigger: 'blur' } |
| | | { max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | standardQuotationPrice: [ |
| | | { required: true, validator: checkStandardQuotationPrice, trigger: 'blur' } |
| | | { required: true, message: '标准报价单金不能为空', trigger: 'blur' }, |
| | | { validator: priceValidate, trigger: 'blur' } |
| | | ], |
| | | standardUnitCurrency: [ |
| | | { required: true, message: '标准报价币种不能为空', trigger: 'change' } |
| | | ], |
| | | standardPerformancePrice: [ |
| | | { required: true, validator: checkStandardPerformancePrice, trigger: 'blur' } |
| | | { required: true, message: '标准绩效单金不能为空', trigger: 'blur' }, |
| | | { validator: priceValidate, trigger: 'blur' } |
| | | ], |
| | | standardPerformanceObjectives: [ |
| | | { required: true, validator: proportionValidate, trigger: 'blur' } |
| | | { required: true, message: '标准绩效目标不能为空', trigger: 'blur' }, |
| | | { validator: proportionValidate, trigger: 'blur' } |
| | | ], |
| | | standardWorkloadUnit: [ |
| | | { required: true, message: '标准工作量单位不能为空', trigger: 'blur' } |
| | | { required: true, message: '标准工作量单位不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | |
| | | ], |
| | | // 标准单价币种 |
| | | standardUnitCurrency: constant.STANDARD_UNIT_CURRENCY, |
| | | // 标准单价币种:人民币 |
| | | standardUnitCurrencyRenminbi: constant.STANDARD_UNIT_CURRENCY_RENMINBI, |
| | | // 标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 随机数 |