3 files added
72 files modified
| | |
| | | //查询请假记录(根据请假类型) |
| | | @Query(value = "SELECT * from attendance_leave where user_id = ?1 and leave_start_time < ?3 and leave_end_time > ?2 and approval_status IN ('approval_status_passed') and leave_type = ?4", nativeQuery = true) |
| | | List<AttendanceLeave> findByUserIdAndDateAndLeaveType(Long userId, LocalDateTime startDate, LocalDateTime endDate,String LeaveType); |
| | | |
| | | @Query(value = "SELECT SUM(leave_duration) from attendance_leave where user_id = ?1 and approval_status IN ('approval_status_passed') and leave_type = ?2", nativeQuery = true) |
| | | Double sumLeaveDurationByUserIdAndLeaveType(Long userId, String LeaveType); |
| | | } |
| | |
| | | |
| | | @Query(value = "SELECT * from attendance_overtime where user_id = ?1 and overtime_start_time >= ?2 and overtime_end_time < ?3 and approval_status in ('overtime_pass')", nativeQuery = true) |
| | | List<AttendanceOvertime> findByUserIdAndDate(Long userId, LocalDateTime startDate, LocalDateTime endDate); |
| | | |
| | | List<AttendanceOvertime> findByUserId(Long userId); |
| | | } |
| | |
| | | return new ResponseEntity<>(attendanceLeaveService.getYearTimeLength(userId), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/getOverTimeLength") |
| | | @Log("获取调休假时长") |
| | | @ApiOperation("获取调休假时长") |
| | | public ResponseEntity<Object> getOverTimeLength(@RequestBody Long userId) throws ParseException { |
| | | return new ResponseEntity<>(attendanceLeaveService.getOverTimeLength(userId), HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping(value = "/approve") |
| | | @Log("审核功能") |
| | | @ApiOperation("审核功能") |
| | |
| | | */ |
| | | package me.zhengjie.modules.attendance.rest; |
| | | |
| | | import me.zhengjie.annotation.AnonymousAccess; |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceMonth; |
| | | import me.zhengjie.modules.attendance.service.AttendanceMonthService; |
| | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('attendanceMonth:download')") |
| | | @AnonymousAccess |
| | | public void exportAttendanceMonth(HttpServletResponse response, AttendanceMonthQueryCriteria criteria) throws IOException { |
| | | attendanceMonthService.download(attendanceMonthService.queryAll(criteria), response); |
| | | } |
| | |
| | | Double getYearTimeLength(Long userId) throws ParseException; |
| | | |
| | | /** |
| | | *获取剩余调休假 |
| | | * @return |
| | | * @throws ParseException |
| | | */ |
| | | Double getOverTimeLength(Long userId) throws ParseException; |
| | | |
| | | /** |
| | | * 审核功能 |
| | | * @param resources / |
| | | */ |
| | |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String bussStartTime = df.format(resources.getTravelStartTime()); |
| | | String bussEndTime = df.format(resources.getTravelEndTime()); |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(bussStartTime, bussEndTime, resources.getUserId() == null ? SecurityUtils.getCurrentUserId() : 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) { |
| | |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String bussStartTime = df.format(resources.getTravelStartTime()); |
| | | String bussEndTime = df.format(resources.getTravelEndTime()); |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(bussStartTime, bussEndTime, resources.getUserId()); |
| | | // // 查询其他状态的表是否有重复 |
| | | // repeatValidation(bussStartTime, bussEndTime, resources.getUserId()); |
| | | // 验证是否存在时间冲突的请假记录 |
| | | Set<Long> ids = new HashSet<>(); |
| | | ids.add(attendanceBusinessTravel.getId()); |
| | |
| | | |
| | | @Override |
| | | public List<AttendanceCardreplacementDto> queryAll(AttendanceCardreplacementQueryCriteria criteria){ |
| | | return attendanceCardreplacementMapper.toDto(attendanceCardreplacementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | List<AttendanceCardreplacementDto> attendanceCardreplacementList = attendanceCardreplacementMapper.toDto(attendanceCardreplacementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); |
| | | attendanceCardreplacementList.forEach(attendanceCardreplacementDto -> { |
| | | //查询申请人信息 |
| | | User user = userRepository.findById(attendanceCardreplacementDto.getUserId()).orElseGet(User::new); |
| | | attendanceCardreplacementDto.setUserName(user.getNickName()); |
| | | //查询申请人信息 |
| | | User appUser = userRepository.findById(attendanceCardreplacementDto.getApprovalUserId()).orElseGet(User::new); |
| | | attendanceCardreplacementDto.setAppUserName(appUser.getNickName()); |
| | | }); |
| | | return attendanceCardreplacementList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | String attCardreplacementType = attendanceCardreplacement.getApprovalStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.CARD_APPROVE_STATUS, attendanceCardreplacement.getApprovalStatus()).getLabel() : ""; |
| | | String attCardReplacementDistinguish = attendanceCardreplacement.getCardReplacementDistinguish() != null ? dictDetailRepository.findByDictNameAndValue(Constant.CARD_REPLACEMENT_DIFFERENTIATION, attendanceCardreplacement.getCardReplacementDistinguish()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户id", attendanceCardreplacement.getUserId()); |
| | | map.put("审批用户id", attendanceCardreplacement.getApprovalUserId()); |
| | | map.put("申请者", attendanceCardreplacement.getUserName()); |
| | | map.put("审批者", attendanceCardreplacement.getAppUserName()); |
| | | map.put("补卡时间", attendanceCardreplacement.getCardReplacementTime()); |
| | | map.put("补卡原因", attendanceCardreplacement.getCardReplacementReason()); |
| | | map.put("审批状态", attCardreplacementType); |
| | |
| | | |
| | | @Override |
| | | public List<AttendanceGoOutDto> queryAll(AttendanceGoOutQueryCriteria criteria){ |
| | | return attendanceGoOutMapper.toDto(attendanceGoOutRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | List<AttendanceGoOutDto> attendanceGoOutDtoList = attendanceGoOutMapper.toDto(attendanceGoOutRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); |
| | | attendanceGoOutDtoList.forEach(attendanceGoOutDto -> { |
| | | //查询用户信息 |
| | | User user = userRepository.findById(attendanceGoOutDto.getUserId()).orElseGet(User::new); |
| | | attendanceGoOutDto.setUserName(user.getNickName()); |
| | | //查询审批用户名 |
| | | User appUser = userRepository.findById(attendanceGoOutDto.getApprovalUserId()).orElseGet(User::new); |
| | | attendanceGoOutDto.setAppUserName(appUser.getNickName()); |
| | | }); |
| | | return attendanceGoOutDtoList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | attendanceGoOut.copy(resources); |
| | | attendanceGoOutRepository.save(attendanceGoOut); |
| | | // } |
| | | SysConfigHolidayDto sysConfigHolidayDto = sysConfigHolidayService.queryByHolidayDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | Boolean isWeekend = localDate.getDayOfWeek() == DayOfWeek.SATURDAY || localDate.getDayOfWeek() == DayOfWeek.SUNDAY; |
| | | if ((sysConfigHolidayDto == null && isWeekend) || |
| | | sysConfigHolidayDto != null && Constant.DATE_TYPE_HOLIDAYS.equals(sysConfigHolidayDto.getDateType())) { |
| | | AttendanceOvertime attendanceOvertime = new AttendanceOvertime(); |
| | | attendanceOvertime.setUserId(resources.getUserId()); |
| | | attendanceOvertime.setOvertimeStartTime(resources.getOutStartTime()); |
| | | attendanceOvertime.setOvertimeEndTime(resources.getOutEndTime()); |
| | | attendanceOvertime.setOvertimeDuration(resources.getOutDuration()); |
| | | attendanceOvertime.setApprovalStatus(resources.getApprovalStatus()); |
| | | attendanceOvertime.setRemarks(resources.getRemarks()); |
| | | attendanceOvertimeService.create(attendanceOvertime); |
| | | } |
| | | // SysConfigHolidayDto sysConfigHolidayDto = sysConfigHolidayService.queryByHolidayDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | // Boolean isWeekend = localDate.getDayOfWeek() == DayOfWeek.SATURDAY || localDate.getDayOfWeek() == DayOfWeek.SUNDAY; |
| | | // if ((sysConfigHolidayDto == null && isWeekend) || |
| | | // sysConfigHolidayDto != null && Constant.DATE_TYPE_HOLIDAYS.equals(sysConfigHolidayDto.getDateType())) { |
| | | // AttendanceOvertime attendanceOvertime = new AttendanceOvertime(); |
| | | // attendanceOvertime.setUserId(resources.getUserId()); |
| | | // attendanceOvertime.setApprovalUserId(resources.getApprovalUserId()); |
| | | // attendanceOvertime.setOvertimeStartTime(resources.getOutStartTime()); |
| | | // attendanceOvertime.setOvertimeEndTime(resources.getOutEndTime()); |
| | | // attendanceOvertime.setOvertimeDuration(resources.getOutDuration()); |
| | | // attendanceOvertime.setApprovalStatus(resources.getApprovalStatus()); |
| | | // attendanceOvertime.setRemarks(resources.getRemarks()); |
| | | // attendanceOvertimeService.create(attendanceOvertime); |
| | | // } |
| | | }); |
| | | // |
| | | // List<String> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | |
| | | public void download(List<AttendanceGoOutDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceGoOutDto attendanceGoOut : all) { |
| | | String outOfOfficeType = attendanceGoOut.getOutOfOfficeType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.GOOUT_APPROVE_STATUS, attendanceGoOut.getOutOfOfficeType()).getLabel() : ""; |
| | | String outOfOfficeType = attendanceGoOut.getOutOfOfficeType() != null ? dictDetailRepository.findByDictNameAndValue("go_out_type", attendanceGoOut.getOutOfOfficeType()).getLabel() : ""; |
| | | String outDurationUnit = attendanceGoOut.getDurationUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.LEAVE_TIME_TYPE, attendanceGoOut.getDurationUnit()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户id", attendanceGoOut.getUserId()); |
| | | map.put("审批用户id", attendanceGoOut.getApprovalUserId()); |
| | | map.put("申请者", attendanceGoOut.getUserName()); |
| | | map.put("审批者", attendanceGoOut.getAppUserName()); |
| | | map.put("外出开始时间", attendanceGoOut.getOutStartTime()); |
| | | map.put("外出结束时间", attendanceGoOut.getOutEndTime()); |
| | | map.put("外出时长", attendanceGoOut.getOutDuration()); |
| | |
| | | } else { |
| | | return ChronoUnit.SECONDS.between(goOutStartTime, goOutEndTime) - 3600; |
| | | } |
| | | } else { |
| | | LocalDateTime goOutStartTime = localDate.atTime(startTime); |
| | | LocalDateTime goOutEndTime = localDate.atTime(endTime); |
| | | return ChronoUnit.SECONDS.between(goOutStartTime, goOutEndTime); |
| | | } |
| | | return 0L; |
| | | }).reduce(0L, (result, current) -> result + current); |
| | | } |
| | | |
| | |
| | | */ |
| | | package me.zhengjie.modules.attendance.service.impl; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.attendance.domain.*; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceBusinessTravelRepository; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceGoOutRepository; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceRepository; |
| | | import me.zhengjie.modules.attendance.repository.*; |
| | | import me.zhengjie.modules.attendance.service.AttendanceLeaveService; |
| | | import me.zhengjie.modules.attendance.service.AttendanceService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceLeaveDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceLeaveQueryCriteria; |
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceLeaveMapper; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.quartz.service.impl.DingTalkServiceImpl; |
| | |
| | | import me.zhengjie.modules.system.repository.SysUserLevelOtherRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceLeaveRepository; |
| | | import me.zhengjie.modules.attendance.service.AttendanceLeaveService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceLeaveDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceLeaveQueryCriteria; |
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceLeaveMapper; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | |
| | | import java.time.*; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import java.util.function.Function; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final AttendanceOvertimeRepository attendanceOvertimeRepository; |
| | | private final DingTalkServiceImpl dingTalkService; |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public List<AttendanceLeaveDto> queryAll(AttendanceLeaveQueryCriteria criteria){ |
| | | return attendanceLeaveMapper.toDto(attendanceLeaveRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | List<AttendanceLeaveDto> attendanceLeaveDtoList = attendanceLeaveMapper.toDto(attendanceLeaveRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); |
| | | attendanceLeaveDtoList.forEach(attendanceLeaveDto -> { |
| | | //查询用户信息 |
| | | User user = userRepository.findById(attendanceLeaveDto.getUserId()).orElseGet(User::new); |
| | | attendanceLeaveDto.setUserName(user.getNickName()); |
| | | //查询审批用户名 |
| | | User appUser = userRepository.findById(attendanceLeaveDto.getApprovalUserId()).orElseGet(User::new); |
| | | attendanceLeaveDto.setAppUserName(appUser.getNickName()); |
| | | }); |
| | | return attendanceLeaveDtoList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<DictDetail> dictDetailList = dictDetailRepository.findByDictName("leave_type"); |
| | | List<String> leaveTypes = new ArrayList<>(); |
| | | for(DictDetail dictDetail : dictDetailList){ |
| | | if(dictDetail.getValue().equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE) || dictDetail.getValue().equals(Constant.LEAVE_TYPE_COMPASSIONATE_LEAVE)){ |
| | | if(dictDetail.getValue().equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE) || dictDetail.getValue().equals(Constant.LEAVE_TYPE_REPLACE) || dictDetail.getValue().equals(Constant.LEAVE_TYPE_COMPASSIONATE_LEAVE)){ |
| | | //事假和年假 |
| | | leaveTypes.add(dictDetail.getValue()); |
| | | } |
| | |
| | | * 获取用户年假剩余时长 |
| | | */ |
| | | @Override |
| | | public Double getYearTimeLength(Long userId) throws ParseException { |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // // 获取当前日期 |
| | | // Date date = new Date(); |
| | | // String nowTime = sdf.format(date); |
| | | // Date dateTime = sdf.parse(nowTime); |
| | | // Double surplusYearTime = new Double(0.00); |
| | | // // 查询用户剩余年假时长 |
| | | // List<SysUserLevelOther> sysUserLevelOtherList = sysUserLevelOtherRepository.findByUserId(userId); |
| | | // for(SysUserLevelOther sysUserLevelOther : sysUserLevelOtherList) { |
| | | // Date dateStart = new Date(sysUserLevelOther.getStartDate().getTime()); |
| | | // Date dateEnd = new Date(); |
| | | // if (ObjectUtils.isNotEmpty(sysUserLevelOther.getStartDate()) && ObjectUtils.isNotEmpty(sysUserLevelOther.getEndDate())) { |
| | | // dateEnd = new Date(sysUserLevelOther.getEndDate().getTime()); |
| | | // } |
| | | // //取当前日期在数据中开始日期与结束日期之间的数据 |
| | | // if (dateTime.compareTo(dateStart) >= 0 && dateTime.compareTo(dateEnd) <= 0 || dateTime.compareTo(dateStart) >= 0 && sysUserLevelOther.getEndDate() == null) { |
| | | // //年假总时长 |
| | | // Double yearTime = Double.valueOf(sysUserLevelOther.getAnnualLeaveDays() == null ? 0 : sysUserLevelOther.getAnnualLeaveDays() * 8); |
| | | // //已使用年假时长 |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // int year = calendar.get(Calendar.YEAR); |
| | | // String startTime = year + "-01-01 00:00:00"; |
| | | // String endTime = year + "-12-31 23:59:59"; |
| | | // Double usedYearTime = attendanceLeaveRepository.getSurplusYearTime(sysUserLevelOther.getUserId(), startTime, endTime); |
| | | // //剩余年假 |
| | | // surplusYearTime = yearTime - (usedYearTime == null ? 0.0 : usedYearTime); |
| | | // } |
| | | // } |
| | | public Double getYearTimeLength(Long userId) { |
| | | //获取年假剩余(新) |
| | | Double surplusYearTime = new Double(0.00); |
| | | // 根据用户查询 |
| | |
| | | |
| | | surplusYearTime = yearTime - (usedYearTime == null ? 0.0 : usedYearTime); |
| | | } |
| | | } |
| | | } |
| | | return surplusYearTime; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户调休假剩余时长 |
| | | */ |
| | | @Override |
| | | public Double getOverTimeLength(Long userId) { |
| | | //获取年假剩余(新) |
| | | Double surplusYearTime = new Double(0.00); |
| | | |
| | | List<AttendanceOvertime> attendanceOvertimeList = attendanceOvertimeRepository.findByUserId(userId); |
| | | if (attendanceOvertimeList.size() > 0) { |
| | | surplusYearTime = attendanceOvertimeList.stream() |
| | | .filter(attendanceOvertime -> attendanceOvertime.getApprovalStatus().equals(Constant.OVERTIME_PASS)) |
| | | .map(attendanceOvertime -> attendanceOvertime.getOvertimeDuration()).reduce(0.0, (o1, o2) -> o1 + o2); |
| | | Double usedTime = attendanceLeaveRepository.sumLeaveDurationByUserIdAndLeaveType(userId, Constant.LEAVE_TYPE_REPLACE); |
| | | if (usedTime != null) { |
| | | surplusYearTime = surplusYearTime - usedTime; |
| | | } |
| | | } |
| | | return surplusYearTime; |
| | |
| | | String leavrType = attendanceLeave.getLeaveType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.LEAVE_TYPE, attendanceLeave.getLeaveType()).getLabel() : ""; |
| | | String leaveStatus = attendanceLeave.getApprovalStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVAL_STATUS, attendanceLeave.getApprovalStatus()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户ID", attendanceLeave.getUserId()); |
| | | map.put("审批用户ID", attendanceLeave.getApprovalUserId()); |
| | | map.put("申请者", attendanceLeave.getUserName()); |
| | | map.put("审批者", attendanceLeave.getAppUserName()); |
| | | map.put("请假类型", leavrType); |
| | | map.put("请假开始时间", attendanceLeave.getLeaveStartTime()); |
| | | map.put("请假结束时间", attendanceLeave.getLeaveEndTime()); |
| | |
| | | attTypeInfo.put("leaveType", attendanceMonthLeaves.get(i).getLeaveType()); |
| | | attTypeInfo.put("leaveCount", attendanceMonthLeaves.get(i).getLeaveCount()); |
| | | attTypeInfo.put("leaveTime", attendanceMonthLeaves.get(i).getLeaveTime()); |
| | | if(attendanceMonthLeaves.get(i).getLeaveType().equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE)){ |
| | | if(attendanceMonthLeaves.get(i).getLeaveType().equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE) || attendanceMonthLeaves.get(i).getLeaveType().equals(Constant.LEAVE_TYPE_REPLACE)){ |
| | | attTypeInfo.put("leaveYearTime", attendanceMonthLeaves.get(i).getSurplusDuration() == null ? 0 : attendanceMonthLeaves.get(i).getSurplusDuration()); |
| | | } |
| | | leaveTypeList.add(attTypeInfo); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @SneakyThrows |
| | | public List<AttendanceMonthDto> queryAll(AttendanceMonthQueryCriteria criteria){ |
| | | return attendanceMonthMapper.toDto(attendanceMonthRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | // 判断工资查询类年月是否为空 |
| | | if (criteria.getAttendanceDate() != null && !"".equals(criteria.getAttendanceDate())) { |
| | | // 年月:国际时间转中国时间 |
| | | criteria.setAttendanceDate(DateUtil.internationalTimeToChinaTime(criteria.getAttendanceDate())); |
| | | } |
| | | List<AttendanceMonthDto> attendanceMonthDtoList = attendanceMonthMapper.toDto(attendanceMonthRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); |
| | | for (AttendanceMonthDto attendanceMonthDto : attendanceMonthDtoList) { |
| | | // 根据用户ID查询用户信息 |
| | | User user = userRepository.findById(attendanceMonthDto.getUserId()).orElseGet(User::new); |
| | | // 用户昵称 |
| | | attendanceMonthDto.setNickName(user.getNickName()); |
| | | // 查询公司 |
| | | SysCompany sysCompany = sysCompanyRepository.findById(attendanceMonthDto.getCompanyId()).orElseGet(SysCompany::new); |
| | | attendanceMonthDto.setCompanyName(sysCompany.getLabel()); |
| | | // 查询部门 |
| | | Dept dept = deptRepository.findById(attendanceMonthDto.getDeptId()).orElseGet(Dept::new); |
| | | attendanceMonthDto.setDeptName(dept.getName()); |
| | | // 查询岗位 |
| | | if(ObjectUtils.isNotEmpty(attendanceMonthDto.getJobId())){ |
| | | Job job = jobRepository.findById(attendanceMonthDto.getJobId()).orElseGet(Job::new); |
| | | attendanceMonthDto.setJobName(job.getName()); |
| | | } |
| | | // List<Map> leaveTypeList = new ArrayList<>(); |
| | | // // 查询请假类型表 |
| | | // List<AttendanceMonthLeave> attendanceMonthLeaves = attendanceMonthLeaveRepository.findByAttendanceMonthId(attendanceMonthDto.getId()); |
| | | // if(attendanceMonthLeaves.size() != 0){ |
| | | // for(int i = 0; i < attendanceMonthLeaves.size(); i++){ |
| | | // Map attTypeInfo = new HashMap(); |
| | | // attTypeInfo.put("leaveType", attendanceMonthLeaves.get(i).getLeaveType()); |
| | | // attTypeInfo.put("leaveCount", attendanceMonthLeaves.get(i).getLeaveCount()); |
| | | // attTypeInfo.put("leaveTime", attendanceMonthLeaves.get(i).getLeaveTime()); |
| | | // if(attendanceMonthLeaves.get(i).getLeaveType().equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE) || attendanceMonthLeaves.get(i).getLeaveType().equals(Constant.LEAVE_TYPE_REPLACE)){ |
| | | // attTypeInfo.put("leaveYearTime", attendanceMonthLeaves.get(i).getSurplusDuration() == null ? 0 : attendanceMonthLeaves.get(i).getSurplusDuration()); |
| | | // } |
| | | // leaveTypeList.add(attTypeInfo); |
| | | // } |
| | | // }else{ |
| | | // Double yearTime = attendanceLeaveService.getYearTimeLength(attendanceMonthDto.getUserId()); |
| | | // attendanceMonthDto.setYearTime(yearTime); |
| | | // } |
| | | // attendanceMonthDto.setLeaveTypeList(leaveTypeList); |
| | | } |
| | | return attendanceMonthDtoList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void download(List<AttendanceMonthDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceMonthDto attendanceMonth : all) { |
| | | // 根据用户ID查询用户信息 |
| | | User user = userRepository.findById(attendanceMonth.getUserId()).orElseGet(User::new); |
| | | // 查询公司 |
| | | SysCompany sysCompany = sysCompanyRepository.findById(attendanceMonth.getCompanyId()).orElseGet(SysCompany::new); |
| | | // 查询部门 |
| | | Dept dept = deptRepository.findById(attendanceMonth.getDeptId()).orElseGet(Dept::new); |
| | | Job job = new Job(); |
| | | // 查询岗位 |
| | | if(attendanceMonth.getJobId() != null){ |
| | | job = jobRepository.findById(attendanceMonth.getJobId()).orElseGet(Job::new); |
| | | } |
| | | // // 根据用户ID查询用户信息 |
| | | // User user = userRepository.findById(attendanceMonth.getUserId()).orElseGet(User::new); |
| | | // // 查询公司 |
| | | // SysCompany sysCompany = sysCompanyRepository.findById(attendanceMonth.getCompanyId()).orElseGet(SysCompany::new); |
| | | // // 查询部门 |
| | | // Dept dept = deptRepository.findById(attendanceMonth.getDeptId()).orElseGet(Dept::new); |
| | | // Job job = new Job(); |
| | | // // 查询岗位 |
| | | // if(attendanceMonth.getJobId() != null){ |
| | | // job = jobRepository.findById(attendanceMonth.getJobId()).orElseGet(Job::new); |
| | | // } |
| | | String isAdmit = attendanceMonth.getIsAdmit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVE_STATUS_ACKNOWLEDGED, attendanceMonth.getIsAdmit()).getLabel() : ""; |
| | | String isP = attendanceMonth.getIsPublicity() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PUBLICITY_STATUS_YES, attendanceMonth.getIsPublicity()).getLabel() : ""; |
| | | |
| | | Double annualLeave = 0.0D; |
| | | Double locationLeave = 0.0D; |
| | | Double compassionateLeave = 0.0D; |
| | | List<AttendanceMonthLeave> attendanceMonthLeaves = attendanceMonthLeaveRepository.findByAttendanceMonthId(attendanceMonth.getId()); |
| | | if(attendanceMonthLeaves.size() != 0){ |
| | | for(AttendanceMonthLeave attendanceMonthLeave : attendanceMonthLeaves){ |
| | | if(attendanceMonthLeave.getLeaveType().equals(Constant.LEAVE_TYPE_COMPASSIONATE_LEAVE) || attendanceMonthLeave.getLeaveType().equals(Constant.LEAVE_TYPE_SICK_LEAVE)){ |
| | | compassionateLeave += attendanceMonthLeave.getLeaveTime(); |
| | | } else { |
| | | } else if (attendanceMonthLeave.getLeaveType().equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE)) { |
| | | annualLeave += attendanceMonthLeave.getLeaveTime(); |
| | | } else if (attendanceMonthLeave.getLeaveType().equals(Constant.LEAVE_TYPE_REPLACE)) { |
| | | locationLeave += attendanceMonthLeave.getLeaveTime(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("统计年月", attendanceMonth.getAttendanceDate()); |
| | | map.put("用户", user.getNickName()); |
| | | map.put("公司", sysCompany.getLabel()); |
| | | map.put("部门", dept.getName()); |
| | | map.put("岗位", job == null ? null : job.getName()); |
| | | map.put("用户", attendanceMonth.getNickName()); |
| | | map.put("公司", attendanceMonth.getCompanyName()); |
| | | map.put("部门", attendanceMonth.getDeptName()); |
| | | map.put("岗位", attendanceMonth.getJobName()); |
| | | map.put("应出勤天数", attendanceMonth.getRequiredAttendanceDays()); |
| | | map.put("应出勤时长", attendanceMonth.getRequiredAttendanceTime()); |
| | | map.put("实际出勤天数", attendanceMonth.getActualAttendanceDays()); |
| | | map.put("应出勤时长", attendanceMonth.getRequiredAttendanceTime()); |
| | | // map.put("外出时长", attendanceMonth.getGoOutTime()); |
| | | // map.put("出差时长", attendanceMonth.getBussTime()); |
| | | map.put("实际出勤时长", attendanceMonth.getActualAttendanceTime()); |
| | | map.put("迟到次数", attendanceMonth.getCountOfBeingLate()); |
| | | map.put("迟到时长", attendanceMonth.getTimeOfBeingLate()); |
| | | map.put("早退次数", attendanceMonth.getCountOfBeingEarly()); |
| | | map.put("早退时长", attendanceMonth.getTimeOfBeingEarly()); |
| | | map.put("外出次数", attendanceMonth.getGoOutNumber()); |
| | | map.put("外出时长", attendanceMonth.getGoOutTime()); |
| | | map.put("出差次数", attendanceMonth.getBussNumber()); |
| | | map.put("出差时长", attendanceMonth.getBussTime()); |
| | | map.put("年假", annualLeave); |
| | | map.put("事假", compassionateLeave); |
| | | // map.put("外出次数", attendanceMonth.getGoOutNumber()); |
| | | // map.put("出差次数", attendanceMonth.getBussNumber()); |
| | | // map.put("出差时长", attendanceMonth.getBussTime()); |
| | | |
| | | map.put("当月使用年假", annualLeave); |
| | | map.put("当月使用调休假", locationLeave); |
| | | map.put("当月使用事假", compassionateLeave); |
| | | |
| | | Double yearTime = attendanceLeaveService.getYearTimeLength(attendanceMonth.getUserId()); |
| | | map.put("剩余年假", yearTime); |
| | | |
| | | Double overTime = attendanceLeaveService.getOverTimeLength(attendanceMonth.getUserId()); |
| | | map.put("剩余调休假", overTime); |
| | | |
| | | map.put("上班缺卡次数", attendanceMonth.getOnCardNumber()); |
| | | map.put("下班缺卡次数", attendanceMonth.getOffCardNumber()); |
| | | map.put("公示状态", attendanceMonth.getIsPublicity()); |
| | | map.put("承认状态", isAdmit); |
| | | map.put("备注", attendanceMonth.getRemarks()); |
| | | map.put("创建者", attendanceMonth.getCreateBy()); |
| | | map.put("创建时间", attendanceMonth.getCreateTime()); |
| | | map.put("更新者", attendanceMonth.getUpdateBy()); |
| | | map.put("更新时间", attendanceMonth.getUpdateTime()); |
| | | // map.put("备注", attendanceMonth.getRemarks()); |
| | | // map.put("创建者", attendanceMonth.getCreateBy()); |
| | | // map.put("创建时间", attendanceMonth.getCreateTime()); |
| | | // map.put("更新者", attendanceMonth.getUpdateBy()); |
| | | // map.put("更新时间", attendanceMonth.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | // list = list.subList(0, 1); |
| | | // list.forEach(System.out::println); |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| | |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.SysRostering; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.*; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | |
| | | private final AttendanceOvertimeRepository attendanceOvertimeRepository; |
| | | private final AttendanceOvertimeMapper attendanceOvertimeMapper; |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final UserRepository userRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<AttendanceOvertimeDto> queryAll(AttendanceOvertimeQueryCriteria criteria){ |
| | | return attendanceOvertimeMapper.toDto(attendanceOvertimeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | List<AttendanceOvertimeDto> attendanceOvertimeDtoList = attendanceOvertimeMapper.toDto(attendanceOvertimeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); |
| | | attendanceOvertimeDtoList.forEach(attendanceOvertimeDto -> { |
| | | //查询用户信息 |
| | | User user = userRepository.findById(attendanceOvertimeDto.getUserId()).orElseGet(User::new); |
| | | attendanceOvertimeDto.setUserName(user.getNickName()); |
| | | //查询审批用户名 |
| | | User appUser = userRepository.findById(attendanceOvertimeDto.getApprovalUserId()).orElseGet(User::new); |
| | | attendanceOvertimeDto.setAppUserName(appUser.getNickName()); |
| | | }); |
| | | return attendanceOvertimeDtoList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void download(List<AttendanceOvertimeDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceOvertimeDto attendanceOvertime : all) { |
| | | String overtimeStatus = attendanceOvertime.getApprovalStatus() != null ? dictDetailRepository.findByDictNameAndValue("overtime_status", attendanceOvertime.getApprovalStatus()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户ID", attendanceOvertime.getUserId()); |
| | | map.put("审批用户ID", attendanceOvertime.getApprovalUserId()); |
| | | map.put("申请者", attendanceOvertime.getUserName()); |
| | | map.put("审批者", attendanceOvertime.getAppUserName()); |
| | | map.put("加班开始时间", attendanceOvertime.getOvertimeStartTime()); |
| | | map.put("加班结束时间", attendanceOvertime.getOvertimeEndTime()); |
| | | map.put("加班时长", attendanceOvertime.getOvertimeDuration()); |
| | | map.put("加班时长单位", attendanceOvertime.getOvertimeDurationUnit()); |
| | | map.put("审批状态", attendanceOvertime.getApprovalStatus()); |
| | | map.put("审批状态", overtimeStatus); |
| | | map.put("审批说明", attendanceOvertime.getApprovalDescription()); |
| | | map.put("备注", attendanceOvertime.getRemarks()); |
| | | list.add(map); |
| | |
| | | private final AttendanceLeaveRepository attendanceLeaveRepository; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | // private final AttendanceOvertimeRepository attendanceOvertimeRepository; |
| | | private final AttendanceOvertimeRepository attendanceOvertimeRepository; |
| | | private final DingTalkServiceImpl dingTalkService; |
| | | |
| | | @Override |
| | |
| | | new Calculate(attendanceGoOut.getOutStartTime().toLocalDateTime(), attendanceGoOut.getOutEndTime().toLocalDateTime()) |
| | | ).collect(Collectors.toList()) |
| | | ); |
| | | // 周末加班 |
| | | List<AttendanceOvertime> attendanceOvertimeList = attendanceOvertimeRepository.findByUserIdAndDate(userId, startOfDate, endOfDate); |
| | | attendanceParts.addAll( |
| | | attendanceOvertimeList.stream().map(attendanceOvertime -> |
| | | new Calculate(attendanceOvertime.getOvertimeStartTime().toLocalDateTime(), attendanceOvertime.getOvertimeEndTime().toLocalDateTime()) |
| | | ).collect(Collectors.toList()) |
| | | ); |
| | | attendanceParts.stream().sorted().reduce(new Stack<Calculate>(), (result, current) -> { |
| | | // 删除重复时间,合并相连的时间段 |
| | | if (result.empty()) { |
| | |
| | | .filter(attendanceLeave -> Constant.LEAVE_TYPE_ANNUAL_LEAVE.equals(attendanceLeave.getLeaveType()) |
| | | || Constant.LEAVE_TYPE_MARRIAGE_HOLIDAY.equals(attendanceLeave.getLeaveType()) |
| | | || Constant.LEAVE_TYPE_BEREAVEMENT_LEAVE.equals(attendanceLeave.getLeaveType()) |
| | | || Constant.LEAVE_TYPE_REPLACE.equals(attendanceLeave.getLeaveType()) |
| | | // || Constant.LEAVE_TYPE_REPLACE.equals(attendanceLeave.getLeaveType()) |
| | | ).map(attendanceLeave -> BigDecimal.valueOf(attendanceLeave.getLeaveDuration())).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); |
| | | return result.add(annualLeaveHours).doubleValue(); |
| | | } |
| | |
| | | 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<>(projectService.queryPartakeAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/projectCost") |
| | | @Log("项目全体分析") |
| | | @ApiOperation("项目全体分析") |
| | | @PreAuthorize("@el.check('project:chart')") |
| | | public ResponseEntity<Object> queryProjectCost(ProjectQueryCriteria criteria) throws ParseException { |
| | | return new ResponseEntity<>(projectService.queryProjectCost(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/subgroupTurnover") |
| | | @Log("查询项目分组营业额") |
| | | @ApiOperation("查询项目分组营业额") |
| | |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | |
| | | */ |
| | | List<ProjectDto> queryPartakeAll(ProjectQueryCriteria criteria); |
| | | |
| | | List<Map<String, Object>> queryProjectCost(ProjectQueryCriteria criteria) throws ParseException; |
| | | |
| | | /** |
| | | * 查询项目分组营业额 |
| | | * @param criteria |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryProjectCost(ProjectQueryCriteria criteria) throws ParseException { |
| | | // 判断入参完整性 |
| | | if (criteria.getTargetYear() == null || "".equals(criteria.getTargetYear())) { |
| | | return null; |
| | | } |
| | | |
| | | List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | |
| | | Sort sort = Sort.by(Sort.Order.desc("createTime")); |
| | | ProjectQueryCriteria criteria1 = new ProjectQueryCriteria(); |
| | | // criteria1.setProjectDistinguish("project_distinguish_product"); // TODO |
| | | criteria1.setProjectStatusNotEqual(Constant.PROJECT_STATUS_COMPLETED); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<Project> projectList = projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria1, criteriaBuilder), sort); |
| | | |
| | | for (Project project : projectList) { |
| | | Query query = new Query( |
| | | Criteria.where("projectId").is(project.getId()) |
| | | .and("planStartTime").gte(sdf.parse(criteria.getTargetYear() + "-01-01")) |
| | | ); |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class); |
| | | |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("projectName", project.getName()); |
| | | |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(new Query(Criteria.where("task").in(taskMongoList)), TaskUserMongo.class); |
| | | result.put("taskHours", taskUserMongoList.stream().mapToDouble(TaskUserMongo::getTaskHours).sum()); |
| | | result.put("consumedHours", taskUserMongoList.stream().mapToDouble(TaskUserMongo::getCostHours).sum()); |
| | | |
| | | if (!result.get("consumedHours").equals(0.0D)) { |
| | | resultList.add(result); |
| | | } |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> querySubgroupTurnover(ProjectQueryCriteria criteria) { |
| | | // 判断入参完整性 |
| | | if (criteria.getTargetYear() == null || "".equals(criteria.getTargetYear())) { |
| | |
| | | value.setRequiredAttendanceTime(Double.valueOf(value.getRequiredAttendanceDays() * 8)); |
| | | // 查询当月请假 |
| | | List<AttendanceLeave> leaveList = attendanceLeaveRepository.findByUserIdAndDate(value.getUserId(), startTime, endTime); |
| | | // // 当月请假时长 |
| | | // Double leaveTimes = 0.0; |
| | | // for(int i = 0; i < leaveList.size(); i++){ |
| | | // // 时间单位为小时就直接加,否则就是天为单位需要乘8 |
| | | // leaveTimes = leaveList.get(i).getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_HOUR) ? leaveTimes + leaveList.get(i).getLeaveDuration() : leaveTimes + leaveList.get(i).getLeaveDuration() * 8; |
| | | // } |
| | | // // 实际出勤时长 |
| | | // value.setActualAttendanceTime(Double.valueOf(value.getRequiredAttendanceTime() - leaveTimes)); |
| | | // 当月请假时长 |
| | | Double leaveTimes = 0.0; |
| | | for(int i = 0; i < leaveList.size(); i++){ |
| | | // 时间单位为小时就直接加,否则就是天为单位需要乘8 |
| | | leaveTimes = leaveList.get(i).getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_HOUR) ? leaveTimes + leaveList.get(i).getLeaveDuration() : leaveTimes + leaveList.get(i).getLeaveDuration() * 8; |
| | | } |
| | | // 实际出勤时长 |
| | | value.setActualAttendanceTime(Double.valueOf(value.getActualAttendanceTime() - leaveTimes)); |
| | | if (value.getActualAttendanceTime() < 0) { |
| | | value.setActualAttendanceTime(0.0); |
| | | } |
| | | //验证考勤月报的确认按钮 |
| | | AttendanceMonth attendanceMonthly = attendanceMonthRepository.findByAttendanceDateAndUserId(baseDate + "-01 00:00:00", value.getUserId()); |
| | | if(ObjectUtil.isNotEmpty(attendanceMonthly) && attendanceMonthly.getIsAdmit() != null && attendanceMonthly.getIsAdmit().equals(Constant.APPROVE_STATUS_ACKNOWLEDGED)){ |
| | |
| | | if(leaveTpeList.get(i2).equals(Constant.LEAVE_TYPE_ANNUAL_LEAVE)){ |
| | | Double yearTime = attendanceLeaveService.getYearTimeLength(insertData.get(i).getUserId()); |
| | | attendanceMonthLeave.setSurplusDuration(yearTime); |
| | | } else if (leaveTpeList.get(i2).equals(Constant.LEAVE_TYPE_LACTATION_LEAVE)) { |
| | | Double yearTime = attendanceLeaveService.getOverTimeLength(insertData.get(i).getUserId()); |
| | | attendanceMonthLeave.setSurplusDuration(yearTime); |
| | | } |
| | | attendanceMonthLeaveRepository.save(attendanceMonthLeave); |
| | | } |
| | |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Async |
| | | //@Async |
| | | public class AttendanceMonthlyMethod { |
| | | |
| | | private final AttendanceMonthTalkServiceImpl attendanceMonthService; |
| | |
| | | } catch (Exception e) { |
| | | return; |
| | | } |
| | | // List<NewSalary> oldNewSalaryList = newSalaryRepository.findByUserIdAndSalaryYearMonth(userId, salaryYearMonth); |
| | | // if (oldNewSalaryList.size() > 0) { |
| | | // for (NewSalary oldNewSalary : oldNewSalaryList) { |
| | | // oldNewSalary.copy(newSalary); |
| | | // newSalaryRepository.save(oldNewSalary); |
| | | // } |
| | | // } else { |
| | | // newSalaryRepository.save(newSalary); |
| | | // } |
| | | List<NewSalary> oldNewSalaryList = newSalaryRepository.findByUserIdAndSalaryYearMonth(userId, salaryYearMonth); |
| | | if (oldNewSalaryList.size() > 0) { |
| | | for (NewSalary oldNewSalary : oldNewSalaryList) { |
| | | oldNewSalary.copy(newSalary); |
| | | newSalaryRepository.save(oldNewSalary); |
| | | } |
| | | } else { |
| | | newSalaryRepository.save(newSalary); |
| | | } |
| | | // create(newSalary); |
| | | // try { |
| | | // 保存 |
| | |
| | | UserDto userDto = userService.findById(userId); |
| | | LocalDate createDate = userDto.getCreateTime().toLocalDateTime().toLocalDate(); |
| | | if (userDto.getInternshipTime() != null) { |
| | | LocalDate localDate = createDate.plusMonths(userDto.getInternshipTime()); |
| | | if (localDate.isAfter(LocalDate.now())) { |
| | | LocalDate localDate1 = createDate.plusMonths(userDto.getInternshipTime()); |
| | | LocalDate localDate2 = LocalDate.parse(targetYearMonth, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | if (!localDate2.isAfter(localDate1)) { |
| | | coefficient = 0.8; |
| | | } |
| | | } |
| | |
| | | UserDto userDto = userService.findById(userId); |
| | | LocalDate createDate = userDto.getCreateTime().toLocalDateTime().toLocalDate(); |
| | | if (userDto.getInternshipTime() != null) { |
| | | LocalDate localDate = createDate.plusMonths(userDto.getInternshipTime()); |
| | | if (localDate.isAfter(LocalDate.now())) { |
| | | LocalDate localDate1 = createDate.plusMonths(userDto.getInternshipTime()); |
| | | LocalDate localDate2 = LocalDate.parse(targetYearMonth, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | if (localDate1.isAfter(localDate2)) { |
| | | // 税前工资累计 |
| | | newSalary.setAfterTaxAmount(newSalary.getPreTaxAmount()); |
| | | return newSalary; |
| | |
| | | if (entry.getValue() >= 8) { |
| | | calendarVo.setDate(entry.getKey()); |
| | | calendarVo.setIsOk(true); |
| | | calendarVo.setTitle("工时:" + entry.getValue()); |
| | | calendarVo.setTitle("工时:" + BigDecimal.valueOf(entry.getValue()).setScale(2, RoundingMode.HALF_UP)); |
| | | calendarVo.setType(2); |
| | | } else { |
| | | calendarVo.setDate(entry.getKey()); |
| | | calendarVo.setIsOk(false); |
| | | calendarVo.setTitle("已填工时:" + entry.getValue() + " 不足8小时,请补充日报"); |
| | | calendarVo.setTitle("已填工时:" + BigDecimal.valueOf(entry.getValue()).setScale(2, RoundingMode.HALF_UP) + " 不足8小时,请补充日报"); |
| | | calendarVo.setType(2); |
| | | } |
| | | calendarInfo.add(calendarVo); |
| | |
| | | // 绩效详细 |
| | | returnData.put("achievementsList", resultList); |
| | | |
| | | // 换休时长 |
| | | Double overTime = attendanceLeaveService.getOverTimeLength(userId); |
| | | returnData.put("overTime", overTime); |
| | | |
| | | return returnData; |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.task.domain; |
| | | |
| | | public interface TaskUserGroupByUserInterface { |
| | | |
| | | /** |
| | | * 用户ID |
| | | * @return |
| | | */ |
| | | Long getUserId(); |
| | | |
| | | Long getTaskNum(); |
| | | |
| | | /** |
| | | * 消耗工时 |
| | | * @return |
| | | */ |
| | | Double getConsumedHours(); |
| | | } |
| | | |
| | |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('taskUser:download')") |
| | | public void exportTaskUser(HttpServletResponse response, TaskUserQueryCriteria criteria) throws IOException { |
| | | //taskUserService.download(taskUserService.queryAll(criteria), response); |
| | | taskUserService.download(taskUserService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | |
| | | Map<String,Object> queryAll(TaskUserQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | List<TaskUserMongoDto> queryAll(TaskUserQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param |
| | | * @return List<TaskUserDto> |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<TaskUserDto> all, HttpServletResponse response) throws IOException; |
| | | void download(List<TaskUserMongoDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 分配 |
| | |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | |
| | | Set<Long> projectIds = Stream.of(projectList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toSet()); |
| | | Set<Long> projectIds = Stream.of(projectList, projectIdList).flatMap(Collection::stream).collect(Collectors.toSet()); |
| | | criteria.setApproveStatusIn(Arrays.asList(Constant.APPROVE_STATUS_MASTER_ACKNOWLEDGED, Constant.APPROVE_STATUS_ACKNOWLEDGED)); |
| | | criteria.setProjectStatusNotEqual(Constant.PROJECT_STATUS_COMPLETED); |
| | | criteria.setIdInList(new ArrayList<Long>(projectIds)); |
| | |
| | | taskMongoDto.setPlanWorkloadUnit(taskMongo.getPlanWorkloadUnit()); |
| | | } |
| | | |
| | | taskMongoDto.setConsumedHours(0.0D); |
| | | |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(Query.query(Criteria.where("task").is(taskMongo)), TaskUserMongo.class); |
| | | List<TaskDaliyMongo> taskDaliyMongoList = mongoTemplate.find(Query.query(Criteria.where("taskUserMongo").in(taskUserMongoList)), TaskDaliyMongo.class); |
| | | double consumedHours = taskDaliyMongoList.stream() |
| | | .map(taskDaliyMongo -> BigDecimal.valueOf(taskDaliyMongo.getConsumedHours())) |
| | | .reduce(BigDecimal::add).orElse(BigDecimal.ZERO).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
| | | taskMongoDto.setConsumedHours(taskMongoDto.getConsumedHours() + consumedHours); |
| | | |
| | | Query query = new Query(Criteria.where("parent").is(taskMongo)); |
| | | List<TaskMongo> children = mongoTemplate.find(query, TaskMongo.class); |
| | | if (children == null || children.size() == 0) { |
| | |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.SysUserLevelWageRepository; |
| | | import me.zhengjie.modules.task.domain.*; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.modules.task.service.dto.*; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import me.zhengjie.modules.treatment.repository.UserLevelWageRepository; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import org.bson.types.ObjectId; |
| | | import org.springframework.cache.annotation.CacheConfig; |
| | |
| | | @CacheConfig(cacheNames = "taskUser") |
| | | public class TaskUserServiceImpl implements TaskUserService { |
| | | |
| | | private final TaskUserRepository taskUserRepository; |
| | | private final TaskUserMapper taskUserMapper; |
| | | private final UserRepository userRepository; |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final TaskRepository taskRepository; |
| | | private final UserService userService; |
| | | private final MongoTemplate mongoTemplate; |
| | | private final UserLevelWageRepository userLevelWageRepository; |
| | | private final SysUserLevelWageRepository sysUserLevelWageRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final ProjectRepository projectRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | // @Override |
| | | // public TaskUserTotalMongoDto sumTotalByTask(String taskId) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<TaskUserMongoDto> queryAll(TaskUserQueryCriteria criteria) { |
| | | Criteria criteriaMongo = new Criteria(); |
| | | if (criteria.getTaskId() != null) { |
| | | TaskMongo taskMongo = mongoTemplate.findById(criteria.getTaskId(), TaskMongo.class); |
| | | criteriaMongo.and("task").is(taskMongo); |
| | | } else { |
| | | return Collections.emptyList(); |
| | | } |
| | | if (criteria.getUserId() != null) { |
| | | criteriaMongo = criteriaMongo.and("userId").is(criteria.getUserId()); |
| | | } |
| | | if (criteria.getTaskStatus() != null && criteria.getTaskStatus().size() > 0) { |
| | | criteriaMongo = criteriaMongo.and("taskStatus").in(criteria.getTaskStatus()); |
| | | } |
| | | Query query = new Query(criteriaMongo); |
| | | |
| | | long count = mongoTemplate.count(query, TaskUserMongo.class); |
| | | if (count == 0) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(query, TaskUserMongo.class); |
| | | List<TaskUserMongoDto> taskUserMongoDtoList = taskUserMongoList.stream().map(taskUserMongo -> { |
| | | TaskUserMongoDto taskUserMongoDto = new TaskUserMongoDto(); |
| | | taskUserMongoDto.setId(taskUserMongo.getId()); |
| | | taskUserMongoDto.setName(taskUserMongo.getName()); |
| | | taskUserMongoDto.setOld_id(taskUserMongo.getTask().getOld_id()); |
| | | List<TaskDaliyMongo> daliyMongoList = mongoTemplate.find(Query.query(new Criteria("taskUserMongo").is(taskUserMongo)), TaskDaliyMongo.class); |
| | | if (daliyMongoList.size() > 0) { |
| | | taskUserMongoDto.setStart(true); |
| | | } |
| | | taskUserMongoDto.setCostHours(daliyMongoList.stream().mapToDouble(TaskDaliyMongo::getConsumedHours).sum()); |
| | | if (taskUserMongo.getTaskStatus().equals(Constant.TASK_STATUS_COMPLETED)) { |
| | | taskUserMongoDto.setOk(true); |
| | | } |
| | | if (taskUserMongo.getUserId() != null) { |
| | | taskUserMongoDto.setUserId(taskUserMongo.getUserId()); |
| | | UserDto userDto = userService.findById(taskUserMongo.getUserId()); |
| | | taskUserMongoDto.setUserNickName(userDto.getNickName()); |
| | | } |
| | | |
| | | taskUserMongoDto.setTaskId(taskUserMongo.getTask().getId()); |
| | | taskUserMongoDto.setPerformanceType(taskUserMongo.getPerformanceType()); |
| | | taskUserMongoDto.setPriority(taskUserMongo.getPriority()); |
| | | taskUserMongoDto.setTaskStatus(taskUserMongo.getTaskStatus()); |
| | | |
| | | taskUserMongoDto.setTaskStartDate(taskUserMongo.getTaskStartDate()); |
| | | taskUserMongoDto.setTaskEndDate(taskUserMongo.getTaskEndDate()); |
| | | taskUserMongoDto.setTaskHours(taskUserMongo.getTaskHours()); |
| | | |
| | | if (daliyMongoList.size() == 0) { |
| | | //没有日报 |
| | | taskUserMongoDto.setNewTaskProgress(0D); |
| | | } else { |
| | | daliyMongoList.sort(((o1, o2) -> o2.getFillDate().compareTo(o1.getFillDate()))); |
| | | //有日报 |
| | | taskUserMongoDto.setNewTaskProgress(daliyMongoList.get(0).getTaskProgress()); |
| | | } |
| | | taskUserMongoDto.setPerformanceHours(taskUserMongo.getTaskHours()); |
| | | return taskUserMongoDto; |
| | | }).collect(Collectors.toList()); |
| | | return taskUserMongoDtoList; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> queryAll(TaskUserQueryCriteria criteria, Pageable pageable) { |
| | | |
| | | Criteria criteriaMongo = new Criteria(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<TaskUserDto> all, HttpServletResponse response) throws IOException { |
| | | // List<Map<String, Object>> list = new ArrayList<>(); |
| | | // for (TaskUserDto taskUser : all) { |
| | | // String projectName = taskUser.getProjectId() != null ? projectRepository.findById(taskUser.getProjectId()).orElseGet(Project::new).getName() : ""; |
| | | // String taskName = taskUser.getTaskId() != null ? taskRepository.findById(taskUser.getTaskId()).orElseGet(Task::new).getName() : ""; |
| | | // String userNickName = taskUser.getUserId() != null ? userRepository.findById(taskUser.getUserId()).orElseGet(User::new).getNickName() : ""; |
| | | // String taskStatus = taskUser.getTaskStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.TASK_STATUS, taskUser.getTaskStatus()).getLabel() : ""; |
| | | // Map<String,Object> map = new LinkedHashMap<>(); |
| | | // map.put("项目名称", projectName); |
| | | // map.put("任务名称", taskName); |
| | | // map.put("用户姓名", userNickName); |
| | | // map.put("任务开始时间", taskUser.getTaskStartDate()); |
| | | // map.put("任务结束时间", taskUser.getTaskEndDate()); |
| | | // map.put("任务工时", taskUser.getTaskHours()); |
| | | // map.put("任务工作量", taskUser.getTaskWorkload()); |
| | | // map.put("任务状态", taskStatus); |
| | | // map.put("备注", taskUser.getRemarks()); |
| | | // map.put("创建者", taskUser.getCreateBy()); |
| | | // map.put("创建时间", taskUser.getCreateTime()); |
| | | // map.put("更新者", taskUser.getUpdateBy()); |
| | | // map.put("更新时间", taskUser.getUpdateTime()); |
| | | // list.add(map); |
| | | // } |
| | | // FileUtil.downloadExcel(list, response); |
| | | public void download(List<TaskUserMongoDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (TaskUserMongoDto taskUser : all) { |
| | | String taskUserName = taskUser.getName(); |
| | | TaskMongo taskMongo = mongoTemplate.findById(new ObjectId(taskUser.getTaskId()), TaskMongo.class); |
| | | String taskName = taskMongo.getName(); |
| | | String projectName = projectRepository.findById(taskMongo.getProjectId()).orElseGet(Project::new).getName(); |
| | | String userNickName = taskUser.getUserNickName(); |
| | | String taskStatus = taskUser.getTaskStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.TASK_STATUS, taskUser.getTaskStatus()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("项目名称", projectName); |
| | | map.put("任务名称", taskName); |
| | | map.put("任务分配", taskUserName); |
| | | map.put("任务开始时间", taskUser.getTaskStartDate()); |
| | | map.put("任务结束时间", taskUser.getTaskEndDate()); |
| | | map.put("任务工时", taskUser.getTaskHours()); |
| | | map.put("用户姓名", userNickName); |
| | | map.put("消耗工时", taskUser.getCostHours()); |
| | | map.put("任务进度", taskUser.getNewTaskProgress() + "%"); |
| | | map.put("任务状态", taskStatus); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | // @Override |
| | |
| | | #配置数据源 |
| | | spring: |
| | | main: |
| | | allow-circular-references: true |
| | | data: |
| | | mongodb: |
| | | uri: mongodb://${MONGO_USER:mongoadmin}:${MONGO_PASS:secret}@${MONGO_HOST:114.116.101.63}:${MONGO_PORT:32452}/${MONGO_NAME:pms_upgrade}?authSource=admin&readPreference=primary&ssl=false&directConnection=true |
| | | datasource: |
| | | druid: |
| | | db-type: com.alibaba.druid.pool.DruidDataSource |
| | |
| | | multi-statement-allow: true |
| | | # 配置消息队列 |
| | | rabbitmq: |
| | | host: 114.116.101.63 |
| | | port: 31444 |
| | | username: admin |
| | | password: 7658757a@ |
| | | host: ${RABBITMQ_HOST:114.116.101.63} |
| | | port: ${RABBITMQ_PORT:31444} |
| | | username: ${RABBITMQ_DEFAULT_USER:admin} |
| | | password: ${RABBITMQ_DEFAULT_PASS:7658757a@} |
| | | # 虚拟host 可以不设置,使用server默认host |
| | | virtual-host: / |
| | | |
| | |
| | | enabled: false |
| | | # pid: |
| | | # file: /自行指定位置/eladmin.pid |
| | | logging: |
| | | level: |
| | | org: |
| | | springframework: |
| | | data: |
| | | mongodb: |
| | | core: |
| | | MongoTemplate: DEBUG |
| | | #配置 Jpa |
| | | jpa: |
| | | hibernate: |
| | | ddl-auto: none |
| | | open-in-view: true |
| | | show-sql: true |
| | | # show-sql: true |
| | | properties: |
| | | hibernate: |
| | | dialect: org.hibernate.dialect.MySQL5InnoDBDialect |
| | |
| | | redis: |
| | | #数据库索引 |
| | | database: ${REDIS_DB:0} |
| | | host: ${REDIS_HOST:127.0.0.1} |
| | | host: ${REDIS_HOST:localhost} |
| | | port: ${REDIS_PORT:6379} |
| | | password: ${REDIS_PWD:} |
| | | #连接超时时间 |
| | | timeout: 5000 |
| | | #logging: |
| | | # level: |
| | | # org: |
| | | # springframework: |
| | | # data: |
| | | # mongodb: |
| | | # core: |
| | | # MongoTemplate: DEBUG |
| | | |
| | | task: |
| | | pool: |
| New file |
| | |
| | | package me.zhengjie; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceGoOut; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceOvertime; |
| | | import me.zhengjie.modules.attendance.domain.Calculate; |
| | | import me.zhengjie.modules.attendance.service.AttendanceGoOutService; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.task.AttendanceMonthlyMethod; |
| | | import me.zhengjie.modules.system.domain.SysRostering; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.SysRosteringRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.SysConfigHolidayService; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigHolidayDto; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.stream.Stream; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
| | | public class AttendanceTest { |
| | | |
| | | @Autowired |
| | | private AttendanceGoOutService attendanceGoOutService; |
| | | @Autowired |
| | | private UserRepository userRepository; |
| | | @Autowired |
| | | private SysConfigHolidayService sysConfigHolidayService; |
| | | @Autowired |
| | | private SysRosteringRepository sysRosteringRepository; |
| | | |
| | | @Test |
| | | public void test() { |
| | | AttendanceGoOut resources = new AttendanceGoOut(); |
| | | resources.setUserId(128L); |
| | | resources.setOutStartTime(Timestamp.valueOf(LocalDateTime.of(2024, 3, 25, 9, 0, 0))); |
| | | resources.setOutEndTime(Timestamp.valueOf(LocalDateTime.of(2024, 3, 25, 18, 0, 0))); |
| | | |
| | | // 获取当前登陆人信息,设置为请假发起人 |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | |
| | | LocalDate startDate = resources.getOutStartTime().toLocalDateTime().toLocalDate(); |
| | | LocalDate endDate = resources.getOutEndTime().toLocalDateTime().toLocalDate(); |
| | | LocalTime startTime = resources.getOutStartTime().toLocalDateTime().toLocalTime(); |
| | | LocalTime endTime = resources.getOutEndTime().toLocalDateTime().toLocalTime(); |
| | | long distance = ChronoUnit.DAYS.between(startDate, endDate); |
| | | Stream.iterate(startDate, d -> d.plusDays(1)).limit(distance + 1).forEach(localDate -> { |
| | | //resUserId为null说明是添加,反之 |
| | | if (resources.getUserId() == null) { |
| | | resources.setUserId(user.getId()); |
| | | } |
| | | resources.setOutStartTime(Timestamp.valueOf(localDate.atTime(startTime))); |
| | | resources.setOutEndTime(Timestamp.valueOf(localDate.atTime(endTime))); |
| | | |
| | | Calculate calculate = new Calculate(); |
| | | calculate.setStart(resources.getOutStartTime().toLocalDateTime()); |
| | | calculate.setEnd(resources.getOutEndTime().toLocalDateTime()); |
| | | |
| | | SysRostering sysRostering = sysRosteringRepository.findByRosId(2L); |
| | | |
| | | LocalDate startDate1 = calculate.getStart().toLocalDate(); |
| | | LocalDate endDate2 = calculate.getEnd().toLocalDate(); |
| | | LocalTime startTime2 = calculate.getStart().toLocalTime(); |
| | | LocalTime endTime2 = calculate.getEnd().toLocalTime(); |
| | | long distance2 = ChronoUnit.DAYS.between(startDate1, endDate2); |
| | | long timeSeconds = Stream.iterate(startDate1, d -> d.plusDays(1)).limit(distance2 + 1).map(localDate2 -> { |
| | | SysConfigHolidayDto sysConfigHolidayDto = sysConfigHolidayService.queryByHolidayDate(localDate2.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | Boolean isWeekend = localDate2.getDayOfWeek() == DayOfWeek.SATURDAY || localDate2.getDayOfWeek() == DayOfWeek.SUNDAY; |
| | | if ((sysConfigHolidayDto == null && !isWeekend) || |
| | | sysConfigHolidayDto != null && Constant.DATE_TYPE_WEEKDAY.equals(sysConfigHolidayDto.getDateType())) { |
| | | |
| | | LocalDateTime goOutStartTime = localDate2.atTime(startTime2); |
| | | LocalDateTime goOutEndTime = localDate2.atTime(endTime2); |
| | | LocalDateTime lunchStartTime = localDate2.atTime(sysRostering.getLunchStartTime()); |
| | | LocalDateTime lunchEndTime = localDate2.atTime(sysRostering.getLunchEndTime()); |
| | | |
| | | |
| | | if (goOutEndTime.isBefore(lunchStartTime) || goOutStartTime.isAfter(lunchEndTime)) { |
| | | return ChronoUnit.SECONDS.between(goOutStartTime, goOutEndTime); |
| | | } else if (!goOutEndTime.isBefore(lunchStartTime) && !goOutEndTime.isAfter(lunchEndTime)) { |
| | | return ChronoUnit.SECONDS.between(goOutStartTime, lunchStartTime); |
| | | } else if (!goOutStartTime.isBefore(lunchStartTime) && !goOutStartTime.isAfter(lunchEndTime)) { |
| | | return ChronoUnit.SECONDS.between(lunchEndTime, goOutEndTime); |
| | | } else { |
| | | return ChronoUnit.SECONDS.between(goOutStartTime, goOutEndTime) - 3600; |
| | | } |
| | | } |
| | | return 0L; |
| | | }).reduce(0L, (result, current) -> result + current); |
| | | |
| | | Double result = Double.valueOf(new BigDecimal((float) timeSeconds / 3600).setScale(2, BigDecimal.ROUND_HALF_UP).toString()); |
| | | |
| | | System.out.println("result : " + result); |
| | | |
| | | }); |
| | | } |
| | | |
| | | @Autowired |
| | | private AttendanceMonthlyMethod attendanceMonthlyMethod; |
| | | |
| | | @Test |
| | | public void exec100() throws ParseException { |
| | | attendanceMonthlyMethod.getMonthlyData(); |
| | | } |
| | | } |
| | |
| | | package me.zhengjie; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | import java.util.TreeMap; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.bson.types.ObjectId; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | |
| | | import me.zhengjie.modules.task.domain.TaskDaliyMongo; |
| | | import me.zhengjie.modules.attendance.domain.Calculate; |
| | | import me.zhengjie.modules.attendance.service.AttendanceService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceQueryCriteria; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.domain.TaskUserMongo; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria; |
| | | import me.zhengjie.modules.task.service.dto.TaskMongoDto; |
| | | import me.zhengjie.modules.task.service.impl.TaskServiceImpl; |
| | | import me.zhengjie.modules.task.service.impl.TaskUserServiceImpl; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
| | | public class EladminSystemApplicationTests { |
| | |
| | | System.out.println("==================================================="); |
| | | } |
| | | |
| | | @Autowired |
| | | private AttendanceService attendanceService; |
| | | |
| | | @Autowired |
| | | private TaskDaliyService taskDaliyService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Test |
| | | @Transactional |
| | | public void findNG() { |
| | | AttendanceQueryCriteria criteria = new AttendanceQueryCriteria(); |
| | | criteria.setAttendanceDateLike("2023-12"); |
| | | List<AttendanceDto> attendanceDtoList = attendanceService.queryAll(criteria); |
| | | System.out.println("total count : " + attendanceDtoList.size()); |
| | | attendanceDtoList.stream().forEach(attendanceDto -> { |
| | | Long userId = attendanceDto.getUserId(); |
| | | Timestamp attendanceDate = attendanceDto.getAttendanceDate(); |
| | | |
| | | TaskDaliyQueryCriteria taskDaliyQueryCriteria = new TaskDaliyQueryCriteria(); |
| | | taskDaliyQueryCriteria.setUserId(userId); |
| | | taskDaliyQueryCriteria.setFillDate(attendanceDate); |
| | | List<TaskDaliyDto> taskDaliyDtoList = taskDaliyService.queryAll(taskDaliyQueryCriteria); |
| | | Double totalConsumedHours = taskDaliyDtoList.stream().collect(Collectors.summingDouble(TaskDaliyDto::getConsumedHours)); |
| | | |
| | | if (totalConsumedHours == 0.0) { |
| | | return; |
| | | } |
| | | |
| | | Double attendanceHours = 0.0; |
| | | |
| | | if (attendanceDto.getActualWorkStartTime() != null && attendanceDto.getActualWorkEndTime() != null) { |
| | | Calculate calculate = new Calculate(); |
| | | calculate.setStart(attendanceDto.getActualWorkStartTime().toLocalDateTime()); |
| | | calculate.setEnd(attendanceDto.getActualWorkEndTime().toLocalDateTime()); |
| | | attendanceHours = BigDecimal.valueOf(attendanceService.calculateTimes(calculate, userId)).divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | if (totalConsumedHours > attendanceHours) { |
| | | System.out.print("姓名 : " + userService.findById(userId).getNickName() + "\t"); |
| | | System.out.println("日期 : " + attendanceDate.toString()); |
| | | System.out.println("应填小时数 : " + attendanceHours); |
| | | System.out.println("实填小时数 : " + totalConsumedHours); |
| | | System.out.println("==========================================================="); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | } |
| | | |
| | |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | | import me.zhengjie.modules.task.repository.TaskUserRepository; |
| | | import me.zhengjie.modules.task.service.TaskUserService; |
| | | import me.zhengjie.modules.task.service.dto.TaskMongoDto; |
| | | import me.zhengjie.modules.task.service.dto.TaskQueryCriteria; |
| | | import me.zhengjie.modules.task.service.impl.TaskServiceImpl; |
| | | import me.zhengjie.modules.task.service.impl.TaskUserServiceImpl; |
| | | import me.zhengjie.modules.treatment.domain.CmnLevel; |
| | | import me.zhengjie.modules.treatment.domain.CmnLevelRank; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | |
| | | import me.zhengjie.modules.treatment.repository.CmnLevelRepository; |
| | | import me.zhengjie.modules.treatment.repository.UserLevelWageRepository; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.sql.Timestamp; |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | |
| | | List<Task> taskListSub = getSubList(task); |
| | | changeToMongo(taskMongo, taskListSub); |
| | | |
| | | // // 查询任务分配 |
| | | // List<TaskUser> taskUserList = taskUserRepository.findByTaskId(task.getId()); |
| | | // // 查询是拥有否有子级 |
| | | // List<Task> taskListFP = taskRepository.findByPid(task.getId()); |
| | | // if (taskUserList.size() <= 0 && taskListFP.size() <= 0 && task.getPid() == null) { |
| | | // // 一级(无父无子没有分配的任务) |
| | | // TaskUserMongo taskUserMongo1 = new TaskUserMongo(); |
| | | // taskUserMongo1.setTask(taskMongo); |
| | | // taskUserMongo1.setName(task.getName()); |
| | | // taskUserMongo1.setPerformanceType(task.getPerformanceType()); |
| | | // taskUserMongo1.setPriority(task.getPriority()); |
| | | // taskUserMongo1.setTaskStatus("task_status_in_hand"); |
| | | // taskUserMongo1.setOld_id(null); |
| | | // mongoTemplate.save(taskUserMongo1); |
| | | // } else { |
| | | List<TaskUser> taskUserList = taskUserRepository.findByTaskId(task.getId()); |
| | | for (TaskUser taskUser : taskUserList) { |
| | | //有效 |
| | |
| | | taskUserMongo.setName(task.getName()); |
| | | taskUserMongo.setPerformanceType(task.getPerformanceType()); |
| | | taskUserMongo.setPriority(task.getPriority()); |
| | | // taskUserMongo.setPerformanceHours(null); // TODO |
| | | // Double num = 0.0; |
| | | // List<UserLevelWage> userLevelWageList = userLevelWageRepository.findUserLevelWageByUserId(taskUser.getUserId()); |
| | | // if (userLevelWageList.size() > 0) { |
| | | // UserLevelWage userLevelWage = userLevelWageList.get(0); |
| | | // BigDecimal bigDecimalValue = new BigDecimal(String.valueOf(userLevelWage.getPerformanceCoefficient())); |
| | | // double doubleValue = bigDecimalValue.doubleValue(); |
| | | // DecimalFormat decimalFormat = new DecimalFormat("#"); |
| | | // decimalFormat.setRoundingMode(RoundingMode.HALF_UP); |
| | | // //绩效工时 = 任务工时/绩效系数 |
| | | // num = Double.valueOf(decimalFormat.format(Double.valueOf(taskUser.getTaskHours()) / doubleValue)); |
| | | // } |
| | | |
| | | taskUserMongo.setPerformanceHours(taskUser.getTaskHours()); |
| | | taskUserMongo.setTaskHours(taskUser.getTaskHours()); |
| | | taskUserMongo.setTaskStartDate(taskUser.getTaskStartDate()); |
| | |
| | | taskUserMongo.setTaskStatus(taskUser.getTaskStatus()); |
| | | taskUserMongo.setRemarks(taskUser.getRemarks()); |
| | | //查询当前用户的这个任务填写的所有日报 |
| | | List<TaskDaliy> taskUserLists = taskDaliyRepository.findByTaskIdAndUserId(task.getId(), taskUser.getUserId()); |
| | | if (taskUserLists.size() == 0) { |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByTaskIdAndUserId(task.getId(), taskUser.getUserId()); |
| | | if (taskDaliyList.size() == 0) { |
| | | taskUserMongo.setCostHours(0.0); |
| | | } else { |
| | | Double coustHorseCount = 0.0; |
| | | for (TaskDaliy taskDaliy : taskUserLists) { |
| | | coustHorseCount = coustHorseCount + taskDaliy.getConsumedHours(); |
| | | taskUserMongo.setCostHours(taskDaliyList.stream().mapToDouble(TaskDaliy::getConsumedHours).sum()); |
| | | } |
| | | taskUserMongo.setCostHours(coustHorseCount); |
| | | } |
| | | |
| | | mongoTemplate.save(taskUserMongo); |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findByTaskIdAndUserId(task.getId(), taskUser.getUserId()); |
| | | for (TaskDaliy taskDaliy : taskDaliyList) { |
| | | //查重 |
| | | Query queryDaily = new Query(); |
| | |
| | | taskDaliyMongo.setUserId(taskUserMongo.getUserId()); |
| | | taskDaliyMongo.setFillDate(taskDaliy.getFillDate()); |
| | | taskDaliyMongo.setConsumedHours(taskDaliy.getConsumedHours()); |
| | | TaskUser byTaskIdAndTaskInnerIdAndUserId = taskUserRepository.findByTaskIdAndTaskInnerIdAndUserId(taskDaliy.getTaskId(), taskDaliy.getTaskInnerId(), taskDaliy.getUserId()); |
| | | taskDaliyMongo.setPerformanceHours(byTaskIdAndTaskInnerIdAndUserId.getTaskHours()); |
| | | taskDaliyMongo.setTaskProgress(taskDaliy.getTaskProgress()); |
| | | taskDaliyMongo.setSettlementStatus(taskDaliy.getSettlementStatus()); |
| | | taskDaliyMongo.setRemarks(taskDaliy.getRemarks()); |
| | | //taskDaliyMongo.setCreateTime(taskDaliy.getCreateTime()); |
| | | //taskDaliyMongo.setUpdateTime(taskDaliy.getUpdateTime()); |
| | | mongoTemplate.save(taskDaliyMongo); |
| | | } |
| | | |
| | | } |
| | | } |
| | | // } |
| | | } |
| | | // return resultList; |
| | | } |
| | | |
| | | public List<Task> getSubList(Task task) { |
| New file |
| | |
| | | package me.zhengjie; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.dto.ProjectQueryCriteria; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.modules.task.domain.TaskDaliyMongo; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.domain.TaskUserMongo; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import me.zhengjie.modules.treatment.repository.UserLevelWageRepository; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
| | | public class ProjectTest { |
| | | |
| | | @Autowired |
| | | private ProjectRepository projectRepository; |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private UserLevelWageRepository userLevelWageRepository; |
| | | |
| | | @Test |
| | | public void closeTaskByProject() { |
| | | List<Project> projectList = projectRepository.findByProjectStatus(Constant.PROJECT_STATUS_COMPLETED); |
| | | projectList.stream().map(project -> project.getName()).forEach(System.out::println); |
| | | } |
| | | |
| | | @Test |
| | | public void closeTaskByProject2() { |
| | | List<Project> projectList = projectRepository.findByProjectStatus(Constant.PROJECT_STATUS_COMPLETED); |
| | | projectList.stream().forEach(project -> { |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("projectId").is(project.getId()).and("taskStatus").ne(Constant.TASK_STATUS_COMPLETED)), TaskMongo.class); |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(Query.query(new Criteria("task").in(taskMongoList).and("taskStatus").ne(Constant.TASK_STATUS_COMPLETED)), TaskUserMongo.class); |
| | | taskUserMongoList.stream().map(taskUserMongo -> { |
| | | taskUserMongo.setTaskStatus(Constant.TASK_STATUS_COMPLETED); |
| | | return taskUserMongo; |
| | | }).forEach(taskUserMongo -> mongoTemplate.save(taskUserMongo)); |
| | | taskMongoList.stream().map(taskMongo -> { |
| | | taskMongo.setTaskStatus(Constant.TASK_STATUS_COMPLETED); |
| | | return taskMongo; |
| | | }).forEach(taskMongo -> mongoTemplate.save(taskMongo)); |
| | | }); |
| | | } |
| | | |
| | | @Test |
| | | public void closeTaskByProject4() { |
| | | List<Project> projectList = projectRepository.findByProjectStatus(Constant.PROJECT_STATUS_COMPLETED); |
| | | projectList.stream().forEach(project -> { |
| | | Long count1 = mongoTemplate.count(Query.query(new Criteria("projectId").is(project.getId()).and("taskStatus").ne(Constant.TASK_STATUS_COMPLETED)), TaskMongo.class); |
| | | System.out.println("count1 : " + count1); |
| | | }); |
| | | } |
| | | |
| | | @Test |
| | | public void closeTaskByProject3() { |
| | | List<Project> projectList = projectRepository.findByProjectStatus(Constant.PROJECT_STATUS_COMPLETED); |
| | | projectList.stream().forEach(project -> { |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("projectId").is(project.getId())), TaskMongo.class); |
| | | Long count2 = mongoTemplate.count(Query.query(new Criteria("task").in(taskMongoList).and("taskStatus").ne(Constant.TASK_STATUS_COMPLETED)), TaskUserMongo.class); |
| | | System.out.println("count2 : " + count2); |
| | | // taskMongoList.stream().map(taskMongo -> { |
| | | // taskMongo.setTaskStatus(Constant.TASK_STATUS_COMPLETED); |
| | | // return taskMongo; |
| | | // }).forEach(taskMongo -> mongoTemplate.save(taskMongo)); |
| | | }); |
| | | } |
| | | |
| | | @Test |
| | | public void closeTaskBySingleId() { |
| | | Long id = 32L; |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("projectId").is(id)), TaskMongo.class); |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(Query.query(new Criteria("task").in(taskMongoList).and("taskStatus").ne(Constant.TASK_STATUS_COMPLETED)), TaskUserMongo.class); |
| | | taskUserMongoList.stream().map(taskUserMongo -> { |
| | | taskUserMongo.setTaskStatus(Constant.TASK_STATUS_COMPLETED); |
| | | return taskUserMongo; |
| | | }).forEach(taskUserMongo -> mongoTemplate.save(taskUserMongo)); |
| | | taskMongoList.stream().map(taskMongo -> { |
| | | taskMongo.setTaskStatus(Constant.TASK_STATUS_COMPLETED); |
| | | return taskMongo; |
| | | }).forEach(taskMongo -> mongoTemplate.save(taskMongo)); |
| | | // mongoTemplate.findAndModify(Query.query(new Criteria("task").in(taskMongoList)), Update.update("taskStatus", Constant.TASK_STATUS_COMPLETED), TaskUserMongo.class); |
| | | } |
| | | |
| | | @Test |
| | | public void closeTaskBySingleId2() { |
| | | Long id = 32L; |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("projectId").is(id)), TaskMongo.class); |
| | | Long count2 = mongoTemplate.count(Query.query(new Criteria("task").in(taskMongoList).and("taskStatus").ne(Constant.TASK_STATUS_COMPLETED)), TaskUserMongo.class); |
| | | System.out.println("count1 : " + taskMongoList.size()); |
| | | System.out.println("count2 : " + count2); |
| | | // mongoTemplate.findAndModify(Query.query(new Criteria("task").in(taskMongoList)), Update.update("taskStatus", Constant.TASK_STATUS_COMPLETED), TaskUserMongo.class); |
| | | } |
| | | |
| | | @Test |
| | | public void closeTaskUserByTaskId() { |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("taskStatus").is(Constant.TASK_STATUS_COMPLETED)), TaskMongo.class); |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(Query.query(new Criteria("task").in(taskMongoList).and("taskStatus").ne(Constant.TASK_STATUS_COMPLETED)), TaskUserMongo.class); |
| | | taskUserMongoList.stream().map(taskUserMongo -> { |
| | | // System.out.print("taskName : " + taskUserMongo.getTask().getName() + "\t"); |
| | | // System.out.println("taskUserName : " + taskUserMongo.getName()); |
| | | taskUserMongo.setTaskStatus(Constant.TASK_STATUS_COMPLETED); |
| | | return taskUserMongo; |
| | | }).forEach(taskUserMongo -> mongoTemplate.save(taskUserMongo)); |
| | | } |
| | | |
| | | @Test |
| | | public void changeTask() { |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("pid").exists(true)), TaskMongo.class); |
| | | List<Long> projectIdList = taskMongoList.stream().map(taskMongo -> taskMongo.getProjectId()).distinct().collect(Collectors.toList()); |
| | | for (Long projectId : projectIdList) { |
| | | Project project = projectRepository.findById(projectId).orElse(new Project()); |
| | | System.out.println(project.getId() + "\t" + project.getName() + "\t" + project.getProjectStatus()); |
| | | mongoTemplate.find(Query.query(new Criteria("projectId").is(projectId)), TaskMongo.class).forEach(System.out::println); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void changeTask2() { |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("pid").exists(false).and("projectId").is(131)), TaskMongo.class); |
| | | for (TaskMongo taskMongo : taskMongoList) { |
| | | updateTask(taskMongo, taskMongo); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void changeTaskStatus() { |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(Criteria.where("taskStatus").is(Constant.TASK_STATUS_NOT_STARTED)), TaskMongo.class); |
| | | taskMongoList.stream().forEach(taskMongo -> { |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(Query.query(Criteria.where("task").is(taskMongo)), TaskUserMongo.class); |
| | | long count = mongoTemplate.count(Query.query(Criteria.where("taskUserMongo").in(taskUserMongoList)), TaskDaliyMongo.class); |
| | | if (count > 0) { |
| | | taskMongo.setTaskStatus(Constant.TASK_STATUS_IN_HAND); |
| | | } |
| | | mongoTemplate.save(taskMongo); |
| | | }); |
| | | } |
| | | |
| | | private void updateTask(TaskMongo parent, TaskMongo current) { |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("pid").is(current.getOld_id())), TaskMongo.class); |
| | | if (taskMongoList.size() > 0) { |
| | | System.out.println("pid : " + current.getOld_id()); |
| | | mongoTemplate.find(Query.query(new Criteria("task").in(taskMongoList)), TaskUserMongo.class).stream().forEach(taskUserMongo -> { |
| | | System.out.println("====================================================="); |
| | | taskUserMongo.setTask(parent); |
| | | mongoTemplate.save(taskUserMongo); |
| | | }); |
| | | taskMongoList.stream().forEach(taskMongo -> { |
| | | System.out.println("------------------------------------------------------"); |
| | | System.out.println("old_id : " + taskMongo.getOld_id()); |
| | | updateTask(parent, taskMongo); |
| | | mongoTemplate.remove(taskMongo); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Test |
| | | public void fetchProjectFinished() throws ParseException { |
| | | Sort sort = Sort.by(Sort.Order.desc("createTime")); |
| | | ProjectQueryCriteria criteria = new ProjectQueryCriteria(); |
| | | criteria.setIdInList(Arrays.asList(170L, 205L, 191L)); |
| | | // criteria.setProjectStatus(Constant.PROJECT_STATUS_COMPLETED); |
| | | // // 开始时间 |
| | | // criteria.setPlanStartDate(Arrays.asList("2024-01-01", "2024-03-31")); |
| | | // // 结束时间 |
| | | // criteria.setPlanEndDate(Arrays.asList("2024-01-01", "2024-03-31")); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<Project> projectList = projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), sort); |
| | | for (Project project : projectList) { |
| | | System.out.println(project.getPlanStartDate() + "\t" + project.getPlanEndDate() + "\t" + project.getName()); |
| | | |
| | | Query query = new Query( |
| | | Criteria.where("projectId").is(project.getId()) |
| | | .and("performanceType").is(Constant.PERFORMANCE_TYPE_ON) |
| | | .and("planStartTime").gte(sdf.parse("2024-01-01")) |
| | | ); |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class); |
| | | for (TaskMongo taskMongo : taskMongoList) { |
| | | System.out.println("所属任务 : " + taskMongo.getName()); |
| | | } |
| | | |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(new Query(Criteria.where("task").in(taskMongoList)), TaskUserMongo.class); |
| | | taskUserMongoList.stream().map(taskUserMongo -> { |
| | | PerformanceBean performanceBean = new PerformanceBean(); |
| | | performanceBean.setId(taskUserMongo.getUserId()); |
| | | performanceBean.setTaskName(taskUserMongo.getName()); |
| | | performanceBean.setTaskHours(taskUserMongo.getTaskHours()); |
| | | performanceBean.setTaskProgress(taskUserMongo.getNewTaskProgress()); |
| | | |
| | | List<TaskDaliyMongo> taskDaliyMongoList = mongoTemplate.find(Query.query(Criteria.where("taskUserMongo").is(taskUserMongo)), TaskDaliyMongo.class); |
| | | double consumedHours = taskDaliyMongoList.stream().mapToDouble(TaskDaliyMongo::getConsumedHours).sum(); |
| | | performanceBean.setConsumedHours(BigDecimal.valueOf(consumedHours).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | |
| | | return performanceBean; |
| | | // && performanceBean.getTaskHours() > performanceBean.getConsumedHours() |
| | | }).filter(performanceBean -> performanceBean.getConsumedHours() > 0).forEach(performanceBean -> { |
| | | UserDto userDto = userService.findById(performanceBean.getId()); |
| | | System.out.print(userDto.getNickName() + "\t"); |
| | | System.out.print(performanceBean.getTaskName() + "\t"); |
| | | System.out.print(performanceBean.getTaskHours() + "\t"); |
| | | System.out.print(performanceBean.getConsumedHours() + "\t"); |
| | | System.out.print( |
| | | BigDecimal.valueOf(performanceBean.getTaskHours() - performanceBean.getConsumedHours()).setScale(2, RoundingMode.HALF_UP).doubleValue() + "\t"); |
| | | // System.out.print("进度 : " + performanceBean.getTaskProgress() + "\t"); |
| | | UserLevelWage userLevelWage = userLevelWageRepository.findByUserCurrentLevelWage(performanceBean.getId(), "2024-03"); |
| | | if (userLevelWage != null) { |
| | | // BigDecimal wage = userLevelWage.getPerformanceWage().add(userLevelWage.getBasicWage()).add(userLevelWage.getRankWage()); |
| | | System.out.print(userLevelWage.getPerformanceWage().doubleValue() + "\t"); |
| | | System.out.print(userLevelWage.getPerformanceWage().multiply(BigDecimal.valueOf(performanceBean.getTaskHours() - performanceBean.getConsumedHours())).divide(BigDecimal.valueOf(160), 2, RoundingMode.HALF_UP).doubleValue() + "\t"); |
| | | } |
| | | System.out.println(); |
| | | }); |
| | | // for (TaskUserMongo taskUserMongo : taskUserMongoList) { |
| | | // UserDto userDto = userService.findById(taskUserMongo.getUserId()); |
| | | // System.out.print(userDto.getNickName() + "\t"); |
| | | // System.out.print("分配时间 : " + taskUserMongo.getTaskHours() + "\t"); |
| | | // |
| | | // Aggregation customerAgg = Aggregation.newAggregation( |
| | | // Aggregation.match(Criteria.where("taskUserMongo").is(taskUserMongo)), |
| | | // Aggregation.project("userId", "consumedHours"), |
| | | // Aggregation.group("userId").sum("consumedHours").as("consumedHours") |
| | | // ); |
| | | // |
| | | // AggregationResults<Map> aggregate = mongoTemplate.aggregate(customerAgg, TaskDaliyMongo.class, Map.class); |
| | | // aggregate.getMappedResults().forEach( |
| | | // data -> System.out.print("消耗时间 : " + data.get("consumedHours")) |
| | | // ); |
| | | // System.out.println(); |
| | | // } |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void fetchProjectInfo() throws ParseException { |
| | | Sort sort = Sort.by(Sort.Order.desc("createTime")); |
| | | ProjectQueryCriteria criteria = new ProjectQueryCriteria(); |
| | | // criteria.setProjectStatus(Constant.PROJECT_STATUS_COMPLETED); |
| | | // // 开始时间 |
| | | // criteria.setPlanStartDate(Arrays.asList("2024-01-01", "2024-03-31")); |
| | | // // 结束时间 |
| | | // criteria.setPlanEndDate(Arrays.asList("2024-01-01", "2024-03-31")); |
| | | criteria.setProjectDistinguish("project_distinguish_product"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<Project> projectList = projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), sort); |
| | | for (Project project : projectList) { |
| | | Query query = new Query( |
| | | Criteria.where("projectId").is(project.getId()) |
| | | // .and("performanceType").is(Constant.PERFORMANCE_TYPE_ON) |
| | | .and("planStartTime").gte(sdf.parse("2024-01-01")) |
| | | ); |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class); |
| | | |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(new Query(Criteria.where("task").in(taskMongoList)), TaskUserMongo.class); |
| | | taskUserMongoList.stream().map(taskUserMongo -> { |
| | | PerformanceBean performanceBean = new PerformanceBean(); |
| | | performanceBean.setId(taskUserMongo.getUserId()); |
| | | performanceBean.setProjectName(project.getName()); |
| | | performanceBean.setTaskName(taskUserMongo.getName()); |
| | | performanceBean.setTaskHours(taskUserMongo.getTaskHours()); |
| | | performanceBean.setConsumedHours(0D); |
| | | performanceBean.setTaskProgress(0D); |
| | | performanceBean.setStatus(taskUserMongo.getTaskStatus()); |
| | | |
| | | List<TaskDaliyMongo> taskDaliyMongoList = mongoTemplate.find(Query.query(Criteria.where("taskUserMongo").is(taskUserMongo)), TaskDaliyMongo.class); |
| | | if (taskDaliyMongoList.size() > 0) { |
| | | double consumedHours = taskDaliyMongoList.stream().mapToDouble(TaskDaliyMongo::getConsumedHours).sum(); |
| | | performanceBean.setConsumedHours(BigDecimal.valueOf(consumedHours).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | |
| | | Double taskProcess = taskDaliyMongoList.stream().max(Comparator.comparing(TaskDaliyMongo::getFillDate)).get().getTaskProgress(); |
| | | performanceBean.setTaskProgress(taskProcess); |
| | | } |
| | | return performanceBean; |
| | | // && performanceBean.getTaskHours() > performanceBean.getConsumedHours() |
| | | }).filter(performanceBean -> performanceBean.getConsumedHours() > 0).forEach(performanceBean -> { |
| | | UserDto userDto = userService.findById(performanceBean.getId()); |
| | | System.out.print(performanceBean.getProjectName() + "\t"); |
| | | System.out.print(userDto.getNickName() + "\t"); |
| | | System.out.print(performanceBean.getTaskName() + "\t"); |
| | | System.out.print(performanceBean.getTaskHours() + "\t"); |
| | | System.out.print(performanceBean.getConsumedHours() + "\t"); |
| | | System.out.print( |
| | | BigDecimal.valueOf(performanceBean.getTaskHours() - performanceBean.getConsumedHours()).setScale(2, RoundingMode.HALF_UP).doubleValue() + "\t"); |
| | | System.out.print(performanceBean.getTaskProgress() + "\t"); |
| | | System.out.print(performanceBean.getStatus()); |
| | | // UserLevelWage userLevelWage = userLevelWageRepository.findByUserCurrentLevelWage(performanceBean.getId(), "2024-03"); |
| | | // if (userLevelWage != null) { |
| | | //// BigDecimal wage = userLevelWage.getPerformanceWage().add(userLevelWage.getBasicWage()).add(userLevelWage.getRankWage()); |
| | | // System.out.print(userLevelWage.getPerformanceWage().doubleValue() + "\t"); |
| | | // System.out.print(userLevelWage.getPerformanceWage().multiply(BigDecimal.valueOf(performanceBean.getTaskHours() - performanceBean.getConsumedHours())).divide(BigDecimal.valueOf(160), 2, RoundingMode.HALF_UP).doubleValue() + "\t"); |
| | | // } |
| | | System.out.println(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void fetchProjectPriceInfo() { |
| | | Sort sort = Sort.by(Sort.Order.desc("createTime")); |
| | | ProjectQueryCriteria criteria = new ProjectQueryCriteria(); |
| | | criteria.setProjectDistinguish("project_distinguish_product"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<Project> projectList = projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), sort); |
| | | for (Project project : projectList) { |
| | | System.out.print(project.getName() + "\t"); |
| | | System.out.print(project.getContractPrice() + "\t"); |
| | | System.out.print(project.getContractPrePrice() + "\t"); |
| | | System.out.print(project.getProjectPrice() + "\t"); |
| | | // System.out.print(project.getPerformancePrice() + "\t"); |
| | | // System.out.print(project.getQuotationPrice() + "\t"); |
| | | System.out.println(); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void fetchProjectCostInfo() { |
| | | |
| | | Optional<Project> projectOpl = projectRepository.findById(195L); |
| | | Project project = projectOpl.get(); |
| | | System.out.println("ProjectPrice" + project.getProjectPrice()); |
| | | |
| | | Query query = new Query( |
| | | Criteria.where("projectId").is(project.getId()) |
| | | ); |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(query, TaskMongo.class); |
| | | |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(new Query(Criteria.where("task").in(taskMongoList)), TaskUserMongo.class); |
| | | taskUserMongoList.stream().map(taskUserMongo -> { |
| | | PerformanceBean performanceBean = new PerformanceBean(); |
| | | performanceBean.setId(taskUserMongo.getUserId()); |
| | | performanceBean.setProjectName(project.getName()); |
| | | performanceBean.setTaskName(taskUserMongo.getTask().getName()); |
| | | performanceBean.setTaskUserName(taskUserMongo.getName()); |
| | | performanceBean.setTaskHours(taskUserMongo.getTaskHours()); |
| | | performanceBean.setConsumedHours(0D); |
| | | performanceBean.setTaskProgress(0D); |
| | | performanceBean.setStatus(taskUserMongo.getTaskStatus()); |
| | | |
| | | List<TaskDaliyMongo> taskDaliyMongoList = mongoTemplate.find(Query.query(Criteria.where("taskUserMongo").is(taskUserMongo)), TaskDaliyMongo.class); |
| | | if (taskDaliyMongoList.size() > 0) { |
| | | double consumedHours = taskDaliyMongoList.stream().mapToDouble(TaskDaliyMongo::getConsumedHours).sum(); |
| | | performanceBean.setConsumedHours(BigDecimal.valueOf(consumedHours).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | |
| | | Double taskProcess = taskDaliyMongoList.stream().max(Comparator.comparing(TaskDaliyMongo::getFillDate)).get().getTaskProgress(); |
| | | performanceBean.setTaskProgress(taskProcess); |
| | | } |
| | | return performanceBean; |
| | | }).forEach(performanceBean -> { |
| | | UserDto userDto = userService.findById(performanceBean.getId()); |
| | | System.out.print(performanceBean.getProjectName() + "\t"); |
| | | System.out.print(userDto.getNickName() + "\t"); |
| | | System.out.print(performanceBean.getTaskName() + "\t"); |
| | | System.out.print(performanceBean.getTaskUserName() + "\t"); |
| | | System.out.print(performanceBean.getTaskHours() + "\t"); |
| | | System.out.print(performanceBean.getConsumedHours() + "\t"); |
| | | System.out.print( |
| | | BigDecimal.valueOf(performanceBean.getTaskHours() - performanceBean.getConsumedHours()).setScale(2, RoundingMode.HALF_UP).doubleValue() + "\t"); |
| | | System.out.print(performanceBean.getTaskProgress() + "\t"); |
| | | System.out.print(performanceBean.getStatus()); |
| | | System.out.println(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | @Data |
| | | class PerformanceBean { |
| | | private Long id; |
| | | private String taskName; |
| | | private String taskUserName; |
| | | private String projectName; |
| | | private String userName; |
| | | private Double taskHours; |
| | | private Double consumedHours; |
| | | private Double taskProgress; |
| | | private String status; |
| | | } |
| | |
| | | package me.zhengjie; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.Attendance; |
| | | import me.zhengjie.modules.attendance.domain.Calculate; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceRepository; |
| | | import me.zhengjie.modules.attendance.service.AttendanceLeaveService; |
| | | import me.zhengjie.modules.attendance.service.AttendanceService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceQueryCriteria; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.ProjectService; |
| | | import me.zhengjie.modules.quartz.service.impl.DingTalkServiceImpl; |
| | | import me.zhengjie.modules.salary.service.NewSalaryService; |
| | | import me.zhengjie.modules.salary.service.dto.NewSalaryQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.domain.vo.CalendarVo; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.impl.UserServiceImpl; |
| | | import me.zhengjie.modules.task.domain.TaskDaliyMongo; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.domain.TaskUserMongo; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyMongoDto; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
| | | public class UserTest { |
| | |
| | | UserRepository userRepository; |
| | | |
| | | @Autowired |
| | | ProjectRepository projectRepository; |
| | | |
| | | @Autowired |
| | | UserServiceImpl userService; |
| | | |
| | | @Autowired |
| | | MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | ProjectService projectService; |
| | | |
| | | @Autowired |
| | | TaskDaliyService taskDaliyService; |
| | | |
| | | @Test |
| | | public void test() { |
| | | List<TaskDaliyMongo> daliyMongoList; |
| | | try { |
| | | daliyMongoList = mongoTemplate.find( |
| | | Query.query( |
| | | new Criteria("userId").is(30) |
| | | .and("fillDate") |
| | | .gte(new SimpleDateFormat("yyyy-MM-dd").parse("2023-11-01")) |
| | | .lt(new SimpleDateFormat("yyyy-MM-dd").parse("2023-12-01"))) |
| | | .with(Sort.by(Sort.Order.desc("fillDate"))) |
| | | , TaskDaliyMongo.class); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | daliyMongoList.stream().collect( |
| | | Collectors.groupingBy( |
| | | (TaskDaliyMongo taskDaliyMongo) -> taskDaliyMongo.getTaskUserMongo().getTask().getName(), |
| | | Collectors.collectingAndThen( |
| | | Collectors.reducing( |
| | | null, |
| | | (TaskDaliyMongo prev, TaskDaliyMongo cur) -> { |
| | | if (prev == null) { |
| | | return cur; |
| | | } |
| | | prev.setConsumedHours(prev.getConsumedHours() + cur.getConsumedHours()); |
| | | return prev; |
| | | } |
| | | ), |
| | | Function.identity() |
| | | ) |
| | | ) |
| | | ).forEach((key, value) -> { |
| | | System.out.print("key : " + key + "\t"); |
| | | System.out.print(value.getTaskUserMongo().getPerformanceType() + "\t"); |
| | | System.out.println("value : " + value.getConsumedHours()); |
| | | }); |
| | | } |
| | | |
| | | @Test |
| | | public void test2() throws ParseException { |
| | | // 查询某月已完成工时 |
| | | DecimalFormat decimalFormat = new DecimalFormat("0.##"); |
| | | decimalFormat.setRoundingMode(RoundingMode.HALF_UP); |
| | | |
| | | List<TaskDaliyMongo> daliyMongoList = mongoTemplate.find( |
| | | Query.query( |
| | | new Criteria("userId").is(30) |
| | | .and("fillDate") |
| | | .gte(new SimpleDateFormat("yyyy-MM-dd").parse("2023-11-01")) |
| | | .lt(new SimpleDateFormat("yyyy-MM-dd").parse("2023-12-01"))) |
| | | .with(Sort.by(Sort.Order.desc("fillDate"))) |
| | | , TaskDaliyMongo.class); |
| | | |
| | | List<TaskDaliyMongo> resultList = daliyMongoList.stream().collect( |
| | | Collectors.groupingBy( |
| | | (TaskDaliyMongo taskDaliyMongo) -> taskDaliyMongo.getTaskUserMongo().getTask().getName(), |
| | | Collectors.reducing( |
| | | null, |
| | | (TaskDaliyMongo prev, TaskDaliyMongo cur) -> { |
| | | if (prev == null) { |
| | | cur.getTaskProgress(); |
| | | cur.getTaskUserMongo().getPerformanceHours(); |
| | | cur.getTaskUserMongo().getPerformanceType(); |
| | | if ("1".equals(cur.getTaskUserMongo().getPerformanceType())) { |
| | | cur.setConsumedHours(BigDecimal.valueOf(cur.getTaskUserMongo().getPerformanceHours()) |
| | | .multiply(BigDecimal.valueOf(cur.getTaskProgress())) |
| | | .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | return cur; |
| | | } |
| | | if ("0".equals(cur.getTaskUserMongo().getPerformanceType())) { |
| | | prev.setConsumedHours(prev.getConsumedHours() + cur.getConsumedHours()); |
| | | } |
| | | return prev; |
| | | } |
| | | ) |
| | | ) |
| | | ).values().stream().map(taskDaliyMongo -> { |
| | | if ("1".equals(taskDaliyMongo.getTaskUserMongo().getPerformanceType())) { |
| | | // 查询日报表是否存在小于当前月填写的当前任务的日报 |
| | | List<TaskDaliyMongo> taskDaliyMongoSm = null; |
| | | try { |
| | | taskDaliyMongoSm = mongoTemplate.find( |
| | | Query.query(new Criteria("userId").is(30) |
| | | .and("taskUserMongo").is(taskDaliyMongo.getTaskUserMongo()) |
| | | .and("fillDate").lt(new SimpleDateFormat("yyyy-MM-dd").parse("2023-11-01"))).with(Sort.by(Sort.Direction.DESC, "fillDate")), TaskDaliyMongo.class); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | //跨月 |
| | | if (taskDaliyMongoSm.size() > 0) { |
| | | Double lastValue = Double.valueOf(decimalFormat.format((taskDaliyMongoSm.get(0).getTaskProgress() / 100) * taskDaliyMongo.getTaskUserMongo().getPerformanceHours())); |
| | | taskDaliyMongo.setConsumedHours(BigDecimal.valueOf(taskDaliyMongo.getConsumedHours()).subtract(BigDecimal.valueOf(lastValue)).doubleValue()); |
| | | } |
| | | } |
| | | return taskDaliyMongo; |
| | | }).collect(Collectors.toList()); |
| | | System.out.println(resultList.stream().mapToDouble(TaskDaliyMongo::getConsumedHours).sum()); |
| | | resultList.stream().forEach(result -> { |
| | | System.out.print(result.getTaskUserMongo().getName() + "\t"); |
| | | System.out.print(result.getTaskUserMongo().getPerformanceType() + "\t"); |
| | | System.out.println(result.getConsumedHours()); |
| | | }); |
| | | } |
| | | |
| | | @Test |
| | | public void test3() throws ParseException { |
| | | |
| | | // 算出季度小时数 |
| | | Double seation = 160 * 3D; |
| | | |
| | | // 详细信息 |
| | | // 1获取当年度已完结项目 |
| | | |
| | | // Long[] ids = Arrays.array(22L); |
| | | // List<Project> projectList = projectRepository.findByProjectStatusAndIdIn("project_status_completed", ids); |
| | | |
| | | List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(new Criteria("projectId").is(183L)), TaskMongo.class); |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(Query.query(new Criteria("task").in(taskMongoList)), TaskUserMongo.class); |
| | | Map<Long, TaskUserMongo> taskUserMongoMap = taskUserMongoList.stream().collect( |
| | | Collectors.groupingBy( |
| | | (TaskUserMongo taskUserMongo) -> taskUserMongo.getUserId(), |
| | | Collectors.reducing( |
| | | null, |
| | | (TaskUserMongo prev, TaskUserMongo cur) -> { |
| | | if ("0".equals(cur.getPerformanceType())) { |
| | | cur.setPerformanceHours(0.0); |
| | | } else if ("1".equals(cur.getPerformanceType())) { |
| | | cur.setCostHours(0.0); |
| | | } |
| | | // System.out.println("-------------------------------------------------------------"); |
| | | // String nickName = userService.findById(cur.getUserId()).getNickName(); |
| | | // System.out.println(nickName); |
| | | // System.out.println(cur.getName()); |
| | | // System.out.println(cur.getCostHours()); |
| | | // System.out.println(cur.getPerformanceHours()); |
| | | if (prev == null) { |
| | | return cur; |
| | | } |
| | | // if ("0".equals(cur.getPerformanceType())) { |
| | | // |
| | | // } else if ("1".equals(cur.getPerformanceType())) { |
| | | // |
| | | // } |
| | | prev.setCostHours(prev.getCostHours() + cur.getCostHours()); |
| | | prev.setPerformanceHours(prev.getPerformanceHours() + cur.getPerformanceHours()); |
| | | return prev; |
| | | } |
| | | ) |
| | | ) |
| | | ); |
| | | System.out.println("========================================================="); |
| | | String projectName = projectService.findById(183L).getName(); |
| | | for (Map.Entry<Long, TaskUserMongo> entry : taskUserMongoMap.entrySet()) { |
| | | String nickName = userService.findById(entry.getKey()).getNickName(); |
| | | System.out.println("项目名:" + projectName); |
| | | System.out.println("nickName : " + nickName); |
| | | System.out.println("costHours : " + entry.getValue().getCostHours()); |
| | | System.out.println("performanceHours : " + entry.getValue().getPerformanceHours()); |
| | | } |
| | | // taskUserMongoMap.values().stream().forEach(System.out::println); |
| | | } |
| | | |
| | | @Autowired |
| | | private AttendanceService attendanceService; |
| | | |
| | | @Test |
| | | public void test4() { |
| | | System.out.println(attendanceService.queryAttendanceHours(53L, "2024-04-01")); |
| | | } |
| | | |
| | | @Test |
| | | public void test5() { |
| | | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | List<Calculate> resultParts = new ArrayList<>(); |
| | | |
| | | List<Calculate> breakParts = new ArrayList<>(); |
| | | breakParts.add(new Calculate(LocalDateTime.parse("2023-12-29 12:00:00", formatter), LocalDateTime.parse("2023-12-29 13:00:00", formatter))); |
| | | |
| | | List<Calculate> attendanceParts = new ArrayList<>(); |
| | | LocalDateTime actualWorkStartTime = LocalDateTime.parse("2023-12-29 09:00:00", formatter); |
| | | LocalDateTime actualWorkEndTime = LocalDateTime.parse("2023-12-29 18:00:00", formatter); |
| | | attendanceParts.add(new Calculate(actualWorkStartTime, actualWorkEndTime)); |
| | | |
| | | // 外出信息 |
| | | attendanceParts.add(new Calculate(LocalDateTime.parse("2023-12-29 13:00:00", formatter), LocalDateTime.parse("2023-12-29 14:30:00", formatter))); |
| | | attendanceParts.add(new Calculate(LocalDateTime.parse("2023-12-29 18:00:00", formatter), LocalDateTime.parse("2023-12-29 18:30:00", formatter))); |
| | | attendanceParts.add(new Calculate(LocalDateTime.parse("2023-12-29 19:00:00", formatter), LocalDateTime.parse("2023-12-29 20:00:00", formatter))); |
| | | |
| | | attendanceParts.stream().sorted().reduce(new Stack<Calculate>(), (result, current) -> { |
| | | if (result.empty()) { |
| | | result.push(current); |
| | | return result; |
| | | } |
| | | Calculate last = result.peek(); |
| | | if (last.getEnd().isBefore(current.getStart())) { |
| | | result.push(current); |
| | | } else if (last.getEnd().isBefore(current.getEnd())) { |
| | | last.setEnd(current.getEnd()); |
| | | } |
| | | return result; |
| | | }, (o1, o2) -> null).forEach(calculate -> { |
| | | for (Calculate breakPart : breakParts) { |
| | | if ((calculate.getStart().isBefore(breakPart.getStart()) && calculate.getEnd().isAfter(breakPart.getStart())) |
| | | || (calculate.getStart().isBefore(breakPart.getEnd()) && calculate.getEnd().isAfter(breakPart.getEnd()))) { |
| | | Calculate calculate1 = new Calculate(calculate.getStart(), breakPart.getStart()); |
| | | Calculate calculate2 = new Calculate(breakPart.getEnd(), calculate.getEnd()); |
| | | if (calculate1.getStart().isBefore(calculate1.getEnd())) { |
| | | resultParts.add(calculate1); |
| | | } |
| | | if (calculate2.getStart().isBefore(calculate2.getEnd())) { |
| | | resultParts.add(calculate2); |
| | | } |
| | | } else { |
| | | resultParts.add(calculate); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | Double hours = resultParts.stream() |
| | | .map(calculate -> ChronoUnit.SECONDS.between(calculate.getStart(), calculate.getEnd())) |
| | | .reduce(new BigDecimal(0), |
| | | (total, current) -> total.add(BigDecimal.valueOf(current)), |
| | | (o1, o2) -> null).divide(BigDecimal.valueOf(3600), 2, RoundingMode.HALF_UP |
| | | ).doubleValue(); |
| | | |
| | | System.out.println("result : " + resultParts); |
| | | System.out.println("hours : " + hours); |
| | | } |
| | | |
| | | @Test |
| | | public void task6() { |
| | | TaskDaliyMongo taskDaliyMongo = new TaskDaliyMongo(); |
| | | taskDaliyMongo.setUserId(44L); |
| | | taskDaliyMongo.setId("658bc51bc1e4c04e325bd569"); |
| | | taskDaliyMongo.setFillDate(Date.from(LocalDate.of(2023, 12, 15).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())); |
| | | Double hours = taskDaliyService.queryTaskConsumedHours(taskDaliyMongo); |
| | | System.out.println(hours); |
| | | } |
| | | |
| | | @Autowired |
| | | private NewSalaryService salaryService; |
| | | |
| | | @Test |
| | | public void task7() { |
| | | NewSalaryQueryCriteria criteria = new NewSalaryQueryCriteria(); |
| | | criteria.setSelectedValue1(Arrays.asList(103L)); // 44 |
| | | criteria.setTargetYearMonth("2024-04-01"); |
| | | salaryService.generate(criteria); |
| | | } |
| | | |
| | | @Test |
| | | public void task8() throws Exception { |
| | | List<CalendarVo> calendarVoList = userService.getUserCalendarInfo("2024-01-01"); |
| | | calendarVoList.stream().sorted(Comparator.comparing(CalendarVo::getDate)).forEach(System.out::println); |
| | | } |
| | | |
| | | @Test |
| | | public void task9() { |
| | | Criteria criteriaMongo = new Criteria(); |
| | | |
| | | TaskMongo taskMongo = mongoTemplate.findById("660a1f95725fac3a43ee629c", TaskMongo.class); |
| | | criteriaMongo.and("task").is(taskMongo); |
| | | |
| | | // if (criteria.getTaskStatus() != null && criteria.getTaskStatus().size() > 0) { |
| | | // criteriaMongo = criteriaMongo.and("taskStatus").in(criteria.getTaskStatus()); |
| | | // } |
| | | Query query = new Query(criteriaMongo); |
| | | |
| | | List<TaskUserMongo> taskUserMongoList = mongoTemplate.find(query, TaskUserMongo.class); |
| | | taskUserMongoList.forEach(taskUserMongo -> { |
| | | System.out.print(taskUserMongo.getName() + "\t"); |
| | | System.out.print(taskUserMongo.getId() + "\t"); |
| | | System.out.print(taskUserMongo.getTaskStatus() + "\t"); |
| | | System.out.println(taskUserMongo.getUserId()); |
| | | }); |
| | | } |
| | | |
| | | @Test |
| | | public void changeTaskUser() { |
| | | String oldTaskUserId = "65af6d15d16d0b56e1f5378c"; |
| | | TaskUserMongo taskUserMongoOld = mongoTemplate.findById(oldTaskUserId, TaskUserMongo.class); |
| | | List<TaskDaliyMongo> taskDaliyMongoList = mongoTemplate.find(Query.query(new Criteria("taskUserMongo").is(taskUserMongoOld)), TaskDaliyMongo.class); |
| | | String newTaskUserId = "65af27357e03b86e92f06642"; |
| | | TaskUserMongo taskUserMongoNew = mongoTemplate.findById(newTaskUserId, TaskUserMongo.class); |
| | | taskDaliyMongoList.stream().forEach(taskDaliyMongo -> { |
| | | taskDaliyMongo.setTaskUserMongo(taskUserMongoNew); |
| | | mongoTemplate.save(taskDaliyMongo); |
| | | }); |
| | | } |
| | | |
| | | @Test |
| | | public void queryAttendanceHours() { |
| | | // Long userId = 45L; |
| | | // String date = "2024-01-29"; |
| | | AttendanceQueryCriteria criteria = new AttendanceQueryCriteria(); |
| | | criteria.setUserId(45L); |
| | | criteria.setTargetYearMonth("2024-03-01"); |
| | | System.out.println(attendanceService.queryAttendanceHours(criteria)); |
| | | } |
| | | |
| | | @Test |
| | | public void reflashPerformanceHour() { |
| | | List<TaskDaliyMongo> taskDaliyMongoList = mongoTemplate.find(Query.query(Criteria.where("performanceHours").exists(false)), TaskDaliyMongo.class); |
| | | taskDaliyMongoList.stream().forEach(taskDaliyMongo -> { |
| | | taskDaliyMongo.setPerformanceHours(taskDaliyMongo.getTaskUserMongo().getPerformanceHours()); |
| | | mongoTemplate.save(taskDaliyMongo); |
| | | }); |
| | | } |
| | | |
| | | @Autowired |
| | | private DingTalkServiceImpl dingTalkService; |
| | | |
| | | @Autowired |
| | | private AttendanceRepository attendanceRepository; |
| | | |
| | | @Test |
| | | public void dingdingReflash() { |
| | | User user = userRepository.findById(46L).get(); |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(46L, "2024-03-19"); // 97L |
| | | System.out.println("1111 : " + attendance); |
| | | attendance = dingTalkService.updateRecord(user, attendance, true, "2024-03-19"); |
| | | System.out.println("2222 : " + attendance); |
| | | attendance = dingTalkService.updateRecord(user, attendance, false, "2024-03-19"); |
| | | System.out.println("3333 : " + attendance); |
| | | } |
| | | |
| | | @Test |
| | | public void exec() throws ParseException { |
| | | // 查询某月已完成工时 |
| | | DecimalFormat decimalFormat = new DecimalFormat("0.##"); |
| | | decimalFormat.setRoundingMode(RoundingMode.HALF_UP); |
| | | |
| | | List<TaskDaliyMongo> daliyMongoList = mongoTemplate.find( |
| | | Query.query( |
| | | new Criteria("userId").is(27L) |
| | | .and("fillDate") |
| | | .gte(new SimpleDateFormat("yyyy-MM-dd").parse("2024-02-08")) |
| | | .lte(new SimpleDateFormat("yyyy-MM-dd").parse("2024-02-08"))) |
| | | .with(Sort.by(Sort.Order.desc("fillDate"))) |
| | | , TaskDaliyMongo.class); |
| | | |
| | | List<TaskDaliyMongoDto> resultList = daliyMongoList.stream().collect( |
| | | Collectors.groupingBy( |
| | | (TaskDaliyMongo taskDaliyMongo) -> taskDaliyMongo.getTaskUserMongo().getId(), |
| | | Collectors.reducing( |
| | | null, |
| | | (TaskDaliyMongo prev, TaskDaliyMongo cur) -> { |
| | | if (prev == null) { |
| | | if ("1".equals(cur.getTaskUserMongo().getPerformanceType())) { |
| | | cur.setConsumedHours(BigDecimal.valueOf(cur.getTaskUserMongo().getPerformanceHours()) |
| | | .multiply(BigDecimal.valueOf(cur.getTaskProgress())) |
| | | .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | return cur; |
| | | } |
| | | if ("0".equals(cur.getTaskUserMongo().getPerformanceType())) { |
| | | prev.setConsumedHours(prev.getConsumedHours() + cur.getConsumedHours()); |
| | | } |
| | | return prev; |
| | | } |
| | | ) |
| | | ) |
| | | ).values().stream().map(taskDaliyMongo -> { |
| | | if ("1".equals(taskDaliyMongo.getTaskUserMongo().getPerformanceType())) { |
| | | // 查询日报表是否存在小于当前月填写的当前任务的日报 |
| | | List<TaskDaliyMongo> taskDaliyMongoSm = null; |
| | | try { |
| | | taskDaliyMongoSm = mongoTemplate.find( |
| | | Query.query(new Criteria("userId").is(27L) |
| | | .and("taskUserMongo").is(taskDaliyMongo.getTaskUserMongo()) |
| | | .and("fillDate").lt(new SimpleDateFormat("yyyy-MM-dd").parse("2024-02-08"))) |
| | | .with(Sort.by(Sort.Direction.DESC, "fillDate")), TaskDaliyMongo.class); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | //跨月 |
| | | if (taskDaliyMongoSm.size() > 0) { |
| | | BigDecimal lastValue = BigDecimal.valueOf(taskDaliyMongoSm.get(0).getTaskProgress()) |
| | | .multiply(BigDecimal.valueOf(taskDaliyMongoSm.get(0).getTaskUserMongo().getPerformanceHours())) |
| | | .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP); |
| | | taskDaliyMongo.setConsumedHours(BigDecimal.valueOf(taskDaliyMongo.getConsumedHours()).subtract(lastValue).doubleValue()); |
| | | } |
| | | } |
| | | return taskDaliyMongo; |
| | | }) |
| | | // .collect( |
| | | // Collectors.groupingBy( |
| | | // (TaskDaliyMongo taskDaliyMongo) -> taskDaliyMongo.getTaskUserMongo().getTask().getId(), |
| | | // Collectors.reducing( |
| | | // null, |
| | | // (TaskDaliyMongo prev, TaskDaliyMongo cur) -> { |
| | | // if (prev == null) { |
| | | // return cur; |
| | | // } |
| | | // prev.setConsumedHours(prev.getConsumedHours() + cur.getConsumedHours()); |
| | | // return prev; |
| | | // } |
| | | // ) |
| | | // ) |
| | | // ).values().stream() |
| | | .map(taskDaliyMongo -> { |
| | | TaskDaliyMongoDto dto = new TaskDaliyMongoDto(); |
| | | dto.setId(taskDaliyMongo.getId()); |
| | | dto.setFillDate(taskDaliyMongo.getFillDate()); |
| | | dto.setUserNickName(userRepository.findById(27L).get().getNickName()); |
| | | dto.setProjectId(taskDaliyMongo.getTaskUserMongo().getTask().getProjectId()); |
| | | dto.setProjectName(projectRepository.findById(taskDaliyMongo.getTaskUserMongo().getTask().getProjectId()).get().getName()); |
| | | dto.setTaskName(taskDaliyMongo.getTaskUserMongo().getTask().getName()); |
| | | dto.setTaskId(taskDaliyMongo.getTaskUserMongo().getTask().getId()); |
| | | dto.setConsumedHours(taskDaliyMongo.getConsumedHours()); |
| | | dto.setTaskProgress(taskDaliyMongo.getTaskProgress()); |
| | | dto.setSettlementStatus(taskDaliyMongo.getSettlementStatus()); |
| | | dto.setRemarks(taskDaliyMongo.getRemarks()); |
| | | dto.setTaskUserMongo(taskDaliyMongo.getTaskUserMongo()); |
| | | return dto; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | resultList.stream().map(taskDaliyMongoDto -> taskDaliyMongoDto.getTaskUserMongo()).forEach(System.out::println); |
| | | |
| | | } |
| | | |
| | | @Autowired |
| | | private AttendanceLeaveService attendanceLeaveService; |
| | | |
| | | @Test |
| | | public void test100() throws ParseException { |
| | | System.out.println(attendanceLeaveService.getOverTimeLength(128L)); |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function queryAttendanceHours(params) { |
| | | return request({ |
| | | url: 'api/attendance/queryAttendanceHours', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function attendanceHours(params) { |
| | | return request({ |
| | | url: 'api/attendance/attendanceHours', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, attendanceHours, getUserMakeUpCard, addAttendanceInfo } |
| | | export default { add, edit, del, getAll, attendanceHours, getUserMakeUpCard, addAttendanceInfo, queryAttendanceHours } |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/project/all', |
| | | url: 'api/project/all' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get', |
| | | params |
| | | }) |
| | |
| | | }) |
| | | } |
| | | |
| | | export function getProjectCost(params) { |
| | | return request({ |
| | | url: 'api/project/projectCost', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function getSubgroupTurnover(params) { |
| | | return request({ |
| | | url: 'api/project/subgroupTurnover', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del, editAdmit, editDisavow, getPartake, getRelevant, getSubgroupTurnover, getSubgroupWorkingHours, getProjectWorkingHours, getTypeContractPrice, getTypeWorkingHours, getSubgroupTopHours, getRelevantOfDaily } |
| | | export default { getAll, add, edit, del, editAdmit, editDisavow, getPartake, getRelevant, getProjectCost, getSubgroupTurnover, getSubgroupWorkingHours, getProjectWorkingHours, getTypeContractPrice, getTypeWorkingHours, getSubgroupTopHours, getRelevantOfDaily } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function changeStatus(params) { |
| | | return request({ |
| | | url: 'api/task/changeStatus?changesId=' + params, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function getRelevantTaskUser(params) { |
| | | return request({ |
| | | url: 'api/task/getRelevantTaskUser', |
| | |
| | | export function getTastAll(param) { |
| | | return request({ |
| | | url: 'api/task/getTastAll?taskId=' + param, |
| | | method: 'get', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, getTags, getNames, getProjects, getChildren, add, edit, del, divide, getPartake, getProjectTotal, ChildrenTaskAnyParent, getAllOfDaily, getRelevantTaskUser, getTaskValidRange, getTaskCalendarInfo, getTastAll } |
| | | export default { getAll, getTags, getNames, getProjects, getChildren, add, edit, del, divide, getPartake, getProjectTotal, ChildrenTaskAnyParent, getAllOfDaily, getRelevantTaskUser, getTaskValidRange, getTaskCalendarInfo, getTastAll, changeStatus } |
| | |
| | | import request from '@/utils/request' |
| | | import qs from 'qs' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/taskDaliy/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function getStatistics(params) { |
| | | return request({ |
| | | url: 'api/taskDaliy/statistics' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function taskConsumedHours(data) { |
| | | return request({ |
| | | url: 'api/taskDaliy/taskConsumedHours', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | export function checkTaskHours(params) { |
| | | return request({ |
| | | url: 'api/taskDaliy/checkTask?taskProgress=' + params.taskProgress + '&taskUserId=' + params.taskUserId + '&fillDate=' + params.fillDate, |
| | | url: 'api/taskDaliy/checkTask', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export default { get, getAll, add, edit, del, completedWork, complianceWork, taskTotalConsumedHours, getTaskDaliyWithHours, getDailyDetail, getDailyTaskProgress, checkTaskHours } |
| | | export default { get, getAll, getStatistics, add, edit, del, completedWork, complianceWork, taskTotalConsumedHours, getTaskDaliyWithHours, taskConsumedHours, getDailyDetail, getDailyTaskProgress, checkTaskHours } |
| | |
| | | const range = XLSX.utils.decode_range(sheet['!ref']) |
| | | let C |
| | | const R = range.s.r |
| | | console.log('111111111111111111111 : ', R) |
| | | /* start in the first row */ |
| | | for (C = range.s.c; C <= range.e.c; ++C) { /* walk every column in the range */ |
| | | console.log('XLSX.utils.encode_cell({ c: C, r: R }) : ', XLSX.utils.encode_cell({ c: C, r: R })) |
| | |
| | | return Promise.reject(error) |
| | | } |
| | | } |
| | | console.log(code) |
| | | if (code) { |
| | | if (code === 401) { |
| | | store.dispatch('LogOut').then(() => { |
| | |
| | | crudMeetingRoom.getAll().then(res => { |
| | | this.meetingRooms = res |
| | | }) |
| | | console.log(this.$route.params.assetId) |
| | | // 判断传参是否为空 |
| | | if (this.$route.params.assetId != null && this.$route.params.assetId !== '' && this.crud.query.assetId === undefined) { |
| | | // 检索条件赋值 |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | }, |
| | | // 查看资产使用管理 |
| | | toAssetUseManagement(data) { |
| | | console.log(data) |
| | | // 跳转页面 |
| | | this.$router.push({ |
| | | name: 'assetUseManagement', |
| | |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userName" label="所属员工" fixed="left" width="100" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | |
| | | crudAttendance.getUserMakeUpCard(this.makeUpCardForm.userId).then(res => { |
| | | // 判断上班打卡状态,给提示 |
| | | if (Number === 1) { |
| | | if (data.startClockResults !== null && data.startClockResults === this.dictAttendanceStateNotSigned) { |
| | | if (data.startLocationResults !== null && data.startLocationResults === this.dictlocationResultsNotSigned) { |
| | | this.makeUpCardTitle = '上班补卡' |
| | | this.makeUpCardForm.timeResult = data.startClockResults |
| | | this.makeUpCardForm.rosterTime = data.rosteringWorkStartTime |
| | |
| | | } |
| | | // 判断下班打卡状态,给提示 |
| | | if (Number === 2) { |
| | | if (data.endClockResults !== null && data.endClockResults === this.dictAttendanceStateNotSigned) { |
| | | if (data.endLocationResults !== null && data.endLocationResults === this.dictlocationResultsNotSigned) { |
| | | this.makeUpCardTitle = '下班补卡' |
| | | this.makeUpCardForm.timeResult = data.endClockResults |
| | | this.makeUpCardForm.rosterTime = data.rosteringWorkEndTime |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :loading="crud.status.cu === 2" |
| | | type="primary" |
| | | @click="crud.submitCU" |
| | | >确认</el-button |
| | | > |
| | | >确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--审核表单--> |
| | |
| | | type="danger" |
| | | style="margin-right: 10px;" |
| | | @click="approveFunction(1, form)" |
| | | >审核退回</el-button |
| | | > |
| | | >审核退回</el-button> |
| | | <el-button |
| | | v-if="form.approvalStatus !== dictGoOutReturn" |
| | | :loading="successLoading" |
| | | type="success" |
| | | @click="approveFunction(2, form)" |
| | | >审核通过</el-button |
| | | > |
| | | >审核通过</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | |
| | | ref="table" |
| | | v-loading="crud.loading" |
| | | :data="crud.data" |
| | | row-key="id" |
| | | size="small" |
| | | style="width: 100%;" |
| | | @selection-change="crud.selectionChangeHandler" |
| | |
| | | type="warning" |
| | | >{{ |
| | | dict.label[dictBussinessStatus][scope.row.approvalStatus] |
| | | }}</el-tag |
| | | > |
| | | }}</el-tag> |
| | | <el-tag |
| | | v-if="scope.row.approvalStatus === dictGoOutAgree" |
| | | type="success" |
| | | >{{ |
| | | dict.label[dictBussinessStatus][scope.row.approvalStatus] |
| | | }}</el-tag |
| | | > |
| | | }}</el-tag> |
| | | <el-tag |
| | | v-if="scope.row.approvalStatus === dictGoOutReturn" |
| | | type="danger" |
| | | >{{ |
| | | dict.label[dictBussinessStatus][scope.row.approvalStatus] |
| | | }}</el-tag |
| | | > |
| | | }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | <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 |
| | | size="mini" |
| | | type="primary" |
| | | @click="canel(scope.row)" |
| | | >取消</el-button> |
| | | <el-button |
| | | :loading="successLoading" |
| | | type="primary" |
| | | size="mini" |
| | | @click="revoke(scope.row)" |
| | | >确定</el-button |
| | | > |
| | | >确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudAttendanceBusinessTravel from "@/api/attendance/attendanceBusinessTravel"; |
| | | import CRUD, { presenter, header, form, crud } from "@crud/crud"; |
| | | import rrOperation from "@crud/RR.operation"; |
| | | import crudUser from "@/api/system/user"; |
| | | import { mapGetters } from "vuex"; |
| | | import crudOperation from "@crud/CRUD.operation"; |
| | | import udOperation from "@crud/UD.operation"; |
| | | import pagination from "@crud/Pagination"; |
| | | import constant from "../../../utils/constant"; |
| | | import crudAttendanceBusinessTravel from '@/api/attendance/attendanceBusinessTravel' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudUser from '@/api/system/user' |
| | | import { mapGetters } from 'vuex' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '../../../utils/constant' |
| | | |
| | | const defaultForm = { |
| | | id: null, |
| | |
| | | createTime: null, |
| | | updateBy: null, |
| | | updateTime: null |
| | | }; |
| | | } |
| | | export default { |
| | | name: "AttendanceBusinessTravel", |
| | | name: 'AttendanceBusinessTravel', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ |
| | | title: "出差记录", |
| | | url: "api/attendanceBusinessTravel", |
| | | idField: "id", |
| | | sort: "travelStartTime,desc", |
| | | title: '出差记录', |
| | | url: 'api/attendanceBusinessTravel', |
| | | idField: 'id', |
| | | sort: 'travelStartTime,desc', |
| | | crudMethod: { ...crudAttendanceBusinessTravel } |
| | | }); |
| | | }) |
| | | }, |
| | | // 数据字典constant |
| | | dicts: [constant.BUSSINESS_APPROVE_STATUS, constant.LEAVE_TIME_TYPE], |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ["admin", "attendanceBusinessTravel:add"], |
| | | edit: ["admin", "attendanceBusinessTravel:edit"], |
| | | del: ["admin", "attendanceBusinessTravel:del"], |
| | | download: ["admin", "attendanceBusinessTravel:download"], |
| | | approve: ["admin", "attendanceBusinessTravel:approve"], |
| | | updateAgree: ["admin", "attendanceBusinessTravel:updateAgree"] |
| | | add: ['admin', 'attendanceBusinessTravel:add'], |
| | | edit: ['admin', 'attendanceBusinessTravel:edit'], |
| | | del: ['admin', 'attendanceBusinessTravel:del'], |
| | | download: ['admin', 'attendanceBusinessTravel:download'], |
| | | approve: ['admin', 'attendanceBusinessTravel:approve'], |
| | | updateAgree: ['admin', 'attendanceBusinessTravel:updateAgree'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: "申请人不能为空", trigger: "change" } |
| | | { required: true, message: '申请人不能为空', trigger: 'change' } |
| | | ], |
| | | approvalUserId: [ |
| | | { required: true, message: "审批者不能为空", trigger: "change" } |
| | | { required: true, message: '审批者不能为空', trigger: 'change' } |
| | | ], |
| | | travelStartTime: [ |
| | | { required: true, message: "出差开始日期不能为空", trigger: "change" } |
| | | { required: true, message: '出差开始日期不能为空', trigger: 'change' } |
| | | ], |
| | | travelEndTime: [ |
| | | { required: true, message: "出差结束日期不能为空", trigger: "change" } |
| | | { required: true, message: '出差结束日期不能为空', trigger: 'change' } |
| | | ], |
| | | travelDuration: [ |
| | | { required: true, message: "出差时长不能为空", trigger: "blur" } |
| | | { required: true, message: '出差时长不能为空', trigger: 'blur' } |
| | | ], |
| | | durationUnit: [ |
| | | { required: true, message: "时长单位不能为空", trigger: "change" } |
| | | { required: true, message: '时长单位不能为空', trigger: 'change' } |
| | | ], |
| | | approvalDescription: [ |
| | | { required: true, message: "退回原因不能为空", trigger: "blur" } |
| | | { required: true, message: '退回原因不能为空', trigger: 'blur' } |
| | | ], |
| | | approvalStatus: [ |
| | | { required: true, message: "审批状态不能为空", trigger: "change" } |
| | | { required: true, message: '审批状态不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | users: [], |
| | |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL |
| | | }; |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["user"]) |
| | | ...mapGetters(['user']) |
| | | }, |
| | | created() { |
| | | this.getUsers(); |
| | | this.getApprovalUsers(); |
| | | this.getUsers() |
| | | this.getApprovalUsers() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level); |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel); |
| | | return true; |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | return true |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | this.form.durationUnit = this.dictLeaveTimeTypeDay; |
| | | this.form.durationUnit = this.dictLeaveTimeTypeDay |
| | | // 判断用户最大角色级别是否大于总经理角色:赋值 |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id; |
| | | this.form.userId = this.user.id |
| | | } |
| | | }, |
| | | // 禁用 |
| | | disabledUser(data) { |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | return true; |
| | | return true |
| | | } |
| | | if ( |
| | | (data.approvalStatus !== null && |
| | | data.approvalStatus === this.dictGoOutAgree) || |
| | | data.approvalStatus === this.dictGoOutReturn |
| | | ) { |
| | | return true; |
| | | return true |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | | this.users = res; |
| | | }); |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 查询审核人 |
| | | getApprovalUsers() { |
| | | crudUser.getApprovalUsers().then(res => { |
| | | this.approvalUsers = res; |
| | | }); |
| | | this.approvalUsers = res |
| | | }) |
| | | }, |
| | | // 设定条件查询日期结尾 |
| | | handleDateChange(value) { |
| | | if (value) { |
| | | this.query.travelEndTime = value.substring(0, 11) + "23:59:59"; |
| | | this.query.travelEndTime = value.substring(0, 11) + '23:59:59' |
| | | } |
| | | }, |
| | | // 计算时长 |
| | |
| | | var data = JSON.stringify({ |
| | | travelStartTime: this.form.travelStartTime, |
| | | travelEndTime: this.form.travelEndTime |
| | | }); |
| | | }) |
| | | crudAttendanceBusinessTravel.getRemainingTime(data).then(res => { |
| | | this.form.travelDuration = res; |
| | | }); |
| | | this.form.travelDuration = res |
| | | }) |
| | | }, |
| | | // 审批页面赋值 |
| | | toApprove(data, Number) { |
| | | if (Number !== "1") { |
| | | this.makeUpCardVisible = true; |
| | | if (Number !== '1') { |
| | | this.makeUpCardVisible = true |
| | | } |
| | | this.form.id = data.id; |
| | | this.form.userId = data.userId; |
| | | this.form.userName = data.userName; |
| | | this.form.travelStartTime = data.travelStartTime; |
| | | this.form.travelEndTime = data.travelEndTime; |
| | | this.form.departureCity = data.departureCity; |
| | | this.form.arrivalCity = data.arrivalCity; |
| | | this.form.travelDuration = data.travelDuration; |
| | | this.form.durationUnit = data.durationUnit; |
| | | this.form.approvalStatus = data.approvalStatus; |
| | | this.form.travelReason = data.travelReason; |
| | | this.form.remarks = data.remarks; |
| | | this.form.id = data.id |
| | | this.form.userId = data.userId |
| | | this.form.userName = data.userName |
| | | this.form.travelStartTime = data.travelStartTime |
| | | this.form.travelEndTime = data.travelEndTime |
| | | this.form.departureCity = data.departureCity |
| | | this.form.arrivalCity = data.arrivalCity |
| | | this.form.travelDuration = data.travelDuration |
| | | this.form.durationUnit = data.durationUnit |
| | | this.form.approvalStatus = data.approvalStatus |
| | | this.form.travelReason = data.travelReason |
| | | this.form.remarks = data.remarks |
| | | }, |
| | | // 审核提交功能 |
| | | approveFunction(Number, data) { |
| | | this.form.userId = data.userId; |
| | | const msg = Number === 2 ? "通过" : "拒绝"; |
| | | this.$refs["form"].validate(valid => { |
| | | this.form.userId = data.userId |
| | | const msg = Number === 2 ? '通过' : '拒绝' |
| | | this.$refs['form'].validate(valid => { |
| | | if (!valid) { |
| | | return; |
| | | return |
| | | } |
| | | // 判断通过状态 |
| | | if (Number === 2) { |
| | | this.form.approvalStatus = this.dictGoOutAgree; |
| | | this.form.approvalStatus = this.dictGoOutAgree |
| | | } else { |
| | | // 退回改状态显示退回原因 |
| | | this.form.approvalStatus = this.dictGoOutReturn; |
| | | this.form.approvalStatus = this.dictGoOutReturn |
| | | if (this.form.approvalDescription == null) { |
| | | return; |
| | | return |
| | | } |
| | | } |
| | | this.successLoading = true; |
| | | this.successLoading = true |
| | | crudAttendanceBusinessTravel |
| | | .approve(this.form) |
| | | .then(res => { |
| | | this.crud.refresh(); |
| | | this.makeUpCardVisible = false; |
| | | this.successLoading = false; |
| | | this.crud.refresh() |
| | | this.makeUpCardVisible = false |
| | | this.successLoading = false |
| | | this.$message({ |
| | | type: "success", |
| | | message: "审核" + msg + "成功" |
| | | }); |
| | | type: 'success', |
| | | message: '审核' + msg + '成功' |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | this.makeUpCardVisible = false; |
| | | this.successLoading = false; |
| | | }); |
| | | if (this.$refs["form"]) { |
| | | this.$refs["form"].resetFields(); |
| | | this.makeUpCardVisible = false |
| | | this.successLoading = false |
| | | }) |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | // 批量审核 |
| | | toAgree(Number, data) { |
| | | const msg = Number === 2 ? "批量拒绝" : "批量同意"; |
| | | const msg1 = Number === 2 ? "error" : "success"; |
| | | const msg = Number === 2 ? '批量拒绝' : '批量同意' |
| | | const msg1 = Number === 2 ? 'error' : 'success' |
| | | // 确认框 |
| | | this.$confirm("此操作将" + msg + "审核内容是否继续?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | this.$confirm('此操作将' + msg + '审核内容是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: msg1 |
| | | }).then(() => { |
| | | const ids = []; |
| | | const ids = [] |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id); |
| | | ids.push(data[i].id) |
| | | } |
| | | crudAttendanceBusinessTravel |
| | | .updateAgree({ |
| | |
| | | .then(res => { |
| | | // 消息提示 |
| | | this.$message({ |
| | | type: "success", |
| | | message: msg + "!" |
| | | }); |
| | | type: 'success', |
| | | message: msg + '!' |
| | | }) |
| | | // 刷新数据 |
| | | this.crud.refresh(); |
| | | }); |
| | | }); |
| | | this.crud.refresh() |
| | | }) |
| | | }) |
| | | }, |
| | | // 撤消功能 |
| | | revoke(data) { |
| | | this.toApprove(data, "1"); |
| | | this.form.approvalStatus = this.dictGoOutAppRev; |
| | | this.successLoading = true; |
| | | this.toApprove(data, '1') |
| | | this.form.approvalStatus = this.dictGoOutAppRev |
| | | this.successLoading = true |
| | | crudAttendanceBusinessTravel |
| | | .approve(this.form) |
| | | .then(res => { |
| | | this.crud.refresh(); |
| | | this.successLoading = false; |
| | | this.$message({ type: "success", message: "撤销成功" }); |
| | | this.$refs[`popover_${data.id}`].showPopper = false; |
| | | this.crud.refresh() |
| | | this.successLoading = false |
| | | this.$message({ type: 'success', message: '撤销成功' }) |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | }) |
| | | .catch(error => { |
| | | this.$message({ |
| | | type: "error", |
| | | type: 'error', |
| | | message: error.response.data.message |
| | | }); |
| | | }); |
| | | if (this.$refs["form"]) { |
| | | this.$refs["form"].resetFields(); |
| | | }) |
| | | }) |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | this.crud.cancelCU(); |
| | | this.crud.cancelCU() |
| | | }, |
| | | // 关闭 |
| | | closeCard() { |
| | | if (this.$refs["form"]) { |
| | | this.$refs["form"].resetFields(); |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | this.crud.cancelCU(); |
| | | this.makeUpCardVisible = false; |
| | | this.crud.cancelCU() |
| | | this.makeUpCardVisible = false |
| | | }, |
| | | // 取消 |
| | | canel(data) { |
| | | this.$refs[`popover_${data.id}`].showPopper = false; |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userName" label="申请人" min-width="100" show-overflow-tooltip fixed="left"> |
| | | <template slot-scope="scope"> |
| | |
| | | } |
| | | }, |
| | | formatDate(date, time) { |
| | | return new Date(date.getFullYear(), date.getMonth(), date.getDate(), ...time.split(':')).toISOString(); |
| | | return new Date(date.getFullYear(), date.getMonth(), date.getDate(), ...time.split(':')).toISOString() |
| | | }, |
| | | // 审批页面赋值 |
| | | toApprove(data) { |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :loading="crud.status.cu === 2" |
| | | type="primary" |
| | | @click="crud.submitCU" |
| | | >确认</el-button |
| | | > |
| | | >确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--审核表单--> |
| | |
| | | type="danger" |
| | | style="margin-right: 10px;" |
| | | @click="approveFunction(1, form)" |
| | | >审核退回</el-button |
| | | > |
| | | >审核退回</el-button> |
| | | <el-button |
| | | v-if="form.approvalStatus !== dictGoOutReturn" |
| | | :loading="successLoading" |
| | | type="success" |
| | | @click="approveFunction(2, form)" |
| | | >审核通过</el-button |
| | | > |
| | | >审核通过</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | |
| | | ref="table" |
| | | v-loading="crud.loading" |
| | | :data="crud.data" |
| | | row-key="id" |
| | | size="small" |
| | | style="width: 100%;" |
| | | @selection-change="crud.selectionChangeHandler" |
| | |
| | | type="warning" |
| | | >{{ |
| | | dict.label[dictApprovalStart][scope.row.approvalStatus] |
| | | }}</el-tag |
| | | > |
| | | }}</el-tag> |
| | | <el-tag |
| | | v-if="scope.row.approvalStatus === dictGoOutAgree" |
| | | type="success" |
| | | >{{ |
| | | dict.label[dictApprovalStart][scope.row.approvalStatus] |
| | | }}</el-tag |
| | | > |
| | | }}</el-tag> |
| | | <el-tag |
| | | v-if="scope.row.approvalStatus === dictGoOutReturn" |
| | | type="danger" |
| | | >{{ |
| | | dict.label[dictApprovalStart][scope.row.approvalStatus] |
| | | }}</el-tag |
| | | > |
| | | }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | <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 |
| | | size="mini" |
| | | type="primary" |
| | | @click="canel(scope.row)" |
| | | >取消</el-button> |
| | | <el-button |
| | | :loading="successLoading" |
| | | type="primary" |
| | | size="mini" |
| | | @click="revoke(scope.row)" |
| | | >确定</el-button |
| | | > |
| | | >确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudAttendanceGoOut from "@/api/attendance/attendanceGoOut"; |
| | | import CRUD, { presenter, header, form, crud } from "@crud/crud"; |
| | | import rrOperation from "@crud/RR.operation"; |
| | | import { mapGetters } from "vuex"; |
| | | import crudUser from "@/api/system/user"; |
| | | import crudOperation from "@crud/CRUD.operation"; |
| | | import udOperation from "@crud/UD.operation"; |
| | | import pagination from "@crud/Pagination"; |
| | | import constant from "@/utils/constant"; |
| | | import crudAttendanceGoOut from '@/api/attendance/attendanceGoOut' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import { mapGetters } from 'vuex' |
| | | import crudUser from '@/api/system/user' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '@/utils/constant' |
| | | |
| | | const defaultForm = { |
| | | id: null, |
| | |
| | | createTime: null, |
| | | updateBy: null, |
| | | updateTime: null |
| | | }; |
| | | } |
| | | export default { |
| | | name: "AttendanceGoOut", |
| | | name: 'AttendanceGoOut', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ |
| | | title: "外出记录", |
| | | url: "api/attendanceGoOut", |
| | | idField: "id", |
| | | sort: "outStartTime,desc", |
| | | title: '外出记录', |
| | | url: 'api/attendanceGoOut', |
| | | idField: 'id', |
| | | sort: 'outStartTime,desc', |
| | | crudMethod: { ...crudAttendanceGoOut } |
| | | }); |
| | | }) |
| | | }, |
| | | // 数据字典 |
| | | dicts: [ |
| | |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ["admin", "attendanceGoOut:add"], |
| | | edit: ["admin", "attendanceGoOut:edit"], |
| | | del: ["admin", "attendanceGoOut:del"], |
| | | download: ["admin", "attendanceGoOut:download"], |
| | | approve: ["admin", "attendanceGoOut:approve"], |
| | | updateAgree: ["admin", "attendanceGoOut:updateAgree"] |
| | | add: ['admin', 'attendanceGoOut:add'], |
| | | edit: ['admin', 'attendanceGoOut:edit'], |
| | | del: ['admin', 'attendanceGoOut:del'], |
| | | download: ['admin', 'attendanceGoOut:download'], |
| | | approve: ['admin', 'attendanceGoOut:approve'], |
| | | updateAgree: ['admin', 'attendanceGoOut:updateAgree'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: "申请人不能为空", trigger: "change" } |
| | | { required: true, message: '申请人不能为空', trigger: 'change' } |
| | | ], |
| | | approvalUserId: [ |
| | | { required: true, message: "审批者不能为空", trigger: "change" } |
| | | { required: true, message: '审批者不能为空', trigger: 'change' } |
| | | ], |
| | | outStartTime: [ |
| | | { required: true, message: "外出开始时间不能为空", trigger: "change" } |
| | | { required: true, message: '外出开始时间不能为空', trigger: 'change' } |
| | | ], |
| | | outEndTime: [ |
| | | { required: true, message: "外出结束时间不能为空", trigger: "change" } |
| | | { required: true, message: '外出结束时间不能为空', trigger: 'change' } |
| | | ], |
| | | outDuration: [ |
| | | { required: true, message: "外出时长不能为空", trigger: "blur" } |
| | | { required: true, message: '外出时长不能为空', trigger: 'blur' } |
| | | ], |
| | | durationUnit: [ |
| | | { required: true, message: "时长单位不能为空", trigger: "change" } |
| | | { required: true, message: '时长单位不能为空', trigger: 'change' } |
| | | ], |
| | | outOfOfficeType: [ |
| | | { required: true, message: "外出类型不能为空", trigger: "change" } |
| | | { required: true, message: '外出类型不能为空', trigger: 'change' } |
| | | ], |
| | | approvalStatus: [ |
| | | { required: true, message: "审批状态不能为空", trigger: "change" } |
| | | { required: true, message: '审批状态不能为空', trigger: 'change' } |
| | | ], |
| | | approvalDescription: [ |
| | | { required: true, message: "审批说明不能为空", trigger: "blur" } |
| | | { required: true, message: '审批说明不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | users: [], |
| | |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL |
| | | }; |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["user"]) |
| | | ...mapGetters(['user']) |
| | | }, |
| | | created() { |
| | | this.getUsers(); |
| | | this.getApprovalUsers(); |
| | | this.getUsers() |
| | | this.getApprovalUsers() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level); |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel); |
| | | return true; |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | return true |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 判断用户最大角色级别是否大于总经理角色:赋值 |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id; |
| | | this.form.userId = this.user.id |
| | | } |
| | | }, |
| | | // 禁用 |
| | | disabledUser(data) { |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | return true; |
| | | return true |
| | | } |
| | | if ( |
| | | (data.approvalStatus !== null && |
| | | data.approvalStatus === this.dictGoOutAgree) || |
| | | data.approvalStatus === this.dictGoOutReturn |
| | | ) { |
| | | return true; |
| | | return true |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | | this.users = res; |
| | | }); |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 查询审核人 |
| | | getApprovalUsers() { |
| | | crudUser.getApprovalUsers().then(res => { |
| | | this.approvalUsers = res; |
| | | }); |
| | | this.approvalUsers = res |
| | | }) |
| | | }, |
| | | // 设定条件查询日期结尾 |
| | | handleDateChange(value) { |
| | | if (value && value[1]) { |
| | | this.query.outStartTime[1] = value[1].substring(0, 11) + "23:59:59"; |
| | | this.query.outStartTime[1] = value[1].substring(0, 11) + '23:59:59' |
| | | } |
| | | }, |
| | | handleDateChange1(value) { |
| | | if (value && value[1]) { |
| | | this.query.outEndTime[1] = value[1].substring(0, 11) + "23:59:59"; |
| | | this.query.outEndTime[1] = value[1].substring(0, 11) + '23:59:59' |
| | | } |
| | | }, |
| | | // 计算时长 |
| | | checkTime() { |
| | | this.form.durationUnit = this.dictLeaveTimeTypeHour; |
| | | if (this.form.outStartTime && this.form.outEndTime) { |
| | | this.form.durationUnit = this.dictLeaveTimeTypeHour |
| | | var data = JSON.stringify({ |
| | | outStartTime: this.form.outStartTime, |
| | | outEndTime: this.form.outEndTime |
| | | }); |
| | | }) |
| | | crudAttendanceGoOut.getRemainingTime(data).then(res => { |
| | | this.form.outDuration = res; |
| | | }); |
| | | this.form.outDuration = res |
| | | }) |
| | | } |
| | | }, |
| | | // 批量审核 |
| | | toAgree(Number, data) { |
| | | const msg = Number === 2 ? "批量拒绝" : "批量同意"; |
| | | const msg1 = Number === 2 ? "error" : "success"; |
| | | const msg = Number === 2 ? '批量拒绝' : '批量同意' |
| | | const msg1 = Number === 2 ? 'error' : 'success' |
| | | // 确认框 |
| | | this.$confirm("此操作将" + msg + "审核内容是否继续?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | this.$confirm('此操作将' + msg + '审核内容是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: msg1 |
| | | }).then(() => { |
| | | const ids = []; |
| | | const ids = [] |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id); |
| | | ids.push(data[i].id) |
| | | } |
| | | crudAttendanceGoOut |
| | | .updateAgree({ |
| | |
| | | .then(res => { |
| | | // 消息提示 |
| | | this.$message({ |
| | | type: "success", |
| | | message: msg + "!" |
| | | }); |
| | | type: 'success', |
| | | message: msg + '!' |
| | | }) |
| | | // 刷新数据 |
| | | this.crud.refresh(); |
| | | }); |
| | | }); |
| | | this.crud.refresh() |
| | | }) |
| | | }) |
| | | }, |
| | | // 审批页面赋值 |
| | | toApprove(data, Number) { |
| | | if (Number !== "1") { |
| | | this.makeUpCardVisible = true; |
| | | if (Number !== '1') { |
| | | this.makeUpCardVisible = true |
| | | } |
| | | this.form.id = data.id; |
| | | this.form.userId = data.userId; |
| | | this.form.userName = data.userName; |
| | | this.form.outOfOfficeType = data.outOfOfficeType; |
| | | this.form.outStartTime = data.outStartTime; |
| | | this.form.outEndTime = data.outEndTime; |
| | | this.form.outDuration = data.outDuration; |
| | | this.form.durationUnit = data.durationUnit; |
| | | this.form.approvalStatus = data.approvalStatus; |
| | | this.form.outReason = data.outReason; |
| | | this.form.remarks = data.remarks; |
| | | this.form.id = data.id |
| | | this.form.userId = data.userId |
| | | this.form.userName = data.userName |
| | | this.form.outOfOfficeType = data.outOfOfficeType |
| | | this.form.outStartTime = data.outStartTime |
| | | this.form.outEndTime = data.outEndTime |
| | | this.form.outDuration = data.outDuration |
| | | this.form.durationUnit = data.durationUnit |
| | | this.form.approvalStatus = data.approvalStatus |
| | | this.form.outReason = data.outReason |
| | | this.form.remarks = data.remarks |
| | | }, |
| | | // 审核提交功能 |
| | | approveFunction(Number, data) { |
| | | this.form.userId = data.userId; |
| | | const msg = Number === 2 ? "通过" : "拒绝"; |
| | | this.$refs["form"].validate(valid => { |
| | | this.form.userId = data.userId |
| | | const msg = Number === 2 ? '通过' : '拒绝' |
| | | this.$refs['form'].validate(valid => { |
| | | if (!valid) { |
| | | return; |
| | | return |
| | | } |
| | | // 判断通过状态 |
| | | if (Number === 2) { |
| | | this.form.approvalStatus = this.dictGoOutAgree; |
| | | this.form.approvalStatus = this.dictGoOutAgree |
| | | } else { |
| | | // 退回改状态显示退回原因 |
| | | this.form.approvalStatus = this.dictGoOutReturn; |
| | | this.form.approvalStatus = this.dictGoOutReturn |
| | | if (this.form.approvalDescription == null) { |
| | | return; |
| | | return |
| | | } |
| | | } |
| | | this.successLoading = true; |
| | | this.successLoading = true |
| | | crudAttendanceGoOut |
| | | .approve(this.form) |
| | | .then(res => { |
| | | this.crud.refresh(); |
| | | this.makeUpCardVisible = false; |
| | | this.successLoading = false; |
| | | this.crud.refresh() |
| | | this.makeUpCardVisible = false |
| | | this.successLoading = false |
| | | this.$message({ |
| | | type: "success", |
| | | message: "审核" + msg + "成功" |
| | | }); |
| | | type: 'success', |
| | | message: '审核' + msg + '成功' |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | this.makeUpCardVisible = false; |
| | | this.successLoading = false; |
| | | }); |
| | | if (this.$refs["form"]) { |
| | | this.$refs["form"].resetFields(); |
| | | this.makeUpCardVisible = false |
| | | this.successLoading = false |
| | | }) |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | // 撤消功能 |
| | | revoke(data) { |
| | | this.toApprove(data, "1"); |
| | | this.form.approvalStatus = this.dictGoOutAppRev; |
| | | this.successLoading = true; |
| | | this.toApprove(data, '1') |
| | | this.form.approvalStatus = this.dictGoOutAppRev |
| | | this.successLoading = true |
| | | crudAttendanceGoOut |
| | | .approve(this.form) |
| | | .then(res => { |
| | | this.crud.refresh(); |
| | | this.successLoading = false; |
| | | this.$message({ type: "success", message: "撤销成功" }); |
| | | this.$refs[`popover_${data.id}`].showPopper = false; |
| | | this.crud.refresh() |
| | | this.successLoading = false |
| | | this.$message({ type: 'success', message: '撤销成功' }) |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | }) |
| | | .catch(error => { |
| | | this.$message({ |
| | | type: "error", |
| | | type: 'error', |
| | | message: error.response.data.message |
| | | }); |
| | | }); |
| | | if (this.$refs["form"]) { |
| | | this.$refs["form"].resetFields(); |
| | | }) |
| | | }) |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | this.crud.cancelCU(); |
| | | this.crud.cancelCU() |
| | | }, |
| | | // 关闭 |
| | | closeCard() { |
| | | if (this.$refs["form"]) { |
| | | this.$refs["form"].resetFields(); |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | this.crud.cancelCU(); |
| | | this.makeUpCardVisible = false; |
| | | this.crud.cancelCU() |
| | | this.makeUpCardVisible = false |
| | | }, |
| | | // 取消 |
| | | canel(data) { |
| | | this.$refs[`popover_${data.id}`].showPopper = false; |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <el-form-item label="请假开始时间" prop="leaveStartTime"> |
| | | <el-date-picker |
| | | v-model="form.leaveStartTime" |
| | | :type="form.leaveType !== dictLeaveTypeAnnualLeave && form.leaveType !== dictLeaveTypeCompassionateLeave ? 'date' : 'datetime'" |
| | | :type="form.leaveType !== dictLeaveTypeAnnualLeave && form.leaveType !== 'leave_type_replace' && form.leaveType !== dictLeaveTypeCompassionateLeave ? 'date' : 'datetime'" |
| | | placeholder="选择日期时间" |
| | | style="width: 340px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | |
| | | <el-form-item label="请假结束时间" prop="leaveEndTime"> |
| | | <el-date-picker |
| | | v-model="form.leaveEndTime" |
| | | :type="form.leaveType !== dictLeaveTypeAnnualLeave && form.leaveType !== dictLeaveTypeCompassionateLeave ? 'date' : 'datetime'" |
| | | :type="form.leaveType !== dictLeaveTypeAnnualLeave && form.leaveType !== 'leave_type_replace' && form.leaveType !== dictLeaveTypeCompassionateLeave ? 'date' : 'datetime'" |
| | | placeholder="选择日期时间" |
| | | style="width: 340px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | |
| | | dictLeaveTimeTypeHour: constant.LEAVE_TIME_TYPE_HOUR, |
| | | dictLeaveTimeTypeDay: constant.LEAVE_TIME_TYPE_DAY, |
| | | yearTimeLenght: null, |
| | | OverTimeLenght: null, |
| | | makeUpCardVisible: false, |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | |
| | | }, |
| | | checkLeaveTime() { |
| | | // 根据请假类型改变时间单位 |
| | | if (this.form.leaveType === this.dictLeaveTypeAnnualLeave || this.form.leaveType === this.dictLeaveTypeCompassionateLeave) { |
| | | if (this.form.leaveType === this.dictLeaveTypeAnnualLeave || this.form.leaveType === this.dictLeaveTypeCompassionateLeave || this.form.leaveType === 'leave_type_replace') { |
| | | this.form.leaveDurationUnit = this.dictLeaveTimeTypeHour |
| | | } else { |
| | | this.form.leaveDurationUnit = this.dictLeaveTimeTypeDay |
| | |
| | | // 获取年假剩余时长 |
| | | crudAttendanceLeave.getYearTimeLength((this.form.userId == null ? 1 : this.form.userId)).then(res => { |
| | | this.yearTimeLenght = res |
| | | }) |
| | | // 获取调休假剩余时长 |
| | | crudAttendanceLeave.getOverTimeLength((this.form.userId == null ? 1 : this.form.userId)).then(res => { |
| | | this.OverTimeLenght = res |
| | | }) |
| | | // 通过后台计算时长 |
| | | var data = JSON.stringify({ |
| | |
| | | if (this.form.leaveType === this.dictLeaveTypeAnnualLeave && this.yearTimeLenght < res.leaveDuration) { |
| | | this.form.leaveDuration = null |
| | | this.crud.notify('年假剩余时间不足', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | } else if (this.form.leaveType === 'leave_type_replace' && this.OverTimeLenght < res.leaveDuration) { |
| | | this.form.leaveDuration = null |
| | | this.crud.notify('调休假剩余时间不足', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | } else { |
| | | this.form.leaveDuration = res.leaveDuration |
| | | } |
| | | }) |
| | | }, |
| | | // 查询员工剩余年假时长 |
| | | // getUserTimes() { |
| | | // crudAttendanceLeave.getYearTimeLength().then(res => { |
| | | // this.yearTimeLenght = res |
| | | // }) |
| | | // }, |
| | | // 审批页面赋值 |
| | | toApprove(data, Number) { |
| | | console.log('11111111111111111111111111111111111 : ', Number) |
| | | if (Number !== '1') { |
| | | this.makeUpCardVisible = true |
| | | } |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | edit: ['admin', 'attendanceOvertime:edit'], |
| | | del: ['admin', 'attendanceOvertime:del'], |
| | | download: ['admin', 'attendanceOvertime:list'], |
| | | approve: ['admin', 'attendanceOvertime:approve'], |
| | | approve: ['admin', 'attendanceOvertime:approve'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | |
| | | dictAppRovalStatusPassed: constant.OVERTIME_PASS, |
| | | dictAppRovalStatusReturn: constant.OVERTIME_RETURN, |
| | | successLoading: false, |
| | | makeUpCardVisible: false, |
| | | makeUpCardVisible: false |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | // 设定条件查询日期结尾 |
| | | handleDateChange(value) { |
| | | if (value && value[1]) { |
| | | this.query.overtimeStartTime[1] = value[1].substring(0, 11) + "23:59:59"; |
| | | this.query.overtimeStartTime[1] = value[1].substring(0, 11) + '23:59:59' |
| | | } |
| | | }, |
| | | handleDateChange1(value) { |
| | | if (value && value[1]) { |
| | | this.query.overtimeEndTime[1] = value[1].substring(0, 11) + "23:59:59"; |
| | | this.query.overtimeEndTime[1] = value[1].substring(0, 11) + '23:59:59' |
| | | } |
| | | }, |
| | | // 计算加班时长 |
| | |
| | | } |
| | | this.crud.cancelCU() |
| | | this.makeUpCardVisible = false |
| | | }, |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <div class="card-panel-text"> |
| | | 出勤天数 |
| | | </div> |
| | | <count-to :start-val="0" :end-val="userInfo.onDutyDays" :duration="2600" class="card-panel-num" /> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="userInfo.onDutyDays" |
| | | :duration="2600" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | |
| | | <div class="card-panel-text"> |
| | | 剩余年假(小时) |
| | | </div> |
| | | <count-to :start-val="0" :end-val="userInfo.annualLeave" :duration="3000" :decimals="2" class="card-panel-num" /> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="userInfo.annualLeave" |
| | | :duration="3000" |
| | | :decimals="2" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | |
| | | <div class="card-panel-text"> |
| | | 剩余补卡次数 |
| | | </div> |
| | | <count-to :start-val="0" :end-val="userInfo.cardLeft" :duration="3600" class="card-panel-num" /> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="userInfo.cardLeft" |
| | | :duration="3600" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | |
| | | <div class="card-panel-text"> |
| | | 当前工作时长 |
| | | </div> |
| | | <count-to :start-val="0" :end-val="userInfo.Times" :decimals="2" :duration="3600" class="card-panel-num" /> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="userInfo.Times" |
| | | :decimals="2" |
| | | :duration="3600" |
| | | class="card-panel-num" |
| | | /> |
| | | <span class="card-panel-texts">/</span> |
| | | <count-to :start-val="0" :end-val="userInfo.Time" :duration="3600" class="card-panel-num" /> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="userInfo.Time" |
| | | :duration="3600" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | |
| | | <div class="card-panel-text"> |
| | | 当月绩效时长 |
| | | </div> |
| | | <count-to :start-val="0" :end-val="userInfo.achievementsTime" :decimals="2" :duration="3600" class="card-panel-num" /> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="userInfo.achievementsTime" |
| | | :decimals="2" |
| | | :duration="3600" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | <el-button type="success" style="position: absolute;bottom: 4%;right: 1%;width: 60px;height: 27px;display: flex;background-color: #40c9c6;border-color: #40c9c6;align-items: center;justify-content: center;" round @click="changeVisible">详细绩效</el-button> |
| | | <el-button |
| | | type="success" |
| | | style="position: absolute;bottom: 4%;right: 1%;width: 60px;height: 27px;display: flex;background-color: #40c9c6;border-color: #40c9c6;align-items: center;justify-content: center;" |
| | | round |
| | | @click="changeVisible" |
| | | >详细绩效</el-button> |
| | | </div> |
| | | <!-- </el-tooltip> --> |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> |
| | | <div class="card-panel" @click="handleSetLineChartData('shoppings')"> |
| | | <div class="card-panel-icon-wrapper icon-message"> |
| | | <svg-icon icon-class="message" class-name="card-panel-icon" /> |
| | | </div> |
| | | <div class="card-panel-description"> |
| | | <div class="card-panel-text"> |
| | | 剩余调休时长 |
| | | </div> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="userInfo.overTime" |
| | | :duration="3600" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | <el-dialog |
| | | title="详细绩效" |
| | | :visible.sync="centerDialogVisible" |
| | | width="50%" |
| | | center |
| | | @opened="showPerformanceDetail" |
| | | @open="showPerformanceDetail" |
| | | > |
| | | <div style="overflow:auto;height:500px"> |
| | | <div style="overflow:auto;height:600px"> |
| | | <div style="display: flex;justify-content: center"> |
| | | <span>本月绩效组成图</span> |
| | | </div> |
| | | <div id="container" style="height:560px" /> |
| | | <div id="container" style="height:580px" /> |
| | | </div> |
| | | </el-dialog> |
| | | <el-col :xs="12" :sm="12" :lg="30" class="card-panel-col"> |
| | |
| | | /> |
| | | <br> |
| | | <div style="display: flex;justify-content: center"> |
| | | <span v-if="meritWageList[0] !== undefined">完成可获得{{ meritWageList[3] }}💰</span> |
| | | <span |
| | | v-if="meritWageList[0] !== undefined" |
| | | >完成可获得{{ meritWageList[3] }}💰</span> |
| | | </div> |
| | | </div> |
| | | <div style="width: 100%;padding-top: 30px;"> |
| | |
| | | renderer: 'canvas', |
| | | useDirtyRect: false |
| | | }) |
| | | var option |
| | | option = { |
| | | var option = { |
| | | tooltip: { |
| | | show: false, |
| | | trigger: 'item' |
| | | // formatter: function(params) { |
| | | // var result = "{a|" + params.data.name + "}" + "\n{hr|}\n"; |
| | | // result += '{b|任务总消耗:' + params.value + '工时\t\t}' + '\n{hr|}\n\n' |
| | | // for (let i = 0; i < params.data.list.length; i++) { |
| | | // result += '{b|\t' + params.data.list[i].name + ':\t' + params.data.list[i].value + '工时\t}' + '\n' |
| | | // } |
| | | // return result; |
| | | // }, |
| | | }, |
| | | legend: { |
| | | top: '1%', |
| | |
| | | }, |
| | | label: { |
| | | formatter: function(params) { |
| | | var result = '{a|' + params.name + '}' + '\n{hr|}\n\n' |
| | | result += '{b|任务总消耗:' + params.value + '工时\t\t}' + '{per|' + params.percent + '%}' + '\n{hr|}\n\n' |
| | | // return params.data.list[0].'任务1'; |
| | | var result = '{a|' + params.data.name + '}' + '\n{hr|}\n' |
| | | result += '{b|任务总消耗:' + params.value + '工时\t\t}' + '\n{hr|}\n\n' |
| | | for (let i = 0; i < params.data.list.length; i++) { |
| | | result += '{b|\t' + Object.keys(params.data.list[i]) + ':\t' + Object.values(params.data.list[i]) + '工时\t}' + '\n{hr|}\n\n' |
| | | result += '{b|\t' + params.data.list[i].name + ':\t' + params.data.list[i].value + '工时\t}' + '\n' |
| | | } |
| | | return result |
| | | }, |
| | | show: true, |
| | | show: false, |
| | | position: 'outside', |
| | | backgroundColor: '#F6F8FC', |
| | | borderColor: '#8C8D8E', |
| | |
| | | rich: { |
| | | a: { |
| | | color: '#6E7079', |
| | | fontWeight: 'bold', |
| | | lineHeight: 22, |
| | | align: 'center' |
| | | }, |
| | |
| | | fontWeight: 'bold' |
| | | } |
| | | }, |
| | | labelLine: { |
| | | show: true |
| | | }, |
| | | zlevel: 999, |
| | | data: [] |
| | | } |
| | | ] |
| | | } |
| | | option.series[0].data = [] |
| | | option.series[0].data = res |
| | | const groups1 = this.userInfo.achievementsList.reduce((groups, data) => { |
| | | const key = data.projectName |
| | | if (!groups[key]) { |
| | | groups[key] = [] |
| | | } |
| | | groups[key].push({ name: data.taskName, value: data.consumedHours, performanceHours: data.taskUserMongo.performanceHours, performanceType: data.taskUserMongo.performanceType }) |
| | | return groups |
| | | }, {}) |
| | | Object.keys(groups1).forEach(key => { |
| | | const value = groups1[key].reduce((prev, data) => prev + data.value, 0) |
| | | option.series[0].data.push({ |
| | | 'name': key, |
| | | 'value': value, |
| | | 'list': groups1[key] |
| | | // 'performanceType' : data.taskUserMongo.performanceType === '0' ? "非绩效" : "绩效" }) |
| | | }) |
| | | }) |
| | | if (option && typeof option === 'object') { |
| | | myChart.setOption(option) |
| | | } |
| | |
| | | overflow: hidden; |
| | | color: #666; |
| | | background: #fff; |
| | | box-shadow: 4px 4px 40px rgba(0, 0, 0, .05); |
| | | border-color: rgba(0, 0, 0, .05); |
| | | box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05); |
| | | border-color: rgba(0, 0, 0, 0.05); |
| | | |
| | | &:hover { |
| | | .card-panel-icon-wrapper { |
| | |
| | | } |
| | | |
| | | .icon-permission { |
| | | background: #34bfa3 |
| | | background: #34bfa3; |
| | | } |
| | | |
| | | .icon-timings{ |
| | | background:#f4516c |
| | | background: #f4516c; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | .icon-permission { |
| | | color: #34bfa3 |
| | | color: #34bfa3; |
| | | } |
| | | |
| | | .card-panel-icon-wrapper { |
| | |
| | | <template> |
| | | <div class="dashboard-container"> |
| | | <div class="dashboard-editor-container"> |
| | | <panel-group :user-info="userInfo" :merit-wage-list="meritWageList" @handleSetLineChartData="handleSetLineChartData" /> |
| | | <panel-group |
| | | :user-info="userInfo" |
| | | :merit-wage-list="meritWageList" |
| | | @handleSetLineChartData="handleSetLineChartData" |
| | | /> |
| | | <el-row style="background: #fff; padding: 16px;"> |
| | | <FullCalendar ref="fullCalendar" :options="calendarOptions" /> |
| | | </el-row> |
| | |
| | | } else { |
| | | calendarApi.today() |
| | | } |
| | | // this.calendarOptions.events = [{title: '上班打卡时间', color: 'red',start: '2023-01-28',date: '2023-01-28'}] |
| | | this.yearMonth = moment(calendarApi.view.currentStart).toString() |
| | | console.log('变化变化:' + this.yearMonth) |
| | | |
| | | const date = moment(calendarApi.view.currentStart).toDate() |
| | | date.setMonth(date.getMonth() + 1) |
| | | date.setDate(0) |
| | | date.setHours(23, 59, 59, 999) |
| | | this.yearMonth = date |
| | | |
| | | this.yearMonthChange() |
| | | this.getUserCalendarInfo(moment(calendarApi.view.currentStart).format('YYYY-MM-DD').toString()) |
| | | this.getUserCalendarInfo( |
| | | moment(calendarApi.view.currentStart) |
| | | .format('YYYY-MM-DD') |
| | | .toString() |
| | | ) |
| | | }, |
| | | // 获取打卡信息 |
| | | getUserCalendarInfo(month) { |
| | | crudUser.getUserCalendarInfo(month).then(res => { |
| | | console.log('res', res) |
| | | crudUser |
| | | .getUserCalendarInfo(month) |
| | | .then(res => { |
| | | this.calendarOptions.events = res.map(function(obj) { |
| | | // obj.start = obj.date |
| | | obj.color = obj.isOk ? 'green' : 'red' |
| | |
| | | return obj |
| | | }) |
| | | setTimeout(() => { |
| | | console.log(this.calendarOptions.events) |
| | | // console.log(this.calendarOptions.events); |
| | | }, 1000) |
| | | }).catch(() => { |
| | | }) |
| | | .catch(() => { |
| | | this.calendarOptions.events = [] |
| | | }) |
| | | }, |
| | | // 日期点击 |
| | | handleDateClick(selectInfo) { |
| | | console.log('handleDateClick.info:', selectInfo) |
| | | // console.log("handleDateClick.info:", selectInfo); |
| | | }, |
| | | // 日程点击信息展示 |
| | | handleEventClick(info) { |
| | |
| | | query: { date: info.event._def.extendedProps.date1 } |
| | | }) |
| | | } else { |
| | | this.$router.push({ path: '/task/taskDaliy', query: { date: info.event._def.extendedProps.date1 }}) |
| | | this.$router.push({ |
| | | path: '/task/taskDaliy', |
| | | query: { date: info.event._def.extendedProps.date1 } |
| | | }) |
| | | } |
| | | }, |
| | | // 获取用户信息 |
| | | getUserBaseInfo() { |
| | | // var date = new Date() |
| | | // date.setDate(1) |
| | | // var dateStart = date.getFullYear() + '-' + (date.getMonth() + 2) + '-' + date.getDate() |
| | | // if (dateStart.split('-')[1] > 12) { |
| | | // dateStart = date.getFullYear() + 1 + '-1-1' |
| | | // } |
| | | var dateObject = new Date(this.yearMonth) |
| | | crudUser.getUserBaseInfo(this.yearMonth).then(res => { |
| | | this.userInfo = res |
| | | this.meritWageList = [] |
| | | crudMeritWage.getMeritWageDetail(this.userInfo.achievementsTime, new Date(this.yearMonth).getTime()).then(res => { |
| | | crudMeritWage |
| | | .getMeritWageDetail( |
| | | this.userInfo.achievementsTime, |
| | | new Date(this.yearMonth).getTime() |
| | | ) |
| | | .then(res => { |
| | | for (var key in res) { |
| | | this.meritWageList.push('距离' + key + '级业绩标准还有:') |
| | | this.meritWageList.push(Number(res[key])) |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.projectStatus" clearable filterable placeholder="项目状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.projectStatusIn" multiple clearable filterable collapse-tags placeholder="项目状态" style="width: 185px;" class="filter-item" @change="$forceUpdate()"> |
| | | <el-option |
| | | v-for="item in dict[projectStatus]" |
| | | :key="item.id" |
| | |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 523px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目类型" prop="projectTypeId"> |
| | | <el-select v-model="form.projectTypeId" clearable filterable placeholder="请选择" style="width: 200px;" :disabled="disabledFlagByApprove" @change="projectTypeChange"> |
| | | <el-option |
| | | v-for="item in projectTypeList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="项目区分" prop="projectDistinguish"> |
| | | <el-select v-model="form.projectDistinguish" clearable filterable placeholder="请选择" style="width: 200px;" :disabled="disabledFlagByApprove"> |
| | | <el-option |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="项目类型" prop="projectTypeId"> |
| | | <el-select v-model="form.projectTypeId" clearable filterable placeholder="请选择" style="width: 200px;" :disabled="disabledFlagByApprove" @change="projectTypeChange"> |
| | | <el-option |
| | | v-for="item in projectTypeList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="公司" prop="companyId"> |
| | | <el-select v-model="form.companyId" clearable filterable placeholder="请选择" style="width: 523px;"> |
| | | <el-option |
| | | v-for="item in companyIdList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="需求说明"> |
| | | <el-input v-model="form.requirement" :rows="3" type="textarea" style="width: 523px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="报价单金" prop="quotationPrice"> |
| | | <money-input :key="random" v-model="form.quotationPrice" :width="200" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="报价币种" prop="unitCurrency"> |
| | | <el-select v-model="form.unitCurrency" clearable filterable placeholder="请选择" style="width: 200px;" :disabled="disabledFlagByApprove"> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效单金" prop="performancePrice"> |
| | | <money-input :key="random" v-model="form.performancePrice" :width="200" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效币种"> |
| | | <el-select v-model="standardUnitCurrencyRenminbi" clearable filterable placeholder="请选择" style="width: 200px;" disabled> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效目标" prop="performanceObjectives"> |
| | | <el-input :key="random" v-model="form.performanceObjectives" style="width: 200px;" :disabled="disabledFlagByApprove"> |
| | | <template slot="append">%</template> |
| | | <el-form-item label="合同总金额" prop="contractPrice"> |
| | | <el-input v-model="form.contractPrice" style="width: 200px;"> |
| | | <template slot="append">万元</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="合同总金额" prop="contractPrice"> |
| | | <money-input :key="random" v-model="form.contractPrice" :width="200" /> |
| | | <el-form-item label="拟定合同额" prop="contractPrePrice"> |
| | | <el-input v-model="form.contractPrePrice" style="width: 200px;"> |
| | | <template slot="append">万元</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="入项目金额" prop="projectPrice"> |
| | | <el-input v-model="form.projectPrice" style="width: 200px;"> |
| | | <template slot="append">万元</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="绩效目标" prop="performanceObjectives"> |
| | | <el-input v-model="performanceObjectives" style="width: 200px;" :disabled="true"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | <span style="margin-left: 30px;"> |
| | | <el-tag v-if="performanceObjectives < 20" type="danger">战略项目</el-tag> |
| | | <el-tag v-else-if="performanceObjectives < 25" type="warning">低利润</el-tag> |
| | | <el-tag v-else-if="performanceObjectives < 30" type="info">正常利润</el-tag> |
| | | <el-tag v-else type="success">高利润</el-tag> |
| | | </span> |
| | | </el-form-item> |
| | | <el-form-item label="计划开始日期" prop="planStartDate"> |
| | | <el-date-picker v-model="form.planStartDate" type="date" :picker-options="pickerOptionsStart" placeholder="选择日期" style="width: 200px;" /> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="actualLaborCost" label="其他成本" width="110"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="actualOtherCost" label="其他成本" width="110"> |
| | | 未实装 |
| | | </el-table-column> |
| | | </el-table-column> |
| | |
| | | <el-button size="mini" type="text" @click="canel(scope.row)">取消</el-button> |
| | | <el-button type="primary" size="mini" @click="projectAdmit(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button slot="reference" type="primary" icon="el-icon-check" size="mini" /> |
| | | <el-button |
| | | v-if="scope.row.approveStatus !== 'approve_status_acknowledged'" |
| | | :key="scope.row.id" |
| | | slot="reference" |
| | | :disabled="!( |
| | | (scope.row.approveStatus === 'approve_status_master_acknowledged' && userRolesLevelMin === 1) || |
| | | (scope.row.approveStatus === 'approve_status_leader_acknowledged' && userRolesLevelMin === 2) || |
| | | (scope.row.approveStatus === 'approve_status_unrecognized' && (userRolesLevelMin === 3 || userRolesLevelMin === 2)) |
| | | )" |
| | | type="primary" |
| | | icon="el-icon-check" |
| | | size="mini" |
| | | /> |
| | | </el-popover> |
| | | <el-popover |
| | | slot="left" |
| | |
| | | <el-button size="mini" type="text" @click="canel(scope.row)">取消</el-button> |
| | | <el-button type="primary" size="mini" @click="projectDisavow(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button slot="reference" type="primary" icon="el-icon-close" size="mini" style="margin-left: 3px;" /> |
| | | <el-button |
| | | v-if="scope.row.approveStatus === 'approve_status_acknowledged'" |
| | | slot="reference" |
| | | :disabled="userRolesLevelMin !== 1" |
| | | type="primary" |
| | | icon="el-icon-close" |
| | | size="mini" |
| | | style="margin-left: 3px;" |
| | | /> |
| | | </el-popover> |
| | | </udOperation> |
| | | </template> |
| | |
| | | <script> |
| | | import crudProject from '@/api/project/project' |
| | | import crudUser from '@/api/system/user' |
| | | import crudCompany from '@/api/system/sysCompany' |
| | | import crudProjectType from '@/api/project/projectType' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | |
| | | import moneyInput from '@/views/assembly/moneyInput/index.vue' |
| | | import constant from '@/utils/constant' |
| | | |
| | | const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, liableUserId: null, liableUserIdList: [], planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, companyId: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, contractPrePrice: null, projectPrice: null, liableUserId: null, liableUserIdList: [], planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'Project', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.STANDARD_UNIT_CURRENCY, constant.PROJECT_DISTINGUISH, constant.PROJECT_STATUS, constant.APPROVE_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '项目详情', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }}) |
| | | return CRUD({ queryOnPresenterCreated: false, title: '项目详情', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }}) |
| | | }, |
| | | data() { |
| | | // 指针重指向 |
| | |
| | | projectTypeId: [ |
| | | { required: true, message: '项目类型不能为空', trigger: 'change' } |
| | | ], |
| | | companyId: [ |
| | | { required: true, message: '公司不能为空', trigger: 'change' } |
| | | ], |
| | | projectDistinguish: [ |
| | | { required: true, message: '项目区分不能为空', trigger: 'change' } |
| | | ], |
| | | unitCurrency: [ |
| | | { required: true, message: '单价币种不能为空', trigger: 'change' } |
| | | ], |
| | | quotationPrice: [ |
| | | { required: true, message: '报价单金不能为空', trigger: 'blur' }, |
| | | projectPrice: [ |
| | | { required: true, message: '入项目金额不能为空', trigger: 'blur' }, |
| | | { validator: priceValidate, trigger: 'blur' } |
| | | ], |
| | | performancePrice: [ |
| | | { required: true, message: '绩效单金不能为空', trigger: 'blur' }, |
| | | { validator: priceValidate, trigger: 'blur' } |
| | | ], |
| | | performanceObjectives: [ |
| | | { required: true, message: '绩效目标不能为空', trigger: 'blur' }, |
| | | { validator: proportionValidate, trigger: 'blur' } |
| | | ], |
| | | projectStatus: [ |
| | | { required: true, message: '项目状态不能为空', trigger: 'change' } |
| | |
| | | { key: 'projectTypeId', display_name: '项目类型' }, |
| | | { key: 'projectDistinguish', display_name: '项目区分' }, |
| | | { key: 'liableUserId', display_name: '责任人' }, |
| | | { key: 'projectStatus', display_name: '项目状态' }, |
| | | { key: 'projectStatusIn', display_name: '项目状态' }, |
| | | { key: 'approveStatus', display_name: '批准状态' } |
| | | ], |
| | | // 标准单价币种 |
| | |
| | | random: 0, |
| | | // 项目类型列表 |
| | | projectTypeList: [], |
| | | // 公司列表 |
| | | companyIdList: [], |
| | | // 用户列表 |
| | | userList: [], |
| | | // 选中的id |
| | |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'user' |
| | | ]) |
| | | ]), |
| | | performanceObjectives() { |
| | | if (this.form && (this.form.contractPrePrice || this.form.contractPrice) && this.form.projectPrice) { |
| | | let contractPrice = this.form.contractPrePrice |
| | | if (this.form.contractPrice) { |
| | | contractPrice = this.form.contractPrice |
| | | } |
| | | if (parseInt(contractPrice) === 0) { |
| | | return 0 |
| | | } |
| | | return ((contractPrice - this.form.projectPrice) / contractPrice * 100).toFixed(0) |
| | | } else { |
| | | return 0 |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.query.projectStatusIn = ['project_status_not_started', 'project_status_under_way'] |
| | | this.crud.toQuery() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | // 获取项目类型 |
| | | this.getPackageTypeAll() |
| | | // 项目 |
| | | this.getCompanyIdAll() |
| | | // 获取责任人 |
| | | this.getUserListAll() |
| | | return true |
| | | }, |
| | | // 钩子:提交 - 之前 |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | this.form.performanceObjectives = this.performanceObjectives |
| | | // 责任人ID |
| | | this.form.liableUserId = null |
| | | // 循环责任人ID列表 |
| | | for (let i = 0; i < this.form.liableUserIdList.length; i++) { |
| | | // 责任人ID |
| | | this.form.liableUserId = this.form.liableUserId === null ? '-' + this.form.liableUserIdList[i] + '-' : this.form.liableUserId + ',' + '-' + this.form.liableUserIdList[i] + '-' |
| | | } |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | |
| | | } |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | // 获取公司 |
| | | getCompanyIdAll() { |
| | | crudCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyIdList = res |
| | | }).catch(() => { |
| | | |
| | | }) |
| | | }, |
| | | // 获取项目类型 |
| | | getPackageTypeAll() { |
| | |
| | | this.form.quotationPrice = res[0].standardQuotationPrice |
| | | // 单价金额赋值 |
| | | this.form.performancePrice = res[0].standardPerformancePrice |
| | | // 绩效目标赋值 |
| | | this.form.performanceObjectives = res[0].standardPerformanceObjectives |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | // // 绩效目标赋值 |
| | | // this.form.performanceObjectives = res[0].standardPerformanceObjectives |
| | | }) |
| | | }, |
| | | // 取消 |
| | |
| | | projectId: data.id |
| | | } |
| | | }) |
| | | }, |
| | | // 钩子:提交 - 之前 |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | // 责任人ID |
| | | this.form.liableUserId = null |
| | | // 循环责任人ID列表 |
| | | for (let i = 0; i < this.form.liableUserIdList.length; i++) { |
| | | // 责任人ID |
| | | this.form.liableUserId = this.form.liableUserId === null ? '-' + this.form.liableUserIdList[i] + '-' : this.form.liableUserId + ',' + '-' + this.form.liableUserIdList[i] + '-' |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.userId" v-permission="permission.queryUserId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-date-picker v-model="query.salaryYearMonth" type="month" clearable placeholder="工资年月" style="width: 185px;margin-top: 6px" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.salaryYearMonth" value-format="yyyy-MM-dd" type="month" clearable placeholder="工资年月" style="width: 185px;margin-top: 6px" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-cascader |
| | | v-model="selectedValue" |
| | | :filterable="true" |
| | |
| | | style="width: 230px" |
| | | @change="changeUserList" |
| | | /> |
| | | <el-select |
| | | v-model="query.companyId" |
| | | clearable |
| | | size="small" |
| | | placeholder="企业" |
| | | class="filter-item" |
| | | style="width: 185px;margin-top: 6px" |
| | | > |
| | | <el-option |
| | | v-for="item in companyList" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | |
| | | style="width: 523px;" |
| | | placeholder="请选择" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | :disabled="disabledFlagByApprove" |
| | | @change="getUserLevel" |
| | | :disabled="true" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 523px;" :disabled="disabledFlagByApprove" @change="getUserLevel"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 523px;" :disabled="true"> |
| | | <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-divider>基本工资</el-divider> |
| | | <el-form-item label="全勤小时数" prop="fullDays"> |
| | | <el-input v-model="form.fullDays" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="basicParameterBlur"> |
| | | <el-input v-model="form.fullDays" style="width: 200px;" :disabled="disabledFlagByApprove" @change="basicParameterBlur"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="缺勤小时数" prop="absenceDays"> |
| | | <el-input v-model="form.absenceDays" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="basicParameterBlur"> |
| | | <el-input v-model="form.absenceDays" style="width: 200px;" :disabled="disabledFlagByApprove" @change="basicParameterBlur"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="预计工资" prop="basicWage"> |
| | | <money-input :key="basicWageRandom" v-model="form.basicWage" :width="523" :disabled="disabledFlagByApprove" @blur="basicWageBlur" /> |
| | | <el-input v-model="form.basicWage" style="width: 523px;" :disabled="disabledFlagByApprove" @change="basicWageBlur" /> |
| | | </el-form-item> |
| | | <el-form-item label="实际工资" prop="actualBasicWage"> |
| | | <money-input :key="actualBasicWageRandom" v-model="form.actualBasicWage" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.actualBasicWage" style="width: 523px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>绩效工资</el-divider> |
| | | <el-form-item label="应完成工时" prop="needCompletedAchievementsHours"> |
| | | <el-input v-model="form.needCompletedAchievementsHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="achievementsParameterBlur"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="已完成工时" prop="alreadyCompletedAchievementsHours"> |
| | | <el-input v-model="form.alreadyCompletedAchievementsHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="achievementsParameterBlur"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="预计工资" prop="achievementsWage"> |
| | | <money-input :key="achievementsWageRandom" v-model="form.achievementsWage" :width="523" :disabled="disabledFlagByApprove" @blur="achievementsWageBlur" /> |
| | | </el-form-item> |
| | | <el-form-item label="实际工资" prop="actualAchievementsWage"> |
| | | <money-input :key="actualAchievementsWageRandom" v-model="form.actualAchievementsWage" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>业绩工资</el-divider> |
| | | <el-form-item label="业绩完成度" prop="CompletedAchievementsRate"> |
| | | <el-input v-model="form.CompletedAchievementsRate" style="width: 200px;" :disabled="true" @blur="achievementsParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="业绩工资" prop="meritMoney"> |
| | | <el-input :key="form.meritMoney" v-model="form.meritMoney" style="width: 200px" :disabled="true" @blur="achievementsWageBlur"> |
| | | <template slot="append">元</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <!-- <el-divider>团队工资</el-divider>--> |
| | | <!-- <el-form-item label="实达标工时" prop="actualComplianceTeamHours">--> |
| | | <!-- <el-input v-model="form.actualComplianceTeamHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="teamParameterBlur">--> |
| | | <!-- <template slot="append">小时</template>--> |
| | | <!-- </el-input>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="已完成工时" prop="alreadyCompletedTeamHours">--> |
| | | <!-- <el-input v-model="form.alreadyCompletedTeamHours" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="teamParameterBlur">--> |
| | | <!-- <template slot="append">小时</template>--> |
| | | <!-- </el-input>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="预计工资" prop="teamWage">--> |
| | | <!-- <money-input :key="teamWageRandom" v-model="form.teamWage" :width="523" :disabled="disabledFlagByApprove" @blur="teamWageBlur" />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="实际工资" prop="actualTeamWage">--> |
| | | <!-- <money-input :key="actualTeamWageRandom" v-model="form.actualTeamWage" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />--> |
| | | <!-- </el-form-item>--> |
| | | <el-divider>其他工资</el-divider> |
| | | <!-- <el-form-item label="计件工资" prop="pieceRate">--> |
| | | <!-- <money-input :key="pieceRateRandom" v-model="form.pieceRate" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" />--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item label="计件工资" prop="pieceRate"> |
| | | <money-input :key="pieceRateRandom" v-model="form.pieceRate" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-form-item label="出差补助工资" prop="travelAllowance"> |
| | | <money-input :key="travelAllowanceRandom" v-model="form.travelAllowance" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.travelAllowance" style="width: 523px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-form-item label="加班工资" prop="overtimeAllowance"> |
| | | <money-input :key="overtimeAllowanceRandom" v-model="form.overtimeAllowance" :width="523" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-form-item label="绩效工资" prop="overtimeAllowance"> |
| | | <el-input v-model="form.overtimeAllowance" style="width: 523px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>公积金</el-divider> |
| | | <el-form-item label="基数" prop="accumulationFund"> |
| | | <money-input :key="accumulationFundRandom" v-model="form.accumulationFund" :width="523" :disabled="disabledFlagByApprove" @blur="accumulationParameterBlur" /> |
| | | <el-input v-model="form.accumulationFund" style="width: 523px;" :disabled="disabledFlagByApprove" @change="accumulationParameterBlur" /> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳比例" prop="accumulationFundPersonal"> |
| | | <el-input v-model="form.accumulationFundPersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="accumulationParameterBlur"> |
| | | <el-input v-model="form.accumulationFundPersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @change="accumulationParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳金额" prop="accumulationFundPersonalAmount"> |
| | | <money-input :key="accumulationFundPersonalAmountRandom" v-model="form.accumulationFundPersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.accumulationFundPersonalAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳比例" prop="accumulationFundCompany"> |
| | | <el-input v-model="form.accumulationFundCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="accumulationParameterBlur"> |
| | | <el-input v-model="form.accumulationFundCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @change="accumulationParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳金额" prop="accumulationFundCompanyAmount"> |
| | | <money-input :key="accumulationFundCompanyAmountRandom" v-model="form.accumulationFundCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.accumulationFundCompanyAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>养老险</el-divider> |
| | | <el-form-item label="基数" prop="retirementInsurance"> |
| | | <money-input :key="retirementInsuranceRandom" v-model="form.retirementInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="pensionParameterBlur" /> |
| | | <el-input v-model="form.retirementInsurance" style="width: 523px;" :disabled="disabledFlagByApprove" @change="pensionParameterBlur" /> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳比例" prop="retirementInsurancePersonal"> |
| | | <el-input v-model="form.retirementInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="pensionParameterBlur"> |
| | | <el-input v-model="form.retirementInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @change="pensionParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳金额" prop="retirementInsurancePersonalAmount"> |
| | | <money-input :key="retirementInsurancePersonalAmountRandom" v-model="form.retirementInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.retirementInsurancePersonalAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳比例" prop="retirementInsuranceCompany"> |
| | | <el-input v-model="form.retirementInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="pensionParameterBlur"> |
| | | <el-input v-model="form.retirementInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @change="pensionParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳金额" prop="retirementInsuranceCompanyAmount"> |
| | | <money-input :key="retirementInsuranceCompanyAmountRandom" v-model="form.retirementInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.retirementInsuranceCompanyAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>医疗险</el-divider> |
| | | <el-form-item label="基数" prop="medicalInsurance"> |
| | | <money-input :key="medicalInsuranceRandom" v-model="form.medicalInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="medicalParameterBlur" /> |
| | | <el-input v-model="form.medicalInsurance" style="width: 523px;" :disabled="disabledFlagByApprove" @change="medicalParameterBlur" /> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳比例" prop="medicalInsurancePersonal"> |
| | | <el-input v-model="form.medicalInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="medicalParameterBlur"> |
| | | <el-input v-model="form.medicalInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @change="medicalParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳金额" prop="medicalInsurancePersonalAmount"> |
| | | <money-input :key="medicalInsurancePersonalAmountRandom" v-model="form.medicalInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.medicalInsurancePersonalAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳比例" prop="medicalInsuranceCompany"> |
| | | <el-input v-model="form.medicalInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="medicalParameterBlur"> |
| | | <el-input v-model="form.medicalInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @change="medicalParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳金额" prop="medicalInsuranceCompanyAmount"> |
| | | <money-input :key="medicalInsuranceCompanyAmountRandom" v-model="form.medicalInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.medicalInsuranceCompanyAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>失业险</el-divider> |
| | | <el-form-item label="基数" prop="unemploymentInsurance"> |
| | | <money-input :key="unemploymentInsuranceRandom" v-model="form.unemploymentInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="unemploymentParameterBlur" /> |
| | | <el-input v-model="form.unemploymentInsurance" style="width: 523px;" :disabled="disabledFlagByApprove" @change="unemploymentParameterBlur" /> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳比例" prop="unemploymentInsurancePersonal"> |
| | | <el-input v-model="form.unemploymentInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="unemploymentParameterBlur"> |
| | | <el-input v-model="form.unemploymentInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @change="unemploymentParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳金额" prop="unemploymentInsurancePersonalAmount"> |
| | | <money-input :key="unemploymentInsurancePersonalAmountRandom" v-model="form.unemploymentInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.unemploymentInsurancePersonalAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳比例" prop="unemploymentInsuranceCompany"> |
| | | <el-input v-model="form.unemploymentInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="unemploymentParameterBlur"> |
| | | <el-input v-model="form.unemploymentInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @change="unemploymentParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳金额" prop="unemploymentInsuranceCompanyAmount"> |
| | | <money-input :key="unemploymentInsuranceCompanyAmountRandom" v-model="form.unemploymentInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.unemploymentInsuranceCompanyAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>生育险</el-divider> |
| | | <el-form-item label="基数" prop="birthInsurance"> |
| | | <money-input :key="birthInsuranceRandom" v-model="form.birthInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="maternityParameterBlur" /> |
| | | <el-input v-model="form.birthInsurance" style="width: 523px;" :disabled="disabledFlagByApprove" @change="maternityParameterBlur" /> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳比例" prop="birthInsurancePersonal"> |
| | | <el-input v-model="form.birthInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="maternityParameterBlur"> |
| | | <el-input v-model="form.birthInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @change="maternityParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳金额" prop="birthInsurancePersonalAmount"> |
| | | <money-input :key="birthInsurancePersonalAmountRandom" v-model="form.birthInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.birthInsurancePersonalAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳比例" prop="birthInsuranceCompany"> |
| | | <el-input v-model="form.birthInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="maternityParameterBlur"> |
| | | <el-input v-model="form.birthInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @change="maternityParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳金额" prop="birthInsuranceCompanyAmount"> |
| | | <money-input :key="birthInsuranceCompanyAmountRandom" v-model="form.birthInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.birthInsuranceCompanyAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>工伤险</el-divider> |
| | | <el-form-item label="基数" prop="employmentInsurance"> |
| | | <money-input :key="employmentInsuranceRandom" v-model="form.employmentInsurance" :width="523" :disabled="disabledFlagByApprove" @blur="industrialInjuryParameterBlur" /> |
| | | <el-input v-model="form.employmentInsurance" style="width: 523px;" :disabled="disabledFlagByApprove" @change="industrialInjuryParameterBlur" /> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳比例" prop="employmentInsurancePersonal"> |
| | | <el-input v-model="form.employmentInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="industrialInjuryParameterBlur"> |
| | | <el-input v-model="form.employmentInsurancePersonal" style="width: 200px;" :disabled="disabledFlagByApprove" @change="industrialInjuryParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="个人缴纳金额" prop="employmentInsurancePersonalAmount"> |
| | | <money-input :key="employmentInsurancePersonalAmountRandom" v-model="form.employmentInsurancePersonalAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.employmentInsurancePersonalAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳比例" prop="employmentInsuranceCompany"> |
| | | <el-input v-model="form.employmentInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @blur="industrialInjuryParameterBlur"> |
| | | <el-input v-model="form.employmentInsuranceCompany" style="width: 200px;" :disabled="disabledFlagByApprove" @change="industrialInjuryParameterBlur"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公司缴纳金额" prop="employmentInsuranceCompanyAmount"> |
| | | <money-input :key="employmentInsuranceCompanyAmountRandom" v-model="form.employmentInsuranceCompanyAmount" :width="200" :disabled="disabledFlagByApprove" @blur="statisticalAmount" /> |
| | | <el-input v-model="form.employmentInsuranceCompanyAmount" style="width: 200px;" :disabled="disabledFlagByApprove" @change="statisticalAmount" /> |
| | | </el-form-item> |
| | | <el-divider>统计</el-divider> |
| | | <el-form-item label="税前金额" prop="preTaxAmount"> |
| | | <money-input :key="preTaxAmountRandom" v-model="form.preTaxAmount" :width="200" :disabled="disabledFlagByApprove" @blur="preTaxAmountBlur" /> |
| | | <el-input v-model="form.preTaxAmount" style="width: 200px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="个人所得税" prop="individualIncomeTax"> |
| | | <money-input :key="individualIncomeTaxRandom" v-model="form.individualIncomeTax" :width="200" :disabled="disabledFlagByApprove" @blur="individualIncomeTaxBlur" /> |
| | | <el-input v-model="form.individualIncomeTax" style="width: 200px;" :disabled="disabledFlagByApprove" @change="individualIncomeTaxBlur" /> |
| | | </el-form-item> |
| | | <el-form-item label="税后金额" prop="afterTaxAmount"> |
| | | <money-input :key="afterTaxAmountRandom" v-model="form.afterTaxAmount" :width="523" :disabled="disabledFlagByApprove" /> |
| | | <el-input v-model="form.afterTaxAmount" style="width: 523px;" :disabled="disabledFlagByApprove" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 523px;" :disabled="disabledFlagByApprove" /> |
| | |
| | | {{ crud.toMonth(scope.row.salaryYearMonth) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="actualBasicWage" label="基础工资" width="100"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="basicWage" label="预计工资" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.basicWage) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="actualBasicWage" label="基本工资" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.actualBasicWage) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="actualAchievementsWage" label="绩效工资" width="100"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="pieceRate" label="其他补助" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.actualAchievementsWage) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="actualPerformanceWage" label="业绩工资" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.actualPerformanceWage) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accumulationFundPersonalAmount" label="公积金·个人缴纳金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.accumulationFundPersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="retirementInsurancePersonalAmount" label="养老险·个人缴纳金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.retirementInsurancePersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="medicalInsurancePersonalAmount" label="医疗险·个人缴纳金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.medicalInsurancePersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="unemploymentInsurancePersonalAmount" label="失业险·个人缴纳金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.unemploymentInsurancePersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="birthInsurancePersonalAmount" label="生育险·个人缴纳金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.birthInsurancePersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="employmentInsurancePersonalAmount" label="工伤险·个人缴纳金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.employmentInsurancePersonalAmount) }} |
| | | {{ crud.toMoney((scope.row.pieceRate == null ? 0 : scope.row.pieceRate) + (scope.row.travelAllowance == null ? 0 : scope.row.travelAllowance) + (scope.row.overtimeAllowance == null ? 0 : scope.row.overtimeAllowance)) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="preTaxAmount" label="税前金额" width="100"> |
| | |
| | | {{ crud.toMoney(scope.row.afterTaxAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="pieceRate" label="其他金额" width="100"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="accumulationFundPersonalAmount" label="公积金·个人" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{crud.toMoney((scope.row.pieceRate == null ? 0 : scope.row.pieceRate) + (scope.row.travelAllowance == null ? 0 : scope.row.travelAllowance) + (scope.row.overtimeAllowance == null ? 0 : scope.row.overtimeAllowance)) }} |
| | | {{ crud.toMoney(scope.row.accumulationFundPersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="retirementInsurancePersonalAmount" label="养老险·个人" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.retirementInsurancePersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="medicalInsurancePersonalAmount" label="医疗险·个人" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.medicalInsurancePersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="unemploymentInsurancePersonalAmount" label="失业险·个人" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.unemploymentInsurancePersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="birthInsurancePersonalAmount" label="生育险·个人" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.birthInsurancePersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="employmentInsurancePersonalAmount" label="工伤险·个人" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.employmentInsurancePersonalAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" width="140" /> |
| | |
| | | <el-form-item label="工资年月" prop="targetYearMonth"> |
| | | <el-date-picker |
| | | v-model="generateForm.targetYearMonth" |
| | | value-format="yyyy-MM-dd" |
| | | type="month" |
| | | style="width: 370px;" |
| | | placeholder="请选择" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="selectedValue1"> |
| | | <el-form-item label="所属员工" prop="userIds"> |
| | | <el-cascader |
| | | v-model="generateForm.selectedValue1" |
| | | v-model="generateForm.userIds" |
| | | :filterable="true" |
| | | :options="options" |
| | | :props="props" |
| | |
| | | style="width: 370px" |
| | | @change="changeUserListTwo" |
| | | /> |
| | | <!-- <el-select v-model="generateForm.userId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <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> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | |
| | | <script> |
| | | import crudNewSalary from '@/api/salary/newSalary' |
| | | import crudSysCompany from '@/api/system/sysCompany' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import constant from '../../../utils/constant' |
| | | import crudUser from '@/api/system/user' |
| | | import crudUserLevelWage from '@/api/treatment/userLevelWage' |
| | | import crudUserInsurance from '@/api/treatment/userInsurance' |
| | | import crudUserLevelOther from '@/api/system/userLevelOther' |
| | | import crudAttendance from '@/api/attendance/attendance' |
| | | import crudTaskDaliy from '@/api/task/taskDaliy' |
| | | import crudProjectPerformanceDetail from '@/api/project/projectPerformanceDetail' |
| | | import crudSysConfigIndividualIncomeTax from '@/api/system/configIndividualIncomeTax' |
| | | // import { getMeritWage } from '../../../api/salary/newSalary' |
| | | |
| | | const defaultForm = { id: null, userId: null, salaryYearMonth: null, basicWage: null, fullDays: null, absenceDays: null, actualBasicWage: null, achievementsWage: null, needCompletedAchievementsHours: null, alreadyCompletedAchievementsHours: 0, CompletedAchievementsRate: 0, meritMoney: 0, actualAchievementsWage: null, performanceWage: null, personalPerformanceProportion: null, needCompletedPerformanceHours: null, alreadyCompletedPerformanceHours: null, actualPerformanceWage: null, teamWage: null, actualComplianceTeamHours: null, alreadyCompletedTeamHours: null, actualTeamWage: null, pieceRate: 0, travelAllowance: 0, overtimeAllowance: 0, accumulationFund: null, accumulationFundPersonal: null, accumulationFundPersonalAmount: null, accumulationFundCompany: null, accumulationFundCompanyAmount: null, retirementInsurance: null, retirementInsurancePersonal: null, retirementInsurancePersonalAmount: null, retirementInsuranceCompany: null, retirementInsuranceCompanyAmount: null, medicalInsurance: null, medicalInsurancePersonal: null, medicalInsurancePersonalAmount: null, medicalInsuranceCompany: null, medicalInsuranceCompanyAmount: null, unemploymentInsurance: null, unemploymentInsurancePersonal: null, unemploymentInsurancePersonalAmount: null, unemploymentInsuranceCompany: null, unemploymentInsuranceCompanyAmount: null, birthInsurance: null, birthInsurancePersonal: null, birthInsurancePersonalAmount: null, birthInsuranceCompany: null, birthInsuranceCompanyAmount: null, employmentInsurance: null, employmentInsurancePersonal: null, employmentInsurancePersonalAmount: null, employmentInsuranceCompany: null, employmentInsuranceCompanyAmount: null, preTaxAmount: null, individualIncomeTax: null, afterTaxAmount: null, remarks: null, publicityStatus: constant.PUBLICITY_STATUS_NOT, approveStatus: constant.APPROVE_STATUS_UNRECOGNIZED, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | |
| | | ], |
| | | actualBasicWage: [ |
| | | { required: true, message: '实际基础工资不能为空', trigger: 'blur' }, |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ], |
| | | achievementsWage: [ |
| | | { required: true, message: '预计绩效工资不能为空', trigger: 'blur' }, |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ], |
| | | needCompletedAchievementsHours: [ |
| | | { required: true, message: '应完成绩效工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | alreadyCompletedAchievementsHours: [ |
| | | { required: true, message: '已完成绩效工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | actualAchievementsWage: [ |
| | | { required: true, message: '实际绩效工资不能为空', trigger: 'blur' }, |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ], |
| | | performanceWage: [ |
| | | { required: true, message: '预计业绩工资不能为空', trigger: 'blur' }, |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ], |
| | | personalPerformanceProportion: [ |
| | | { required: true, message: '个人业绩比例不能为空', trigger: 'blur' }, |
| | | { validator: proportionValidate, trigger: 'blur' } |
| | | ], |
| | | needCompletedPerformanceHours: [ |
| | | { required: true, message: '应完成业绩工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | alreadyCompletedPerformanceHours: [ |
| | | { required: true, message: '已完成业绩工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | actualPerformanceWage: [ |
| | | { required: true, message: '实际业绩工资不能为空', trigger: 'blur' }, |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ], |
| | | teamWage: [ |
| | | { required: true, message: '预计团队工资不能为空', trigger: 'blur' }, |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ], |
| | | actualComplianceTeamHours: [ |
| | | { required: true, message: '实达标团队工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | alreadyCompletedTeamHours: [ |
| | | { required: true, message: '已完成团队工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | actualTeamWage: [ |
| | | { required: true, message: '实际团队工资不能为空', trigger: 'blur' }, |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ], |
| | | accumulationFund: [ |
| | |
| | | approveStatus: constant.APPROVE_STATUS, |
| | | // 用户列表 |
| | | users: [], |
| | | // 公司列表 |
| | | companyList: [], |
| | | // 表单加载 |
| | | formLoading: false, |
| | | // 公示弹窗加载 |
| | |
| | | // 生成表单加载 |
| | | generateLoading: false, |
| | | // 生成表单数据 |
| | | generateForm: { targetYearMonth: null, userId: null, selectedValue1: [] }, |
| | | generateForm: { targetYearMonth: null, userIds: [], selectedValue1: [] }, |
| | | // 生成表单验证 |
| | | generateRules: { |
| | | targetYearMonth: [ |
| | |
| | | }, |
| | | // 获取用户 |
| | | getUser() { |
| | | // 查询配置参数 |
| | | crudSysCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | | // 获取用户 |
| | | crudUser.getAll().then(res => { |
| | | // 用户列表 |
| | |
| | | // 表单禁用标记(承认状态) |
| | | this.disabledFlagByApprove = false |
| | | } |
| | | // 预计基本工资随机数 |
| | | this.basicWageRandom = Math.random() |
| | | // 实际基本工资随机数 |
| | | this.actualBasicWageRandom = Math.random() |
| | | // 预计绩效工资随机数 |
| | | this.achievementsWageRandom = Math.random() |
| | | // 实际绩效工资随机数 |
| | | this.actualAchievementsWageRandom = Math.random() |
| | | // 预计业绩工资随机数 |
| | | this.performanceWageRandom = Math.random() |
| | | // 实际业绩工资随机数 |
| | | this.actualPerformanceWageRandom = Math.random() |
| | | // 预计团队工资随机数 |
| | | this.teamWageRandom = Math.random() |
| | | // 实际团队工资随机数 |
| | | this.actualTeamWageRandom = Math.random() |
| | | // 公积金基数随机数 |
| | | this.accumulationFundRandom = Math.random() |
| | | // 公积金个人缴纳金额随机数 |
| | | this.accumulationFundPersonalAmountRandom = Math.random() |
| | | // 公积金公司缴纳金额随机数 |
| | | this.accumulationFundCompanyAmountRandom = Math.random() |
| | | // 养老险基数随机数 |
| | | this.retirementInsuranceRandom = Math.random() |
| | | // 养老险个人缴纳金额随机数 |
| | | this.retirementInsurancePersonalAmountRandom = Math.random() |
| | | // 养老险公司缴纳金额随机数 |
| | | this.retirementInsuranceCompanyAmountRandom = Math.random() |
| | | // 医疗险基数随机数 |
| | | this.medicalInsuranceRandom = Math.random() |
| | | // 医疗险个人缴纳金额随机数 |
| | | this.medicalInsurancePersonalAmountRandom = Math.random() |
| | | // 医疗险公司缴纳金额随机数 |
| | | this.medicalInsuranceCompanyAmountRandom = Math.random() |
| | | // 失业险基数随机数 |
| | | this.unemploymentInsuranceRandom = Math.random() |
| | | // 失业险个人缴纳金额随机数 |
| | | this.unemploymentInsurancePersonalAmountRandom = Math.random() |
| | | // 失业险公司缴纳金额随机数 |
| | | this.unemploymentInsuranceCompanyAmountRandom = Math.random() |
| | | // 生育险基数随机数 |
| | | this.birthInsuranceRandom = Math.random() |
| | | // 生育险个人缴纳金额随机数 |
| | | this.birthInsurancePersonalAmountRandom = Math.random() |
| | | // 生育险公司缴纳金额随机数 |
| | | this.birthInsuranceCompanyAmountRandom = Math.random() |
| | | // 工伤险基数随机数 |
| | | this.employmentInsuranceRandom = Math.random() |
| | | // 工伤险个人缴纳金额随机数 |
| | | this.employmentInsurancePersonalAmountRandom = Math.random() |
| | | // 工伤险公司缴纳金额随机数 |
| | | this.employmentInsuranceCompanyAmountRandom = Math.random() |
| | | // 税前金额随机数 |
| | | this.preTaxAmountRandom = Math.random() |
| | | // 计件工资 |
| | | this.pieceRateRandom = Math.random() |
| | | // 出差补助工资 |
| | | this.travelAllowanceRandom = Math.random() |
| | | // 加班工资 |
| | | this.overtimeAllowanceRandom = Math.random() |
| | | // // 预计基本工资随机数 |
| | | // this.basicWageRandom = Math.random() |
| | | // // 实际基本工资随机数 |
| | | // this.actualBasicWageRandom = Math.random() |
| | | // // 预计绩效工资随机数 |
| | | // this.achievementsWageRandom = Math.random() |
| | | // // 实际绩效工资随机数 |
| | | // this.actualAchievementsWageRandom = Math.random() |
| | | // // 预计业绩工资随机数 |
| | | // this.performanceWageRandom = Math.random() |
| | | // // 实际业绩工资随机数 |
| | | // this.actualPerformanceWageRandom = Math.random() |
| | | // // 预计团队工资随机数 |
| | | // this.teamWageRandom = Math.random() |
| | | // // 实际团队工资随机数 |
| | | // this.actualTeamWageRandom = Math.random() |
| | | // // 公积金基数随机数 |
| | | // this.accumulationFundRandom = Math.random() |
| | | // // 公积金个人缴纳金额随机数 |
| | | // this.accumulationFundPersonalAmountRandom = Math.random() |
| | | // // 公积金公司缴纳金额随机数 |
| | | // this.accumulationFundCompanyAmountRandom = Math.random() |
| | | // // 养老险基数随机数 |
| | | // this.retirementInsuranceRandom = Math.random() |
| | | // // 养老险个人缴纳金额随机数 |
| | | // this.retirementInsurancePersonalAmountRandom = Math.random() |
| | | // // 养老险公司缴纳金额随机数 |
| | | // this.retirementInsuranceCompanyAmountRandom = Math.random() |
| | | // // 医疗险基数随机数 |
| | | // this.medicalInsuranceRandom = Math.random() |
| | | // // 医疗险个人缴纳金额随机数 |
| | | // this.medicalInsurancePersonalAmountRandom = Math.random() |
| | | // // 医疗险公司缴纳金额随机数 |
| | | // this.medicalInsuranceCompanyAmountRandom = Math.random() |
| | | // // 失业险基数随机数 |
| | | // this.unemploymentInsuranceRandom = Math.random() |
| | | // // 失业险个人缴纳金额随机数 |
| | | // this.unemploymentInsurancePersonalAmountRandom = Math.random() |
| | | // // 失业险公司缴纳金额随机数 |
| | | // this.unemploymentInsuranceCompanyAmountRandom = Math.random() |
| | | // // 生育险基数随机数 |
| | | // this.birthInsuranceRandom = Math.random() |
| | | // // 生育险个人缴纳金额随机数 |
| | | // this.birthInsurancePersonalAmountRandom = Math.random() |
| | | // // 生育险公司缴纳金额随机数 |
| | | // this.birthInsuranceCompanyAmountRandom = Math.random() |
| | | // // 工伤险基数随机数 |
| | | // this.employmentInsuranceRandom = Math.random() |
| | | // // 工伤险个人缴纳金额随机数 |
| | | // this.employmentInsurancePersonalAmountRandom = Math.random() |
| | | // // 工伤险公司缴纳金额随机数 |
| | | // this.employmentInsuranceCompanyAmountRandom = Math.random() |
| | | // // 税前金额随机数 |
| | | // this.preTaxAmountRandom = Math.random() |
| | | // // 计件工资 |
| | | // this.pieceRateRandom = Math.random() |
| | | // // 出差补助工资 |
| | | // this.travelAllowanceRandom = Math.random() |
| | | // // 加班工资 |
| | | // this.overtimeAllowanceRandom = Math.random() |
| | | // 个人所得税随机数 |
| | | // this.individualIncomeTaxRandom = Math.random() |
| | | this.individualIncomeTaxRandom = 0 |
| | | // 税后金额随机数 |
| | | this.afterTaxAmountRandom = Math.random() |
| | | // 获取用户级别工资 |
| | | // crudUserLevelWage.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => { |
| | | // this.Level_now = res.level |
| | | // }) |
| | | }, |
| | | |
| | | // 获取用户级别数据 |
| | | getUserLevel() { |
| | | console.log('12') |
| | | // 判断所属员工、工资年月是否为空 |
| | | if (this.form.userId != null && this.form.userId !== '' && this.form.salaryYearMonth != null && this.form.salaryYearMonth !== '') { |
| | | // 表单加载 |
| | | this.formLoading = true |
| | | // 执行完以下内容才往下走:获取用户级别工资、获取用户级别保险、获取用户级别其他、获取工作天数、获取出勤小时数、获取达标工时、获取已完成工时、获取员工出差补助 |
| | | Promise.all([ |
| | | this.getUserLevelWage(),this.getUserLevelOther(), this.getWorkDays(), this.getAttendanceHours(), |
| | | this.getComplianceWork(), this.getCompletedWork(), this.getUserLevelInsurance(), this.getTravelAllowance(), this.getOvertimeAllowance() |
| | | ]).then(res => { |
| | | // 表单加载 |
| | | this.formLoading = false |
| | | }).catch((e) => { |
| | | // 表单加载 |
| | | this.formLoading = false |
| | | }) |
| | | } |
| | | }, |
| | | // 获取员工出差补助 |
| | | getTravelAllowance() { |
| | | return new Promise((resolve, reject) => { |
| | | // 获取用户级别其他 |
| | | crudUserLevelWage.getTravelAllowance({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => { |
| | | this.form.travelAllowance = res |
| | | this.travelAllowanceRandom = Math.random() |
| | | // 成功 |
| | | resolve() |
| | | }).catch(() => { |
| | | // 失败 |
| | | reject() |
| | | }) |
| | | }) |
| | | }, |
| | | // 获取员工加班工资 |
| | | getOvertimeAllowance() { |
| | | return new Promise((resolve, reject) => { |
| | | // 获取用户级别其他 |
| | | crudUserLevelWage.getOvertimeAllowance({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => { |
| | | this.form.overtimeAllowance = res |
| | | this.overtimeAllowanceRandom = Math.random() |
| | | // 成功 |
| | | resolve() |
| | | }).catch(() => { |
| | | // 失败 |
| | | reject() |
| | | }) |
| | | }) |
| | | }, |
| | | // 获取用户级别工资 |
| | | getUserLevelWage() { |
| | | return new Promise((resolve, reject) => { |
| | | // 获取用户级别工资 |
| | | crudUserLevelWage.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => { |
| | | this.Level_now = res.level |
| | | // 级别基本工资 |
| | | const basicWage = Number(res.basicWage.toFixed(2)) |
| | | // 级别等级工资 |
| | | const rankWage = Number(res.rankWage.toFixed(2)) |
| | | // 预计基本工资 |
| | | this.form.basicWage = Number((basicWage + rankWage).toFixed(2)) |
| | | // 预计基本工资随机数 |
| | | this.basicWageRandom = Math.random() |
| | | // 预计绩效工资 |
| | | this.form.achievementsWage = Number(res.performanceWage.toFixed(2)) |
| | | // 预计绩效工资随机数 |
| | | this.achievementsWageRandom = Math.random() |
| | | // 预计业绩工资 |
| | | this.form.performanceWage = 0 |
| | | // 预计业绩工资随机数 |
| | | this.performanceWageRandom = Math.random() |
| | | // 预计团队工资 |
| | | this.form.teamWage = 0 |
| | | // 预计团队工资随机数 |
| | | this.teamWageRandom = Math.random() |
| | | // 成功 |
| | | resolve() |
| | | }).catch(() => { |
| | | // 预计基本工资 |
| | | this.form.basicWage = 0 |
| | | // 预计基本工资随机数 |
| | | this.basicWageRandom = Math.random() |
| | | // 预计绩效工资 |
| | | this.form.achievementsWage = 0 |
| | | // 预计绩效工资随机数 |
| | | this.achievementsWageRandom = Math.random() |
| | | // 预计业绩工资 |
| | | this.form.performanceWage = 0 |
| | | // 预计业绩工资随机数 |
| | | this.performanceWageRandom = Math.random() |
| | | // 预计团队工资 |
| | | this.form.teamWage = 0 |
| | | // 预计团队工资随机数 |
| | | this.teamWageRandom = Math.random() |
| | | // 失败 |
| | | reject() |
| | | }) |
| | | }) |
| | | }, |
| | | // 获取用户级别保险 |
| | | getUserLevelInsurance() { |
| | | return new Promise((resolve, reject) => { |
| | | // 获取用户级别保险 |
| | | crudUserInsurance.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => { |
| | | // 公积金基数 |
| | | this.form.accumulationFund = Number(res.accumulationRadix.toFixed(2)) |
| | | // 公积金基数随机数 |
| | | this.accumulationFundRandom = Math.random() |
| | | // 公积金个人缴纳比例 |
| | | this.form.accumulationFundPersonal = Number(res.accumulationPersonalProportion.toFixed(2)) |
| | | // 公积金个人缴纳金额 |
| | | this.form.accumulationFundPersonalAmount = Number((res.accumulationFund * (res.accumulationFundPersonal / 100)).toFixed(2)) |
| | | // 公积金个人缴纳金额随机数 |
| | | this.accumulationFundPersonalAmountRandom = Math.random() |
| | | // 公积金公司缴纳比例 |
| | | this.form.accumulationFundCompany = Number(res.accumulationCompanyProportion.toFixed(2)) |
| | | // 公积金公司缴纳金额 |
| | | this.form.accumulationFundCompanyAmount = Number((res.accumulationFund * (res.accumulationFundCompany / 100)).toFixed(2)) |
| | | // 公积金公司缴纳金额随机数 |
| | | this.accumulationFundCompanyAmountRandom = Math.random() |
| | | // 养老险基数 |
| | | this.form.retirementInsurance = Number(res.pensionRadix.toFixed(2)) |
| | | // 养老险基数随机数 |
| | | this.retirementInsuranceRandom = Math.random() |
| | | // 养老险个人缴纳比例 |
| | | this.form.retirementInsurancePersonal = Number(res.pensionPersonalProportion.toFixed(2)) |
| | | // 养老险个人缴纳金额 |
| | | this.form.retirementInsurancePersonalAmount = Number((res.retirementInsurance * (res.retirementInsurancePersonal / 100)).toFixed(2)) |
| | | // 养老险个人缴纳金额随机数 |
| | | this.retirementInsurancePersonalAmountRandom = Math.random() |
| | | // 养老险公司缴纳比例 |
| | | this.form.retirementInsuranceCompany = Number(res.pensionCompanyProportion.toFixed(2)) |
| | | // 养老险公司缴纳金额 |
| | | this.form.retirementInsuranceCompanyAmount = Number((res.retirementInsurance * (res.retirementInsuranceCompany / 100)).toFixed(2)) |
| | | // 养老险公司缴纳金额随机数 |
| | | this.retirementInsuranceCompanyAmountRandom = Math.random() |
| | | // 医疗险基数 |
| | | this.form.medicalInsurance = Number(res.medicalRadix.toFixed(2)) |
| | | // 医疗险基数随机数 |
| | | this.medicalInsuranceRandom = Math.random() |
| | | // 医疗险个人缴纳比例 |
| | | this.form.medicalInsurancePersonal = Number(res.medicalPersonalProportion.toFixed(2)) |
| | | // 医疗险个人缴纳金额 |
| | | this.form.medicalInsurancePersonalAmount = Number((res.medicalInsurance * (res.medicalInsurancePersonal / 100)).toFixed(2)) |
| | | // 医疗险个人缴纳金额随机数 |
| | | this.medicalInsurancePersonalAmountRandom = Math.random() |
| | | // 医疗险公司缴纳比例 |
| | | this.form.medicalInsuranceCompany = Number(res.medicalCompanyProportion.toFixed(2)) |
| | | // 医疗险公司缴纳金额 |
| | | this.form.medicalInsuranceCompanyAmount = Number((res.medicalInsurance * (res.medicalInsuranceCompany / 100)).toFixed(2)) |
| | | // 医疗险公司缴纳金额随机数 |
| | | this.medicalInsuranceCompanyAmountRandom = Math.random() |
| | | // 失业险基数 |
| | | this.form.unemploymentInsurance = Number(res.unemploymentRadix.toFixed(2)) |
| | | // 失业险基数随机数 |
| | | this.unemploymentInsuranceRandom = Math.random() |
| | | // 失业险个人缴纳比例 |
| | | this.form.unemploymentInsurancePersonal = Number(res.unemploymentPersonalProportion.toFixed(2)) |
| | | // 失业险个人缴纳金额 |
| | | this.form.unemploymentInsurancePersonalAmount = Number((res.unemploymentInsurance * (res.unemploymentInsurancePersonal / 100)).toFixed(2)) |
| | | // 失业险个人缴纳金额随机数 |
| | | this.unemploymentInsurancePersonalAmountRandom = Math.random() |
| | | // 失业险公司缴纳比例 |
| | | this.form.unemploymentInsuranceCompany = Number(res.unemploymentCompanyProportion.toFixed(2)) |
| | | // 失业险公司缴纳金额 |
| | | this.form.unemploymentInsuranceCompanyAmount = Number((res.unemploymentInsurance * (res.unemploymentInsuranceCompany / 100)).toFixed(2)) |
| | | // 失业险公司缴纳金额随机数 |
| | | this.unemploymentInsuranceCompanyAmountRandom = Math.random() |
| | | // 生育险基数 |
| | | this.form.birthInsurance = Number(res.maternityRadix.toFixed(2)) |
| | | // 生育险基数随机数 |
| | | this.birthInsuranceRandom = Math.random() |
| | | // 生育险个人缴纳比例 |
| | | this.form.birthInsurancePersonal = Number(res.maternityPersonalProportion.toFixed(2)) |
| | | // 生育险个人缴纳金额 |
| | | this.form.birthInsurancePersonalAmount = Number((res.birthInsurance * (res.birthInsurancePersonal / 100)).toFixed(2)) |
| | | // 生育险个人缴纳金额随机数 |
| | | this.birthInsurancePersonalAmountRandom = Math.random() |
| | | // 生育险公司缴纳比例 |
| | | this.form.birthInsuranceCompany = Number(res.maternityCompanyProportion.toFixed(2)) |
| | | // 生育险公司缴纳金额 |
| | | this.form.birthInsuranceCompanyAmount = Number((res.birthInsurance * (res.birthInsuranceCompany / 100)).toFixed(2)) |
| | | // 生育险公司缴纳金额随机数 |
| | | this.birthInsuranceCompanyAmountRandom = Math.random() |
| | | // 工伤险基数 |
| | | this.form.employmentInsurance = Number(res.industrialInjuryRadix.toFixed(2)) |
| | | // 工伤险基数随机数 |
| | | this.employmentInsuranceRandom = Math.random() |
| | | // 工伤险个人缴纳比例 |
| | | this.form.employmentInsurancePersonal = Number(res.industrialInjuryPersonalProportion.toFixed(2)) |
| | | // 工伤险个人缴纳金额 |
| | | this.form.employmentInsurancePersonalAmount = Number((res.employmentInsurance * (res.employmentInsurancePersonal / 100)).toFixed(2)) |
| | | // 工伤险个人缴纳金额随机数 |
| | | this.employmentInsurancePersonalAmountRandom = Math.random() |
| | | // 工伤险公司缴纳比例 |
| | | this.form.employmentInsuranceCompany = Number(res.industrialInjuryCompanyProportion.toFixed(2)) |
| | | // 工伤险公司缴纳金额 |
| | | this.form.employmentInsuranceCompanyAmount = Number((res.employmentInsurance * (res.employmentInsuranceCompany / 100)).toFixed(2)) |
| | | // 工伤险公司缴纳金额随机数 |
| | | this.employmentInsuranceCompanyAmountRandom = Math.random() |
| | | // 成功 |
| | | resolve() |
| | | }).catch(() => { |
| | | // 公积金基数 |
| | | this.form.accumulationFund = 0 |
| | | // 公积金基数随机数 |
| | | this.accumulationFundRandom = Math.random() |
| | | // 公积金个人缴纳比例 |
| | | this.form.accumulationFundPersonal = 0 |
| | | // 公积金个人缴纳金额 |
| | | this.form.accumulationFundPersonalAmount = 0 |
| | | // 公积金个人缴纳金额随机数 |
| | | this.accumulationFundPersonalAmountRandom = Math.random() |
| | | // 公积金公司缴纳比例 |
| | | this.form.accumulationFundCompany = 0 |
| | | // 公积金公司缴纳金额 |
| | | this.form.accumulationFundCompanyAmount = 0 |
| | | // 公积金公司缴纳金额随机数 |
| | | this.accumulationFundCompanyAmountRandom = Math.random() |
| | | // 养老险基数 |
| | | this.form.retirementInsurance = 0 |
| | | // 养老险基数随机数 |
| | | this.retirementInsuranceRandom = Math.random() |
| | | // 养老险个人缴纳比例 |
| | | this.form.retirementInsurancePersonal = 0 |
| | | // 养老险个人缴纳金额 |
| | | this.form.retirementInsurancePersonalAmount = 0 |
| | | // 养老险个人缴纳金额随机数 |
| | | this.retirementInsurancePersonalAmountRandom = Math.random() |
| | | // 养老险公司缴纳比例 |
| | | this.form.retirementInsuranceCompany = 0 |
| | | // 养老险公司缴纳金额 |
| | | this.form.retirementInsuranceCompanyAmount = 0 |
| | | // 养老险公司缴纳金额随机数 |
| | | this.retirementInsuranceCompanyAmountRandom = Math.random() |
| | | // 医疗险基数 |
| | | this.form.medicalInsurance = 0 |
| | | // 医疗险基数随机数 |
| | | this.medicalInsuranceRandom = Math.random() |
| | | // 医疗险个人缴纳比例 |
| | | this.form.medicalInsurancePersonal = 0 |
| | | // 医疗险个人缴纳金额 |
| | | this.form.medicalInsurancePersonalAmount = 0 |
| | | // 医疗险个人缴纳金额随机数 |
| | | this.medicalInsurancePersonalAmountRandom = Math.random() |
| | | // 医疗险公司缴纳比例 |
| | | this.form.medicalInsuranceCompany = 0 |
| | | // 医疗险公司缴纳金额 |
| | | this.form.medicalInsuranceCompanyAmount = 0 |
| | | // 医疗险公司缴纳金额随机数 |
| | | this.medicalInsuranceCompanyAmountRandom = Math.random() |
| | | // 失业险基数 |
| | | this.form.unemploymentInsurance = 0 |
| | | // 失业险基数随机数 |
| | | this.unemploymentInsuranceRandom = Math.random() |
| | | // 失业险个人缴纳比例 |
| | | this.form.unemploymentInsurancePersonal = 0 |
| | | // 失业险个人缴纳金额 |
| | | this.form.unemploymentInsurancePersonalAmount = 0 |
| | | // 失业险个人缴纳金额随机数 |
| | | this.unemploymentInsurancePersonalAmountRandom = Math.random() |
| | | // 失业险公司缴纳比例 |
| | | this.form.unemploymentInsuranceCompany = 0 |
| | | // 失业险公司缴纳金额 |
| | | this.form.unemploymentInsuranceCompanyAmount = 0 |
| | | // 失业险公司缴纳金额随机数 |
| | | this.unemploymentInsuranceCompanyAmountRandom = Math.random() |
| | | // 生育险基数 |
| | | this.form.birthInsurance = 0 |
| | | // 生育险基数随机数 |
| | | this.birthInsuranceRandom = Math.random() |
| | | // 生育险个人缴纳比例 |
| | | this.form.birthInsurancePersonal = 0 |
| | | // 生育险个人缴纳金额 |
| | | this.form.birthInsurancePersonalAmount = 0 |
| | | // 生育险个人缴纳金额随机数 |
| | | this.birthInsurancePersonalAmountRandom = Math.random() |
| | | // 生育险公司缴纳比例 |
| | | this.form.birthInsuranceCompany = 0 |
| | | // 生育险公司缴纳金额 |
| | | this.form.birthInsuranceCompanyAmount = 0 |
| | | // 生育险公司缴纳金额随机数 |
| | | this.birthInsuranceCompanyAmountRandom = Math.random() |
| | | // 工伤险基数 |
| | | this.form.employmentInsurance = 0 |
| | | // 工伤险基数随机数 |
| | | this.employmentInsuranceRandom = Math.random() |
| | | // 工伤险个人缴纳比例 |
| | | this.form.employmentInsurancePersonal = 0 |
| | | // 工伤险个人缴纳金额 |
| | | this.form.employmentInsurancePersonalAmount = 0 |
| | | // 工伤险个人缴纳金额随机数 |
| | | this.employmentInsurancePersonalAmountRandom = Math.random() |
| | | // 工伤险公司缴纳比例 |
| | | this.form.employmentInsuranceCompany = 0 |
| | | // 工伤险公司缴纳金额 |
| | | this.form.employmentInsuranceCompanyAmount = 0 |
| | | // 工伤险公司缴纳金额随机数 |
| | | this.employmentInsuranceCompanyAmountRandom = Math.random() |
| | | // 失败 |
| | | reject() |
| | | }) |
| | | }) |
| | | }, |
| | | // 获取用户级别其他 |
| | | getUserLevelOther() { |
| | | return new Promise((resolve, reject) => { |
| | | // 获取用户级别其他 |
| | | crudUserLevelOther.getTargetYearMonth({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => { |
| | | // 个人业绩比例 |
| | | this.form.personalPerformanceProportion = Number(res.personalPerformanceProportion.toFixed(2)) |
| | | // 成功 |
| | | resolve() |
| | | }).catch(() => { |
| | | // 个人业绩比例 |
| | | this.form.personalPerformanceProportion = 0 |
| | | // 失败 |
| | | reject() |
| | | }) |
| | | }) |
| | | }, |
| | | // 获取工作天数 |
| | | getWorkDays() { |
| | | console.log("useruseroooii:" + this.form.userId) |
| | | return new Promise((resolve, reject) => { |
| | | // 获取工作天数 |
| | | crudNewSalary.workDays({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => { |
| | | // 全勤小时数 |
| | | this.form.fullDays = Number((res * 8).toFixed(2)) |
| | | // 应完成绩效工时 |
| | | this.form.needCompletedAchievementsHours = Number((res * 8).toFixed(2)) |
| | | this.form.CompletedAchievementsRate = Number(this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours * 100).toFixed(2) |
| | | // this.form.CompletedAchievementsRate = 100.0 |
| | | if(this.form.CompletedAchievementsRate != NaN && this.Level_now != undefined) { |
| | | crudNewSalary.getMeritWage(this.form.CompletedAchievementsRate, this.Level_now).then(res => { |
| | | this.form.meritMoney = res |
| | | }) |
| | | } |
| | | // 发请求获取当前这个用户当前的基本的当前的业绩完成比可以得到多少钱 |
| | | // 定时器 |
| | | const interval = setInterval(() => { |
| | | console.log('personalPerformanceProportion: ' + this.form.personalPerformanceProportion) |
| | | // 判断个人业绩比例是否为空 |
| | | if (this.form.personalPerformanceProportion != null && this.form.personalPerformanceProportion !== '') { |
| | | // 应完成业绩工时 |
| | | this.form.needCompletedPerformanceHours = Number((res * 8 * (1 + this.form.personalPerformanceProportion / 100)).toFixed(2)) |
| | | // 清空定时器 |
| | | clearInterval(interval) |
| | | // 成功 |
| | | resolve() |
| | | } |
| | | }, 500) |
| | | }).catch(() => { |
| | | // 全勤小时数 |
| | | this.form.fullDays = 0 |
| | | // 应完成绩效工时 |
| | | this.form.needCompletedAchievementsHours = 0 |
| | | // 应完成业绩工时 |
| | | this.form.needCompletedPerformanceHours = 0 |
| | | // 失败 |
| | | reject() |
| | | }) |
| | | }) |
| | | }, |
| | | // 获取出勤小时数 |
| | | getAttendanceHours() { |
| | | return new Promise((resolve, reject) => { |
| | | // 获取出勤小时数 |
| | | crudAttendance.attendanceHours({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => { |
| | | // 定时器 |
| | | const interval = setInterval(() => { |
| | | // 判断预计基础工资、全勤小时数是否为空 |
| | | if (this.form.basicWage != null && this.form.basicWage !== '' && this.form.fullDays != null && this.form.fullDays !== '') { |
| | | // 缺勤小时数 |
| | | this.form.absenceDays = Number((this.form.fullDays - res).toFixed(2)) |
| | | // 实际基础工资 |
| | | this.form.actualBasicWage = Number((this.form.basicWage - (this.form.basicWage / this.form.fullDays) * (this.form.fullDays - res)).toFixed(2)) |
| | | // 实际基本工资随机数 |
| | | this.actualBasicWageRandom = Math.random() |
| | | // 清空定时器 |
| | | clearInterval(interval) |
| | | // 成功 |
| | | resolve() |
| | | } |
| | | }, 500) |
| | | }).catch(() => { |
| | | // 缺勤小时数 |
| | | this.form.absenceDays = 0 |
| | | // 实际基础工资 |
| | | this.form.actualBasicWage = 0 |
| | | // 实际基本工资随机数 |
| | | this.actualBasicWageRandom = Math.random() |
| | | // 失败 |
| | | reject() |
| | | }) |
| | | }) |
| | | }, |
| | | // 获取达标工时 |
| | | getComplianceWork() { |
| | | return new Promise((resolve, reject) => { |
| | | // 获取达标工时 |
| | | crudProjectPerformanceDetail.complianceWork({ userId: this.form.userId, yearMonth: this.form.salaryYearMonth }).then(res => { |
| | | // 实达标团队工时 |
| | | this.form.actualComplianceTeamHours = Number(res.toFixed(2)) |
| | | // 成功 |
| | | resolve() |
| | | }).catch(() => { |
| | | // 实达标团队工时 |
| | | this.form.actualComplianceTeamHours = 0 |
| | | // 失败 |
| | | reject() |
| | | }) |
| | | }) |
| | | }, |
| | | // 获取已完成工时 |
| | | getCompletedWork() { |
| | | return new Promise((resolve, reject) => { |
| | | // 获取已完成工时 |
| | | crudTaskDaliy.completedWork({ userId: this.form.userId, targetYearMonth: this.form.salaryYearMonth }).then(res => { |
| | | // 已完成绩效工时 |
| | | this.form.alreadyCompletedAchievementsHours = Number(res.toFixed(2)) |
| | | // 已完成业绩工时 |
| | | this.form.alreadyCompletedPerformanceHours = Number(res.toFixed(2)) |
| | | // 已完成团队工时 |
| | | this.form.alreadyCompletedTeamHours = Number(res.toFixed(2)) |
| | | // 绩效定时器 |
| | | const achievementsInterval = setInterval(() => { |
| | | // 判断预计绩效工资、应完成绩效工时是否为空 |
| | | if (this.form.achievementsWage != null && this.form.achievementsWage !== '' && this.form.needCompletedAchievementsHours != null && this.form.needCompletedAchievementsHours !== '') { |
| | | // 实际绩效工资 |
| | | this.form.actualAchievementsWage = Number((this.form.achievementsWage * (res / this.form.needCompletedAchievementsHours)).toFixed(2)) |
| | | // 实际绩效工资随机数 |
| | | this.actualAchievementsWageRandom = Math.random() |
| | | // 清空绩效定时器 |
| | | clearInterval(achievementsInterval) |
| | | } |
| | | }, 500) |
| | | // 业绩定时器 |
| | | const performanceInterval = setInterval(() => { |
| | | console.log('performanceWage:' + this.form.performanceWage + 'needCompletedPerformanceHours:' + this.form.needCompletedPerformanceHours) |
| | | // 判断预计业绩工资、应完成业绩工时是否为空 |
| | | if (this.form.performanceWage != null && this.form.performanceWage !== '' && this.form.needCompletedPerformanceHours != null && this.form.needCompletedPerformanceHours !== '') { |
| | | // 实际业绩工资 |
| | | this.form.actualPerformanceWage = Number((res >= this.form.needCompletedPerformanceHours ? this.form.performanceWage : 0).toFixed(2)) |
| | | // 实际业绩工资随机数 |
| | | this.actualPerformanceWageRandom = Math.random() |
| | | // 清空业绩定时器 |
| | | clearInterval(performanceInterval) |
| | | } |
| | | }, 500) |
| | | // 团队定时器 |
| | | const teamInterval = setInterval(() => { |
| | | // 判断预计团队工资、实达标团队工时是否为空 |
| | | if (this.form.teamWage != null && this.form.teamWage !== '' && this.form.actualComplianceTeamHours != null && this.form.actualComplianceTeamHours !== '') { |
| | | // 实际团队工资 |
| | | this.form.actualTeamWage = Number(this.form.actualComplianceTeamHours !== 0 ? (this.form.teamWage * (this.form.actualComplianceTeamHours / this.form.needCompletedAchievementsHours)).toFixed(2) : 0) |
| | | // 实际团队工资随机数 |
| | | this.actualTeamWageRandom = Math.random() |
| | | // 清空团队定时器 |
| | | clearInterval(teamInterval) |
| | | } |
| | | }, 500) |
| | | // 统计定时器 |
| | | const statisticsInterval = setInterval(() => { |
| | | // 判断 实际基础工资、实际绩效工资、实际业绩工资、实际团队工资、公积金个人缴纳金额、 |
| | | // 养老险个人缴纳金额、医疗险个人缴纳金额、失业险个人缴纳金额、生育险个人缴纳金额、工伤险个人缴纳金额 是否为空 |
| | | if ( |
| | | this.form.actualBasicWage != null && this.form.actualBasicWage !== '' && |
| | | this.form.actualAchievementsWage != null && this.form.actualAchievementsWage !== '' && |
| | | this.form.actualPerformanceWage != null && this.form.actualPerformanceWage !== '' && |
| | | this.form.actualTeamWage != null && this.form.actualTeamWage !== '' && |
| | | this.form.accumulationFundPersonalAmount != null && this.form.accumulationFundPersonalAmount !== '' && |
| | | this.form.retirementInsurancePersonalAmount != null && this.form.retirementInsurancePersonalAmount !== '' && |
| | | this.form.medicalInsurancePersonalAmount != null && this.form.medicalInsurancePersonalAmount !== '' && |
| | | this.form.unemploymentInsurancePersonalAmount != null && this.form.unemploymentInsurancePersonalAmount !== '' && |
| | | this.form.birthInsurancePersonalAmount != null && this.form.birthInsurancePersonalAmount !== '' && |
| | | this.form.employmentInsurancePersonalAmount != null && this.form.employmentInsurancePersonalAmount !== '' |
| | | ) { |
| | | // 统计金额 |
| | | this.statisticalAmount() |
| | | // 清空统计定时器 |
| | | clearInterval(statisticsInterval) |
| | | // 成功 |
| | | resolve() |
| | | } |
| | | }, 500) |
| | | }).catch(() => { |
| | | // 已完成绩效工时 |
| | | this.form.alreadyCompletedAchievementsHours = 0 |
| | | // 已完成业绩工时 |
| | | this.form.alreadyCompletedPerformanceHours = 0 |
| | | // 已完成团队工时 |
| | | this.form.alreadyCompletedTeamHours = 0 |
| | | // 实际绩效工资 |
| | | this.form.actualAchievementsWage = 0 |
| | | // 实际绩效工资随机数 |
| | | this.actualAchievementsWageRandom = Math.random() |
| | | // 实际业绩工资 |
| | | this.form.actualPerformanceWage = 0 |
| | | // 实际业绩工资随机数 |
| | | this.actualPerformanceWageRandom = Math.random() |
| | | // 实际团队工资 |
| | | this.form.actualTeamWage = 0 |
| | | // 实际团队工资随机数 |
| | | this.actualTeamWageRandom = Math.random() |
| | | // 税前金额 |
| | | this.form.preTaxAmount = 0 |
| | | // 税前金额随机数 |
| | | this.preTaxAmountRandom = Math.random() |
| | | // 个人所得税 |
| | | this.form.individualIncomeTax = 0 |
| | | // 个人所得税随机数 |
| | | // this.individualIncomeTaxRandom = Math.random() |
| | | // 税后金额 |
| | | this.form.afterTaxAmount = 0 |
| | | // 税后金额随机数 |
| | | this.afterTaxAmountRandom = Math.random() |
| | | // 失败 |
| | | reject() |
| | | }) |
| | | }) |
| | | // // 税后金额随机数 |
| | | // this.afterTaxAmountRandom = Math.random() |
| | | }, |
| | | // 公示弹窗关闭 |
| | | publicityCancel(data) { |
| | |
| | | openGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = true |
| | | // 生成表单数据 |
| | | this.generateForm = { targetYearMonth: null, userIds: [], selectedValue1: [] } |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false |
| | | // 生成表单数据 |
| | | this.generateForm = { targetYearMonth: null, userId: null, selectedValue1: [] } |
| | | // 清空表单 |
| | | this.$refs['generateForm'].clearValidate() |
| | | }, |
| | |
| | | if (valid) { |
| | | this.generateForm.selectedValue1 = this.selval |
| | | // 生成工资 |
| | | crudNewSalary.generate(this.generateForm).then(res => { |
| | | crudNewSalary.generate({ selectedValue1: this.generateForm.selectedValue1, targetYearMonth: this.generateForm.targetYearMonth }).then(res => { |
| | | // 生成表单加载 |
| | | this.generateLoading = false |
| | | // 生成表单关闭 |
| | |
| | | this.form.actualAchievementsWage = isNaN(Number((this.form.achievementsWage * (this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours)).toFixed(2))) ? 0 : Number((this.form.achievementsWage * (this.form.alreadyCompletedAchievementsHours / this.form.needCompletedAchievementsHours)).toFixed(2)) |
| | | // 实际绩效工资随机数 |
| | | this.actualAchievementsWageRandom = Math.random() |
| | | // 统计金额 |
| | | this.statisticalAmount() |
| | | }, |
| | | // 业绩参数变更 |
| | | performanceParameterBlur() { |
| | | // 实际业绩工资 = 已完成业绩工时 >= 应完成业绩工时 ? 预计业绩工资 : 0 |
| | | this.form.actualPerformanceWage = Number((this.form.alreadyCompletedPerformanceHours >= this.form.needCompletedPerformanceHours ? this.form.performanceWage : 0).toFixed(2)) |
| | | // 实际业绩工资随机数 |
| | | this.actualPerformanceWageRandom = Math.random() |
| | | // 统计金额 |
| | | this.statisticalAmount() |
| | | }, |
| | | // 预计业绩工资变更 |
| | | performanceWageBlur() { |
| | | // 实际业绩工资 = 已完成业绩工时 >= 应完成业绩工时 ? 预计业绩工资 : 0 |
| | | this.form.actualPerformanceWage = Number((this.form.alreadyCompletedPerformanceHours >= this.form.needCompletedPerformanceHours ? this.form.performanceWage : 0).toFixed(2)) |
| | | // 实际业绩工资随机数 |
| | | this.actualPerformanceWageRandom = Math.random() |
| | | // 统计金额 |
| | | this.statisticalAmount() |
| | | }, |
| | | // 团队参数变更 |
| | | teamParameterBlur() { |
| | | // 实际团队工资 = 预计团队工资 * (实达标团队工时 / 已完成团队工时) |
| | | this.form.actualTeamWage = Number(this.form.actualComplianceTeamHours !== 0 ? (this.form.teamWage * (this.form.actualComplianceTeamHours / this.form.alreadyCompletedTeamHours)).toFixed(2) : 0) |
| | | // 实际团队工资随机数 |
| | | this.actualTeamWageRandom = Math.random() |
| | | // 统计金额 |
| | | this.statisticalAmount() |
| | | }, |
| | | // 预计团队工资变更 |
| | | teamWageBlur() { |
| | | // 实际团队工资 = 预计团队工资 * (实达标团队工时 / 已完成团队工时) |
| | | this.form.actualTeamWage = Number(this.form.actualComplianceTeamHours !== 0 ? (this.form.teamWage * (this.form.actualComplianceTeamHours / this.form.alreadyCompletedTeamHours)).toFixed(2) : 0) |
| | | // 实际团队工资随机数 |
| | | this.actualTeamWageRandom = Math.random() |
| | | // 统计金额 |
| | | this.statisticalAmount() |
| | | }, |
| | |
| | | // 统计金额 |
| | | statisticalAmount() { |
| | | // 税前金额 |
| | | this.form.preTaxAmount = this.form.actualBasicWage + this.form.actualAchievementsWage + this.form.actualPerformanceWage + this.form.actualTeamWage + this.form.pieceRate + this.form.travelAllowance + this.form.meritMoney + this.form.overtimeAllowance |
| | | this.form.preTaxAmount = Number(this.form.actualBasicWage) + Number(this.form.actualAchievementsWage) + Number(this.form.actualPerformanceWage) + Number(this.form.actualTeamWage) + Number(this.form.pieceRate) + Number(this.form.travelAllowance) + Number(this.form.meritMoney) + Number(this.form.overtimeAllowance) |
| | | // 税前金额随机数 |
| | | this.preTaxAmountRandom = Math.random() |
| | | this.getWorkDays() |
| | | // 税前金额变更 |
| | | this.preTaxAmountBlur() |
| | | this.individualIncomeTaxBlur() |
| | | }, |
| | | // 税前金额变更 |
| | | preTaxAmountBlur() { |
| | | // 查询个人所得税列表 |
| | | crudSysConfigIndividualIncomeTax.getAll().then(res => { |
| | | // 税额 |
| | | let taxAmount = 0 |
| | | // 计税金额 = 税前金额 - 五险一金个人缴纳金额 |
| | | const taxableAmount = this.form.preTaxAmount - this.form.accumulationFundPersonalAmount - this.form.retirementInsurancePersonalAmount - this.form.medicalInsurancePersonalAmount - this.form.unemploymentInsurancePersonalAmount - this.form.birthInsurancePersonalAmount - this.form.employmentInsurancePersonalAmount |
| | | // 循环个人所得税列表 |
| | | for (let i = 0; i < res.length; i++) { |
| | | // 判断计税金额所在个人所得税范围 |
| | | if (res[i].gearAmountEnd != null && res[i].gearAmountEnd !== '' && taxableAmount > res[i].gearAmountEnd) { |
| | | // 税额 |
| | | taxAmount += (res[i].gearAmountEnd - res[i].gearAmountStart) * (res[i].taxRate / 100) |
| | | } else if (taxableAmount >= res[i].gearAmountStart && (res[i].gearAmountEnd == null || res[i].gearAmountEnd === '' || taxableAmount <= res[i].gearAmountEnd)) { |
| | | // 税额 |
| | | taxAmount += (taxableAmount - res[i].gearAmountStart) * (res[i].taxRate / 100) |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === res.length - 1) { |
| | | // 个人所得税 = 税额 |
| | | // this.form.individualIncomeTax = taxAmount |
| | | this.form.individualIncomeTax = 0 |
| | | // 个人所得税随机数 |
| | | // this.individualIncomeTaxRandom = Math.random() |
| | | this.individualIncomeTaxRandom = Math.random() |
| | | // 税后金额 = 计税金额 - 税额 |
| | | this.form.afterTaxAmount = (taxableAmount - taxAmount) < 0 ? 0 : taxableAmount - taxAmount - this.form.individualIncomeTax |
| | | this.form.afterTaxAmount = this.form.preTaxAmount |
| | | // 税后金额随机数 |
| | | this.afterTaxAmountRandom = Math.random() |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 个人所得税变更 |
| | | individualIncomeTaxBlur() { |
| | | // 计税金额 = 税前金额 - 五险一金个人缴纳金额 |
| | | const taxableAmount = this.form.preTaxAmount - this.form.accumulationFundPersonalAmount - this.form.retirementInsurancePersonalAmount - this.form.medicalInsurancePersonalAmount - this.form.unemploymentInsurancePersonalAmount - this.form.birthInsurancePersonalAmount - this.form.employmentInsurancePersonalAmount |
| | | // 税后金额 = 计税金额 - 个人所得税 |
| | | this.form.afterTaxAmount = (taxableAmount - this.form.individualIncomeTax) < 0 ? 0 : taxableAmount - this.form.individualIncomeTax |
| | | this.form.afterTaxAmount = Number((taxableAmount - this.form.individualIncomeTax) < 0 ? 0 : taxableAmount - this.form.individualIncomeTax).toFixed(2) |
| | | // 税后金额随机数 |
| | | this.afterTaxAmountRandom = Math.random() |
| | | }, |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | // 个人所得税随机数 |
| | | individualIncomeTaxRandom: 0, |
| | | // 税后金额随机数 |
| | | afterTaxAmountRandom: 0, |
| | | afterTaxAmountRandom: 0 |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | }, |
| | | // 统计金额 |
| | | statisticalAmount() { |
| | | console.log('统计金额') |
| | | // 税前金额 |
| | | this.form.preTaxAmount = this.form.actualBasicWage + this.form.actualAchievementsWage + this.form.actualPerformanceWage + this.form.actualTeamWage + this.form.pieceRate + this.form.travelAllowance |
| | | // 税前金额随机数 |
| | |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | // 生成表单提交 |
| | | submitGenerate() { |
| | | this.uploading = true |
| | | console.log('3333333333333333333 : ', this.generateForm) |
| | | crudPerformanceCoefficient.generate(this.generateForm).then(res => { |
| | | // 生成表单关闭 |
| | | this.closeGenerate() |
| | |
| | | }).catch(err => { |
| | | this.resetForm() |
| | | this.codeLoading = false |
| | | console.log(err.response.data.message) |
| | | }) |
| | | } |
| | | }, |
| | |
| | | store.dispatch('GetInfo').then(() => {}) |
| | | }).catch(err => { |
| | | this.loading = false |
| | | console.log(err.response.data.message) |
| | | }) |
| | | } else { |
| | | return false |
| | |
| | | }, 1500) |
| | | }).catch(err => { |
| | | this.loading = false |
| | | console.log(err.response.data.message) |
| | | }) |
| | | } else { |
| | | return false |
| | |
| | | <crudOperation show="" :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.levelWage" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="info" |
| | | icon="el-icon-view" |
| | | @click="toLevelWage" |
| | | > |
| | | 用户级别工资 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.levelInsurance" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="info" |
| | | icon="el-icon-view" |
| | | style="margin-left: 4px !important;" |
| | | @click="toLevelInsurance" |
| | | > |
| | | 用户级别保险 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.levelOther" |
| | | class="filter-item" |
| | | size="mini" |
| | |
| | | import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
| | | import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' |
| | | import crudRostering from '@/api/system/rostering' |
| | | import crudLevel from '@/api/system/level' |
| | | // import crudLevel from '@/api/system/level' |
| | | import crudCmnLevel from '@/api/treatment/cmnLevel' |
| | | import crudSysCompany from '@/api/system/sysCompany' |
| | | let userRoles = [] |
| | | let userJobs = [] |
| | |
| | | ], |
| | | 'company.id': [ |
| | | { required: true, message: '公司不能为空', trigger: 'blur' } |
| | | ], |
| | | ] |
| | | }, |
| | | // CRUD状态 |
| | | crudStatusPrepared: CRUD.STATUS.PREPARED, |
| | |
| | | // 公司列表 |
| | | this.companyList = res |
| | | this.companyList.forEach(image => { |
| | | console.log('id:' + image.id) |
| | | }) |
| | | }) |
| | | return true |
| | |
| | | getLevel() { |
| | | // 判断用户岗位列表 |
| | | if (userJobs.length !== 0) { |
| | | // 获取级别 |
| | | crudLevel.getAll({ jobId: userJobs[0].id }).then(res => { |
| | | // // 获取级别 |
| | | // crudLevel.getAll({ jobId: userJobs[0].id }).then(res => { |
| | | // // 级别 |
| | | // this.levels = res |
| | | // }) |
| | | crudCmnLevel.getAll({ jobId: userJobs[0].id }).then(res => { |
| | | // 级别 |
| | | this.levels = res |
| | | }) |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import crudUser from '@/api/system/user' |
| | | import crudLevel from '@/api/system/level' |
| | | import crudLevel from '@/api/treatment/cmnLevel' |
| | | |
| | | const defaultForm = { id: null, userId: null, levelId: null, yearMonth: null, startDate: null, endDate: null, personalPerformanceProportion: null, annualLeaveDays: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | |
| | | callback() |
| | | } |
| | | } |
| | | // 天数(二十内)验证 |
| | | var daysValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|1\d)$|20$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 二十 以内的正整数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | // // 天数(二十内)验证 |
| | | // var daysValidate = (rule, value, callback) => { |
| | | // const reg = /^([0-9]|1\d)$|20$/ |
| | | // if (value != null && value !== '' && !reg.test(value)) { |
| | | // callback(new Error('请输入 二十 以内的正整数')) |
| | | // } else { |
| | | // callback() |
| | | // } |
| | | // } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'sysUserLevelOther:add'], |
| | |
| | | { validator: proportionValidate, trigger: 'blur' } |
| | | ], |
| | | annualLeaveDays: [ |
| | | { required: true, message: '年假天数不能为空', trigger: 'blur' }, |
| | | { validator: daysValidate, trigger: 'blur' } |
| | | { required: true, message: '年假天数不能为空', trigger: 'blur' } |
| | | // { validator: daysValidate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <div class="head-container"> |
| | | <div> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="curProject" value-key="id" filterable placeholder="所属项目" style="width: 400px;" class="filter-item" @change="queryByProjectId"> |
| | | <el-select v-model="curProject" value-key="id" clearable filterable placeholder="所属项目" style="width: 400px;" class="filter-item" @change="queryByProjectId"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | <div class="block"> |
| | | <el-cascader |
| | | v-model="query.userIds" |
| | | v-model="queryUser" |
| | | :filterable="true" |
| | | :options="options" |
| | | :props="props" |
| | | clearable |
| | | placeholder="任务负责人" |
| | | :show-all-levels="false" |
| | |
| | | :disabled="taskDetailDisabled" |
| | | @click="draw" |
| | | >任务详情</el-button> |
| | | <el-button |
| | | slot="right" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | :disabled="this.crud.selections.length === 0" |
| | | @click="doTaskCompleted" |
| | | >任务完结</el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务状态" v-if="isShow"> |
| | | <el-form-item v-if="isShow" label="任务状态"> |
| | | <el-select v-model="form.taskStatus" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in filteredDict" |
| | |
| | | <el-date-picker v-model="form.planEndTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" :picker-options="planEndTimePickerOptions" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量" prop="planWorkload"> |
| | | <el-input v-model="form.planWorkload" style="width: 340px;"> |
| | | </el-input> |
| | | <el-input v-model="form.planWorkload" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划工作量单位"> |
| | | <el-select v-model="form.planWorkloadUnit" filterable clearable placeholder="请选择" style="width: 340px;"> |
| | |
| | | <el-select v-if="form.containUserList" v-model="form.userIdList" :no-data-text=" '没有任务成员' " multiple filterable clearable placeholder="请选择" style="width: 340px;"> |
| | | <el-option |
| | | v-for="item in users" |
| | | v-show="form.containUserList != undefined && form.containUserList.some(animal => animal === item.id)" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table |
| | | ref="table" |
| | | v-loading="crud.loading" |
| | | :data="crud.data" |
| | | size="small" |
| | |
| | | @row-click="getTaskUser" |
| | | > |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectName" label="项目" fixed="left" width="180" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="180" /> |
| | | <el-table-column :show-overflow-tooltip="true" label="计划工时" width="80"> |
| | | <template slot-scope="scope"> |
| | |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="消耗工时" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.consumedHours > scope.row.sumPlanHours" type="info">{{ scope.row.consumedHours }}</el-tag> |
| | | <el-tag v-else type="error">{{ scope.row.consumedHours }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performanceType" label="绩效类型" width="80"> |
| | |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="tagList" label="任务负责人" width="240"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userIdList" label="任务负责人" width="240"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-for="userId in scope.row.userIdList" :key="userId">{{ getUserNameById(userId) }}</el-tag> |
| | | </template> |
| | |
| | | isShow: false |
| | | } |
| | | }, |
| | | computed: { |
| | | filteredDict() { |
| | | return this.dict[this.taskStatus] |
| | | } |
| | | }, |
| | | watch: { |
| | | 'selectedValue': function(newVal) { |
| | | this.form.containUserList = [] |
| | |
| | | } |
| | | }, |
| | | 'queryUser': function(newVal) { |
| | | // this.query.userId = newVal[newVal.length - 1] |
| | | this.query.userIds = [] |
| | | for (let i = 0; i < newVal.length; i++) { |
| | | var temp = [] |
| | | temp = newVal[i] |
| | | if (!this.query.userIds.includes(temp[newVal[i].length - 1])) { |
| | | // 如果不在 |
| | | this.query.userIds.push(temp[newVal[i].length - 1]) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.crud.optShow.reset = false |
| | | }, |
| | | computed: { |
| | | filteredDict() { |
| | | return this.dict[this.taskStatus].filter(item => item.value !== 'task_status_unrecognized'); |
| | | } |
| | | }, |
| | | mounted() { |
| | | // 获取项目 |
| | |
| | | }, |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | if (!this.crud.query.projectId) { |
| | | return false |
| | | } |
| | | // if (!this.crud.query.projectId) { |
| | | // return false |
| | | // } |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.$store.state.user.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | |
| | | return true |
| | | }, |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | crudUser.getUserPidDept(this.form.containUserList).then(res => { |
| | | this.selectedValue = res |
| | | }) |
| | | }, |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | if (!this.form.taskStatus) { |
| | |
| | | // 编辑之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | this.isShow = true |
| | | crudUser.getUserPidDept(this.form.containUserList).then(res => { |
| | | this.selectedValue = res |
| | | }) |
| | | }, |
| | | doTaskCompleted() { |
| | | const selectData = this.$refs.table.selection |
| | | var changesId = [] |
| | | for (var i = 0; i < selectData.length; i++) { |
| | | changesId.push(selectData[i].id) |
| | | } |
| | | crudTask.changeStatus(changesId).then(res => { |
| | | this.crud.toQuery() |
| | | this.$notify.success({ |
| | | title: '任务关闭成功' |
| | | }) |
| | | }) |
| | | }, |
| | | // 日期点击 |
| | | handleDateClick(selectInfo) { |
| | | console.log('handleDateClick.info:', selectInfo) |
| | | }, |
| | | handleEventClick(info) { |
| | | if (info.event._def.extendedProps.type === 1) { |
| | |
| | | return obj |
| | | }) |
| | | setTimeout(() => { |
| | | console.log(this.calendarOptions.events) |
| | | }, 1000) |
| | | }) |
| | | }, |
| | | queryByProjectId(project) { |
| | | this.crud.resetQuery(false) |
| | | // this.crud.resetQuery(false) |
| | | if (project) { |
| | | this.crud.query.projectId = project.id |
| | | this.crud.query.flag = project.flag |
| | | } else { |
| | | this.crud.query.projectId = undefined |
| | | this.crud.query.flag = undefined |
| | | } |
| | | this.query.taskStatuses = ['task_status_not_started', 'task_status_in_hand', 'task_status_test', 'task_status_stop', 'task_status_unrecognized'] |
| | | this.crud.toQuery() |
| | | this.getProjectTotal() |
| | | }, |
| | |
| | | }, |
| | | handleInputConfirm() { |
| | | const inputValue = this.inputValue |
| | | console.log(inputValue) |
| | | if (inputValue !== '' && inputValue !== null && inputValue !== ' ') { |
| | | this.form.tagList.push(inputValue) |
| | | } |
| | |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-view" |
| | | style="margin-left: 4px !important;" |
| | | @click="statistics" |
| | | > |
| | | 统计 |
| | | </el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <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-input v-model="form.userNickName" style="width: 340px;" :disabled="true" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-if="queryProjects.length > 0" :key="form.projectId" v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formProjectChange"> |
| | | <el-input v-if="crud.status.edit > 0" v-model="form.projectName" style="width: 340px;" :disabled="true" /> |
| | | <el-select v-else-if="queryProjects.length > 0" :key="form.projectId" v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formProjectChange"> |
| | | <template v-if="loadingQueryProjectsOne" #prefix> |
| | | <i class="el-icon-loading" /> |
| | | </template> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属任务" prop="taskId"> |
| | | <el-select v-if="formTasks.length > 0" :key="form.taskId" v-model="form.taskId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskChange"> |
| | | <el-input v-if="form.taskName" v-model="form.taskName" style="width: 340px;" :disabled="true" /> |
| | | <el-select v-else-if="formTasks.length > 0" :key="form.taskId" v-model="form.taskId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskChange"> |
| | | <template v-if="loadingQueryProjects" #prefix> |
| | | <i class="el-icon-loading" /> |
| | | </template> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="分配任务" prop="taskUserMongo"> |
| | | <el-select v-if="formTaskUserIds.length > 0" :key="form.taskUserMongo.id" v-model="form.taskUserMongo.id" :allow-create="true" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange"> |
| | | <el-input v-if="form.taskUserMongo && form.taskUserMongo.name" v-model="form.taskUserMongo.name" style="width: 340px;" :disabled="true" /> |
| | | <el-select v-else-if="formTaskUserIds.length > 0" :key="form.taskUserMongo.id" v-model="form.taskUserMongo.id" :allow-create="true" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange"> |
| | | <template v-if="loadingQueryProjectsTwo" #prefix> |
| | | <i class="el-icon-loading" /> |
| | | </template> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="填写日期" prop="fillDate"> |
| | | <el-date-picker v-model="form.fillDate" type="date" style="width: 340px;" :disabled="form.taskUserMongo.id == null" @change="formDateChange" /> |
| | | <el-date-picker :key="form.taskUserMongo.id" v-model="form.fillDate" value-format="yyyy-MM-dd" type="date" style="width: 340px;" :picker-options="{ disabledDate }" :disabled="form.taskUserMongo.id == null || crud.status.edit > 0" @change="formDateChange" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | 本日已填其他任务工时:{{ (1 * form.todayFixedHours).toFixed(2) }} / 本日打卡工时:{{ (1 * form.todayAttendanceHours).toFixed(2) }} |
| | | </el-form-item> |
| | | <el-form-item label="消耗工时" prop="consumedHours"> |
| | | <el-input v-model="form.consumedHours" style="width: 340px;" :disabled="disabledFlagBySettlement || form.fillDate == null" @input="watchFlagChange"> |
| | |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | 已消耗工时:{{ form.alreadyConsumedHours }} / 任务工时:{{ form.taskHours }} |
| | | 本任务已消耗工时:{{ (1 * form.alreadyConsumedHours).toFixed(2) }} / 本任务总工时:{{ (1 * form.taskHours).toFixed(2) }} |
| | | </el-form-item> |
| | | <el-form-item label="消耗工作量" prop="consumedWorkload"> |
| | | <el-input v-model="form.consumedWorkload" style="width: 340px;"> |
| | | </el-input> |
| | | <el-input v-model="form.consumedWorkload" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="消耗工作量单位"> |
| | | {{ dict.label[standardWorkloadUnit][form.consumedWorkloadUnit] }} |
| | |
| | | <el-button type="text" @click="crud.cancelCU">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="checkForm(1)">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :visible.sync="centerDialogVisibleStatistics" title="统计数据" width="800px"> |
| | | <el-table v-loading="statisticsLoading" :data="statisticsData" size="small" style="width: 100%;"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectName" label="项目名称" fixed="left" min-width="100px" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskName" label="任务名称" fixed="left" min-width="100px" /> |
| | | <el-table-column prop="settlementStatus" min-width="80px" label="绩效类型"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.taskUserMongo.performanceType === "1" ? "绩效" : "非绩效" }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performanceHours" label="分配工时" min-width="80px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taskUserMongo.performanceHours }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="consumedHours" label="绩效工时" min-width="80px" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" min-width="80px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taskProgress }}% |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | |
| | | {{ scope.row.taskProgress }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" min-width="80px" label="结算状态"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" min-width="80px" label="绩效类型"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[settlementStatus][scope.row.settlementStatus] }}</el-tag> |
| | | <el-tag>{{ scope.row.taskUserMongo.performanceType === "1" ? "绩效" : "非绩效" }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" min-width="140px" /> |
| | |
| | | import crudProject from '@/api/project/project' |
| | | import crudTask from '@/api/task/task' |
| | | import crudTaskUser from '@/api/task/taskUser' |
| | | import crudAttendance from '@/api/attendance/attendance' |
| | | |
| | | const defaultForm = { id: null, projectId: null, taskId: null, taskMongoId: null, taskUserMongo: {}, userId: null, fillDate: null, consumedHours: null, alreadyConsumedHours: 0, taskHours: 0, consumedWorkload: null, consumedWorkloadUnit: null, taskProgress: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, projectId: null, taskId: null, taskName: null, taskMongoId: null, taskUserMongo: {}, userId: null, fillDate: null, consumedHours: null, todayFixedHours: 0, todayAttendanceHours: 0, alreadyConsumedHours: 0, taskHours: 0, consumedWorkload: null, consumedWorkloadUnit: null, taskProgress: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'TaskDaliy', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 字典:结算状态 |
| | | settlementStatus: constant.SETTLEMENT_STATUS, |
| | | // 字典:绩效对象 |
| | | performanceType: constant.PERFORMANCE_TYPE, |
| | | // 角色级别:超级管理员 |
| | | roleLevelSuper: constant.ROLE_LEVEL_SUPER, |
| | | // 角色级别:总经理 |
| | |
| | | taskLoading: true, |
| | | centerDialogVisibleTaskHours: false, |
| | | centerDialogVisibleTaskProgress: false, |
| | | centerDialogVisibleStatistics: false, |
| | | confirmHours: false, |
| | | confirmProgress: false, |
| | | newValue: '', |
| | |
| | | loadingTast: false, |
| | | loadingQueryProjectsOne: false, |
| | | loadingQueryProjects: false, |
| | | loadingQueryProjectsTwo: false |
| | | loadingQueryProjectsTwo: false, |
| | | statisticsLoading: false, |
| | | statisticsData: [] |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | this.form.alreadyConsumedHours = this.tempValue |
| | | } |
| | | if (this.crud.status.edit === 1 && newVal === 0) { |
| | | this.form.alreadyConsumedHours = this.form.alreadyConsumedHours - (this.editVar - 0) |
| | | this.form.alreadyConsumedHours = (this.form.alreadyConsumedHours - (this.editVar - 0)).toFixed(2) |
| | | } |
| | | if (this.watchFlg) { |
| | | this.form.alreadyConsumedHours = (this.form.alreadyConsumedHours) - (oldVal - 0) + (newVal - 0) |
| | | this.form.alreadyConsumedHours = (this.form.alreadyConsumedHours - (oldVal - 0) + (newVal - 0)).toFixed(2) |
| | | this.watchFlg = false |
| | | } |
| | | if (this.form.alreadyConsumedHours < 0) { |
| | | this.form.alreadyConsumedHours = 0 |
| | | } |
| | | }, |
| | | 'confirmProgress': function(newVal) { |
| | |
| | | // 表单禁用标记(结算状态) |
| | | this.disabledFlagBySettlement = false |
| | | } |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | [CRUD.HOOK.afterSubmit]() { |
| | | this.form.flag = false |
| | |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | if (this.currentTask) { |
| | | this.form.projectId = this.currentTask.projectId |
| | | this.form.taskId = this.currentTask.taskId |
| | | this.form.taskName = this.currentTask.taskName |
| | | this.form.taskUserMongo.id = this.currentTask.id |
| | | this.form.taskUserMongo.name = this.currentTask.name |
| | | this.form.taskUserMongo.taskStartDate = this.currentTask.taskStartDate |
| | | this.form.taskUserMongo.taskEndDate = this.currentTask.taskEndDate |
| | | |
| | | this.fetchAlreadyConsumedHours() |
| | | |
| | | // this.form.taskHours = this.currentTask.performanceHours |
| | | // this.form.alreadyConsumedHours = this.currentTask.alreadyConsumedHours |
| | | // this.tempValue = this.currentTask.alreadyConsumedHours |
| | | this.form.flag = true |
| | | |
| | | this.form.userId = this.user.id |
| | | this.form.userNickName = this.user.nickName |
| | | } else { |
| | | this.formTasks = [] |
| | | this.formTaskUserIds = [] |
| | | this.form.taskId = null |
| | | this.form.taskUserMongo.id = null |
| | | this.form.taskUserMongo.name = null |
| | | this.form.taskUserMongo.taskStartDate = null |
| | | this.form.taskUserMongo.taskEndDate = null |
| | | this.form.userId = this.user.id |
| | | this.form.userNickName = this.user.nickName |
| | | // 判断用户最大角色级别是否是角色级别:超级管理员或角色级别:总经理 |
| | | if (this.userRolesLevelMin !== this.roleLevelSuper && this.userRolesLevelMin !== this.roleLevelGeneral) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | this.form.userNickName = this.user.nickName |
| | | |
| | | // 表单用户变更 |
| | | this.formUserChange() |
| | | this.formTaskChange() |
| | | } |
| | | if (this.currentTask) { |
| | | this.form.projectId = this.currentTask.projectId |
| | | this.formProjectChange(() => { |
| | | this.form.taskId = this.currentTask.taskId |
| | | this.formTaskChange(() => { this.form.taskUserMongo.id = this.currentTask.id }) |
| | | }) |
| | | this.form.taskHours = this.currentTask.performanceHours |
| | | this.form.alreadyConsumedHours = this.currentTask.alreadyConsumedHours |
| | | this.tempValue = this.currentTask.alreadyConsumedHours |
| | | this.form.flag = true |
| | | } |
| | | }, |
| | | // 钩子:编辑 - 之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | this.form.userId = this.user.id |
| | | this.form.userNickName = this.user.nickName |
| | | this.loadingQueryProjects = true |
| | | this.loadingQueryProjectsTwo = true |
| | | crudTask.getAllOfDaily({ projectId: this.form.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.tempValue = this.form.taskHours |
| | | |
| | | this.formTasks = res |
| | | this.$nextTick().then(() => { |
| | | this.loadingQueryProjects = false |
| | | }) |
| | | }) |
| | | crudTaskUser.getAllTaskUser(this.form.taskUserMongo.id).then(res => { |
| | | if (res === []) { |
| | | this.formTaskUserIds = [] |
| | | } |
| | | this.formTaskUserIds = res |
| | | this.$nextTick().then(() => { |
| | | this.loadingQueryProjectsTwo = false |
| | | }) |
| | | |
| | | for (let i = 0; i < this.formTaskUserIds.length; i++) { |
| | | this.userIds.push(this.formTaskUserIds[i].id) |
| | | } |
| | | |
| | | // 循环表单任务列表 |
| | | for (let i = 0; i < this.formTaskUserIds.length; i++) { |
| | | // 判断是否为选中任务 |
| | | if (this.formTaskUserIds[i].id === this.form.taskUserMongo.id) { |
| | | this.form.taskHours = this.formTaskUserIds[i].performanceHours |
| | | this.form.alreadyConsumedHours = this.formTaskUserIds[i].alreadyConsumedHours |
| | | this.tempValue = this.formTaskUserIds[i].alreadyConsumedHours |
| | | } |
| | | } |
| | | }) |
| | | this.formDateChange() |
| | | this.fetchAlreadyConsumedHours() |
| | | }, |
| | | [CRUD.HOOK.afterRefresh]() { |
| | | this.taskLoading = false |
| | | }, |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | if (!this.userIds.includes(this.form.taskUserMongo.id)) { |
| | | // 置换一下 |
| | | var taskUserMongoName = this.form.taskUserMongo.id |
| | | this.form.taskUserMongo.name = taskUserMongoName |
| | | this.form.taskUserMongo.id = null |
| | | } |
| | | // [CRUD.HOOK.beforeSubmit]() { |
| | | // if (!this.userIds.includes(this.form.taskUserMongo.id)) { |
| | | // // 置换一下 |
| | | // var taskUserMongoName = this.form.taskUserMongo.id |
| | | // this.form.taskUserMongo.name = taskUserMongoName |
| | | // this.form.taskUserMongo.id = null |
| | | // } |
| | | // }, |
| | | disabledDate(time) { |
| | | return ( |
| | | time.getTime() < new Date(this.form.taskUserMongo.taskStartDate) - 8.64e7 || |
| | | time.getTime() > new Date(this.form.taskUserMongo.taskEndDate).getTime() |
| | | ) |
| | | }, |
| | | checkForm(flag) { |
| | | if (this.form.taskUserMongo.id === undefined) { |
| | |
| | | } else if (this.form.consumedHours === undefined || this.form.consumedHours === 0) { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: '请填写任务时长', |
| | | message: '请填写消耗工时', |
| | | type: 'error' |
| | | }) |
| | | return |
| | | } else if (parseInt(this.form.consumedHours) + parseInt(this.form.todayFixedHours) > parseInt(this.form.todayAttendanceHours)) { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: '当日消耗工时总和超过打卡时间,请修改消耗工时', |
| | | type: 'error' |
| | | }) |
| | | return |
| | |
| | | if (this.confirmProgress) { |
| | | // 如果确定了 |
| | | const result = this.form.alreadyConsumedHours |
| | | if (result > this.form.taskHours && !this.confirmHours) { |
| | | this.centerDialogVisibleTaskHours = true |
| | | if (this.confirmHours) { |
| | | // if (result > this.form.taskHours && !this.confirmHours) { |
| | | // this.centerDialogVisibleTaskHours = true |
| | | // if (this.confirmHours) { |
| | | // this.crud.submitCU() |
| | | // } else { |
| | | // if (flag > 1) { |
| | | // return |
| | | // } else { |
| | | // this.checkForm() |
| | | // } |
| | | // } |
| | | // } else { |
| | | this.crud.submitCU() |
| | | } else { |
| | | if (flag > 1) { |
| | | return |
| | | } else { |
| | | this.checkForm() |
| | | } |
| | | } |
| | | } else { |
| | | this.crud.submitCU() |
| | | } |
| | | // } |
| | | } else { |
| | | if (flag > 1) { |
| | | return |
| | |
| | | watchFlagChange() { |
| | | this.watchFlg = true |
| | | }, |
| | | statistics() { |
| | | this.centerDialogVisibleStatistics = true |
| | | this.statisticsLoading = true |
| | | crudTaskDaliy.getStatistics(this.crud.query).then(res => { |
| | | this.statisticsData = res |
| | | console.log('this.statisticsData : ', this.statisticsData) |
| | | }).finally(() => { |
| | | // 同意按钮加载状态 |
| | | this.statisticsLoading = false |
| | | }) |
| | | }, |
| | | getAdventTasks() { |
| | | crudTaskUser.getAdventTasks().then(res => { |
| | | this.adventTasks = res |
| | |
| | | }) |
| | | }, |
| | | handleClick(tab, event) { |
| | | console.log(tab, event) |
| | | }, |
| | | handleClickTobeTasked(tab, event) { |
| | | console.log(tab, event) |
| | | }, |
| | | // 获取检索项目 |
| | | getQueryProject() { |
| | |
| | | this.$nextTick().then(() => { |
| | | this.loadingQueryProjectsOne = false |
| | | }) |
| | | }) |
| | | |
| | | // 获取任务列表 |
| | | crudTask.getAllOfDaily({ projectId: this.query.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.queryTasks = res |
| | | }) |
| | | }, |
| | | // 检索项目变更 |
| | |
| | | this.loadingTast = false |
| | | }, |
| | | formDateChange() { |
| | | crudAttendance.queryAttendanceHours({ userId: this.$store.state.user.user.id, date: this.form.fillDate }).then(res => { |
| | | this.form.todayAttendanceHours = res |
| | | }) |
| | | crudTaskDaliy.taskConsumedHours({ userId: this.$store.state.user.user.id, fillDate: this.form.fillDate, id: this.form.id }).then(res => { |
| | | this.form.todayFixedHours = res |
| | | }) |
| | | crudTaskDaliy.getDailyDetail({ taskUserId: this.form.taskUserMongo.id, fillDate: this.form.fillDate }).then(res => { |
| | | if (res === '') { |
| | | this.form.alreadyConsumedHours = this.tempValue |
| | |
| | | this.form.consumedHours = res.consumedHours |
| | | this.form.taskProgress = res.taskProgress |
| | | } |
| | | if (!this.userIds.includes(this.form.taskUserMongo.id)) { |
| | | this.form.consumedHours = 0 |
| | | this.form.taskProgress = 0 |
| | | this.form.alreadyConsumedHours = 0 |
| | | } |
| | | // if (!this.userIds.includes(this.form.taskUserMongo.id)) { |
| | | // this.form.consumedHours = 0 |
| | | // this.form.taskProgress = 0 |
| | | // this.form.alreadyConsumedHours = 0 |
| | | // } |
| | | }) |
| | | }, |
| | | // 表单用户变更 |
| | |
| | | }) |
| | | } |
| | | }, |
| | | fetchAlreadyConsumedHours() { |
| | | crudTask.getRelevantTaskUser({ 'taskId': this.form.taskId }).then(res => { |
| | | for (let i = 0; i < res.length; i++) { |
| | | this.userIds.push(res[i].id) |
| | | } |
| | | this.formTaskUserIds = res |
| | | // 循环表单任务列表 |
| | | for (let i = 0; i < this.formTaskUserIds.length; i++) { |
| | | // 判断是否为选中任务 |
| | | if (this.formTaskUserIds[i].id === this.form.taskUserMongo.id) { |
| | | this.form.taskHours = this.formTaskUserIds[i].performanceHours |
| | | this.form.alreadyConsumedHours = this.formTaskUserIds[i].alreadyConsumedHours |
| | | this.tempValue = this.formTaskUserIds[i].alreadyConsumedHours |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 表单任务变更 |
| | | formTaskChange(cb) { |
| | | this.formTaskUserIds = [] |
| | |
| | | // 判断是否为选中任务 |
| | | if (this.formTasks[i].id === this.form.taskId) { |
| | | crudTask.getRelevantTaskUser({ 'taskId': this.form.taskId }).then(res => { |
| | | if (res === []) { |
| | | if (res == []) { |
| | | this.formTaskUserIds = [] |
| | | return |
| | | } |
| | | for (let i = 0; i < res.length; i++) { |
| | | this.userIds.push(res[i].id) |
| | |
| | | this.$nextTick().then(() => { |
| | | this.loadingQueryProjectsTwo = false |
| | | }) |
| | | this.form.taskProgress = res.taskProgress |
| | | this.form.consumedHours = res.consumedHours |
| | | // this.form.taskProgress = res.taskProgress |
| | | // this.form.consumedHours = res.consumedHours |
| | | if (cb) { |
| | | cb() |
| | | } |
| | |
| | | // this.form.taskProgress = 0 |
| | | this.form.alreadyConsumedHours = 0 |
| | | this.form.taskHours = 0 |
| | | console.log('ddd:' + this.form.taskUserMongo.id) |
| | | // 循环表单任务列表 |
| | | for (let i = 0; i < this.formTaskUserIds.length; i++) { |
| | | // 判断是否为选中任务 |
| | |
| | | } else { |
| | | this.form.taskProgress = 0 |
| | | } |
| | | if (res.taskUserMongo) { |
| | | this.form.taskUserMongo.id = res.taskUserMongo.id |
| | | this.form.taskUserMongo.taskStartDate = res.taskUserMongo.taskStartDate |
| | | this.form.taskUserMongo.taskEndDate = res.taskUserMongo.taskEndDate |
| | | this.form.taskUserMongo.performanceType = res.taskUserMongo.performanceType |
| | | } |
| | | }) |
| | | }, |
| | | submitDialogTaskHours() { |
| | |
| | | </div> |
| | | <div |
| | | v-if="!infinite" |
| | | v-loading="taskLoading" |
| | | class="infinite-list" |
| | | style="overflow:auto;height:500px" |
| | | v-loading="taskLoading" |
| | | > |
| | | <el-card |
| | | v-for="task in taskDatas" |
| | |
| | | :color="ProgressStatus" |
| | | :format="formatTaskProgress" |
| | | /> |
| | | <br /> |
| | | <i>任务预计时长:{{ expectedHours }}小时</i |
| | | ><i style="margin-left: 40px" |
| | | >任务实际用时:{{ actualHours }}小时</i |
| | | > |
| | | <br> |
| | | <i>任务预计时长:{{ expectedHours }}小时</i><i |
| | | style="margin-left: 40px" |
| | | >任务实际用时:{{ actualHours }}小时</i> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | <br /> |
| | | <br> |
| | | <div |
| | | v-if="steps.length > 0" |
| | | v-loading="dialogLoading_taskUser" |
| | |
| | | :key="index" |
| | | style="padding-top: 10px" |
| | | > |
| | | <span>{{ index }} 分配时长: {{ item }} 小时</span><br /> |
| | | <span>{{ index }} 分配时长: {{ item }} 小时</span><br> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | <div v-else> |
| | | <el-card style="padding-top: 10px"> |
| | | <span>暂无数据</span><br /> |
| | | <span>暂无数据</span><br> |
| | | </el-card> |
| | | </div> |
| | | <div |
| | |
| | | </el-dialog> |
| | | |
| | | <el-dialog |
| | | title="临期任务" |
| | | v-loading="taskLoading_L" |
| | | title="临期任务" |
| | | :visible.sync="dialogVisible_task_LQ" |
| | | @closed="setNull" |
| | | @close="dialogLoading_task_LQ = false" |
| | |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <el-pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage" |
| | | :page-sizes="[10, 20, 30, 40]" |
| | | :page-size="pageSize" |
| | | layout="total, prev, pager, next, sizes , jumper" |
| | | :total="total" |
| | | ></el-pagination> |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </el-card> |
| | | </el-dialog> |
| | | <!--工具栏--> |
| | |
| | | icon="el-icon-plus" |
| | | style="margin-right: 6px;" |
| | | @click="openGenerate" |
| | | >导入</el-button |
| | | > |
| | | >导入</el-button> |
| | | <el-button |
| | | slot="right" |
| | | :loading="slong" |
| | | v-permission="permission.generate" |
| | | :loading="slong" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-bottom" |
| | | style="margin-right: 6px;" |
| | | @click="exportUser()" |
| | | >生成员工Excel</el-button |
| | | > |
| | | >生成员工Excel</el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | :disabled="crud.selections.length !== 1" |
| | | class="filter-item" |
| | | size="mini" |
| | |
| | | icon="el-icon-search" |
| | | style="margin-right: 6px;" |
| | | @click="showDetail(crud.selections[0])" |
| | | >任务详情</el-button |
| | | > |
| | | >任务详情</el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | :disabled="crud.selections.length === 0" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-check" |
| | | style="margin-right: 6px;" |
| | | @click="taskCompleted" |
| | | >任务完结</el-button |
| | | > |
| | | @click="toTaskCompleted" |
| | | >任务完结</el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-tickets" |
| | | style="margin-right: 60px;" |
| | | @click="adventTesk()" |
| | | >临期任务</el-button |
| | | > |
| | | >临期任务</el-button> |
| | | </crudOperation> |
| | | <div> |
| | | <span> |
| | | 当前任务:<i> {{ selectedTaskName }} </i> |
| | | <span v-if="taskTotal.performanceType" style="magin: right 10px;" |
| | | <span |
| | | v-if="taskTotal.performanceType" |
| | | style="magin: right 10px;" |
| | | ><i> |
| | | (绩效类型: |
| | | {{ |
| | | taskTotal.performanceType === "1" ? "绩效" : "非绩效" |
| | | }})</i |
| | | ></span |
| | | > |
| | | }})</i></span> |
| | | </span> |
| | | <el-divider> |
| | | <span |
| | |
| | | style="width: 340px;" |
| | | @change="withUser(form)" |
| | | > |
| | | <template slot="append" |
| | | >小时</template |
| | | > |
| | | <template |
| | | slot="append" |
| | | >小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | |
| | | style="width: 340px;" |
| | | :disabled="true" |
| | | > |
| | | <template slot="append" |
| | | >小时</template |
| | | > |
| | | <template |
| | | slot="append" |
| | | >小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="任务进度" prop="newTaskProgress"> |
| | |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.newTaskProgress === 100" label="任务状态"> |
| | | <!-- <el-switch |
| | | v-if="form.taskStatus === taskSt" |
| | | v-model="form.is_ok" |
| | | v-permission="permission.list" |
| | | active-text="已完成" |
| | | /> |
| | | <el-switch |
| | | v-if="form.taskStatus === taskSo" |
| | | v-model="form.is_ok" |
| | | v-permission="permission.list" |
| | | active-text="未承认" |
| | | /> --> |
| | | <el-switch |
| | | v-if="form.taskStatus === taskSt || form.taskStatus === taskSo" |
| | | v-model="form.is_ok" |
| | |
| | | :loading="crud.status.cu === 2" |
| | | type="primary" |
| | | @click="crud.submitCU" |
| | | >确认</el-button |
| | | > |
| | | >确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <el-table |
| | |
| | | /> |
| | | <el-table-column |
| | | :show-overflow-tooltip="true" |
| | | prop="costHours" |
| | | label="消耗工时" |
| | | width="80" |
| | | /> |
| | | <el-table-column |
| | | :show-overflow-tooltip="true" |
| | | label="任务进度" |
| | | width="80" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <span style="margin-left: 10px" |
| | | >{{ scope.row.newTaskProgress }}%</span |
| | | > |
| | | <span |
| | | style="margin-left: 10px" |
| | | >{{ scope.row.newTaskProgress }}%</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | type="primary" |
| | | style="float: left" |
| | | :disabled="true" |
| | | >已分配</el-button |
| | | > |
| | | >已分配</el-button> |
| | | <el-button |
| | | v-else |
| | | slot="left" |
| | |
| | | type="primary" |
| | | style="float: left" |
| | | @click="unPick(scope.row)" |
| | | >获取</el-button |
| | | > |
| | | >获取</el-button> |
| | | <udOperation |
| | | v-if="flag" |
| | | :data="scope.row" |
| | |
| | | <!--表格渲染--> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--进度不足100%--> |
| | | <el-dialog |
| | | title="提示" |
| | | :visible.sync="centerDialogVisibleTaskProgress" |
| | | width="30%" |
| | | center |
| | | > |
| | | <span>当前要完结的任务中存在没有到达100%的任务,确定要完结吗?</span> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="centerDialogVisibleTaskProgress = false">取 消</el-button> |
| | | <el-button type="primary" @click="doTaskCompleted">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <!--表单组件--> |
| | | <el-dialog |
| | | :close-on-click-modal="false" |
| | |
| | | type="primary" |
| | | :disabled="uploading" |
| | | @click="submitGenerate" |
| | | >确认</el-button |
| | | > |
| | | >确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </el-col> |
| | |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import crudTaskUser from "@/api/task/taskUser"; |
| | | import crudTask from "@/api/task/task"; |
| | | import crudUser from "@/api/system/user"; |
| | | import crudUserInsurance from "@/api/treatment/userInsurance"; |
| | | import CRUD, { presenter, header, form, crud } from "@crud/crud"; |
| | | import rrOperation from "@crud/RR.operation"; |
| | | import crudOperation from "@crud/CRUD.operation"; |
| | | import udOperation from "@crud/UD.operation"; |
| | | import pagination from "@crud/Pagination"; |
| | | import DateRangePicker from "@/components/DateRangePicker"; |
| | | import Treeselect from "@riophae/vue-treeselect"; |
| | | import { mapGetters } from "vuex"; |
| | | import constant from "@/utils/constant"; |
| | | import UploadExcelComponent from "@/components/UploadExcel/index.vue"; |
| | | import UploadExcelComponentTwo from "@/components/UploadExcel/excelIndex.vue"; |
| | | import { transformData, formatExcelDate } from "@/utils/trans"; |
| | | import { parseTime, downloadFile } from "@/utils/index"; |
| | | import crudTaskUser from '@/api/task/taskUser' |
| | | import crudTask from '@/api/task/task' |
| | | import crudUser from '@/api/system/user' |
| | | import crudUserInsurance from '@/api/treatment/userInsurance' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import DateRangePicker from '@/components/DateRangePicker' |
| | | import Treeselect from '@riophae/vue-treeselect' |
| | | import { mapGetters } from 'vuex' |
| | | import constant from '@/utils/constant' |
| | | import UploadExcelComponent from '@/components/UploadExcel/index.vue' |
| | | import UploadExcelComponentTwo from '@/components/UploadExcel/excelIndex.vue' |
| | | import { transformData, formatExcelDate } from '@/utils/trans' |
| | | import { parseTime, downloadFile } from '@/utils/index' |
| | | const defaultForm = { |
| | | id: null, |
| | | name: null, |
| | | userId: null, |
| | | projectId: null, |
| | | task: { id: null }, |
| | | task: { id: null, name: null }, |
| | | taskStartDate: null, |
| | | taskEndDate: null, |
| | | taskHours: null, |
| | |
| | | remarks: null, |
| | | divideUserIds: [], |
| | | is_ok: null |
| | | }; |
| | | } |
| | | export default { |
| | | name: "TaskUser", |
| | | name: 'TaskUser', |
| | | // eslint-disable-next-line vue/no-unused-components |
| | | components: { |
| | | Treeselect, |
| | |
| | | }, |
| | | cruds() { |
| | | return CRUD({ |
| | | title: "任务分配", |
| | | url: "api/taskUser", |
| | | title: '任务分配', |
| | | url: 'api/taskUser', |
| | | crudMethod: { ...crudTaskUser } |
| | | }); |
| | | }) |
| | | }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | // 数据字典 |
| | |
| | | // 时长(万内)验证 |
| | | // eslint-disable-next-line no-unused-vars |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/; |
| | | if (value != null && value !== "" && !reg.test(value)) { |
| | | callback(new Error("请输入 一万 以内的正整数或两位小数")); |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback(); |
| | | callback() |
| | | } |
| | | }; |
| | | } |
| | | return { |
| | | projectId: null, |
| | | projectDatas: [], |
| | | taskName: "", |
| | | selectedTaskName: "", |
| | | taskName: '', |
| | | selectedTaskName: '', |
| | | planStartTime: null, |
| | | planEndTime: null, |
| | | taskTotal: {}, |
| | | taskDatas: [], |
| | | taskLoading: false, |
| | | defaultProps: { children: "nodes", label: "name", isLeaf: "leaf" }, |
| | | defaultProps: { children: 'nodes', label: 'name', isLeaf: 'leaf' }, |
| | | permission: { |
| | | list: ["admin", "taskUser:list"], |
| | | add: ["admin", "taskUser:add"], |
| | | edit: ["admin", "taskUser:edit"], |
| | | del: ["admin", "taskUser:del"], |
| | | download: ["admin", "taskUser:download"], |
| | | generate: ["admin", "taskUser:add"] |
| | | list: ['admin', 'taskUser:list'], |
| | | add: ['admin', 'taskUser:add'], |
| | | edit: ['admin', 'taskUser:edit'], |
| | | del: ['admin', 'taskUser:del'], |
| | | download: ['admin', 'taskUser:download'], |
| | | generate: ['admin', 'taskUser:add'] |
| | | }, |
| | | rules: { |
| | | taskStartDate: [ |
| | | { required: true, message: "任务开始时间不能为空", trigger: "change" } |
| | | { required: true, message: '任务开始时间不能为空', trigger: 'change' } |
| | | ], |
| | | taskEndDate: [ |
| | | { required: true, message: "任务结束时间不能为空", trigger: "change" } |
| | | { required: true, message: '任务结束时间不能为空', trigger: 'change' } |
| | | ], |
| | | taskHours: [ |
| | | { required: true, message: "任务时长不能为空", trigger: "change" } |
| | | { required: true, message: '任务时长不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: "userId", display_name: "所属员工" }, |
| | | { key: "taskStatus", display_name: "任务状态" }, |
| | | { key: "createTime", display_name: "创建时间" } |
| | | { key: 'userId', display_name: '所属员工' }, |
| | | { key: 'taskStatus', display_name: '任务状态' }, |
| | | { key: 'createTime', display_name: '创建时间' } |
| | | ], |
| | | // 字典:任务状态 |
| | | taskStatus: constant.TASK_STATUS, |
| | |
| | | generateStatus: false, |
| | | // 生成表单加载 |
| | | generateLoading: false, |
| | | // 进度未达到100%确认 |
| | | centerDialogVisibleTaskProgress: false, |
| | | uploading: true, |
| | | flag: false, |
| | | infinite: false, |
| | | selectedTask: "", |
| | | selectedTask: '', |
| | | dialogVisible_taskUser: false, |
| | | dialogLoading_taskUser: true, |
| | | taskLoading_L: true, |
| | |
| | | dialogLoading_task: true, |
| | | dialogLoading_task_LQ: true, |
| | | steps: [], |
| | | TaskName: "", |
| | | expectedHours: "", |
| | | actualHours: "", |
| | | TaskName: '', |
| | | expectedHours: '', |
| | | actualHours: '', |
| | | taskUserDetail: {}, |
| | | taskDetail: {}, |
| | | taskProgress: "", |
| | | ProgressStatus: "", |
| | | taskProgress: '', |
| | | ProgressStatus: '', |
| | | advList: [], |
| | | tobeOver: "first", |
| | | tobeTasked: "任务详细", |
| | | tobeOver: 'first', |
| | | tobeTasked: '任务详细', |
| | | total: 0, |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | |
| | | taskSo: constant.TASK_STATUS_UNRECOGNIZED, |
| | | taskSt: constant.TASK_STATUS_COMPLETED, |
| | | taskStatusOne: '' |
| | | }; |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["user"]) |
| | | ...mapGetters(['user']) |
| | | }, |
| | | mounted() { |
| | | this.getAllProjectDatas(); |
| | | this.getTaskDatas(); |
| | | this.getAllProjectDatas() |
| | | this.getTaskDatas() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | if (!this.query.taskId) { |
| | | this.taskTotal = {}; |
| | | return false; |
| | | this.taskTotal = {} |
| | | return false |
| | | } |
| | | crudTaskUser.getSum({ taskId: this.query.taskId }).then(res => { |
| | | this.taskTotal = res; |
| | | }); |
| | | return true; |
| | | this.taskTotal = res |
| | | }) |
| | | return true |
| | | }, |
| | | [CRUD.HOOK.afterSubmit]() { |
| | | this.formTasks = []; |
| | | this.form.name = null; |
| | | this.form.performanceHours = null; |
| | | this.form.start = false; |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | // 编辑之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | if(this.form.taskStatus == this.taskSo) { |
| | | this.form.is_ok = false |
| | | this.taskStatusOne = "未承认" |
| | | this.taskStatusOne = '未承认' |
| | | } |
| | | if(this.form.taskStatus == this.taskSt) { |
| | | this.form.is_ok = true |
| | | this.taskStatusOne = "已完成" |
| | | this.taskStatusOne = '已完成' |
| | | } |
| | | }, |
| | | [CRUD.HOOK.afterEditError]() { |
| | | this.formTasks = []; |
| | | this.form.name = null; |
| | | this.form.performanceHours = null; |
| | | this.form.start = false; |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.afterEditCancel]() { |
| | | this.formTasks = []; |
| | | this.form.name = null; |
| | | this.form.performanceHours = null; |
| | | this.form.start = false; |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.afterAddCancel]() { |
| | | this.formTasks = []; |
| | | this.form.name = null; |
| | | this.form.performanceHours = null; |
| | | this.form.start = false; |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.afterAddError]() { |
| | | this.formTasks = []; |
| | | this.form.name = null; |
| | | this.form.performanceHours = null; |
| | | this.form.start = false; |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | this.form.task.id = this.query.taskId; |
| | | this.form.task.name = this.selectedTaskName; |
| | | this.form.projectId = this.projectId; |
| | | this.form.task.id = this.query.taskId |
| | | this.form.task.name = this.selectedTaskName |
| | | this.form.projectId = this.projectId |
| | | }, |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | if (!this.form.taskStatus) { |
| | | this.form.taskStatus = "task_status_not_started"; |
| | | this.form.taskStatus = 'task_status_not_started' |
| | | } |
| | | if (!this.form.name) { |
| | | this.form.name = this.form.task.name |
| | | } |
| | | // if (this.form.task.id === undefined || this.form.task.id === null || this.form.task.id === '') { |
| | | // this.form.task = null |
| | | // } |
| | | return true; |
| | | return true |
| | | }, |
| | | // [CRUD.HOOK.afterCrudDelete]() { |
| | | // this.advList = [] |
| | |
| | | return ( |
| | | time.getTime() < new Date(this.planStartTime) - 8.64e7 || |
| | | time.getTime() > new Date(this.planEndTime).getTime() |
| | | ); |
| | | ) |
| | | }, |
| | | handleChange(value) { |
| | | if (value) { |
| | | this.taskStatusOne = '已完成'; |
| | | this.taskStatusOne = '已完成' |
| | | } else { |
| | | this.taskStatusOne = '未承认'; |
| | | this.taskStatusOne = '未承认' |
| | | } |
| | | }, |
| | | checkStartTime(time) { |
| | | if (time > this.planEndTime || time < this.planStartTime) { |
| | | this.form.taskStartDate = null; |
| | | this.form.taskStartDate = null |
| | | this.$notify({ |
| | | title: "无效时间", |
| | | type: "error", |
| | | title: '无效时间', |
| | | type: 'error', |
| | | duration: 2500 |
| | | }); |
| | | return; |
| | | }) |
| | | return |
| | | } |
| | | }, |
| | | changer() { |
| | | this.getTaskDatas(); |
| | | this.crud.data = []; |
| | | this.taskDatas = []; |
| | | this.getTaskDatas() |
| | | this.crud.data = [] |
| | | this.taskDatas = [] |
| | | }, |
| | | checkEndTime(time) { |
| | | if (time > this.planEndTime || time < this.planStartTime) { |
| | | this.form.taskEndDate = null; |
| | | this.form.taskEndDate = null |
| | | this.$notify({ |
| | | title: "无效时间", |
| | | type: "error", |
| | | title: '无效时间', |
| | | type: 'error', |
| | | duration: 2500 |
| | | }); |
| | | return; |
| | | }) |
| | | return |
| | | } |
| | | }, |
| | | // 获取用户 |
| | |
| | | // 获取用户 |
| | | crudUser.getProjectUser(taskId).then(res => { |
| | | // 用户列表 |
| | | this.users = res; |
| | | }); |
| | | this.users = res |
| | | }) |
| | | }, |
| | | |
| | | // 获取项目包含所有的用户 |
| | |
| | | // 获取用户 |
| | | crudUser.getAllUser(taskId).then(res => { |
| | | // 用户列表 |
| | | this.proUsers = res; |
| | | }); |
| | | this.proUsers = res |
| | | }) |
| | | }, |
| | | getAllProjectDatas() { |
| | | crudTask.getProjects().then(res => { |
| | | this.projectDatas = res; |
| | | }); |
| | | this.projectDatas = res |
| | | }) |
| | | }, |
| | | // 获取左侧部门数据 |
| | | getTaskDatas(node, resolve) { |
| | | // if (node !== undefined) { |
| | | // this.infinite = true |
| | | // } |
| | | const sort = "id,desc"; |
| | | const params = { sort: sort }; |
| | | const sort = 'id,desc' |
| | | const params = { sort: sort } |
| | | if (!this.projectId) { |
| | | return; |
| | | return |
| | | } else { |
| | | params["projectId"] = this.projectId; |
| | | this.taskLoading = true; |
| | | params['projectId'] = this.projectId |
| | | this.taskLoading = true |
| | | } |
| | | if (typeof node === "object" && node.level !== 0) { |
| | | params["pid"] = node.data.id; |
| | | if (typeof node === 'object' && node.level !== 0) { |
| | | params['pid'] = node.data.id |
| | | } else { |
| | | params["isTop"] = true; |
| | | params['isTop'] = true |
| | | } |
| | | if (this.taskName) { |
| | | params["name"] = this.taskName; |
| | | params['name'] = this.taskName |
| | | } |
| | | setTimeout(() => { |
| | | crudTask |
| | | .ChildrenTaskAnyParent(params) |
| | | .then(res => { |
| | | if (resolve) { |
| | | resolve(res); |
| | | resolve(res) |
| | | } else { |
| | | this.infinite = false; |
| | | this.taskDatas = res; |
| | | this.infinite = false |
| | | this.taskDatas = res |
| | | } |
| | | this.taskLoading = false; |
| | | this.taskLoading = false |
| | | }) |
| | | .catch(() => { |
| | | this.taskLoading = false; |
| | | }); |
| | | }, 100); |
| | | this.taskLoading = false |
| | | }) |
| | | }, 100) |
| | | }, |
| | | // 生成员工Excel |
| | | exportUser() { |
| | | this.slong = true; |
| | | this.slong = true |
| | | crudTaskUser |
| | | .exportUser(this.query.taskId) |
| | | .then(res => { |
| | | downloadFile(res, "测试数据", "xlsx"); |
| | | this.slong = false; |
| | | this.crud.notify("生成成功", CRUD.NOTIFICATION_TYPE.SUCCESS); |
| | | downloadFile(res, '测试数据', 'xlsx') |
| | | this.slong = false |
| | | this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | }) |
| | | .catch(error => { |
| | | console.error(error); |
| | | this.slong = false; |
| | | this.crud.notify("生成失败", CRUD.NOTIFICATION_TYPE.ERROR); |
| | | }); |
| | | this.slong = false |
| | | this.crud.notify('生成失败', CRUD.NOTIFICATION_TYPE.ERROR) |
| | | }) |
| | | }, |
| | | // 切换任务 |
| | | handleNodeClick(data) { |
| | | this.selectedTask = data; |
| | | this.selectedTask = data |
| | | if (data.pid === 0) { |
| | | this.query.taskId = null; |
| | | this.query.taskStatus = []; |
| | | this.selectedTaskName = null; |
| | | this.query.taskId = null |
| | | this.query.taskStatus = [] |
| | | this.selectedTaskName = null |
| | | } else { |
| | | this.query.taskId = data.id; |
| | | this.query.taskId = data.id |
| | | this.query.taskStatus = [ |
| | | "task_status_not_started", |
| | | "task_status_in_hand", |
| | | "task_status_test", |
| | | "task_status_stop", |
| | | ]; |
| | | this.selectedTaskName = data.name; |
| | | this.flag = data.flag; |
| | | console.log("data : ", data); |
| | | this.planStartTime = data.planStartTime; |
| | | this.planEndTime = data.planEndTime; |
| | | // crudTaskUser.getSum({ 'taskId': this.query.taskId }).then(res => { |
| | | // this.taskTotal = res |
| | | // }) |
| | | 'task_status_not_started', |
| | | 'task_status_in_hand', |
| | | 'task_status_test', |
| | | 'task_status_stop', |
| | | 'task_status_unrecognized' |
| | | ] |
| | | this.selectedTaskName = data.name |
| | | this.flag = true // data.flag; |
| | | this.planStartTime = data.planStartTime |
| | | this.planEndTime = data.planEndTime |
| | | } |
| | | this.crud.toQuery(); |
| | | this.getUser(this.query.taskId); |
| | | this.getProUser(this.query.taskId); |
| | | this.crud.toQuery() |
| | | this.getUser(this.query.taskId) |
| | | this.getProUser(this.query.taskId) |
| | | }, |
| | | handleSizeChange(val) { |
| | | this.pageSize = val; |
| | | this.adventTesk(); |
| | | this.pageSize = val |
| | | this.adventTesk() |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.currentPage = val; |
| | | this.adventTesk(); |
| | | this.currentPage = val |
| | | this.adventTesk() |
| | | }, |
| | | // 临期任务 |
| | | adventTesk() { |
| | | this.dialogVisible_task_LQ = true; |
| | | this.dialogVisible_task_LQ = true |
| | | // 点击侧面查询临期任务 |
| | | crudTaskUser |
| | | .getTaskUserAdvent(this.query.taskId, this.currentPage, this.pageSize) |
| | | .then(res => { |
| | | this.advList = res.data; |
| | | this.total = res.total; |
| | | this.taskLoading_L = false; |
| | | }); |
| | | this.advList = res.data |
| | | this.total = res.total |
| | | this.taskLoading_L = false |
| | | }) |
| | | }, |
| | | beforeUpload(file) { |
| | | const isLt1M = file.size / 1024 / 1024 < 1; |
| | | const isLt1M = file.size / 1024 / 1024 < 1 |
| | | if (isLt1M) { |
| | | return true; |
| | | return true |
| | | } |
| | | this.$message({ |
| | | message: "请不要上传大于1m的文件.", |
| | | type: "warning" |
| | | }); |
| | | return false; |
| | | message: '请不要上传大于1m的文件.', |
| | | type: 'warning' |
| | | }) |
| | | return false |
| | | }, |
| | | handleSuccess({ results, header }) { |
| | | this.uploading = false; |
| | | this.generateForm = results; |
| | | console.log("res:" + this.generateForm); |
| | | console.log("header:" + header); |
| | | this.uploading = false |
| | | this.generateForm = results |
| | | this.generateForm = results.map(item => { |
| | | const { |
| | | 所属员工ID: _, |
| | |
| | | 隔绝列7: __________, |
| | | 隔绝列8: ____________, |
| | | ...newItem |
| | | } = item; |
| | | if ("任务开始时间" in newItem) { |
| | | newItem["任务开始时间"] = formatExcelDate(newItem["任务开始时间"]); |
| | | } = item |
| | | if ('任务开始时间' in newItem) { |
| | | newItem['任务开始时间'] = formatExcelDate(newItem['任务开始时间']) |
| | | } |
| | | if ("任务结束时间" in newItem) { |
| | | newItem["任务结束时间"] = formatExcelDate(newItem["任务结束时间"]); |
| | | if ('任务结束时间' in newItem) { |
| | | newItem['任务结束时间'] = formatExcelDate(newItem['任务结束时间']) |
| | | } |
| | | return newItem; |
| | | }); |
| | | return newItem |
| | | }) |
| | | // 表头数据转换 |
| | | this.generateFormTwo = transformData(results); |
| | | this.generateFormTwo = transformData(results) |
| | | for (let i = 0; i < this.generateFormTwo.length; i++) { |
| | | const item = this.generateFormTwo[i]; |
| | | const item = this.generateFormTwo[i] |
| | | if (!item.name) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的名称为空`, |
| | | type: "warning" |
| | | }); |
| | | this.generateFormTwo = []; |
| | | this.generateForm = []; |
| | | return false; |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskStartDate) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务开始时间为空`, |
| | | type: "warning" |
| | | }); |
| | | this.generateFormTwo = []; |
| | | this.generateForm = []; |
| | | return false; |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskEndDate) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务结束时间为空`, |
| | | type: "warning" |
| | | }); |
| | | this.generateFormTwo = []; |
| | | this.generateForm = []; |
| | | return false; |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskHours) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务工时为空`, |
| | | type: "warning" |
| | | }); |
| | | this.generateFormTwo = []; |
| | | this.generateForm = []; |
| | | return false; |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | if (!item.taskStatus) { |
| | | this.$message({ |
| | | message: `第${i + 1}项的任务状态为空`, |
| | | type: "warning" |
| | | }); |
| | | this.generateFormTwo = []; |
| | | this.generateForm = []; |
| | | return false; |
| | | type: 'warning' |
| | | }) |
| | | this.generateFormTwo = [] |
| | | this.generateForm = [] |
| | | return false |
| | | } |
| | | } |
| | | this.tableHeader = header.filter( |
| | | item => |
| | | item !== "所属员工ID" && item !== "任务状态ID" && item !== "优先度ID" && item !== "隔绝列1" && |
| | | item !== "隔绝列2" && item !== "隔绝列3" && item !== "隔绝列4" && item !== "隔绝列5" && item !== "隔绝列6" && |
| | | item !== "隔绝列7" && item !== "隔绝列8" |
| | | ); |
| | | item !== '所属员工ID' && item !== '任务状态ID' && item !== '优先度ID' && item !== '隔绝列1' && |
| | | item !== '隔绝列2' && item !== '隔绝列3' && item !== '隔绝列4' && item !== '隔绝列5' && item !== '隔绝列6' && |
| | | item !== '隔绝列7' && item !== '隔绝列8' |
| | | ) |
| | | }, |
| | | // 生成表单打开 |
| | | openGenerate() { |
| | | // 生成表单数据 |
| | | this.generateForm = []; |
| | | this.generateForm = [] |
| | | // 生成表单状态 |
| | | this.generateStatus = true; |
| | | this.generateStatus = true |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false; |
| | | this.generateStatus = false |
| | | }, |
| | | // 生成表单提交 |
| | | submitGenerate() { |
| | | if (!this.generateForm) { |
| | | this.$message.warning("请选择上传的文件"); |
| | | return; |
| | | this.$message.warning('请选择上传的文件') |
| | | return |
| | | } |
| | | // 生成表单加载 |
| | | this.generateLoading = true; |
| | | this.uploading = true; |
| | | this.generateLoading = true |
| | | this.uploading = true |
| | | crudTaskUser |
| | | .generate({ |
| | | generateForm: this.generateFormTwo, |
| | |
| | | }) |
| | | .then(res => { |
| | | // 生成表单关闭 |
| | | this.closeGenerate(); |
| | | this.closeGenerate() |
| | | // 生成表单加载 |
| | | this.generateLoading = false; |
| | | this.generateLoading = false |
| | | // 搜索:刷新表格 |
| | | this.crud.toQuery(); |
| | | this.crud.notify("导入成功", CRUD.NOTIFICATION_TYPE.SUCCESS); |
| | | this.crud.toQuery() |
| | | this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | }) |
| | | .catch(err => { |
| | | this.uploading = false; |
| | | this.uploading = false |
| | | // 生成表单加载 |
| | | this.generateLoading = false; |
| | | }); |
| | | this.generateLoading = false |
| | | }) |
| | | }, |
| | | |
| | | unPick(e) { |
| | | crudTaskUser |
| | | .addTaskUser({ TaskId: e.id, projectId: this.projectId }) |
| | | .then(res => { |
| | | this.pickFlg = false; |
| | | this.pickFlg = false |
| | | if (res === 1) { |
| | | this.$notify({ |
| | | title: "获取成功", |
| | | type: "success", |
| | | title: '获取成功', |
| | | type: 'success', |
| | | duration: 2500 |
| | | }); |
| | | }) |
| | | |
| | | this.crud.toQuery(); |
| | | this.crud.toQuery() |
| | | } else { |
| | | this.$notify({ |
| | | title: "获取失败", |
| | | type: "error", |
| | | title: '获取失败', |
| | | type: 'error', |
| | | duration: 2500 |
| | | }); |
| | | }) |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | taskCompleted() { |
| | | const selectData = this.$refs.table.selection; |
| | | var changesId = []; |
| | | toTaskCompleted() { |
| | | const selectData = this.$refs.table.selection |
| | | var changesId = [] |
| | | for (var i = 0; i < selectData.length; i++) { |
| | | if (selectData[i].newTaskProgress !== 100) { |
| | | this.$notify.error({ |
| | | title: "任务进度未达到100%" |
| | | }); |
| | | return; |
| | | this.centerDialogVisibleTaskProgress = true |
| | | return |
| | | } |
| | | changesId.push(selectData[i].id); |
| | | changesId.push(selectData[i].id) |
| | | } |
| | | // 当程序执行到这里时,说明选择的都是已经达到100的任务 |
| | | crudTaskUser.changeStatus(changesId).then(res => { |
| | | this.crud.toQuery(); |
| | | this.crud.toQuery() |
| | | this.$notify.success({ |
| | | title: "确认成功" |
| | | }); |
| | | }); |
| | | title: '确认成功' |
| | | }) |
| | | }) |
| | | }, |
| | | doTaskCompleted() { |
| | | this.centerDialogVisibleTaskProgress = false |
| | | const selectData = this.$refs.table.selection |
| | | var changesId = [] |
| | | for (var i = 0; i < selectData.length; i++) { |
| | | changesId.push(selectData[i].id) |
| | | } |
| | | // 当程序执行到这里时,说明选择的都是已经达到100的任务 |
| | | crudTaskUser.changeStatus(changesId).then(res => { |
| | | this.crud.toQuery() |
| | | this.$notify.success({ |
| | | title: '确认成功' |
| | | }) |
| | | }) |
| | | }, |
| | | // 当选择完人物计算出绩效工时 |
| | | withUser(data) { |
| | | if (data.taskHours != null && data.userId != null) { |
| | | crudTaskUser |
| | | .getPerformanceg({ |
| | | taskHours: data.taskHours, |
| | | userId: data.userId |
| | | }) |
| | | .then(res => { |
| | | this.form.performanceHours = res == 0 ? null : res; |
| | | }); |
| | | } |
| | | // 绩效直下 |
| | | this.form.performanceHours = data.taskHours |
| | | // if (data.taskHours != null && data.userId != null) { |
| | | // crudTaskUser |
| | | // .getPerformanceg({ |
| | | // taskHours: data.taskHours, |
| | | // userId: data.userId |
| | | // }) |
| | | // .then(res => { |
| | | // this.form.performanceHours = res == 0 ? null : res; |
| | | // }); |
| | | // } |
| | | }, |
| | | showDetail(e) { |
| | | this.dialogVisible_taskUser = true; |
| | | this.TaskName = e.name; |
| | | this.expectedHours = e.performanceHours; |
| | | this.actualHours = 0; |
| | | this.dialogVisible_taskUser = true |
| | | this.TaskName = e.name |
| | | this.expectedHours = e.performanceHours |
| | | this.actualHours = 0 |
| | | // 发送taskUser,获取所有的日报信息,并在后台进行处理,将处理后的结果返回给前端的steps中,进行显示 |
| | | crudTaskUser.getTaskUserDetail(e.id).then(res => { |
| | | this.steps = res; |
| | | this.steps = res |
| | | for (let i = 0; i < this.steps.length; i++) { |
| | | this.taskUserDetail[this.steps[i].taskUserName] = this.steps[ |
| | | i |
| | | ].alreadyConsumeHours; |
| | | ].alreadyConsumeHours |
| | | } |
| | | |
| | | // var key = this.taskUserDetail.keySet(); |
| | | for (var key in this.taskUserDetail) { |
| | | this.actualHours += this.taskUserDetail[key]; |
| | | this.actualHours += this.taskUserDetail[key] |
| | | } |
| | | |
| | | this.taskProgress = Math.round( |
| | | (this.actualHours / this.expectedHours) * 100 |
| | | ); |
| | | ) |
| | | if (this.taskProgress > 100) { |
| | | this.taskProgress = 100; |
| | | this.taskProgress = 100 |
| | | } |
| | | if (this.taskProgress === 100) { |
| | | this.ProgressStatus = "#F56C6C"; |
| | | this.ProgressStatus = '#F56C6C' |
| | | } |
| | | if (this.taskProgress < 100) { |
| | | this.ProgressStatus = "#409EFF"; |
| | | this.ProgressStatus = '#409EFF' |
| | | } |
| | | // this.taskUserDetail.forEach(function(value,key){ |
| | | // console.log(value,key); |
| | | // }); |
| | | this.dialogLoading_taskUser = false; |
| | | }); |
| | | this.dialogLoading_taskUser = false |
| | | }) |
| | | }, |
| | | setNull() { |
| | | this.taskUserDetail = {}; |
| | | this.dialogLoading_taskUser = true; |
| | | this.dialogLoading_task = true; |
| | | this.dialogLoading_task_LQ = true; |
| | | this.taskUserDetail = {} |
| | | this.dialogLoading_taskUser = true |
| | | this.dialogLoading_task = true |
| | | this.dialogLoading_task_LQ = true |
| | | }, |
| | | showTaskDetail(e) { |
| | | this.taskDetail = {}; |
| | | this.dialogVisible_task = true; |
| | | this.taskDetail = {} |
| | | this.dialogVisible_task = true |
| | | crudTaskUser.getTaskDetail(e.id).then(res => { |
| | | for (let i = 0; i < res.length; i++) { |
| | | this.taskDetail[res[i].nickName] = res[i].assignedWork; |
| | | this.taskDetail[res[i].nickName] = res[i].assignedWork |
| | | } |
| | | this.dialogLoading_task = false; |
| | | }); |
| | | this.dialogLoading_task = false |
| | | }) |
| | | }, |
| | | formatTaskProgress(percentage) { |
| | | return percentage === 100 ? "实际消耗已超出计划时长" : `${percentage}%`; |
| | | return percentage === 100 ? '实际消耗已超出计划时长' : `${percentage}%` |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style rel="stylesheet/scss" lang="scss"> |
| | |
| | | this.loading = false |
| | | }).catch(err => { |
| | | this.loading = false |
| | | console.log(err.response.data.message) |
| | | }) |
| | | } else { |
| | | return false |
| | |
| | | this.url = res |
| | | }).catch(err => { |
| | | this.loading = false |
| | | console.log(err.response.data.message) |
| | | }) |
| | | } else { |
| | | return false |
| | |
| | | this.loading = false |
| | | }).catch(err => { |
| | | this.loading = false |
| | | console.log(err.response.data.message) |
| | | }) |
| | | } else { |
| | | return false |
| | |
| | | this.loading = false |
| | | }).catch(err => { |
| | | this.loading = false |
| | | console.log(err.response.data.message) |
| | | }) |
| | | } else { |
| | | return false |
| | |
| | | this.dialog = false |
| | | }).catch(err => { |
| | | this.loading = false |
| | | console.log(err.response.data.message) |
| | | }) |
| | | } else { |
| | | return false |
| | |
| | | this.url = res.url |
| | | }).catch(err => { |
| | | this.downloadLoading = false |
| | | console.log(err.response.data.message) |
| | | }) |
| | | }, |
| | | // 同步数据 |
| | |
| | | this.crud.toQuery() |
| | | }).catch(err => { |
| | | this.icon = 'el-icon-refresh' |
| | | console.log(err.response.data.message) |
| | | }) |
| | | } |
| | | } |
| | |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <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 ref="form" :model="form" :inline="true" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="公司" prop="company.id"> |
| | | <el-select v-model="form.company.id" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="公积金基数" prop="accumulationFund"> |
| | | <el-divider>公积金</el-divider> |
| | | <el-form-item label="基数" prop="accumulationFund"> |
| | | <el-input v-model="form.accumulationFund" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人比例" prop="accumulationFundPersonal"> |
| | | <el-input v-model="form.accumulationFundPersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="accumulationFundPersonal"> |
| | | <el-input v-model="form.accumulationFundPersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司比例" prop="accumulationFundCompany"> |
| | | <el-input v-model="form.accumulationFundCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="accumulationFundCompany"> |
| | | <el-input v-model="form.accumulationFundCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="养老险基数" prop="retirementInsurance"> |
| | | <el-divider>养老险</el-divider> |
| | | <el-form-item label="基数" prop="retirementInsurance"> |
| | | <el-input v-model="form.retirementInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人比例" prop="retirementInsurancePersonal"> |
| | | <el-input v-model="form.retirementInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="retirementInsurancePersonal"> |
| | | <el-input v-model="form.retirementInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司比例" prop="retirementInsuranceCompany"> |
| | | <el-input v-model="form.retirementInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="retirementInsuranceCompany"> |
| | | <el-input v-model="form.retirementInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险基数" prop="medicalInsurance"> |
| | | <el-divider>医疗险</el-divider> |
| | | <el-form-item label="基数" prop="medicalInsurance"> |
| | | <el-input v-model="form.medicalInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险个人比例" prop="medicalInsurancePersonal"> |
| | | <el-input v-model="form.medicalInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="medicalInsurancePersonal"> |
| | | <el-input v-model="form.medicalInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险公司比例" prop="medicalInsuranceCompany"> |
| | | <el-input v-model="form.medicalInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="medicalInsuranceCompany"> |
| | | <el-input v-model="form.medicalInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="失业险基数" prop="unemploymentInsurance"> |
| | | <el-divider>失业险</el-divider> |
| | | <el-form-item label="基数" prop="unemploymentInsurance"> |
| | | <el-input v-model="form.unemploymentInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="失业险个人比例" prop="unemploymentInsurancePersonal"> |
| | | <el-input v-model="form.unemploymentInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="unemploymentInsurancePersonal"> |
| | | <el-input v-model="form.unemploymentInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="失业险公司比例" prop="unemploymentInsuranceCompany"> |
| | | <el-input v-model="form.unemploymentInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="unemploymentInsuranceCompany"> |
| | | <el-input v-model="form.unemploymentInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="生育险基数" prop="birthInsurance"> |
| | | <el-divider>生育险</el-divider> |
| | | <el-form-item label="基数" prop="birthInsurance"> |
| | | <el-input v-model="form.birthInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="生育险个人比例" prop="birthInsurancePersonal"> |
| | | <el-input v-model="form.birthInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="birthInsurancePersonal"> |
| | | <el-input v-model="form.birthInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="生育险公司比例" prop="birthInsuranceCompany"> |
| | | <el-input v-model="form.birthInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="birthInsuranceCompany"> |
| | | <el-input v-model="form.birthInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险基数" prop="employmentInsurance"> |
| | | <el-divider>工伤险</el-divider> |
| | | <el-form-item label="基数" prop="employmentInsurance"> |
| | | <el-input v-model="form.employmentInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险个人比例" prop="employmentInsurancePersonal"> |
| | | <el-input v-model="form.employmentInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="employmentInsurancePersonal"> |
| | | <el-input v-model="form.employmentInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险公司比例" prop="employmentInsuranceCompany"> |
| | | <el-input v-model="form.employmentInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="employmentInsuranceCompany"> |
| | | <el-input v-model="form.employmentInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | edit: ['admin', 'cmnInsurance:edit'], |
| | | del: ['admin', 'cmnInsurance:del'], |
| | | download: ['admin', 'cmnInsurance:list'], |
| | | synchronous: ["admin", "cmnInsurance:synchronous"] |
| | | synchronous: ['admin', 'cmnInsurance:synchronous'] |
| | | }, |
| | | rules: { |
| | | 'company.id': [ |
| | |
| | | // 修改同步按钮 |
| | | synchronous(data) { |
| | | this.$confirm( |
| | | "此操作将同步 " + data.length + " 条五险一金相关的数据, 是否继续?", |
| | | "提示", |
| | | '此操作将同步 ' + data.length + ' 条五险一金相关的数据, 是否继续?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "success" |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'success' |
| | | } |
| | | ).then(() => { |
| | | this.loading = true; |
| | | this.loading = true |
| | | // ID列表 |
| | | const ids = []; |
| | | const ids = [] |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id); |
| | | ids.push(data[i].id) |
| | | } |
| | | crudCmnInsurance.synchronous(ids).then(res => { |
| | | // 消息提示 |
| | | this.crud.notify("同步成功", CRUD.NOTIFICATION_TYPE.SUCCESS); |
| | | this.loading = false; |
| | | }); |
| | | }); |
| | | this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | this.loading = false |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | |
| | | /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = "left" or "right"--> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | |
| | | style="margin-right: 6px;" |
| | | :disabled="crud.selections.length === 0" |
| | | @click="synchronous(crud.selections)" |
| | | >同步</el-button |
| | | > |
| | | 同步 |
| | | </el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog |
| | |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="级别基本工资" prop="basicWage"> |
| | | <el-form-item label="基本工资" prop="basicWage"> |
| | | <el-input v-model="form.basicWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="级别浮动工资" prop="rankWage"> |
| | | <el-input v-model="form.rankWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效工资" prop="performanceWage"> |
| | | <el-input v-model="form.performanceWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="浮动工资" prop="rankWage"> |
| | | <el-input v-model="form.rankWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input |
| | |
| | | round |
| | | size="mini" |
| | | @click="calcByStep" |
| | | >计算</el-button |
| | | > |
| | | 计算 |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-divider v-if="form.hasChild" style="margin-top:10px" |
| | | ><b>级别阶梯详细</b></el-divider |
| | | >-- |
| | | <el-divider v-if="form.hasChild" style="margin-top:10px"><b>级别阶梯详细</b></el-divider> |
| | | <el-form-item v-if="form.hasChild" label-width="0px"> |
| | | <el-table |
| | | ref="miniTable" |
| | |
| | | > |
| | | <el-table-column |
| | | prop="basicWage" |
| | | label="级别基本工资" |
| | | label="基本工资" |
| | | width="100" |
| | | fixed="left" |
| | | > |
| | |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="rankWage" |
| | | label="级别浮动工资" |
| | | label="浮动工资" |
| | | width="160" |
| | | fixed="left" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-tag |
| | | >{{ scope.row.minRankWage }} ~ |
| | | {{ scope.row.maxRankWage }}</el-tag |
| | | > |
| | | <el-tag> |
| | | {{ scope.row.minRankWage }} ~ |
| | | {{ scope.row.maxRankWage }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="performanceWage" |
| | | label="绩效工资" |
| | | label="岗位工资" |
| | | width="100" |
| | | fixed="left" |
| | | > |
| | |
| | | :loading="crud.status.cu === 2" |
| | | type="primary" |
| | | @click="crud.submitCU" |
| | | >确认</el-button |
| | | > |
| | | 确认 |
| | | </el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="名称" /> |
| | | <el-table-column prop="basicWage" label="级别基本工资" /> |
| | | <el-table-column prop="rankWage" label="级别浮动工资" /> |
| | | <el-table-column prop="performanceWage" label="绩效工资" /> |
| | | <el-table-column prop="basicWage" label="基本工资" /> |
| | | <el-table-column prop="performanceWage" label="岗位工资" /> |
| | | <el-table-column prop="rankWage" label="浮动工资" /> |
| | | <el-table-column |
| | | :show-overflow-tooltip="true" |
| | | prop="description" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudCmnLevel from "@/api/treatment/cmnLevel"; |
| | | import CRUD, { presenter, header, form, crud } from "@crud/crud"; |
| | | import rrOperation from "@crud/RR.operation"; |
| | | import crudOperation from "@crud/CRUD.operation"; |
| | | import udOperation from "@crud/UD.operation"; |
| | | import pagination from "@crud/Pagination"; |
| | | import crudJob from "@/api/system/job"; |
| | | import crudCmnLevel from '@/api/treatment/cmnLevel' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import crudJob from '@/api/system/job' |
| | | |
| | | const defaultForm = { |
| | | id: null, |
| | |
| | | hasChild: false, |
| | | step: null, |
| | | cmnLevelRankList: [] |
| | | }; |
| | | } |
| | | export default { |
| | | name: "CmnLevel", |
| | | name: 'CmnLevel', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ |
| | | title: "级别定义", |
| | | url: "api/cmnLevel", |
| | | idField: "id", |
| | | sort: "id,desc", |
| | | title: '级别定义', |
| | | url: 'api/cmnLevel', |
| | | idField: 'id', |
| | | sort: 'id,desc', |
| | | crudMethod: { ...crudCmnLevel } |
| | | }); |
| | | }) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ["admin", "cmnLevel:add"], |
| | | edit: ["admin", "cmnLevel:edit"], |
| | | del: ["admin", "cmnLevel:del"], |
| | | download: ["admin", "cmnLevel:download"], |
| | | synchronous: ["admin", "cmnLevel:synchronous"] |
| | | add: ['admin', 'cmnLevel:add'], |
| | | edit: ['admin', 'cmnLevel:edit'], |
| | | del: ['admin', 'cmnLevel:del'], |
| | | download: ['admin', 'cmnLevel:download'], |
| | | synchronous: ['admin', 'cmnLevel:synchronous'] |
| | | }, |
| | | rules: { |
| | | "job.id": [ |
| | | { required: true, message: "岗位不能为空", trigger: "blur" } |
| | | 'job.id': [ |
| | | { required: true, message: '岗位不能为空', trigger: 'blur' } |
| | | ], |
| | | name: [{ required: true, message: "名称不能为空", trigger: "blur" }], |
| | | name: [{ required: true, message: '名称不能为空', trigger: 'blur' }], |
| | | basicWage: [ |
| | | { required: true, message: "级别基本工资不能为空", trigger: "blur" } |
| | | { required: true, message: '级别基本工资不能为空', trigger: 'blur' } |
| | | ], |
| | | rankWage: [ |
| | | { required: true, message: "级别浮动工资不能为空", trigger: "blur" } |
| | | { required: true, message: '级别浮动工资不能为空', trigger: 'blur' } |
| | | ], |
| | | performanceWage: [ |
| | | { required: true, message: "绩效工资不能为空", trigger: "blur" } |
| | | { required: true, message: '绩效工资不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: "jobId", display_name: "岗位" }, |
| | | { key: "name", display_name: "名称" } |
| | | { key: 'jobId', display_name: '岗位' }, |
| | | { key: 'name', display_name: '名称' } |
| | | ], |
| | | // 岗位列表 |
| | | jobs: [], |
| | | loading: false |
| | | }; |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取所有岗位 |
| | | this.getAllJob(); |
| | | return true; |
| | | this.getAllJob() |
| | | return true |
| | | }, |
| | | // 钩子: 在新增前执行 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | this.form.hasChild = this.form.cmnLevelRankList.length !== 0; |
| | | this.form.hasChild = this.form.cmnLevelRankList.length !== 0 |
| | | }, |
| | | // 获取所有岗位 |
| | | getAllJob() { |
| | |
| | | .getAll() |
| | | .then(res => { |
| | | // 岗位列表 |
| | | this.jobs = res; |
| | | this.jobs = res |
| | | }) |
| | | .catch(() => {}); |
| | | .catch(() => {}) |
| | | }, |
| | | // 岗位变更 |
| | | changeJob() { |
| | | this.form.name = null; |
| | | const jobs = this.jobs.filter(job => job.id === this.form.job.id) |
| | | if (jobs.length > 0) { |
| | | this.form.job = jobs[0] |
| | | } |
| | | this.form.name = null |
| | | }, |
| | | // 计算级别阶梯详细 |
| | | calcByStep() { |
| | | this.$refs["form"].validate(valid => { |
| | | this.$refs['form'].validate(valid => { |
| | | if (valid) { |
| | | this.form.cmnLevelRankList = []; |
| | | let totalCnt = this.form.rankWage; |
| | | this.form.cmnLevelRankList = [] |
| | | let totalCnt = this.form.rankWage |
| | | while (totalCnt > 0) { |
| | | const performanceCoefficient = |
| | | (parseInt(this.form.basicWage) + |
| | | parseInt(totalCnt) + |
| | | parseInt(this.form.performanceWage)) / |
| | | this.form.job.performanceUnitWage; |
| | | console.log(this.form.job.performanceUnitWage); |
| | | this.form.job.performanceUnitWage |
| | | this.form.cmnLevelRankList.push({ |
| | | minRankWage: totalCnt - this.form.step, |
| | | maxRankWage: totalCnt, |
| | | performanceCoefficient: performanceCoefficient.toFixed(2) |
| | | }); |
| | | }) |
| | | // TODO performanceCoefficient 不需要在这里算出 |
| | | totalCnt = totalCnt - this.form.step; |
| | | totalCnt = totalCnt - this.form.step |
| | | } |
| | | } else { |
| | | return false; |
| | | return false |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | // 同步 |
| | | synchronous(data) { |
| | | this.$confirm( |
| | | "此操作将同步 " + data.length + " 条级别定义相关的数据, 是否继续?", |
| | | "提示", |
| | | '此操作将同步 ' + data.length + ' 条级别定义相关的数据, 是否继续?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "success" |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'success' |
| | | } |
| | | ).then(() => { |
| | | this.loading = true; |
| | | this.loading = true |
| | | // ID列表 |
| | | const ids = []; |
| | | const ids = [] |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id); |
| | | ids.push(data[i].id) |
| | | } |
| | | crudCmnLevel.synchronous(ids).then(res => { |
| | | // 消息提示 |
| | | this.crud.notify("同步成功", CRUD.NOTIFICATION_TYPE.SUCCESS); |
| | | this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | this.loading = false |
| | | }); |
| | | }); |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style scoped></style> |
| | |
| | | } |
| | | } |
| | | } |
| | | console.log(this.crud.data) |
| | | }, |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | console.log(this.form) |
| | | }, |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | |
| | | }, |
| | | // 获取岗位对应的级别 |
| | | getLevelsUpd(jobId) { |
| | | console.log(jobId) |
| | | // 获取岗位对应的级别 |
| | | crudCmnLevel.getAll({ jobId: jobId }).then(res => { |
| | | // 岗位列表 |
| | |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <label class="el-form-item-label">员工</label> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="请选择员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | <el-cascader |
| | | v-model="selectedValue" |
| | | :filterable="true" |
| | | :options="options" |
| | | :props="propsUsers" |
| | | clearable |
| | | collapse-tags |
| | | placeholder="所属员工" |
| | | :show-all-levels="false" |
| | | style="width: 230px" |
| | | @change="changeUserList" |
| | | /> |
| | | </el-select> |
| | | <label class="el-form-item-label">年月</label> |
| | | <el-date-picker v-model="query.yearMonth" clearable type="month" format="yyyy 年 MM 月" placeholder="请选择年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-date-picker v-model="query.yearMonth" value-format="yyyy-MM" clearable type="month" format="yyyy 年 MM 月" placeholder="请选择年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | |
| | | >生成</el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <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-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="550px"> |
| | | <el-form ref="form" :model="form" :inline="true" :rules="rules" size="small" label-width="96px"> |
| | | <el-form-item label="员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择员工" style="width: 340px;" @change="changeUser"> |
| | | <el-option |
| | |
| | | <el-form-item label="年月" prop="yearMonth"> |
| | | <el-date-picker v-model="form.yearMonth" value-format="yyyy-MM" format="yyyy 年 MM 月" clearable type="month" placeholder="请选择年月" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金基数" prop="accumulationFund"> |
| | | <el-divider>公积金</el-divider> |
| | | <el-form-item label="基数" prop="accumulationFund"> |
| | | <el-input v-model="form.accumulationFund" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人比例" prop="accumulationFundPersonal"> |
| | | <el-input v-model="form.accumulationFundPersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="accumulationFundPersonal"> |
| | | <el-input v-model="form.accumulationFundPersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司比例" prop="accumulationFundCompany"> |
| | | <el-input v-model="form.accumulationFundCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="accumulationFundCompany"> |
| | | <el-input v-model="form.accumulationFundCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="养老险基数" prop="retirementInsurance"> |
| | | <el-divider>养老险</el-divider> |
| | | <el-form-item label="基数" prop="retirementInsurance"> |
| | | <el-input v-model="form.retirementInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="公积金个人比例" prop="retirementInsurancePersonal"> |
| | | <el-input v-model="form.retirementInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="retirementInsurancePersonal"> |
| | | <el-input v-model="form.retirementInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="公积金公司比例" prop="retirementInsuranceCompany"> |
| | | <el-input v-model="form.retirementInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="retirementInsuranceCompany"> |
| | | <el-input v-model="form.retirementInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险基数" prop="medicalInsurance"> |
| | | <el-divider>医疗险</el-divider> |
| | | <el-form-item label="基数" prop="medicalInsurance"> |
| | | <el-input v-model="form.medicalInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险个人比例" prop="medicalInsurancePersonal"> |
| | | <el-input v-model="form.medicalInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="medicalInsurancePersonal"> |
| | | <el-input v-model="form.medicalInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="医疗险公司比例" prop="medicalInsuranceCompany"> |
| | | <el-input v-model="form.medicalInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="medicalInsuranceCompany"> |
| | | <el-input v-model="form.medicalInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="失业险基数" prop="unemploymentInsurance"> |
| | | <el-divider>失业险</el-divider> |
| | | <el-form-item label="基数" prop="unemploymentInsurance"> |
| | | <el-input v-model="form.unemploymentInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="失业险个人比例" prop="unemploymentInsurancePersonal"> |
| | | <el-input v-model="form.unemploymentInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="unemploymentInsurancePersonal"> |
| | | <el-input v-model="form.unemploymentInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="失业险公司比例" prop="unemploymentInsuranceCompany"> |
| | | <el-input v-model="form.unemploymentInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="unemploymentInsuranceCompany"> |
| | | <el-input v-model="form.unemploymentInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="生育险基数" prop="birthInsurance"> |
| | | <el-divider>生育险</el-divider> |
| | | <el-form-item label="基数" prop="birthInsurance"> |
| | | <el-input v-model="form.birthInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="生育险个人比例" prop="birthInsurancePersonal"> |
| | | <el-input v-model="form.birthInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="birthInsurancePersonal"> |
| | | <el-input v-model="form.birthInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="生育险公司比例" prop="birthInsuranceCompany"> |
| | | <el-input v-model="form.birthInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="birthInsuranceCompany"> |
| | | <el-input v-model="form.birthInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险基数" prop="employmentInsurance"> |
| | | <el-divider>工伤险</el-divider> |
| | | <el-form-item label="基数" prop="employmentInsurance"> |
| | | <el-input v-model="form.employmentInsurance" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险个人比例" prop="employmentInsurancePersonal"> |
| | | <el-input v-model="form.employmentInsurancePersonal" style="width: 370px;"> |
| | | <el-form-item label="个人比例" prop="employmentInsurancePersonal"> |
| | | <el-input v-model="form.employmentInsurancePersonal" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="工伤险公司比例" prop="employmentInsuranceCompany"> |
| | | <el-input v-model="form.employmentInsuranceCompany" style="width: 370px;"> |
| | | <el-form-item label="公司比例" prop="employmentInsuranceCompany"> |
| | | <el-input v-model="form.employmentInsuranceCompany" style="width: 130px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | placeholder="工资年月" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="员工" prop="userId"> |
| | | <el-tree |
| | | ref="tree" |
| | | :data="deptDatas" |
| | | :props="props" |
| | | :load="getDeptDatas" |
| | | lazy |
| | | :default-expanded-keys="[]" |
| | | show-checkbox |
| | | node-key="id" |
| | | @check="handleCheckChange" |
| | | <el-form-item label="所属员工" prop="userIds"> |
| | | <el-cascader |
| | | v-model="selectedValue1" |
| | | :filterable="true" |
| | | :options="options" |
| | | :props="propsUsers" |
| | | clearable |
| | | collapse-tags |
| | | placeholder="请选择" |
| | | :show-all-levels="false" |
| | | style="width: 370px" |
| | | @change="changeUserListTwo" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '员工' }, |
| | | { key: 'userIds', display_name: '员工' }, |
| | | { key: 'yearMonth', display_name: '年月' } |
| | | ], |
| | | // 员工 |
| | | users: [], |
| | | selectedValue: [], |
| | | selectedValue1: [], |
| | | // 生成表单状态 |
| | | generateStatus: false, |
| | | // 生成表单加载 |
| | |
| | | props: { |
| | | children: 'children', label: 'label', isLeaf: 'leaf' |
| | | }, |
| | | deptDatas: [] |
| | | options: [], |
| | | propsUsers: { multiple: true } |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | crudUser.getAll({ enabled: true }).then(res => { |
| | | this.users = res |
| | | }) |
| | | crudUser.getUserDept().then(res => { |
| | | this.options = res |
| | | }) |
| | | this.users.forEach(user => { |
| | | if (user.id === userId) { |
| | | const num= user.company |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | changeUserList(e) { |
| | | var tempList = [] |
| | | for (let i = 0; i < e.length; i++) { |
| | | var temp = e[i] |
| | | tempList.push(temp[e[i].length - 1]) |
| | | } |
| | | this.query.userIds = tempList |
| | | }, |
| | | changeUserListTwo(e) { |
| | | var tempList = [] |
| | | for (let i = 0; i < e.length; i++) { |
| | | var temp = e[i] |
| | | tempList.push(temp[e[i].length - 1]) |
| | | } |
| | | this.generateForm.nodes = tempList |
| | | }, |
| | | // 变更员工 |
| | | changeUser(userId) { |
| | |
| | | this.generateForm = { targetYearMonth: null, nodes: [] } |
| | | // 生成表单状态 |
| | | this.generateStatus = true |
| | | // 清空 |
| | | this.selectedValue1 = [] |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false |
| | | this.getDeptDatas({ level: 0 }) |
| | | // 生成表单数据 |
| | | this.generateForm = { targetYearMonth: null, nodes: [] } |
| | | // 清空 |
| | | this.selectedValue1 = [] |
| | | // 清空表单 |
| | | this.$refs['generateForm'].clearValidate() |
| | | }, |
| | |
| | | this.form.employmentInsuranceCompany = res[0].employmentInsuranceCompany |
| | | } |
| | | }) |
| | | }, |
| | | // 获取部门数据 |
| | | getDeptDatas(node, resolve) { |
| | | const sort = 'id,desc' |
| | | const params = { sort: sort } |
| | | if (node.level !== 0) { |
| | | crudUser.getByDept(node.level !== 0 ? node.data.id : null).then(res => { |
| | | if (resolve) { |
| | | resolve(res) |
| | | } else { |
| | | this.deptDatas = res.content |
| | | } |
| | | }) |
| | | } else { |
| | | getDepts(params).then(res => { |
| | | if (resolve) { |
| | | resolve(res.content) |
| | | } else { |
| | | this.deptDatas = res.content |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | handleCheckChange(data, status) { |
| | | this.generateForm.nodes = status.checkedNodes |
| | | } |
| | | } |
| | | } |
| | |
| | | :value="item.id" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.company.label }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="级别基本工资" prop="basicWage"> |
| | | <el-form-item label="基本工资" prop="basicWage"> |
| | | <el-input v-model="form.basicWage" style="width: 370px;" :disabled="true" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效工资" prop="performanceWage"> |
| | | <el-form-item label="岗位工资" prop="performanceWage"> |
| | | <el-input v-model="form.performanceWage" style="width: 370px;" :disabled="true" /> |
| | | </el-form-item> |
| | | <el-form-item label="等级" prop="rank"> |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="级别等级工资" prop="rankWage"> |
| | | <el-form-item label="调整工资" prop="rankWage"> |
| | | <el-slider |
| | | v-model="form.rankWage" |
| | | style="width: 370px;" |
| | |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="nickName" label="员工" /> |
| | | <el-table-column prop="yearMonth" label="年月" /> |
| | | <el-table-column prop="basicWage" label="级别基本工资" /> |
| | | <el-table-column prop="rankWage" label="级别等级工资" /> |
| | | <el-table-column prop="performanceWage" label="绩效工资" /> |
| | | <el-table-column prop="totalWage" label="总工资"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.basicWage + scope.row.rankWage + scope.row.performanceWage) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="basicWage" label="基本工资"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.basicWage) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="rankWage" label="调整工资"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.rankWage) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceWage" label="岗位工资"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.performanceWage) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceCoefficient" label="绩效系数" /> |
| | | <el-table-column prop="locked" label="锁定状态" /> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | |
| | | handleSuccess({ results, header }) { |
| | | this.uploading = false |
| | | this.generateForm = results |
| | | console.log('this.generateForm : ', results) |
| | | this.tableHeader = header |
| | | }, |
| | | |
| | |
| | | // 生成表单加载 |
| | | this.generateLoading = true |
| | | this.uploading = true |
| | | console.log('3333333333333333333 : ', this.generateForm) |
| | | // crudUserInsurance.generate(this.generateForm).then(res => { |
| | | // // 生成表单关闭 |
| | | // this.closeGenerate() |
| | | // // 生成表单加载 |
| | | // this.generateLoading = true |
| | | // // 搜索:刷新表格 |
| | | // this.crud.toQuery() |
| | | // this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | // }).catch(err=>{ |
| | | // this.uploading = false |
| | | // // 生成表单加载 |
| | | // this.generateLoading = false |
| | | // }) |
| | | } |
| | | } |
| | | } |