weicd
2022-12-20 440b9f4f13711f3cfed6af210df7ccd1c1d7028b
考勤页面布局调整,表单组件补充,删除用户方法,钉钉定时任务
7 files modified
584 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/constant/Constant.java 11 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/OapiDingTalkMethod.java 249 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java 7 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java 5 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java 9 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/utils/constant.js 59 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/attendance/attendance/index.vue 244 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/constant/Constant.java
@@ -10,6 +10,8 @@
    public static final String DATE_TYPE_LEGAL_HOLIDAYS = "date_type_legal_holid";
    // 日期类型:节假日(串休)
    public static final String DATE_TYPE_HOLIDAYS = "date_type_holidays";
    // 日期类型:双休
    public static  final String DATE_TYPE_WEEKEND = "date_type_weekend";
    //考勤状态
    public static final String ATTENDANCE_STATE = "attendance_state";
@@ -25,6 +27,8 @@
    public static final String ATTENDANCE_STATE_BUSINESS = "attendance_state_business";
    //考勤状态: 请假
    public static final String ATTENDANCE_STATE_LEAVE = "attendance_state_leave";
    //考勤状态: 休息
    public static final String ATTENDANCE_STATE_REST = "attendance_state_rest";
    //考勤位置状态
    public static final String LOCATION_RESULTS = "location_results";
@@ -34,4 +38,11 @@
    public static final String LOCATION_RESULTS_OUTSIDE = "location_results_outside";
    // 考勤位置状态: 未打卡
    public static final String LOCATION_RESULTS_NOTSIGNED = "location_results_notSigned";
    // 考勤位置状态: 休息
    public static final String LOCATION_RESULTS_REST = "location_results_rest";
    // 固定时间(12:30)
    public static final String DATE_TIME_NOON = "12:30:00";
    // 固定时间(02:00)
    public static final String DATE_TIME_ONE = "23:59:59";
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/OapiDingTalkMethod.java
@@ -1,7 +1,9 @@
package me.zhengjie.modules.quartz.task;
import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.attendance.domain.Attendance;
import me.zhengjie.modules.attendance.repository.AttendanceRepository;
import me.zhengjie.modules.constant.Constant;
@@ -20,6 +22,7 @@
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -29,7 +32,7 @@
 */
@Slf4j
@Component
@Async
@RequiredArgsConstructor
public class OapiDingTalkMethod {
    private final AttendanceRepository attendanceRepository;
@@ -42,13 +45,6 @@
    private final SysRosteringRepository sysRosteringRepository;
    public OapiDingTalkMethod(AttendanceRepository attendanceRepository, UserRepository userRepository, SysConfigHolidayRepository sysConfigHolidayRepository, OpaiDingTalkService opaiDingTalkService, SysRosteringRepository sysRosteringRepository) {
        this.attendanceRepository = attendanceRepository;
        this.userRepository = userRepository;
        this.sysConfigHolidayRepository = sysConfigHolidayRepository;
        this.opaiDingTalkService = opaiDingTalkService;
        this.sysRosteringRepository = sysRosteringRepository;
    }
    /**
     * 每天0点执行,新增用户考勤信息
@@ -62,32 +58,23 @@
        String todayDate = df.format(new Date());
        //查询节假日表是否有记录
        SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(todayDate);
           if(ObjectUtils.isEmpty(sysConfigHoliday)){
                //获取当前时间
                Calendar calTodayDay = Calendar.getInstance();
                calTodayDay.setTime(Timestamp.valueOf(todayDate + " 00:00:00"));
                //判断今天是否不是周末
                if (calTodayDay.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY || calTodayDay.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
                    DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
        //判断节假日表中是否有数据,没有就添加周一至周末范围的考勤记录(每天都更新考勤记录)
        if(ObjectUtils.isEmpty(sysConfigHoliday)){
                    //遍历在职员工向考勤记录添加数据
                    for (User user : userList){
                        //查询当前用户的排班
                        SysRostering sysRostering = sysRosteringRepository.findByRosId(user.getSysRostering().getId());
                        //查询考勤记录是否存在
                        Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), todayDate);
                        if (ObjectUtil.isEmpty(attendance)) {
                            attendance = new Attendance();
                //调用方法添加考勤记录
                Attendance attendance = setAttendance(user,todayDate,calTodayDay,sysConfigHoliday);
                attendanceRepository.save(attendance);
                        }
                        attendance.setUserId(user.getId());
                        Date date = df.parse(todayDate);
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        String today=sdf.format(date);
                        attendance.setAttendanceDate(Timestamp.valueOf(today));
                        attendance.setStartClockResults(Constant.ATTENDANCE_STATE_WAITFOR);
                        attendance.setEndClockResults(Constant.ATTENDANCE_STATE_WAITFOR);
                        attendance.setRosteringWorkStartTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(sysRostering.getWorkStartTime())));
                        attendance.setRosteringWorkEndTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(sysRostering.getWorkEndTime())));
                        attendance.setDateType(Constant.DATE_TYPE_WEEKDAY);
        }else{
            //节假日表有记录,假期类型为串休的也添加进考勤记录
            if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)){
                for(User user : userList){
                    //调用方法添加考勤记录
                    Attendance attendance = setAttendance(user,todayDate,calTodayDay,sysConfigHoliday);
                        attendanceRepository.save(attendance);
                    }
                }
@@ -95,42 +82,139 @@
    }
    /**
     * 中午12点30执行定时任务
     * set考勤记录
     */
    public Attendance setAttendance(User user,String todate,Calendar calTodayDay,SysConfigHoliday sysConfigHoliday) throws ParseException {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
        //查询当前用户的排班
        SysRostering sysRostering = sysRosteringRepository.findByRosId(user.getSysRostering().getId());
        //查询考勤记录是否存在
        Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), todate);
        if (ObjectUtil.isEmpty(attendance)) {
            attendance = new Attendance();
        }
        //添加记录
        attendance.setUserId(user.getId());
        Date date = df.parse(todate);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String today=sdf.format(date);
        attendance.setAttendanceDate(Timestamp.valueOf(today));
        //状态为等待
        attendance.setStartClockResults(Constant.ATTENDANCE_STATE_WAITFOR);
        attendance.setEndClockResults(Constant.ATTENDANCE_STATE_WAITFOR);
        if(calTodayDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && sysConfigHoliday == null || calTodayDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY && sysConfigHoliday == null){
            //双休
            attendance.setDateType(Constant.DATE_TYPE_WEEKEND);
        }else if(sysConfigHoliday != null){
            if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)){
                //串休
                attendance.setDateType(Constant.DATE_TYPE_HOLIDAYS);
            }
        }else{
            //工作日
            attendance.setDateType(Constant.DATE_TYPE_WEEKDAY);
        }
        attendance.setRosteringWorkStartTime(Timestamp.valueOf(todate + " " + dateTimeFormatter.format(sysRostering.getWorkStartTime())));
        attendance.setRosteringWorkEndTime(Timestamp.valueOf(todate + " " + dateTimeFormatter.format(sysRostering.getWorkEndTime())));
        return attendance;
    }
    /**
     * 中午12点30或凌晨02:30执行定时任务
     * @throws Exception
     */
    public void getDingTalkAttendanceListOfNoon() throws Exception {
    public void getDingTalkAttendanceListOfNoonOrNight() throws Exception {
        //获取当前执行定时任务的时间
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        String nowDate = sdf.format(new Date());
        //查询状态正常的员工
        List<User> userList = getUserList();
        //获取今天时间
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String todayDate = df.format(new Date());
        //获取昨天时间
        Calendar calYesterDay = Calendar.getInstance();
        calYesterDay.add(Calendar.DATE, -1);
        String yesterday = df.format(calYesterDay.getTime());
        //获取钉钉 Token
        OapiDingTalkAccessToken oapiDingTalkAccessToken = opaiDingTalkService.getAccessToken();
        // errcode = 0,表示正常返回
        if(0 == oapiDingTalkAccessToken.getErrcode()){
            //查询节假日表是否有记录
            SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(todayDate);
            //定时任务的执行时间大于12:30小于23:59为更新早上的打卡信息,获取今天的日期查询假期表是否有记录
            SysConfigHoliday sysConfigHoliday = null;
            //获取今天或昨天时间
            Calendar calDay = Calendar.getInstance();
            //标识
            Boolean day = false;
            if(sdf.parse(nowDate).compareTo(sdf.parse(Constant.DATE_TIME_NOON)) >= 0 && sdf.parse(nowDate).compareTo(sdf.parse(Constant.DATE_TIME_ONE)) < 0){
                sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(todayDate);
                calDay.setTime(Timestamp.valueOf(todayDate + " 00:00:00"));
                day = true;
            }else if(sdf.parse(nowDate).compareTo(sdf.parse(Constant.DATE_TIME_ONE)) > 0){
                sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(yesterday);
                calDay.setTime(Timestamp.valueOf(yesterday + " 00:00:00"));
            }
            //判断节假日表中是否有数据,没有就添加周一至周末范围的考勤记录(每天都更新考勤记录)
            if(ObjectUtils.isEmpty(sysConfigHoliday)){
                //获取当前时间
                Calendar calTodayDay = Calendar.getInstance();
                calTodayDay.setTime(Timestamp.valueOf(todayDate + " 00:00:00"));
                //判断今天是否不是周末
                if (calTodayDay.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY || calTodayDay.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
//                if (calTodayDay.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && calTodayDay.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
                    DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
                    //遍历在职员工向考勤记录添加数据
                    for (User user : userList) {
                    //调用方法,set考勤
                    Attendance attendance = setAttendanceNoonOrNight(user,day,todayDate,yesterday,oapiDingTalkAccessToken,sysConfigHoliday,calDay);
                    // 判断修改考勤状态
                    if(day){
                        attendance = updateRecord(user,attendance,todayDate);
                    }else{
                        attendance = updateRecord(user,attendance,yesterday);
                    }
                    attendanceRepository.save(attendance);
                }
            }else{
                //节假日表有记录,假期类型为串休的也添加进考勤记录
                if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)){
                    for(User user : userList){
                        //调用方法,set考勤
                        Attendance attendance = setAttendanceNoonOrNight(user,day,todayDate,yesterday,oapiDingTalkAccessToken,sysConfigHoliday,calDay);
                        // 判断修改考勤状态
                        if(day){
                            attendance = updateRecord(user,attendance,todayDate);
                        }else{
                            attendance = updateRecord(user,attendance,yesterday);
                        }
                        attendanceRepository.save(attendance);
                    }
                }
            }
        }else{
            throw new BadRequestException(oapiDingTalkAccessToken.getErrmsg());
        }
    }
    /**
     * set考勤记录
     */
    public Attendance setAttendanceNoonOrNight(User user,Boolean day,String todayDate, String yesterday,OapiDingTalkAccessToken oapiDingTalkAccessToken,SysConfigHoliday sysConfigHoliday,Calendar calDay) throws Exception {
                        //用户钉钉id
                        List<String> userDinDingList = new ArrayList<>();
                        userDinDingList.add(user.getDingding());
                        //查询当前用户的排班
                        SysRostering sysRostering = sysRosteringRepository.findByRosId(user.getSysRostering().getId());
                        //查询考勤记录是否存在
                        Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), todayDate);
                        //访问钉钉获取数据
        //钉钉数据
                        List<OapiDingTalkRecordResult> oapiDingTalkRecordResultList = new ArrayList<>();
        userDinDingList.add(user.getDingding());
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
        Attendance attendance = null;
        //查询考勤记录是否存在
        if(day){
            attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), todayDate);
                        oapiDingTalkRecordResultList = opaiDingTalkService.getAttendanceList(oapiDingTalkRecordResultList, oapiDingTalkAccessToken.getAccessToken(), todayDate + " 00:00:00", userDinDingList, 0l, 50l);
                        //判断钉钉是否获取到数据
                        if (oapiDingTalkRecordResultList.size() != 0) {
        }else{
            attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), yesterday);
            oapiDingTalkRecordResultList = opaiDingTalkService.getAttendanceList(oapiDingTalkRecordResultList, oapiDingTalkAccessToken.getAccessToken(), yesterday + " 00:00:00", userDinDingList, 0l, 50l);
        }
                            for (OapiDingTalkRecordResult oapiDingTalkRecordResult : oapiDingTalkRecordResultList) {
                                if ("NotSigned".equals(oapiDingTalkRecordResult.getTimeResult())) {
                                    oapiDingTalkRecordResult.setUserCheckTime(null);
@@ -141,58 +225,7 @@
                                    attendance.setStartClockResults(result);
                                    attendance.setStartLocationResults(setLocationResults(oapiDingTalkRecordResult.getLocationResult()));
                                    attendance.setActualWorkStartTime(oapiDingTalkRecordResult.getUserCheckTime());
                                }
                            }
                            attendanceRepository.save(attendance);
                            // 判断修改考勤状态
                            updateRecord(user,todayDate);
                        }
                    }
                }
            }
        }
    }
    /**
     * 晚上02:30定时任务
     */
    public void getDingTalkAttendanceListOfNight() throws Exception {
        //查询状态正常的员工
        List<User> userList = getUserList();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        //获取钉钉 Token
        OapiDingTalkAccessToken oapiDingTalkAccessToken = opaiDingTalkService.getAccessToken();
        // errcode = 0,表示正常返回
        if(0 == oapiDingTalkAccessToken.getErrcode()){
            //获取昨天时间
            Calendar calYesterDay = Calendar.getInstance();
            calYesterDay.add(Calendar.DATE, -1);
            String yesterday = df.format(calYesterDay.getTime());
            //查询节假日表是否有记录
            SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(yesterday);
            if(ObjectUtils.isEmpty(sysConfigHoliday)){
                //判断今天是否不是周末
                if (calYesterDay.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY || calYesterDay.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
                    DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
                    //遍历在职员工向考勤记录添加数据
                    for (User user : userList) {
                        //用户钉钉id
                        List<String> userDinDingList = new ArrayList<>();
                        userDinDingList.add(user.getDingding());
                        //查询当前用户的排班
                        SysRostering sysRostering = sysRosteringRepository.findByRosId(user.getSysRostering().getId());
                        //查询考勤记录是否存在
                        Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), yesterday);
                        //访问钉钉获取数据
                        List<OapiDingTalkRecordResult> oapiDingTalkRecordResultList = new ArrayList<>();
                        oapiDingTalkRecordResultList = opaiDingTalkService.getAttendanceList(oapiDingTalkRecordResultList, oapiDingTalkAccessToken.getAccessToken(), yesterday + " 00:00:00", userDinDingList, 0l, 50l);
                        //判断钉钉是否获取数据
                        if (oapiDingTalkRecordResultList.size() != 0) {
                            for (OapiDingTalkRecordResult oapiDingTalkRecordResult : oapiDingTalkRecordResultList) {
                                if ("NotSigned".equals(oapiDingTalkRecordResult.getTimeResult())) {
                                    oapiDingTalkRecordResult.setUserCheckTime(null);
                                }
                                if ("OffDuty".equals(oapiDingTalkRecordResult.getCheckType())) {
            }else if("OffDuty".equals(oapiDingTalkRecordResult.getCheckType())){
                                    //判断状态
                                    String result = ObjectUtils.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : Constant.ATTENDANCE_STATE_NORMAL;
                                    attendance.setEndClockResults(result);
@@ -200,15 +233,24 @@
                                    attendance.setActualWorkEndTime(oapiDingTalkRecordResult.getUserCheckTime());
                                }
                            }
                            attendanceRepository.save(attendance);
                            // 判断修改考勤状态
                            updateRecord(user,yesterday);
        //如果是周六或者周日,打卡状态为等待的话,就改状态为休息(oapiDingTalkRecordResultList为空的情况下)
        if(calDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY){
            //上午
            if(day && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) && !attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)){
                attendance.setStartClockResults(Constant.ATTENDANCE_STATE_REST);
                attendance.setStartLocationResults(Constant.LOCATION_RESULTS_REST);
                attendance.setActualWorkStartTime(null);
            }else if(!day && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR) && !attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)){
                attendance.setEndClockResults(Constant.ATTENDANCE_STATE_REST);
                attendance.setEndLocationResults(Constant.LOCATION_RESULTS_REST);
                attendance.setActualWorkEndTime(null);
                        }
                    }
        return attendance;
                }
            }
        }
    }
    /**
     * 判断返回位置状态
@@ -240,12 +282,13 @@
     * @param user
     * @param date
     */
    public void updateRecord(User user, String date){
    public Attendance updateRecord(User user, Attendance attendance, String date){
        //根据日期查询请假表
        //根据日期查询外出表
        //根据日期查询出差表
        return attendance;
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
@@ -111,13 +111,6 @@
        return new ResponseEntity<>(PageUtil.toPage(null,0),HttpStatus.OK);
    }
    @GetMapping(value = "/getUsers")
    @Log("查询在职的员工")
    @ApiOperation("查询在职的员工")
    public ResponseEntity<Object> getUsers() {
        return new ResponseEntity<>(userService.getUsers(), HttpStatus.OK);
    }
    @Log("新增用户")
    @ApiOperation("新增用户")
    @PostMapping
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java
@@ -123,9 +123,4 @@
     */
    void updateCenter(User resources);
    /**
     * 查询在职的员工
     * @return
     */
    List<User> getUsers();
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
@@ -233,15 +233,6 @@
        flushCache(username);
    }
    /**
     * 查询在职员工
     * @return
     */
    @Override
    public List<User> getUsers() {
        List<User> List = userRepository.findAllByEnabled(true);
        return List;
    }
    @Override
    public void download(List<UserDto> queryAll, HttpServletResponse response) throws IOException {
eladmin-web-master/src/utils/constant.js
@@ -41,6 +41,8 @@
export const DATE_TYPE_LEGAL_HOLIDAYS = 'date_type_legal_holid'
// 日期类型: 节假日(串休)
export const DATE_TYPE_HOLIDAYS = 'date_type_holidays'
// 日期类型: 双休
export const  DATE_TYPE_WEEKEND = 'date_type_weekend'
// 标准单价币种
export const STANDARD_UNIT_CURRENCY = 'standard_unit_currency'
@@ -99,6 +101,8 @@
export const ATTENDANCE_STATE_BUSINESS = 'attendance_state_business'
// 考勤状态: 请假
export const ATTENDANCE_STATE_LEAVE = 'attendance_state_leave'
// 考勤状态:休息
export const ATTENDANCE_STATE_REST = 'attendance_state_rest'
// 考勤位置状态
export const LOCATION_RESULTS = 'location_results'
@@ -108,6 +112,41 @@
export const LOCATION_RESULTS_OUTSIDE = 'location_results_outside'
// 考勤位置状态: 缺卡
export const LOCATION_RESULTS_NOTSIGNED = 'location_results_notSigned'
// 考勤位置状态: 休息
export const LOCATION_RESULTS_REST = 'location_results_rest'
// 请假状态
export const LEAVE_TYPE = 'leave_type'
// 请假状态: 年假
export const LEAVE_TYPE_ANNUAL_LEAVE = 'leave_type_annual_leave'
// 请假状态:事假
export const LEAVE_TYPE_COMPASSIONATE_LEAVE = 'leave_type_compassionate_leave'
// 请假状态: 病假
export const LEAVE_TYPE_SICk_leave = 'leave_type_sick_leave'
// 请假状态: 产假
export const LEAVE_TYPE_maternity_leave = 'leave_type_maternity_leave'
// 请假状态: 婚假
export const LEAVE_TYPE_marriage_holiday = 'leave_type_marriage_holiday'
// 请假状态: 丧假
export const LEAVE_TYPE_bereavement_leave = 'leave_type_bereavement_leave'
// 请假状态: 哺乳假
export const LEAVE_TYPE_lactation_leave = 'leave_type_lactation_leave'
// 请假审批状态
export const APPROVAL_STATUS = 'approval_status'
// 请假审批状态: 审核中
export const APPROVAL_STATUS_UNDER_APPROVAL = 'approval_status_under_approval'
// 请假审批状态:已通过
export const APPROVAL_STATUS_PASSED = 'approval_status_passed'
// 请假审批状态: 已退回
export const APPROVAL_STATUS_RETURNED = 'approval_status_returned'
// 请假时间单位
export const LEAVE_TIME_TYPE = 'leave_time_type'
// 请假时间单位: (小时)
export const LEAVE_TIME_TYPE_HOUR = 'leave_time_type_hour'
// 请假时间单位: (天)
export const LEAVE_TIME_TYPE_DAY = 'leave_time_type_day'
export default {
  CONFIG_PROPORTION_BASIC_WAGE,
@@ -131,6 +170,7 @@
  DATE_TYPE_WEEKDAY,
  DATE_TYPE_LEGAL_HOLIDAYS,
  DATE_TYPE_HOLIDAYS,
  DATE_TYPE_WEEKEND,
  STANDARD_UNIT_CURRENCY,
  STANDARD_UNIT_CURRENCY_RENMINBI,
  STANDARD_UNIT_CURRENCY_DOLLAR,
@@ -157,8 +197,25 @@
  ATTENDANCE_STATE_GOOUT,
  ATTENDANCE_STATE_BUSINESS,
  ATTENDANCE_STATE_LEAVE,
  ATTENDANCE_STATE_REST,
  LOCATION_RESULTS,
  LOCATION_RESULTS_NORMAL,
  LOCATION_RESULTS_OUTSIDE,
  LOCATION_RESULTS_NOTSIGNED
  LOCATION_RESULTS_NOTSIGNED,
  LOCATION_RESULTS_REST,
  LEAVE_TYPE,
  LEAVE_TYPE_ANNUAL_LEAVE,
  LEAVE_TYPE_COMPASSIONATE_LEAVE,
  LEAVE_TYPE_SICk_leave,
  LEAVE_TYPE_maternity_leave,
  LEAVE_TYPE_marriage_holiday,
  LEAVE_TYPE_bereavement_leave,
  LEAVE_TYPE_lactation_leave,
  APPROVAL_STATUS,
  APPROVAL_STATUS_UNDER_APPROVAL,
  APPROVAL_STATUS_PASSED,
  APPROVAL_STATUS_RETURNED,
  LEAVE_TIME_TYPE,
  LEAVE_TIME_TYPE_HOUR,
  LEAVE_TIME_TYPE_DAY
}
eladmin-web-master/src/views/attendance/attendance/index.vue
@@ -3,7 +3,7 @@
    <!--工具栏-->
    <div class="head-container">
      <div>
        <el-select v-model="query.userId" filterable clearable placeholder="请选择员工" style="width: 170px;" class="filter-item" @keyup.enter.native="crud.toQuery">
        <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"
@@ -18,7 +18,7 @@
          value-format="yyyy-MM-dd"
          placeholder="请选择日期"
        />
        <el-select v-model="query.startLocationResults" filterable clearable placeholder="请选择开始位置结果" style="width: 170px;" class="filter-item" @keyup.enter.native="crud.toQuery">
        <el-select v-model="query.startLocationResults" filterable clearable placeholder="请选择开始位置结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[lacationResules]"
            :key="item.value"
@@ -26,7 +26,7 @@
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.startClockResults" filterable clearable placeholder="请选择开始打卡结果" style="width: 170px;" class="filter-item" @keyup.enter.native="crud.toQuery">
        <el-select v-model="query.startClockResults" filterable clearable placeholder="请选择开始打卡结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[attendanceState]"
            :key="item.value"
@@ -34,7 +34,7 @@
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.endLocationResults" filterable clearable placeholder="请选择结束位置结果" style="width: 170px;" class="filter-item" @keyup.enter.native="crud.toQuery">
        <el-select v-model="query.endLocationResults" filterable clearable placeholder="请选择结束位置结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[lacationResules]"
            :key="item.value"
@@ -42,7 +42,7 @@
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.endClockResults" filterable clearable placeholder="请选择结束打卡结果" style="width: 170px;" class="filter-item" @keyup.enter.native="crud.toQuery">
        <el-select v-model="query.endClockResults" filterable clearable placeholder="请选择结束打卡结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[attendanceState]"
            :key="item.value"
@@ -56,39 +56,132 @@
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px">
          <el-form-item label="员工" prop="userId">
            <el-select v-model="form.userId" clearable filterable placeholder="请选择" @change="getRosteTime(form)" style="width: 310px;">
              <el-option
                v-for="item in users"
                :key="item.id"
                :label="item.nickName"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="考勤日期" prop="attendanceDate">
            <el-input v-model="form.attendanceDate" style="width: 370px;" />
            <el-date-picker v-model="form.attendanceDate" style="width: 310px;" type="date" placeholder="选择日期" @change="getRosteTime(form)" />
          </el-form-item>
          <el-form-item label="排班工作开始时间" prop="rosteringWorkStartTime">
            <el-input v-model="form.rosteringWorkStartTime" style="width: 370px;" />
            <el-date-picker
              v-model="form.rosteringWorkStartTime"
              type="datetime"
              placeholder="选择日期时间"
              style="width: 310px;"
              value-format="yyyy-MM-dd HH:mm:ss"
              align="right"
              :picker-options="{ disabledDate(time) {
                return form.rosteringWorkEndTime ? time.getTime() > new Date(form.rosteringWorkEndTime).getTime() - 8.64e7 : false;
              }
              }"
              default-time="09:00:00"
            />
          </el-form-item>
          <el-form-item label="实际工作开始时间" prop="actualWorkStartTime">
            <el-input v-model="form.actualWorkStartTime" style="width: 370px;" />
            <el-date-picker
              v-model="form.actualWorkStartTime"
              type="datetime"
              placeholder="选择日期时间"
              style="width: 310px;"
              value-format="yyyy-MM-dd HH:mm:ss"
              align="right"
              :picker-options="{ disabledDate(time) {
                return form.actualWorkEndTime ? time.getTime() > new Date(form.actualWorkEndTime).getTime() - 8.64e7 : false;
              }
              }"
              default-time="09:00:00"
            />
          </el-form-item>
          <el-form-item label="开始位置结果" prop="startLocationResults">
            <el-input v-model="form.startLocationResults" style="width: 370px;" />
            <el-select v-model="form.startLocationResults" style="width: 310px;">
              <el-option
                v-for="item in dict[lacationResules]"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="开始打卡结果" prop="startClockResults">
            <el-input v-model="form.startClockResults" style="width: 370px;" />
            <el-select v-model="form.startClockResults" style="width: 310px;">
              <el-option
                v-for="item in dict[attendanceState]"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="排班工作结束时间" prop="rosteringWorkEndTime">
            <el-input v-model="form.rosteringWorkEndTime" style="width: 370px;" />
            <el-date-picker
              v-model="form.rosteringWorkEndTime"
              type="datetime"
              placeholder="选择日期时间"
              style="width: 310px;"
              value-format="yyyy-MM-dd HH:mm:ss"
              align="right"
              :picker-options="{ disabledDate(time) {
              return form.rosteringWorkStartTime ? time.getTime() < new Date(form.rosteringWorkStartTime).getTime() - 8.64e7 : false;
              }
              }"
              default-time="18:00:00"
            />
          </el-form-item>
          <el-form-item label="实际工作结束时间" prop="actualWorkEndTime">
            <el-input v-model="form.actualWorkEndTime" style="width: 370px;" />
            <el-date-picker
              v-model="form.actualWorkEndTime"
              type="datetime"
              placeholder="选择日期时间"
              style="width: 310px;"
              value-format="yyyy-MM-dd HH:mm:ss"
              align="right"
              :picker-options="{ disabledDate(time) {
              return form.actualWorkStartTime ? time.getTime() < new Date(form.actualWorkStartTime).getTime() - 8.64e7 : false;
              }
              }"
              default-time="18:00:00"
            />
          </el-form-item>
          <el-form-item label="结束位置结果" prop="endLocationResults">
            <el-input v-model="form.endLocationResults" style="width: 370px;" />
            <el-select v-model="form.endLocationResults" style="width: 310px;">
              <el-option
                v-for="item in dict[lacationResules]"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="结束打卡结果" prop="endClockResults">
            <el-input v-model="form.endClockResults" style="width: 370px;" />
            <el-select v-model="form.endClockResults" style="width: 310px;">
              <el-option
                v-for="item in dict[attendanceState]"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="日期类型" prop="dateType">
            <el-input v-model="form.dateType" style="width: 370px;" />
            <el-select v-model="form.dateType" style="width: 310px;">
              <el-option
                v-for="item in dict[dateType]"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="备注">
            <el-input v-model="form.remarks" type="textarea" rows="3" maxlength="1000" style="width: 370px;" />
            <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 310px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
@@ -99,53 +192,57 @@
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="userName" label="员工" show-overflow-tooltip />
        <el-table-column prop="attendanceDate" label="考勤日期" show-overflow-tooltip>
        <el-table-column prop="userName" label="员工" fixed="left" width="80px" show-overflow-tooltip />
        <el-table-column prop="attendanceDate" label="考勤日期" fixed="left" width="100px" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ crud.toDate(scope.row.attendanceDate) }}
          </template>
        </el-table-column>
        <el-table-column prop="rosteringWorkStartTime" min-width="150" label="排班工作开始时间" show-overflow-tooltip />
        <el-table-column prop="actualWorkStartTime" min-width="150" label="实际工作开始时间" show-overflow-tooltip />
        <el-table-column prop="startLocationResults" label="开始位置结果" show-overflow-tooltip>
        <el-table-column prop="rosteringWorkStartTime" min-width="120" label="排班工作开始时间" show-overflow-tooltip />
        <el-table-column prop="actualWorkStartTime" min-width="120" label="实际工作开始时间" show-overflow-tooltip />
        <el-table-column prop="startLocationResults" min-width="100" label="开始位置结果" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag v-if="scope.row.startLocationResults === 'location_results_normal'" type="success">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.startLocationResults === 'location_results_outside'" type="warning">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.startLocationResults === 'location_results_notSigned'" type="danger">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.startLocationResults === dictlocationResultsNormal" type="success">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.startLocationResults === dictlocationResultsOutside" type="warning">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.startLocationResults === dictlocationResultsNotSigned" type="danger">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.startLocationResults === dictlocationResultsRest" type="warning">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="startClockResults" label="开始打卡结果" show-overflow-tooltip>
        <el-table-column prop="startClockResults" min-width="120" label="开始打卡结果" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag v-if="scope.row.startClockResults === 'attendance_state_waitFor'" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === 'attendance_state_normal'" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === 'attendance_state_notSigned'" type="danger">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === 'attendance_state_goOut'" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === 'attendance_state_business'" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === 'attendance_state_leave'" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === dictAttendanceStateWaitFor" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === dictAttendanceStateNormal" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === dictAttendanceStateNotSigned" type="danger">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === dictAttendanceStateGoOut" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === dictAttendanceStateBusiness" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === dictAttendanceStateLeave" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
            <el-tag v-if="scope.row.startClockResults === dictAttendanceStateRest" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="rosteringWorkEndTime" min-width="150" label="排班工作结束时间" show-overflow-tooltip />
        <el-table-column prop="actualWorkEndTime" min-width="150" label="实际工作结束时间" show-overflow-tooltip />
        <el-table-column prop="endLocationResults" label="结束位置结果" show-overflow-tooltip>
        <el-table-column prop="rosteringWorkEndTime" min-width="120" label="排班工作结束时间" show-overflow-tooltip />
        <el-table-column prop="actualWorkEndTime" min-width="120" label="实际工作结束时间" show-overflow-tooltip />
        <el-table-column prop="endLocationResults" min-width="100" label="结束位置结果" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag v-if="scope.row.endLocationResults === 'location_results_normal'" type="success">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.endLocationResults === 'location_results_outside'" type="warning">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.endLocationResults === 'location_results_notSigned'" type="danger">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.endLocationResults === dictlocationResultsNormal" type="success">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.endLocationResults === dictlocationResultsOutside" type="warning">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.endLocationResults === dictlocationResultsNotSigned" type="danger">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
            <el-tag v-if="scope.row.endLocationResults === dictlocationResultsRest" type="warning">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="endClockResults" label="结束打卡结果" show-overflow-tooltip>
        <el-table-column prop="endClockResults" min-width="120" label="结束打卡结果" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag v-if="scope.row.endClockResults === 'attendance_state_waitFor'" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === 'attendance_state_normal'" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === 'attendance_state_notSigned'" type="danger">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === 'attendance_state_goOut'" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === 'attendance_state_business'" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === 'attendance_state_leave'" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === dictAttendanceStateWaitFor" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === dictAttendanceStateNormal" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === dictAttendanceStateNotSigned" type="danger">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === dictAttendanceStateGoOut" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === dictAttendanceStateBusiness" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === dictAttendanceStateLeave" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
            <el-tag v-if="scope.row.endClockResults === dictAttendanceStateRest" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="dateType" label="日期类型" show-overflow-tooltip>
        <el-table-column prop="dateType" min-width="100" label="日期类型" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ dict.label[dateType][scope.row.dateType] }}
            <el-tag>{{ dict.label[dateType][scope.row.dateType] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="createTime" label="创建时间" min-width="150" show-overflow-tooltip />
@@ -166,7 +263,7 @@
<script>
import crudAttendance from '@/api/attendance/attendance'
import { getUsers } from '@/api/system/user'
import crudUser from '@/api/system/user'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
@@ -194,7 +291,7 @@
      },
      rules: {
        userId: [
          { required: true, message: '用户ID 外键不能为空', trigger: 'blur' }
          { required: true, message: '员工不能为空', trigger: 'change' }
        ],
        attendanceDate: [
          { required: true, message: '考勤日期不能为空', trigger: 'blur' }
@@ -202,29 +299,11 @@
        rosteringWorkStartTime: [
          { required: true, message: '排班工作开始时间不能为空', trigger: 'blur' }
        ],
        actualWorkStartTime: [
          { required: true, message: '实际工作开始时间不能为空', trigger: 'blur' }
        ],
        startLocationResults: [
          { required: true, message: '开始位置结果不能为空', trigger: 'blur' }
        ],
        startClockResults: [
          { required: true, message: '开始打卡结果不能为空', trigger: 'blur' }
        ],
        rosteringWorkEndTime: [
          { required: true, message: '排班工作结束时间不能为空', trigger: 'blur' }
        ],
        actualWorkEndTime: [
          { required: true, message: '实际工作结束时间不能为空', trigger: 'blur' }
        ],
        endLocationResults: [
          { required: true, message: '结束位置结果不能为空', trigger: 'blur' }
        ],
        endClockResults: [
          { required: true, message: '结束打卡结果不能为空', trigger: 'blur' }
        ],
        dateType: [
          { required: true, message: '日期类型不能为空', trigger: 'blur' }
          { required: true, message: '日期类型不能为空', trigger: 'change' }
        ],
        createBy: [
          { required: true, message: '创建者不能为空', trigger: 'blur' }
@@ -236,21 +315,40 @@
      attendanceState: constant.ATTENDANCE_STATE,
      lacationResules: constant.LOCATION_RESULTS,
      dateType: constant.DATE_TYPE,
      dictlocationResultsNormal: constant.LOCATION_RESULTS_NORMAL,
      dictlocationResultsOutside: constant.LOCATION_RESULTS_OUTSIDE,
      dictlocationResultsNotSigned: constant.LOCATION_RESULTS_NOTSIGNED,
      dictlocationResultsRest: constant.LOCATION_RESULTS_REST,
      dictAttendanceStateWaitFor: constant.ATTENDANCE_STATE_WAITFOR,
      dictAttendanceStateNormal: constant.ATTENDANCE_STATE_NORMAL,
      dictAttendanceStateNotSigned: constant.ATTENDANCE_STATE_NOTSIGNED,
      dictAttendanceStateGoOut: constant.ATTENDANCE_STATE_GOOUT,
      dictAttendanceStateBusiness: constant.ATTENDANCE_STATE_BUSINESS,
      dictAttendanceStateLeave: constant.ATTENDANCE_STATE_LEAVE,
      dictAttendanceStateRest: constant.ATTENDANCE_STATE_REST,
      users: [] }
  },
  created() {
    this.getUsers()
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      this.getUsers()
      return true
    },
    // 查询在职员工
    // 查询员工
    getUsers() {
      getUsers().then(res => {
      crudUser.getAll().then(res => {
        this.users = res
      })
    },
    // 获取表格上下班排班时间
    getRosteTime(data){
      if(data.userId !== null && data.attendanceDate !== null) {
        // 根据用户id查询排班时间
        crudUser.getAll({id: data.userId}).then(res => {
            this.form.rosteringWorkStartTime = new Date(this.crud.toDate(data.attendanceDate) + ' ' + res[0].sysRostering.workStartTime)
            this.form.rosteringWorkEndTime = new Date(this.crud.toDate(data.attendanceDate) + ' ' + res[0].sysRostering.workEndTime)
        })
      }
    }
  }
}