Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into zhaoss
# Conflicts:
# eladmin-web-master/src/views/attendance/attendanceCardReplacement/index.vue
# eladmin-web-master/src/views/attendance/attendanceGoOut/index.vue
# eladmin-web-master/src/views/attendance/attendanceLeave/index.vue
1 files added
37 files modified
2 files renamed
| | |
| | | @PutMapping(value = "/approve") |
| | | @Log("审核/撤销功能") |
| | | @ApiOperation("审核/撤销功能") |
| | | @PreAuthorize("@el.check('attendanceBusinessTravel:approve')") |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceBusinessTravel resources) throws Exception { |
| | | attendanceBusinessTravelService.updateApprove(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | |
| | | @PutMapping(value = "/approve") |
| | | @Log("审核功能") |
| | | @ApiOperation("审核功能") |
| | | @PreAuthorize("@el.check('attendanceCardreplacement:approve')") |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceCardreplacement resources){ |
| | | attendanceCardreplacementService.updateApprove(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | |
| | | @PutMapping(value = "/revoke") |
| | | @Log("补卡撤销") |
| | | @ApiOperation("补卡撤销") |
| | | @PreAuthorize("@el.check('attendanceCardreplacement:revoke')") |
| | | public ResponseEntity<Object> checkInApplicationPass(@Validated @RequestBody AttendanceCardreplacement resources){ |
| | | attendanceCardreplacementService.cardRevoke(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | |
| | | return new ResponseEntity<>(attendanceService.queryAttendanceHours(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/getExceptional") |
| | | @Log("获取异常") |
| | | @ApiOperation("获取异常") |
| | | public ResponseEntity<Object> getExceptional(@Validated @RequestBody String Number){ |
| | | attendanceService.getExceptional(Number); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PostMapping(value = "/getUserMakeUpCard") |
| | | @Log("补卡判断登录人") |
| | | @ApiOperation("补卡判断登录人") |
| | |
| | | } |
| | | |
| | | @PutMapping(value = "/approve") |
| | | @Log("审核功能") |
| | | @ApiOperation("审核功能") |
| | | @Log("审核/撤销功能") |
| | | @ApiOperation("审核/撤销功能") |
| | | @PreAuthorize("@el.check('attendanceGoOut:approve')") |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceGoOut resources) throws Exception { |
| | | attendanceGoOutService.updateApprove(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | |
| | | @PutMapping(value = "/approve") |
| | | @Log("审核功能") |
| | | @ApiOperation("审核功能") |
| | | @PreAuthorize("@el.check('attendanceLeave:approve')") |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceLeave resources) throws Exception { |
| | | attendanceLeaveService.updateApprove(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | |
| | | */ |
| | | Double queryAttendanceHours(AttendanceQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 获取异常信息 |
| | | * @param Number |
| | | */ |
| | | void getExceptional(String Number); |
| | | |
| | | void getUserMakeUpCard(String userId); |
| | | |
| | |
| | | String bussStartTime = df.format(resources.getTravelStartTime()); |
| | | String bussEndTime = df.format(resources.getTravelEndTime()); |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(bussStartTime, bussEndTime, resources.getUserId()); |
| | | repeatValidation(bussStartTime, bussEndTime, resources.getUserId() == null ? SecurityUtils.getCurrentUserId() : resources.getUserId()); |
| | | // 验证出差时间是否冲突 |
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.checkCreateTime(bussStartTime,bussEndTime, resources.getUserId()); |
| | | if(attendanceBusinessTravelList.size() > 0){ |
| | |
| | | + "已经存在出差记录,请调整时间"); |
| | | }else { |
| | | // 获取当前登陆人信息,设置为请假发起人 |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | User user = userRepository.getOne(resources.getUserId() == null ? SecurityUtils.getCurrentUserId() : resources.getUserId()); |
| | | List<String> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | | // 查询节假日 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll(); |
| | |
| | | String goStartTime = df.format(resources.getOutStartTime()); |
| | | String goEndTime = df.format(resources.getOutEndTime()); |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(goStartTime, goEndTime, resources.getUserId()); |
| | | repeatValidation(goStartTime, goEndTime, resources.getUserId() == null ? SecurityUtils.getCurrentUserId() : resources.getUserId()); |
| | | // 验证请假时间是否冲突 |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.checkCreateTime(goStartTime, goEndTime, resources.getUserId()); |
| | | if(attendanceGoOutList.size() > 0){ |
| | |
| | | + "已经存在外出记录,请调整时间"); |
| | | }else { |
| | | // 获取当前登陆人信息,设置为请假发起人 |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | User user = userRepository.getOne(resources.getUserId() == null ? SecurityUtils.getCurrentUserId() : resources.getUserId()); |
| | | List<String> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | | // 查询节假日 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll(); |
| | |
| | | import me.zhengjie.modules.attendance.repository.AttendanceLeaveRepository; |
| | | import me.zhengjie.modules.attendance.service.dto.*; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.quartz.service.impl.DingTalkServiceImpl; |
| | | import me.zhengjie.modules.quartz.task.OapiDingTalkMethod; |
| | | import me.zhengjie.modules.system.domain.*; |
| | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.*; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AttendanceDto create(Attendance resources) { |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); |
| | | // 查询用户 |
| | | User user = userRepository.findById(resources.getUserId()).orElseGet(User::new); |
| | | resources.setRosteringLunchStartTime(Timestamp.valueOf(df.format(resources.getAttendanceDate()) + " " + dateTimeFormatter.format(user.getSysRostering().getLunchStartTime()))); |
| | | resources.setRosteringLunchEndTime(Timestamp.valueOf(df.format(resources.getAttendanceDate()) + " " + dateTimeFormatter.format(user.getSysRostering().getLunchEndTime()))); |
| | | return attendanceMapper.toDto(attendanceRepository.save(resources)); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | attendanceRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 补卡获取异常信息 |
| | | * @param Number |
| | | */ |
| | | @Override |
| | | public void getExceptional(String Number) { |
| | | if(Number.equals("1")){ |
| | | throw new BadRequestException("上班无需补卡"); |
| | | }else{ |
| | | throw new BadRequestException("下班无需补卡"); |
| | | } |
| | | } |
| | | |
| | |
| | | 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 |
| | |
| | | * @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); |
| | | } |
| | |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | |
| | | public interface ProjectProgressRepository extends JpaRepository<ProjectProgress, Long>, JpaSpecificationExecutor<ProjectProgress> { |
| | | |
| | | |
| | | @Query(value = "SELECT * FROM project_progress WHERE project_id = ?1 ORDER BY create_time DESC", nativeQuery = true) |
| | | List<ProjectProgress> findByProjectId(Long id); |
| | | @Query(value = "SELECT * FROM project_progress WHERE project_id = ?1 AND belong_date < ?2 ORDER BY belong_date DESC", nativeQuery = true) |
| | | List<ProjectProgress> findByProjectId(Long id, Timestamp belongDate); |
| | | |
| | | /** |
| | | * 根据年度、周度、多项目ID查询 |
| | |
| | | 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("新增项目绩效") |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | return new ResponseEntity<>(projectPerformanceDetailService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询项目绩效详细") |
| | | @ApiOperation("查询项目绩效详细") |
| | | @PreAuthorize("@el.check('projectPerformanceDetail:list')") |
| | | public ResponseEntity<Object> queryProjectPerformanceDetail(ProjectPerformanceDetailQueryCriteria criteria){ |
| | | return new ResponseEntity<>(projectPerformanceDetailService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增项目绩效详细") |
| | | @ApiOperation("新增项目绩效详细") |
| | | @PreAuthorize("@el.check('projectPerformanceDetail:add')") |
| | | public ResponseEntity<Object> createProjectPerformanceDetail(@Validated @RequestBody ProjectPerformanceDetail resources){ |
| | | public ResponseEntity<Object> createProjectPerformanceDetail(@Validated @RequestBody ProjectPerformanceDetail resources) throws ParseException { |
| | | return new ResponseEntity<>(projectPerformanceDetailService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | |
| | | import me.zhengjie.modules.project.domain.ProjectCost; |
| | | import me.zhengjie.modules.project.service.dto.ProjectCostDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectCostQueryCriteria; |
| | | |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.text.ParseException; |
| | |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | */ |
| | | void download(List<ProjectCostDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | BigDecimal calcUserCostByDate(Long userId, String enterProjectTime, String exitProjectTime, Map<String, Double> costHoursMap) throws Exception; |
| | | BigDecimal calcUserCostByDate(Long userId, Timestamp enterProjectTime, Timestamp exitProjectTime, Map<String, Double> costHoursMap); |
| | | } |
| | |
| | | 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; |
| | |
| | | * @param resources / |
| | | * @return ProjectPerformanceDetailDto |
| | | */ |
| | | ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources); |
| | | ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources) throws ParseException; |
| | | |
| | | /** |
| | | * 编辑 |
| | |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | * 生成周报 |
| | | * @param ids 项目ID |
| | | */ |
| | | void generateProjectProcess(Integer year, Integer weeks, Long[] ids); |
| | | void autoGenerateProjectProcess(LocalDate localDate, Integer year, Integer weeks); |
| | | |
| | | } |
| | |
| | | package me.zhengjie.modules.project.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Data |
| | | public class ProjectPerformanceDetailDto implements Serializable { |
| | | public class ProjectPerformanceDetailDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | |
| | | /** 绩效年月 */ |
| | | private Timestamp yearMonth; |
| | | |
| | | /** 创建者 */ |
| | | private String createBy; |
| | | /** 员工姓名 */ |
| | | private String userName; |
| | | |
| | | /** 创建时间 */ |
| | | private Timestamp createTime; |
| | | |
| | | /** 更新者 */ |
| | | private String updateBy; |
| | | |
| | | /** 更新时间 */ |
| | | private Timestamp updateTime; |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | } |
| | |
| | | package me.zhengjie.modules.project.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | |
| | | * @date 2023-01-17 |
| | | **/ |
| | | @Data |
| | | public class ProjectPerformanceDto implements Serializable { |
| | | public class ProjectPerformanceDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | |
| | | /** 绩效年月 */ |
| | | private Timestamp yearMonth; |
| | | |
| | | /** 创建者 */ |
| | | private String createBy; |
| | | |
| | | /** 创建时间 */ |
| | | private Timestamp createTime; |
| | | |
| | | /** 更新者 */ |
| | | private String updateBy; |
| | | |
| | | /** 更新时间 */ |
| | | private Timestamp updateTime; |
| | | /** 项目名称 */ |
| | | private String projectName; |
| | | } |
| | |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp startDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp endDate; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Timestamp yearMonth; |
| | | } |
| | |
| | | /** 预计进度 */ |
| | | private Double estimatedProgress; |
| | | |
| | | /** 上周预计进度 */ |
| | | private Double lastedProgress; |
| | | |
| | | /** 项目进度 */ |
| | | private Double projectProgress; |
| | | |
| | |
| | | /** 总消耗绩效工时 */ |
| | | private Double timeTotalCost; |
| | | |
| | | /** 本周消化绩效工时 */ |
| | | private Double timeLastCost; |
| | | |
| | | /** 实际消化工时 */ |
| | | private Double realLastCost; |
| | | |
| | |
| | | |
| | | /** 总消耗工作量 */ |
| | | private Double workTotalCost; |
| | | |
| | | /** 本周消化工作量 */ |
| | | private Double workLastCost; |
| | | |
| | | /** 计划总成本 */ |
| | | private BigDecimal moneyTotalInit; |
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.DayOfWeek; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal calcUserCostByDate(Long userId, String enterProjectTime, String exitProjectTime, Map<String, Double> costHoursMap) throws Exception { |
| | | public BigDecimal calcUserCostByDate(Long userId, Timestamp enterProjectTime, Timestamp exitProjectTime, Map<String, Double> costHoursMap) { |
| | | // 工资 |
| | | BigDecimal wageCost = BigDecimal.valueOf(0); |
| | | // 工作天数 |
| | | LocalDateTime enterProject = LocalDateTime.parse(enterProjectTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | LocalDateTime exitProject = LocalDateTime.parse(exitProjectTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date startDate = simpleDateFormat.parse(enterProjectTime); |
| | | Date endDate = simpleDateFormat.parse(exitProjectTime); |
| | | LocalDateTime enterProject = enterProjectTime.toLocalDateTime(); |
| | | LocalDateTime exitProject = exitProjectTime.toLocalDateTime(); |
| | | |
| | | // 通过id获取用户级别工资 |
| | | List<SysUserLevelWage> sysUserLevelWages = sysUserLevelWageRepository.findByUserId(userId) |
| | | .stream().filter(sysUserLevelWage -> !((sysUserLevelWage.getEndDate() != null && sysUserLevelWage.getEndDate().before(startDate)) || sysUserLevelWage.getStartDate().after(endDate))) |
| | | .stream().filter(sysUserLevelWage -> !((sysUserLevelWage.getEndDate() != null && sysUserLevelWage.getEndDate().before(enterProjectTime)) || sysUserLevelWage.getStartDate().after(exitProjectTime))) |
| | | .collect(Collectors.toList()); |
| | | // 通过id获取用户级别保险 |
| | | List<SysUserLevelInsurance> sysUserLevelInsurances = sysUserLevelInsuranceRepository.findByUserId(userId) |
| | | .stream().filter(sysUserLevelInsurance -> !((sysUserLevelInsurance.getEndDate() != null && sysUserLevelInsurance.getEndDate().before(startDate)) || sysUserLevelInsurance.getStartDate().after(endDate))) |
| | | .stream().filter(sysUserLevelInsurance -> !((sysUserLevelInsurance.getEndDate() != null && sysUserLevelInsurance.getEndDate().before(enterProjectTime)) || sysUserLevelInsurance.getStartDate().after(exitProjectTime))) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 判断是否有用户级别工资 |
| | |
| | | */ |
| | | 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 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.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.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | |
| | | 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); |
| | | return PageUtil.toPage(page.map(projectPerformanceDetailMapper::toDto)); |
| | | //将实体转换为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 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources) { |
| | | public ProjectPerformanceDetailDto create(ProjectPerformanceDetail resources) throws ParseException { |
| | | return projectPerformanceDetailMapper.toDto(projectPerformanceDetailRepository.save(resources)); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void download(List<ProjectPerformanceDetailDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (ProjectPerformanceDetailDto projectPerformanceDetail : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("员工ID", projectPerformanceDetail.getUserId()); |
| | | Project project = projectRepository.findById(projectPerformanceDetail.getProjectId()).orElseGet(Project::new); |
| | | User user = userRepository.findById(projectPerformanceDetail.getUserId()).orElseGet(User::new); |
| | | map.put("员工", user.getNickName()); |
| | | map.put("绩效工时", projectPerformanceDetail.getPerformanceHours()); |
| | | map.put("项目ID", projectPerformanceDetail.getProjectId()); |
| | | map.put("绩效年月", projectPerformanceDetail.getYearMonth()); |
| | | map.put("项目", project.getName()); |
| | | map.put("绩效年月", (df.format(projectPerformanceDetail.getYearMonth())).substring(0,7)); |
| | | map.put("创建者", projectPerformanceDetail.getCreateBy()); |
| | | map.put("创建时间", projectPerformanceDetail.getCreateTime()); |
| | | map.put("更新者", projectPerformanceDetail.getUpdateBy()); |
| | |
| | | |
| | | 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.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; |
| | |
| | | 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); |
| | | return PageUtil.toPage(page.map(projectPerformanceMapper::toDto)); |
| | | //将实体转换为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 |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectPerformanceDto create(ProjectPerformance resources) { |
| | | //判断项目名称是否存在 |
| | | getInfo(resources,null); |
| | | return projectPerformanceMapper.toDto(projectPerformanceRepository.save(resources)); |
| | | } |
| | | |
| | |
| | | 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 |
| | |
| | | @Override |
| | | public void download(List<ProjectPerformanceDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm"); |
| | | 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()); |
| | | Project project = projectRepository.findById(projectPerformance.getProjectId()).orElseGet(Project::new); |
| | | map.put("项目", project.getName()); |
| | | map.put("结算开始日", (df.format(projectPerformance.getStartDate())).substring(0,10)); |
| | | map.put("结算终了日", (df.format(projectPerformance.getEndDate())).substring(0,10)); |
| | | map.put("绩效年月", (df.format(projectPerformance.getYearMonth())).substring(0,7)); |
| | | map.put("创建者", projectPerformance.getCreateBy()); |
| | | map.put("创建时间", projectPerformance.getCreateTime()); |
| | | map.put("更新者", projectPerformance.getUpdateBy()); |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.temporal.WeekFields; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskInterface; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.utils.FileUtil; |
| | |
| | | public Map<String,Object> queryAll(ProjectProgressQueryCriteria criteria, Pageable pageable){ |
| | | Page<ProjectProgress> page = projectProgressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder), pageable); |
| | | |
| | | // 当年第一周需满足四天。(例:2022年的第一周是从1月3号开始的,1号和2号并入到2021年度的最后一周里) |
| | | WeekFields wfs = WeekFields.of(DayOfWeek.MONDAY, 4); |
| | | |
| | | // 将实体类转换为DTO(重写) |
| | |
| | | public ProjectProgressDto apply(ProjectProgress projectProgress) { |
| | | // 将实体类转换成DTO |
| | | ProjectProgressDto projectProgressDto = projectProgressMapper.toDto(projectProgress); |
| | | // 根据项目ID查询项目信息 |
| | | // 获取前一周的周五 |
| | | LocalDate localDate = LocalDate.now() |
| | | .with(wfs.weekBasedYear(), projectProgress.getBelongYear()) |
| | | .with(wfs.weekOfWeekBasedYear(), projectProgress.getBelongWeek()) |
| | | .with(wfs.dayOfWeek(), 1L) |
| | | .with(wfs.dayOfWeek(), 5L) |
| | | .minusDays(7); |
| | | |
| | | // 获取前一周的项目进度信息 |
| | | Optional<ProjectProgress> projectProgressOpl = projectProgressRepository.findByBelongYearAndBelongWeekAndProjectId(localDate.get(wfs.weekBasedYear()), localDate.get(wfs.weekOfWeekBasedYear()), projectProgressDto.getProject().getId()); |
| | | projectProgressDto.setLastProjectProcess(projectProgressOpl.orElseGet(ProjectProgress::new)); |
| | | if (!projectProgressOpl.isPresent()) { |
| | | projectProgressDto.setTimeLastCost(projectProgressDto.getTimeTotalCost()); |
| | | projectProgressDto.setWorkLastCost(projectProgressDto.getWorkTotalCost()); |
| | | projectProgressDto.setLastedProgress(0.0); |
| | | } else { |
| | | if (projectProgressDto.getTimeTotalCost() != null) { |
| | | if (projectProgressOpl.get().getTimeTotalCost() != null) { |
| | | projectProgressDto.setTimeLastCost(projectProgressDto.getTimeTotalCost() - projectProgressOpl.get().getTimeTotalCost()); |
| | | } else { |
| | | projectProgressDto.setTimeLastCost(projectProgressDto.getTimeTotalCost()); |
| | | } |
| | | } |
| | | if (projectProgressDto.getWorkTotalCost() != null) { |
| | | if (projectProgressOpl.get().getWorkTotalCost() != null) { |
| | | projectProgressDto.setWorkLastCost(projectProgressDto.getWorkTotalCost() - projectProgressOpl.get().getWorkTotalCost()); |
| | | } else { |
| | | projectProgressDto.setWorkLastCost(projectProgressDto.getWorkTotalCost()); |
| | | } |
| | | } |
| | | projectProgressDto.setLastedProgress(projectProgressOpl.get().getEstimatedProgress() != null ? projectProgressOpl.get().getEstimatedProgress() : 0.0); |
| | | } |
| | | if (projectProgressDto.getProjectProgress() == null) { |
| | | projectProgressDto.setProjectProgress(0.0); |
| | | } |
| | |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public void generateProjectProcess(Integer year, Integer weeks, Long[] ids) { |
| | | |
| | | List<Project> projectList = null; |
| | | if (ids == null || ids.length == 0) { |
| | | projectList = projectRepository.findByProjectStatus(Constant.PROJECT_STATUS_UNDER_WAY); |
| | | } else { |
| | | projectList = projectRepository.findByProjectStatusAndIdIn(Constant.PROJECT_STATUS_UNDER_WAY, ids); |
| | | } |
| | | |
| | | WeekFields wfs = WeekFields.of(DayOfWeek.MONDAY, 4); |
| | | |
| | | // 根据项目ID查询项目信息 |
| | | LocalDate localDate = LocalDate.now() |
| | | .with(wfs.weekBasedYear(), year) |
| | | .with(wfs.weekOfWeekBasedYear(), weeks) |
| | | .with(wfs.dayOfWeek(), 1L) |
| | | .minusDays(7); |
| | | |
| | | projectList.forEach(project -> { |
| | | // 存在则更新,不存在则插入 |
| | | ProjectProgress projectProgress = projectProgressRepository.findByBelongYearAndBelongWeekAndProjectId(year, weeks, project.getId()).orElseGet(ProjectProgress::new); |
| | | if (projectProgress.getId() == null) { |
| | | projectProgress.setBelongYear(year); |
| | | projectProgress.setBelongWeek(weeks); |
| | | projectProgress.setBelongDate(Timestamp.valueOf(localDate.atStartOfDay())); |
| | | |
| | | projectProgress.setProject(project); |
| | | projectProgress.setApproveStatus(Constant.APPROVE_STATUS_UNRECOGNIZED); |
| | | } |
| | | |
| | | // 总工时 |
| | | Double timeTotalInit = 0.0; |
| | | // 总消化工时 |
| | | Double timeTotalCost = 0.0; |
| | | // 总工作量 |
| | | Double workTotalInit = 0.0; |
| | | // 总消耗工作量 |
| | | Double workTotalCost = 0.0; |
| | | // 真实时长 |
| | | Double realLastCost = 0.0; |
| | | List<Task> taskList = taskRepository.findByProjectIdUntilDate(project.getId(), projectProgress.getBelongDate()); |
| | | |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByProjectId(project.getId()); |
| | | Map<Long, List<TaskDaliy>> collectMap = taskDaliyList.stream().collect(Collectors.groupingBy(TaskDaliy::getUserId)); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | BigDecimal totalCost = BigDecimal.valueOf(0.0); |
| | | for (Entry<Long, List<TaskDaliy>> entry : collectMap.entrySet()) { |
| | | List<TaskDaliy> taskDaliyListSub = entry.getValue(); |
| | | Map<String, Double> costHourMap = new HashMap<String, Double>(); |
| | | taskDaliyListSub.forEach(taskDaliy -> { |
| | | costHourMap.put(sdf.format(taskDaliy.getFillDate()), taskDaliy.getConsumedHours()); |
| | | }); |
| | | String startDate = sdf.format(taskDaliyListSub.get(0).getFillDate()); |
| | | String endDate = sdf.format(taskDaliyListSub.get(taskDaliyListSub.size() - 1).getFillDate()); |
| | | try { |
| | | totalCost = totalCost.add(projectCostService.calcUserCostByDate(entry.getKey(), startDate + " 00:00:00", endDate + " 00:00:00", costHourMap)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | for (Task task : taskList) { |
| | | timeTotalInit = timeTotalInit + task.getPlanHours(); |
| | | workTotalInit = workTotalInit + (task.getPlanWorkload() == null ? 0.0 : task.getPlanWorkload()); |
| | | TaskDailyInterface taskDailyInterface = taskDaliyRepository.collectTaskDaliyUntilDate(task.getId(), projectProgress.getBelongDate()); |
| | | if (Constant.TASK_STATUS_COMPLETED.equals(task.getTaskStatus())) { |
| | | timeTotalCost += BigDecimal.valueOf(task.getPlanHours()).multiply(BigDecimal.valueOf(taskDailyInterface.getTaskProgress())).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_CEILING).doubleValue(); |
| | | } else { |
| | | timeTotalCost += task.getPlanHours(); |
| | | } |
| | | workTotalCost += taskDailyInterface.getConsumedWorkload(); |
| | | realLastCost += taskDailyInterface.getConsumedHours(); |
| | | } |
| | | // 真实时长 |
| | | projectProgress.setRealLastCost(realLastCost); |
| | | // 总消化工时 |
| | | projectProgress.setTimeTotalCost(timeTotalCost); |
| | | // 总工时 |
| | | projectProgress.setTimeTotalInit(timeTotalInit); |
| | | // 总消耗工作量 |
| | | projectProgress.setWorkTotalCost(workTotalCost); |
| | | // 总工作量 |
| | | projectProgress.setWorkTotalInit(workTotalInit); |
| | | // 计划总成本 |
| | | projectProgress.setMoneyTotalInit(project.getPerformancePrice().multiply(BigDecimal.valueOf(timeTotalInit))); |
| | | // 总消耗成本 |
| | | projectProgress.setMoneyTotalCost(totalCost); |
| | | |
| | | // 存在则更新,不存在则插入 |
| | | projectProgressRepository.save(projectProgress); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectProgressDto create(ProjectProgress resources) { |
| | | // 项目进度 check |
| | | checkProjectProgress(resources); |
| | | |
| | | // 项目是否已承认 |
| | | Project project = projectRepository.findByIdUpdate(resources.getProject().getId()); |
| | | if(project.getApproveStatus().equals(Constant.APPROVE_STATUS_UNRECOGNIZED)){ |
| | | throw new BadRequestException("项目未承认无法创建周报"); |
| | | } |
| | | resources.setProject(project); |
| | | |
| | | // 当年第一周需满足四天。(例:2022年的第一周是从1月3号开始的,1号和2号并入到2021年度的最后一周里) |
| | | WeekFields wfs = WeekFields.of(DayOfWeek.MONDAY, 4); |
| | | // 所属日未设定的场合,取对应周的周五 |
| | | if (resources.getBelongDate() == null) { |
| | | LocalDate localDate = LocalDate.now() |
| | | .with(wfs.weekBasedYear(), resources.getBelongYear()) |
| | | .with(wfs.weekOfWeekBasedYear(), resources.getBelongWeek()) |
| | | .with(wfs.dayOfWeek(), 1L); |
| | | .with(wfs.dayOfWeek(), 5L); |
| | | resources.setBelongDate(Timestamp.valueOf(localDate.atStartOfDay())); |
| | | } |
| | | return projectProgressMapper.toDto(projectProgressRepository.save(resources)); |
| | | return generalProjectProgress(resources); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ProjectProgress resources) { |
| | | |
| | | ProjectProgress projectProgress = projectProgressRepository.findById(resources.getId()).orElseGet(ProjectProgress::new); |
| | | ValidationUtil.isNull( projectProgress.getId(),"ProjectProgress","id",resources.getId()); |
| | | |
| | | // 项目是否已承认 |
| | | Project project = projectRepository.findByIdUpdate(resources.getProject().getId()); |
| | | if(project.getApproveStatus().equals(Constant.APPROVE_STATUS_UNRECOGNIZED)){ |
| | | throw new BadRequestException("项目未承认无法创建周报"); |
| | | } |
| | | resources.setProject(project); |
| | | |
| | | // 周报是否已承认 |
| | | if(projectProgress.getApproveStatus().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){ |
| | | throw new BadRequestException("周报已承认无法修改"); |
| | | } |
| | | |
| | | // 当年第一周需满足四天。(例:2022年的第一周是从1月3号开始的,1号和2号并入到2021年度的最后一周里) |
| | | WeekFields wfs = WeekFields.of(DayOfWeek.MONDAY, 4); |
| | | // 所属日未设定的场合,取对应周的周五 |
| | | if (resources.getBelongDate() == null) { |
| | | LocalDate localDate = LocalDate.now() |
| | | .with(wfs.weekBasedYear(), resources.getBelongYear()) |
| | | .with(wfs.weekOfWeekBasedYear(), resources.getBelongWeek()) |
| | | .with(wfs.dayOfWeek(), 5L); |
| | | resources.setBelongDate(Timestamp.valueOf(localDate.atStartOfDay())); |
| | | } |
| | | |
| | | projectProgress.copy(resources); |
| | | projectProgressRepository.save(projectProgress); |
| | | generalProjectProgress(resources); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void autoGenerateProjectProcess(LocalDate localDate, Integer year, Integer weeks) { |
| | | |
| | | // 获取所有的【进行中】的项目 |
| | | List<Project> projectList = projectRepository.findByProjectStatus(Constant.PROJECT_STATUS_UNDER_WAY); |
| | | |
| | | projectList.forEach(project -> { |
| | | // 存在则更新,不存在则插入 |
| | | ProjectProgress projectProgress = projectProgressRepository.findByBelongYearAndBelongWeekAndProjectId(year, weeks, project.getId()).orElseGet(ProjectProgress::new); |
| | | // 初始主键 |
| | | if (projectProgress.getId() == null) { |
| | | projectProgress.setBelongYear(year); |
| | | projectProgress.setBelongWeek(weeks); |
| | | projectProgress.setBelongDate(Timestamp.valueOf(localDate.atStartOfDay())); |
| | | |
| | | projectProgress.setProject(project); |
| | | projectProgress.setApproveStatus(Constant.APPROVE_STATUS_UNRECOGNIZED); |
| | | } |
| | | |
| | | // 如果已经承认则不需要更新 |
| | | if (Constant.APPROVE_STATUS_ACKNOWLEDGED.equals(projectProgress.getApproveStatus())) { |
| | | return; |
| | | } |
| | | |
| | | generalProjectProgress(projectProgress); |
| | | }); |
| | | } |
| | | |
| | | private ProjectProgressDto generalProjectProgress(ProjectProgress resources) { |
| | | |
| | | // 总消化工时 |
| | | Double timeTotalCost = 0.0; |
| | | // 总消耗工作量 |
| | | Double workTotalCost = 0.0; |
| | | // 真实时长 |
| | | Double realLastCost = 0.0; |
| | | List<TaskDailyInterface> taskDaliyWithTaskList = taskDaliyRepository.collectByProjectIdAndFillDateLessThanGroupByTaskIdJoinTask(resources.getProject().getId(), resources.getBelongDate()); |
| | | |
| | | for (TaskDailyInterface taskDaily : taskDaliyWithTaskList) { |
| | | // 总消化工时 |
| | | timeTotalCost += BigDecimal.valueOf(taskDaily.getPlanHours()).multiply(BigDecimal.valueOf(taskDaily.getTaskProgress())).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_CEILING).doubleValue(); |
| | | // 总消耗工作量 |
| | | workTotalCost += taskDaily.getConsumedWorkload(); |
| | | // 真实时长 |
| | | realLastCost += taskDaily.getConsumedHours(); |
| | | } |
| | | // 总消化工时 |
| | | resources.setTimeTotalCost(timeTotalCost); |
| | | // 总消耗工作量 |
| | | resources.setWorkTotalCost(workTotalCost); |
| | | // 真实时长 |
| | | resources.setRealLastCost(realLastCost); |
| | | |
| | | if (resources.getId() == null) { |
| | | // 根据项目ID取得任务信息 |
| | | TaskInterface taskTotal = taskRepository.collectByProjectId(resources.getProject().getId()); |
| | | // 总工时 |
| | | resources.setTimeTotalInit(taskTotal.getPlanHours()); |
| | | // 总工作量 |
| | | resources.setWorkTotalInit(taskTotal.getPlanWorkload()); |
| | | // 计划总成本 |
| | | resources.setMoneyTotalInit(resources.getProject().getPerformancePrice().multiply(BigDecimal.valueOf(taskTotal.getPlanHours()))); |
| | | } |
| | | |
| | | // 根据日期和项目ID取得日报信息 |
| | | List<TaskDailyInterface> taskDaliyList = taskDaliyRepository.collectByProjectIdAndFillDateLessThanGroupByUserIdAndFillDate(resources.getProject().getId(), resources.getBelongDate()); |
| | | Map<Long, List<TaskDailyInterface>> collectMap = taskDaliyList.stream().collect(Collectors.groupingBy(TaskDailyInterface::getUserId)); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 总消耗成本 |
| | | BigDecimal totalCost = BigDecimal.valueOf(0.0); |
| | | for (Entry<Long, List<TaskDailyInterface>> entry : collectMap.entrySet()) { |
| | | List<TaskDailyInterface> taskDaliyListSub = entry.getValue(); |
| | | // 最小日期 |
| | | TaskDailyInterface taskDaliyFirst = taskDaliyListSub.stream().min(Comparator.comparing(taskDaliy -> taskDaliy.getFillDate())).get(); |
| | | // 最大日期 |
| | | TaskDailyInterface taskDaliyLast = taskDaliyListSub.stream().max(Comparator.comparing(taskDaliy -> taskDaliy.getFillDate())).get(); |
| | | Map<String, Double> costHourMap = new HashMap<String, Double>(); |
| | | taskDaliyListSub.forEach(taskDaliy -> { |
| | | costHourMap.put(sdf.format(taskDaliy.getFillDate()), taskDaliy.getConsumedHours()); |
| | | }); |
| | | // 根据员工成本单金算出当前工作的成本 |
| | | totalCost = totalCost.add(projectCostService.calcUserCostByDate(entry.getKey(), new Timestamp(taskDaliyFirst.getFillDate().getTime()), new Timestamp(taskDaliyLast.getFillDate().getTime()), costHourMap)); |
| | | } |
| | | |
| | | // 总消耗成本 |
| | | resources.setMoneyTotalCost(totalCost); |
| | | |
| | | return projectProgressMapper.toDto(projectProgressRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | map.put("总绩效工时", projectProgress.getTimeTotalInit()); |
| | | map.put("总消耗绩效工时", projectProgress.getTimeTotalCost()); |
| | | map.put("本周消化绩效工时", projectProgress.getTimeLastCost()); |
| | | map.put("实际消化工时", projectProgress.getRealLastCost()); |
| | | |
| | | map.put("总工作量", projectProgress.getWorkTotalInit()); |
| | | map.put("总消耗工作量", projectProgress.getWorkTotalCost()); |
| | | map.put("本周消化工作量", projectProgress.getWorkLastCost()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | public void checkProjectProgress(ProjectProgress resources){ |
| | | List<ProjectProgress> list = projectProgressRepository.findByProjectId(resources.getProject().getId()); |
| | | // 获取前次月报的最大进度。 |
| | | List<ProjectProgress> list = projectProgressRepository.findByProjectId(resources.getProject().getId(), resources.getBelongDate()); |
| | | if (list.size() > 0 && list.get(0).getProjectProgress() != null) { |
| | | if (resources.getProjectProgress() <= list.get(0).getProjectProgress()) { |
| | | throw new BadRequestException("项目进度必须大于上一次的项目进度"); |
| | |
| | | */ |
| | | public void createWeekReport() throws Exception { |
| | | |
| | | // 当年第一周需满足四天。(例:2022年的第一周是从1月3号开始的,1号和2号并入到2021年度的最后一周里) |
| | | WeekFields wfs = WeekFields.of(DayOfWeek.MONDAY, 4); |
| | | LocalDate localDate = LocalDate.now().with(wfs.dayOfWeek(), 1L); |
| | | // 取得前一周的周五 |
| | | LocalDate localDate = LocalDate.now().with(wfs.dayOfWeek(), 5L).minusDays(7); |
| | | |
| | | int year = localDate.minusDays(7).get(wfs.weekBasedYear()); |
| | | int weeks = localDate.minusDays(7).get(wfs.weekOfWeekBasedYear()); |
| | | int year = localDate.get(wfs.weekBasedYear()); |
| | | int weeks = localDate.get(wfs.weekOfWeekBasedYear()); |
| | | |
| | | projectProgressService.generateProjectProcess(year, weeks, null); |
| | | projectProgressService.autoGenerateProjectProcess(localDate, year, weeks); |
| | | } |
| | | } |
| | |
| | | package me.zhengjie.modules.task.domain; |
| | | |
| | | import java.sql.Date; |
| | | import java.sql.Timestamp; |
| | | |
| | | import javax.persistence.Temporal; |
| | | import javax.persistence.TemporalType; |
| | | |
| | | |
| | | public interface TaskDailyInterface { |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | Long getTaskId(); |
| | | |
| | | /** |
| | | * 日报日期 |
| | | */ |
| | | Date getFillDate(); |
| | | |
| | | /** |
| | | * 任务绩效工时 |
| | | */ |
| | | Double getPlanHours(); |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.task.domain; |
| | | |
| | | import java.sql.Timestamp; |
| | | |
| | | public interface TaskInterface { |
| | | |
| | | /** |
| | | * 计划工时 |
| | | * @return |
| | | */ |
| | | Double getPlanHours(); |
| | | |
| | | /** |
| | | * 计划工作量 |
| | | * @return |
| | | */ |
| | | Double getPlanWorkload(); |
| | | |
| | | /** |
| | | * 任务ID |
| | | * @return |
| | | */ |
| | | Long getTaskId(); |
| | | |
| | | /** |
| | | * 项目ID |
| | | */ |
| | | Timestamp getProjectId(); |
| | | } |
| | |
| | | * @param projectId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM task_daliy WHERE project_id = ?1 ORDER BY user_id, fill_date ASC", nativeQuery = true) |
| | | List<TaskDaliy> findByProjectId(Long projectId); |
| | | @Query(value = "SELECT COALESCE(SUM(consumed_hours), 0.0) AS consumedHours, COALESCE(sum(consumed_workload), 0.0) as consumedWorkload FROM task_daliy WHERE project_id = ?1 AND fill_date < ?2", nativeQuery = true) |
| | | TaskDailyInterface collectByProjectIdAndFillDateLessThan(Long projectId, Timestamp fillDate); |
| | | |
| | | /** |
| | | * 根据项目ID查询任务日报信息 |
| | | * @param projectId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT td.task_id AS taskId, COALESCE(MAX(td.task_progress), 0) AS taskProgress, COALESCE(SUM(consumed_hours), 0) AS consumedHours, COALESCE(sum(consumed_workload), 0.0) as consumedWorkload, plan_hours AS planHours FROM task_daliy td INNER JOIN task t ON (td.task_id = t.id) WHERE td.project_id = ?1 AND td.fill_date < ?2 GROUP BY td.task_id", nativeQuery = true) |
| | | List<TaskDailyInterface> collectByProjectIdAndFillDateLessThanGroupByTaskIdJoinTask(Long projectId, Timestamp fillDate); |
| | | |
| | | /** |
| | | * 根据项目ID查询任务日报信息 |
| | | * @param projectId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT user_id AS userId, fill_date AS fillDate, COALESCE(SUM(consumed_hours), 0) AS consumedHours FROM task_daliy WHERE project_id = ?1 AND fill_date < ?2 GROUP BY user_id, fill_date", nativeQuery = true) |
| | | List<TaskDailyInterface> collectByProjectIdAndFillDateLessThanGroupByUserIdAndFillDate(Long projectId, Timestamp fillDate); |
| | | |
| | | /** |
| | | * 根据项目ID、任务ID查询 |
| | |
| | | * @param taskId |
| | | * @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) |
| | | @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, Timestamp sdate, Timestamp edate); |
| | | |
| | | |
| | |
| | | package me.zhengjie.modules.task.repository; |
| | | |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskInterface; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | List<Task> findByProjectId(Long id); |
| | | |
| | | @Query(value = "SELECT * FROM task WHERE project_id = ?1 AND create_time < ?2", nativeQuery = true) |
| | | List<Task> findByProjectIdUntilDate(Long projectId, Date belongDate); |
| | | @Query(value = "SELECT COALESCE(SUM(plan_hours), 0.0) AS planHours, COALESCE(sum(plan_workload), 0.0) as planWorkload FROM task WHERE project_id = ?1", nativeQuery = true) |
| | | TaskInterface collectByProjectId(Long projectId); |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function getExceptional(data) { |
| | | return request({ |
| | | url: 'api/attendance/getExceptional', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function getUserMakeUpCard(data) { |
| | | return request({ |
| | | url: 'api/attendance/getUserMakeUpCard', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, attendanceHours, getExceptional, getUserMakeUpCard, addAttendanceInfo } |
| | | export default { add, edit, del, getAll, attendanceHours, getUserMakeUpCard, addAttendanceInfo } |
| File was renamed from eladmin-web-master/src/api/projectPerformance.js |
| | |
| | | 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', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | | export default { add, edit, del, getAll } |
| File was renamed from eladmin-web-master/src/api/projectPerformanceDetail.js |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/projectPerformanceDetail/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/projectPerformanceDetail', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | | export default { add, edit, del, getAll } |
| | |
| | | this.makeUpCardForm.cardReplacementDistinguish = this.dictCardReplacementGoOn |
| | | this.makeUpCardVisible = true |
| | | } else { |
| | | crudAttendance.getExceptional(Number).then(res => { |
| | | }) |
| | | this.crud.notify('上班无需补卡', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | } |
| | | } |
| | | // 判断下班打卡状态,给提示 |
| | |
| | | this.makeUpCardForm.cardReplacementDistinguish = this.dictCardReplacementOffOn |
| | | this.makeUpCardVisible = true |
| | | } else { |
| | | crudAttendance.getExceptional(Number).then(res => { |
| | | }) |
| | | this.crud.notify('下班无需补卡', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | } |
| | | } |
| | | }).catch(() => { |
| | |
| | | crudAttendanceCardreplacement.add(this.makeUpCardForm).then(res => { |
| | | this.makeUpCardVisible = false |
| | | this.makeUpCardLoading = false |
| | | this.crud.addSuccessNotify() |
| | | this.crud.notify('补卡提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | if (this.$refs['makeUpCardForm']) { |
| | | this.$refs['makeUpCardForm'].resetFields() |
| | | } |
| | | }).catch(() => { |
| | | this.makeUpCardVisible = true |
| | | this.makeUpCardLoading = false |
| | | }) |
| | | }) |
| | | }, |
| | |
| | | if (!valid) { |
| | | return |
| | | } |
| | | this.goOutVisible = true |
| | | this.goSuccessLoading = true |
| | | crudAttendanceGoOut.add(this.goOutForm).then(res => { |
| | | this.goOutVisible = false |
| | | this.goSuccessLoading = false |
| | | this.crud.addSuccessNotify() |
| | | this.crud.notify('外出提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | if (this.$refs['goOutForm']) { |
| | | this.$refs['goOutForm'].resetFields() |
| | | } |
| | | }).catch(() => { |
| | | this.goOutVisible = true |
| | | this.goSuccessLoading = false |
| | | }) |
| | | }) |
| | | }, |
| | |
| | | if (!valid) { |
| | | return |
| | | } |
| | | this.bussVisible = true |
| | | this.bussSuccessLoading = true |
| | | crudAttendanceBusinessTravel.add(this.bussForm).then(res => { |
| | | this.bussVisible = false |
| | | this.bussSuccessLoading = false |
| | | this.crud.addSuccessNotify() |
| | | this.crud.notify('出差提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | if (this.$refs['bussForm']) { |
| | | this.$refs['bussForm'].resetFields() |
| | | } |
| | | }).catch(() => { |
| | | this.bussVisible = true |
| | | this.bussSuccessLoading = false |
| | | }) |
| | | }) |
| | | }, |
| | |
| | | crudAttendance.addAttendanceInfo(data).then(res => { |
| | | this.attendVisible = false |
| | | this.attendLoading = false |
| | | this.crud.addSuccessNotify() |
| | | this.crud.notify('考勤信息提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | this.crud.toQuery() |
| | | if (this.$refs['attform']) { |
| | | this.$refs['attform'].resetFields() |
| | | } |
| | | }).catch(() => { |
| | | this.attendVisible = true |
| | | this.attendLoading = false |
| | | }) |
| | | }) |
| | | }, |
| | |
| | | <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;" :disabled="userRolesLevelMin == roleLevelOrdinary"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabledUser(form)"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批用户" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择审批员工" style="width: 370px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择审批员工" style="width: 370px;" class="filter-item" :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | return form.travelEndTime ? time.getTime() > new Date(form.travelEndTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" |
| | | @change="checkTime" |
| | | /> |
| | | </el-form-item> |
| | |
| | | return form.travelStartTime ? time.getTime() < new Date(form.travelStartTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" |
| | | @change="checkTime" |
| | | /> |
| | | </el-form-item> |
| | |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="出差原因"> |
| | | <el-input v-model="form.travelReason" type="textarea" rows="3" style="width: 370px;" /> |
| | | <el-input v-model="form.travelReason" type="textarea" rows="3" style="width: 370px;" :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" /> |
| | | </el-form-item> |
| | | <el-form-item label="出发城市"> |
| | | <el-input v-model="form.departureCity" style="width: 370px;" /> |
| | | <el-input v-model="form.departureCity" style="width: 370px;" :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" /> |
| | | </el-form-item> |
| | | <el-form-item label="到达城市"> |
| | | <el-input v-model="form.arrivalCity" style="width: 370px;" /> |
| | | <el-input v-model="form.arrivalCity" style="width: 370px;" :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" /> |
| | | </el-form-item> |
| | | <el-form-item label="审批说明"> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 370px;" /> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 370px;" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" /> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-permission="permission.attendanceBusinessApp" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | | type="primary" |
| | |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | slot="reference" |
| | | v-permission="permission.attendanceBusinessApp" |
| | | type="danger" |
| | | icon="el-icon-edit-outline" |
| | | size="mini" |
| | |
| | | add: ['admin', 'attendanceBusinessTravel:add'], |
| | | edit: ['admin', 'attendanceBusinessTravel:edit'], |
| | | del: ['admin', 'attendanceBusinessTravel:del'], |
| | | download: ['admin', 'attendanceBusinessTravel:download'] |
| | | download: ['admin', 'attendanceBusinessTravel:download'], |
| | | attendanceBusinessApp: ['admin', 'attendanceBusinessTravel:approve'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY } |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 判断用户最大角色级别是否是角色级别:普通用户 |
| | | if (this.userRolesLevelMin === this.roleLevelOrdinary) { |
| | | // 判断用户最大角色级别是否大于总经理角色:赋值 |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | }, |
| | | // 禁用 |
| | | disabledUser(data) { |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | return true |
| | | } |
| | | if (data.approvalStatus !== null && data.approvalStatus === this.dictGoOutAgree || data.approvalStatus === this.dictGoOutReturn) { |
| | | return true |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | |
| | | <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;" :disabled="userRolesLevelMin == roleLevelOrdinary"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabledUser(form)"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批者" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" clearable filterable placeholder="请选择" style="width: 370px;"> |
| | | <el-select v-model="form.approvalUserId" clearable filterable placeholder="请选择" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | default-time="09:00:00" |
| | | :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="补卡原因"> |
| | | <el-input v-model="form.cardReplacementReason" type="textarea" rows="3" style="width: 370px;" /> |
| | | <el-input v-model="form.cardReplacementReason" type="textarea" rows="3" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse" /> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.id !== null" label="审批状态" prop="approvalStatus"> |
| | | <el-select v-model="form.approvalStatus" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse"> |
| | | <el-option |
| | | v-for="item in dict[dictCardApproveStatus]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批说明"> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 370px;" /> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 370px;" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="补卡区分" prop="cardReplacementDistinguish"> |
| | | <el-select v-model="form.cardReplacementDistinguish" style="width: 370px;"> |
| | | <el-select v-model="form.cardReplacementDistinguish" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse"> |
| | | <el-option |
| | | v-for="item in dict[dictCardReplacement]" |
| | | :key="item.value" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" /> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-permission="permission.attendanceCardreplacementApp" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | | type="primary" |
| | |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | slot="reference" |
| | | v-permission="permission.attendanceCardreplacemenRev" |
| | | type="danger" |
| | | icon="el-icon-edit-outline" |
| | | size="mini" |
| | |
| | | add: ['admin', 'attendanceCardreplacement:add'], |
| | | edit: ['admin', 'attendanceCardreplacement:edit'], |
| | | del: ['admin', 'attendanceCardreplacement:del'], |
| | | download: ['admin', 'attendanceCardreplacement:download'] |
| | | download: ['admin', 'attendanceCardreplacement:download'], |
| | | attendanceCardreplacementApp: ['admin', 'attendanceCardreplacement:approve'], |
| | | attendanceCardreplacemenRev: ['admin', 'attendanceCardreplacement:revoke'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | |
| | | dictCardReplacement: constant.CARD_REPLACEMENT_DIFFERENTIATION, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY } |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 判断用户最大角色级别是否是角色级别:普通用户 |
| | | if (this.userRolesLevelMin === this.roleLevelOrdinary) { |
| | | // 判断用户最大角色级别是否大于总经理角色:赋值 |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | }, |
| | | // 禁用 |
| | | disabledUser(data) { |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | return true |
| | | } |
| | | if (data.approvalStatus !== null && data.approvalStatus === this.dictCardApproveStatusAgree || data.approvalStatus === this.dictCardApproveStatusRefuse) { |
| | | return true |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | |
| | | <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="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledUser(form)"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批者" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | } |
| | | }" |
| | | default-time="09:00:00" |
| | | :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" |
| | | @change="checkTime" |
| | | /> |
| | | </el-form-item> |
| | |
| | | } |
| | | }" |
| | | default-time="18:00:00" |
| | | :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" |
| | | @change="checkTime" |
| | | /> |
| | | </el-form-item> |
| | |
| | | <template slot="append">{{ dict.label[dictLeaveTimeType][form.durationUnit] }}</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="外出类型" prop="outOfOfficeType"> |
| | | <el-select v-model="form.outOfOfficeType" filterable clearable placeholder="请选择外出类型" style="width: 370px;" :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn"> |
| | | <el-option |
| | | v-for="item in dict[dictGoOutTypr]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="外出原因"> |
| | | <el-input v-model="form.outReason" type="textarea" rows="3" style="width: 340px;" /> |
| | | <el-input v-model="form.outReason" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" /> |
| | | </el-form-item> |
| | | <el-form-item label="审批说明"> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 340px;" /> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 340px;" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" /> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-permission="permission.attendanceGoOutApp" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | | type="primary" |
| | |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | slot="reference" |
| | | v-permission="permission.attendanceGoOutApp" |
| | | type="danger" |
| | | icon="el-icon-edit-outline" |
| | | size="mini" |
| | |
| | | add: ['admin', 'attendanceGoOut:add'], |
| | | edit: ['admin', 'attendanceGoOut:edit'], |
| | | del: ['admin', 'attendanceGoOut:del'], |
| | | download: ['admin', 'attendanceGoOut:download'] |
| | | download: ['admin', 'attendanceGoOut:download'], |
| | | attendanceGoOutApp: ['admin', 'attendanceGoOut:approve'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY } |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 判断用户最大角色级别是否是角色级别:普通用户 |
| | | if (this.userRolesLevelMin === this.roleLevelOrdinary) { |
| | | // 判断用户最大角色级别是否大于总经理角色:赋值 |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | }, |
| | | // 禁用 |
| | | disabledUser(data) { |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | return true |
| | | } |
| | | if (data.approvalStatus !== null && data.approvalStatus === this.dictGoOutAgree || data.approvalStatus === this.dictGoOutReturn) { |
| | | return true |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | |
| | | <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="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary" @change="checkLeaveTime"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledUser(form)" @change="checkLeaveTime"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批者" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;" class="filter-item" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="请假类型" prop="leaveType"> |
| | | <el-select v-model="form.leaveType" filterable clearable placeholder="请选择" style="width: 340px;" @change="checkLeaveTime"> |
| | | <el-select v-model="form.leaveType" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" @change="checkLeaveTime"> |
| | | <el-option |
| | | v-for="item in dict[dictLeaveType]" |
| | | :key="item.value" |
| | |
| | | } |
| | | }" |
| | | default-time="09:00:00" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" |
| | | @change="checkLeaveTime" |
| | | /> |
| | | </el-form-item> |
| | |
| | | } |
| | | }" |
| | | default-time="18:00:00" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" |
| | | @change="checkLeaveTime" |
| | | /> |
| | | </el-form-item> |
| | |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="请假原因"> |
| | | <el-input v-model="form.leaveReason" type="textarea" rows="3" style="width: 340px;" /> |
| | | <el-input v-model="form.leaveReason" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" /> |
| | | </el-form-item> |
| | | <el-form-item label="审批说明"> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 340px;" /> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 340px;" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" /> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | <el-table-column prop="approvalDescription" label="审批说明" width="140" show-overflow-tooltip /> |
| | | <el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" width="140" label="创建时间" show-overflow-tooltip /> |
| | | <el-table-column label="审核操作" width="180" align="center" fixed="right"> |
| | | <el-table-column label="审核操作" width="180px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-permission="permission.attendanceLeaveApp" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | | type="primary" |
| | |
| | | @click="toApprove(scope.row)" |
| | | >审核 |
| | | </el-button> |
| | | <el-popover |
| | | :ref="`popover_${scope.row.id}`" |
| | | width="200" |
| | | > |
| | | <p>确定撤销该记录?</p> |
| | | <div style="text-align: right; margin: 0"> |
| | | <el-button size="mini" type="primary" @click="canel(scope.row)">取消</el-button> |
| | | <el-button :loading="successLoading" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | slot="reference" |
| | | v-permission="permission.attendanceLeaveApp" |
| | | type="danger" |
| | | icon="el-icon-edit-outline" |
| | | size="mini" |
| | | :disabled="scope.row.approvalStatus === dictAppRovalStatusUnderAppover ? true : false" |
| | | >撤销 |
| | | </el-button> |
| | | </el-popover> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','attendanceLeave:edit','attendanceLeave:del'])" label="操作" width="150px" align="center" fixed="right"> |
| | |
| | | add: ['admin', 'attendanceLeave:add'], |
| | | edit: ['admin', 'attendanceLeave:edit'], |
| | | del: ['admin', 'attendanceLeave:del'], |
| | | download: ['admin', 'attendanceLeave:download'] |
| | | download: ['admin', 'attendanceLeave:download'], |
| | | attendanceLeaveApp: ['admin', 'attendanceLeave:approve'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY |
| | | } |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 判断用户最大角色级别是否是角色级别:普通用户 |
| | | if (this.userRolesLevelMin === this.roleLevelOrdinary) { |
| | | // 判断用户最大角色级别是否大于总经理角色:赋值 |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | |
| | | // [CRUD.HOOK.afterSubmit]() { |
| | | // this.getUserTimes() |
| | | // }, |
| | | // 禁用 |
| | | disabledUser(data) { |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | return true |
| | | } |
| | | if (data.approvalStatus !== null && data.approvalStatus === this.dictAppRovalStatusPassed || data.approvalStatus === this.dictAppRovalStatusReturn) { |
| | | return true |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | |
| | | // }) |
| | | // }, |
| | | // 审批页面赋值 |
| | | toApprove(data) { |
| | | toApprove(data, Number) { |
| | | if (Number !== '1') { |
| | | this.makeUpCardVisible = true |
| | | } |
| | | this.form.id = data.id |
| | | this.form.userId = data.userId |
| | | this.form.userName = data.userName |
| | |
| | | } |
| | | }) |
| | | }, |
| | | // 撤消功能 |
| | | revoke(data) { |
| | | this.toApprove(data, '1') |
| | | this.form.approvalStatus = this.dictAppRovalStatusUnderAppover |
| | | this.successLoading = true |
| | | crudAttendanceLeave.approve(this.form).then(res => { |
| | | this.crud.refresh() |
| | | this.successLoading = false |
| | | this.$message({ type: 'success', message: '撤销成功' }) |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | }).catch((error) => { |
| | | this.$message({ type: 'error', message: error.response.data.message }) |
| | | }) |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | this.crud.cancelCU() |
| | | }, |
| | | // 关闭 |
| | | closeCard() { |
| | | if (this.$refs['form']) { |
| | |
| | | } |
| | | this.crud.cancelCU() |
| | | this.makeUpCardVisible = false |
| | | }, |
| | | // 取消 |
| | | canel(data) { |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | } |
| | | } |
| | | } |
| | |
| | | :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" /> |
| | | <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'--> |
| | |
| | | <!--表单组件--> |
| | | <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-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" |
| | |
| | | <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-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-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 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 |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudProjectPerformance from '@/api/projectPerformance' |
| | | 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' |
| | |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | | { required: true, message: '项目ID不能为空', trigger: 'blur' } |
| | | { required: true, message: '项目名称不能为空', trigger: 'change' } |
| | | ], |
| | | startDate: [ |
| | | { required: true, message: '结算开始日不能为空', trigger: 'blur' } |
| | | { required: true, message: '结算开始日不能为空', trigger: 'change' } |
| | | ], |
| | | endDate: [ |
| | | { required: true, message: '结算终了日不能为空', trigger: 'blur' } |
| | | { required: true, message: '结算终了日不能为空', trigger: 'change' } |
| | | ], |
| | | yearMonth: [ |
| | | { required: true, message: '绩效年月不能为空', trigger: 'blur' } |
| | | { required: true, message: '绩效年月不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | // 选中结束时间之后不可选 |
| | |
| | | crudProject.getAll().then(res => { |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | // 截取年月 |
| | | substr(data) { |
| | | return data.substring(0, 7) |
| | | } |
| | | } |
| | | } |
| | |
| | | <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" /> |
| | | <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'--> |
| | |
| | | <!--表单组件--> |
| | | <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 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;" /> |
| | | <el-input v-model="form.performanceHours" style="width: 370px;"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="项目ID" prop="projectId"> |
| | | 未设置字典,请手动设置 Select |
| | | <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="datetime" style="width: 370px;" /> |
| | | <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-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 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 |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudProjectPerformanceDetail from '@/api/projectPerformanceDetail' |
| | | 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' |
| | |
| | | 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'] |
| | | del: ['admin', 'projectPerformanceDetail:del'], |
| | | download: ['admin', 'projectPerformanceDetail:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '员工ID不能为空', trigger: 'blur' } |
| | | { required: true, message: '员工ID不能为空', trigger: 'change' } |
| | | ], |
| | | performanceHours: [ |
| | | { required: true, message: '绩效工时不能为空', trigger: 'blur' } |
| | | { required: true, message: '绩效工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '项目ID不能为空', trigger: 'blur' } |
| | | { required: true, message: '项目ID不能为空', trigger: 'change' } |
| | | ], |
| | | yearMonth: [ |
| | | { required: true, message: '绩效年月不能为空', trigger: 'blur' } |
| | | { 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) |
| | | } |
| | | } |
| | | } |
| | |
| | | <el-form-item label="周数" prop="belongWeek"> |
| | | <el-input v-model.number="form.belongWeek" style="width: 370px;" :disabled="disabled || crud.status.add !== 1" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目进度" prop="projectProgress"> |
| | | <el-form-item v-if="crud.status.add !== 1" label="本周预计" prop="lastedProgress"> |
| | | <el-input v-model="form.lastProjectProcess.estimatedProgress" style="width: 370px;" :disabled="true"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </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="estimatedProgress"> |
| | | <el-input v-model="form.estimatedProgress" style="width: 370px;" :disabled="disabled"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | <el-tag>{{ scope.row.project.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="lastedProgress" label="预计进度"> |
| | | <el-table-column show-overflow-tooltip prop="lastedProgress" label="本周预计"> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.lastedProgress ? scope.row.lastedProgress : 0) + '%' }} |
| | | {{ (scope.row.lastProjectProcess.estimatedProgress ? scope.row.lastProjectProcess.estimatedProgress : 0) + '%' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="projectProgress" label="实际进度"> |
| | | <el-table-column show-overflow-tooltip prop="projectProgress" label="本周实际"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{ color: scope.row.lastedProgress > scope.row.projectProgress ? 'red' : '' }">{{ (scope.row.projectProgress ? scope.row.projectProgress : 0) + '%' }}</span> |
| | | <span :style="{ color: scope.row.lastedProgress > scope.row.projectProgress ? 'red' : '' }">{{ (scope.row.projectProgress ? scope.row.projectProgress + '%' : '') }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="estimatedProgress" label="下周预计"> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.estimatedProgress ? scope.row.estimatedProgress + '%' : '') }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip prop="moneyTotalInit" label="计划总成本"> |
| | |
| | | ({{ 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 show-overflow-tooltip prop="realLastCost" label="本周消化工时" /> |
| | | <el-table-column show-overflow-tooltip prop="realLastCost" label="本周消化工时"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.lastProjectProcess.realLastCost != null ? scope.row.realLastCost - scope.row.lastProjectProcess.realLastCost : 0 }} |
| | | </template> |
| | | </el-table-column> |
| | | <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 }} |
| | |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '../../../utils/constant' |
| | | |
| | | const defaultForm = { id: null, project: { id: null }, belongYear: null, belongWeek: null, approveStatus: null, projectProgress: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, project: { id: null }, belongYear: null, belongWeek: null, approveStatus: null, projectProgress: null, estimatedProgress: null, lastProjectProcess: {}, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'ProjectProgress', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | } |
| | | // 周数(1~53)验证 |
| | | var weekValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || !Number.isInteger(value) || Number(value) <= 1 || Number(value) >= 53)) { |
| | | if (value != null && value !== '' && (isNaN(value) || !Number.isInteger(value) || Number(value) < 1 || Number(value) > 53)) { |
| | | callback(new Error('请输入 1 到 53 以内的正整数')) |
| | | } else { |
| | | callback() |
| | |
| | | { validator: weekValidate, trigger: 'blur' } |
| | | ], |
| | | projectProgress: [ |
| | | { required: true, message: '进度不能为空', trigger: 'blur' }, |
| | | { required: true, message: '本周实际不能为空', trigger: 'blur' }, |
| | | { validator: progressValidate, trigger: 'blur' } |
| | | ], |
| | | estimatedProgress: [ |
| | | { required: true, message: '下周预计不能为空', trigger: 'blur' }, |
| | | { validator: progressValidate, trigger: 'blur' } |
| | | ], |
| | | approveStatus: [ |
| | | { required: true, message: '进度不能为空', trigger: 'blur' }, |
| | | { validator: progressValidate, trigger: 'blur' } |
| | | { required: true, message: '承认状态不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | |
| | | // 禁用状态 |
| | | this.disabled = false |
| | | } |
| | | this.rules['project.id'].forEach(element => { |
| | | element.required = !(this.disabled || this.crud.status.add !== 1) |
| | | }) |
| | | this.rules.projectProgress.forEach(element => { |
| | | element.required = !(this.disabled) |
| | | }) |
| | | this.rules.approveStatus.forEach(element => { |
| | | element.required = !(this.disabled) |
| | | }) |
| | | } |
| | | } |
| | | } |