yaozc
2023-01-18 e818b1d6d438c2bfd3985d1edba1842fcf4af1d3
项目绩效
20 files added
1 files modified
1408 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectPerformance.java 68 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectPerformanceDetail.java 68 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/repository/ProjectPerformanceDetailRepository.java 34 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/repository/ProjectPerformanceRepository.java 28 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectPerformanceController.java 87 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectPerformanceDetailController.java 87 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectPerformanceDetailService.java 83 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectPerformanceService.java 83 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectPerformanceDetailDto.java 57 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectPerformanceDetailQueryCriteria.java 42 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectPerformanceDto.java 57 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectPerformanceQueryCriteria.java 38 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectPerformanceDetailServiceImpl.java 111 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectPerformanceServiceImpl.java 184 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/mapstruct/ProjectPerformanceDetailMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/mapstruct/ProjectPerformanceMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java 2 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/projectPerformance.js 27 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/projectPerformanceDetail.js 27 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/projectPerformance/index.vue 146 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/projectPerformanceDetail/index.vue 115 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectPerformance.java
New file
@@ -0,0 +1,68 @@
/*
*  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));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/domain/ProjectPerformanceDetail.java
New file
@@ -0,0 +1,68 @@
/*
*  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));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/repository/ProjectPerformanceDetailRepository.java
New file
@@ -0,0 +1,34 @@
/*
*  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);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/repository/ProjectPerformanceRepository.java
New file
@@ -0,0 +1,28 @@
/*
*  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;
/**
* @website https://eladmin.vip
* @author YaoZengChun
* @date 2023-01-17
**/
public interface ProjectPerformanceRepository extends JpaRepository<ProjectPerformance, Long>, JpaSpecificationExecutor<ProjectPerformance> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectPerformanceController.java
New file
@@ -0,0 +1,87 @@
/*
*  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);
    }
    @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);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectPerformanceDetailController.java
New file
@@ -0,0 +1,87 @@
/*
*  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 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){
        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);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectPerformanceDetailService.java
New file
@@ -0,0 +1,83 @@
/*
*  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.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);
    /**
    * 编辑
    * @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;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectPerformanceService.java
New file
@@ -0,0 +1,83 @@
/*
*  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;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectPerformanceDetailDto.java
New file
@@ -0,0 +1,57 @@
/*
*  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.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author YaoZengChun
* @date 2023-01-17
**/
@Data
public class ProjectPerformanceDetailDto implements Serializable {
    /** ID */
    private Long id;
    /** 员工ID */
    private Long userId;
    /** 绩效工时 */
    private Double performanceHours;
    /** 项目ID */
    private Long projectId;
    /** 绩效年月 */
    private Timestamp yearMonth;
    /** 创建者 */
    private String createBy;
    /** 创建时间 */
    private Timestamp createTime;
    /** 更新者 */
    private String updateBy;
    /** 更新时间 */
    private Timestamp updateTime;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectPerformanceDetailQueryCriteria.java
New file
@@ -0,0 +1,42 @@
/*
*  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;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectPerformanceDto.java
New file
@@ -0,0 +1,57 @@
/*
*  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.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author YaoZengChun
* @date 2023-01-17
**/
@Data
public class ProjectPerformanceDto implements Serializable {
    /** ID */
    private Long id;
    /** 项目ID */
    private Long projectId;
    /** 结算开始日 */
    private Timestamp startDate;
    /** 结算终了日 */
    private Timestamp endDate;
    /** 绩效年月 */
    private Timestamp yearMonth;
    /** 创建者 */
    private String createBy;
    /** 创建时间 */
    private Timestamp createTime;
    /** 更新者 */
    private String updateBy;
    /** 更新时间 */
    private Timestamp updateTime;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/dto/ProjectPerformanceQueryCriteria.java
New file
@@ -0,0 +1,38 @@
/*
*  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 yearMonth;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectPerformanceDetailServiceImpl.java
New file
@@ -0,0 +1,111 @@
/*
*  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.ProjectPerformanceDetail;
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.util.List;
import java.util.Map;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
/**
* @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;
    @Override
    public Map<String,Object> queryAll(ProjectPerformanceDetailQueryCriteria criteria, Pageable pageable){
        Page<ProjectPerformanceDetail> page = projectPerformanceDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        return PageUtil.toPage(page.map(projectPerformanceDetailMapper::toDto));
    }
    @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) {
        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);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectPerformanceServiceImpl.java
New file
@@ -0,0 +1,184 @@
/*
*  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.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 javax.servlet.http.HttpServletResponse;
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;
    @Override
    public Map<String,Object> queryAll(ProjectPerformanceQueryCriteria criteria, Pageable pageable){
        Page<ProjectPerformance> page = projectPerformanceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        return PageUtil.toPage(page.map(projectPerformanceMapper::toDto));
    }
    @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) {
        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());
        projectPerformance.copy(resources);
        projectPerformanceRepository.save(projectPerformance);
    }
    @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);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/mapstruct/ProjectPerformanceDetailMapper.java
New file
@@ -0,0 +1,32 @@
/*
*  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> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/mapstruct/ProjectPerformanceMapper.java
New file
@@ -0,0 +1,32 @@
/*
*  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> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/repository/TaskDaliyRepository.java
@@ -104,7 +104,7 @@
     * @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);
    /**
eladmin-web-master/src/api/projectPerformance.js
New file
@@ -0,0 +1,27 @@
import request from '@/utils/request'
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 }
eladmin-web-master/src/api/projectPerformanceDetail.js
New file
@@ -0,0 +1,27 @@
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 }
eladmin-web-master/src/views/project/projectPerformance/index.vue
New file
@@ -0,0 +1,146 @@
<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.yearMonth" type="month" 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="项目ID" 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" 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" />
        <el-table-column prop="id" label="ID" />
        <el-table-column prop="projectId" label="项目ID" />
        <el-table-column prop="startDate" label="结算开始日" />
        <el-table-column prop="endDate" label="结算终了日" />
        <el-table-column prop="yearMonth" label="绩效年月" />
        <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/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: '项目ID不能为空', trigger: 'blur' }
        ],
        startDate: [
          { required: true, message: '结算开始日不能为空', trigger: 'blur' }
        ],
        endDate: [
          { required: true, message: '结算终了日不能为空', trigger: 'blur' }
        ],
        yearMonth: [
          { required: true, message: '绩效年月不能为空', trigger: 'blur' }
        ]
      },
      // 选中结束时间之后不可选
      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
      })
    }
  }
}
</script>
<style scoped>
</style>
eladmin-web-master/src/views/project/projectPerformanceDetail/index.vue
New file
@@ -0,0 +1,115 @@
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <label class="el-form-item-label">员工ID</label>
        <el-input v-model="query.userId" clearable placeholder="员工ID" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">项目ID</label>
        <el-input v-model="query.projectId" clearable placeholder="项目ID" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">绩效年月</label>
        <el-input v-model="query.yearMonth" 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="员工ID" prop="userId">
            未设置字典,请手动设置 Select
          </el-form-item>
          <el-form-item label="绩效工时" prop="performanceHours">
            <el-input v-model="form.performanceHours" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="项目ID" prop="projectId">
            未设置字典,请手动设置 Select
          </el-form-item>
          <el-form-item label="绩效年月" prop="yearMonth">
            <el-date-picker v-model="form.yearMonth" type="datetime" style="width: 370px;" />
          </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="员工ID" />
        <el-table-column prop="performanceHours" label="绩效工时" />
        <el-table-column prop="projectId" label="项目ID" />
        <el-table-column prop="yearMonth" label="绩效年月" />
        <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/projectPerformanceDetail'
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() {
    return {
      permission: {
        add: ['admin', 'projectPerformanceDetail:add'],
        edit: ['admin', 'projectPerformanceDetail:edit'],
        del: ['admin', 'projectPerformanceDetail:del']
      },
      rules: {
        userId: [
          { required: true, message: '员工ID不能为空', trigger: 'blur' }
        ],
        performanceHours: [
          { required: true, message: '绩效工时不能为空', trigger: 'blur' }
        ],
        projectId: [
          { required: true, message: '项目ID不能为空', trigger: 'blur' }
        ],
        yearMonth: [
          { required: true, message: '绩效年月不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'userId', display_name: '员工ID' },
        { key: 'projectId', display_name: '项目ID' },
        { key: 'yearMonth', display_name: '绩效年月' }
      ]
    }
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>
<style scoped>
</style>