| | |
| | | |
| | | @PostMapping(value = "/getYearTimeLength") |
| | | @Log("获取年假时长") |
| | | @ApiOperation("计算请假时长") |
| | | public ResponseEntity<Object> getYearTimeLength() throws ParseException { |
| | | return new ResponseEntity<>(attendanceLeaveService.getYearTimeLength(), HttpStatus.OK); |
| | | @ApiOperation("获取年假时长") |
| | | public ResponseEntity<Object> getYearTimeLength(@RequestBody Long userId) throws ParseException { |
| | | return new ResponseEntity<>(attendanceLeaveService.getYearTimeLength(userId), HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping(value = "/approve") |
| | |
| | | * @return |
| | | * @throws ParseException |
| | | */ |
| | | Double getYearTimeLength() throws ParseException; |
| | | Double getYearTimeLength(Long userId) throws ParseException; |
| | | |
| | | /** |
| | | * 审核功能 |
| | |
| | | String bussStartTime = df.format(resources.getTravelStartTime()); |
| | | String bussEndTime = df.format(resources.getTravelEndTime()); |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(bussStartTime, bussEndTime); |
| | | // 验证请假时间是否冲突 |
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.checkCreateTime(bussStartTime,bussEndTime, SecurityUtils.getCurrentUserId()); |
| | | repeatValidation(bussStartTime, bussEndTime, resources.getUserId()); |
| | | // 验证出差时间是否冲突 |
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.checkCreateTime(bussStartTime,bussEndTime, resources.getUserId()); |
| | | if(attendanceBusinessTravelList.size() > 0){ |
| | | AttendanceBusinessTravel errorSysAskForLeave = attendanceBusinessTravelList.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
| | |
| | | + "已经存在出差记录,请调整时间"); |
| | | }else { |
| | | // 获取当前登陆人信息,设置为请假发起人 |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | List<String> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | | // 查询节假日 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll(); |
| | |
| | | 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()); |
| | | // 验证是否存在时间冲突的请假记录 |
| | | Set<Long> ids = new HashSet<>(); |
| | | ids.add(attendanceBusinessTravel.getId()); |
| | |
| | | attendanceBusinessTravelRepository.deleteById(id); |
| | | } |
| | | // 获取当前登陆人信息,设置为请假发起人 |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | List<String> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | | // 查询节假日 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll(); |
| | |
| | | * @param buStartTime |
| | | * @param buEndTime |
| | | */ |
| | | public void repeatValidation(String buStartTime, String buEndTime){ |
| | | public void repeatValidation(String buStartTime, String buEndTime, Long userId){ |
| | | //查询用户的排班时间 |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | User user = userRepository.getOne(userId); |
| | | buStartTime = buStartTime.substring(0,10) + " " + user.getSysRostering().getWorkStartTime().toString() + ":00"; |
| | | buEndTime = buEndTime.substring(0,10) + " " + user.getSysRostering().getWorkEndTime().toString() + ":00"; |
| | | // 查询请假表(时单位) |
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.checkCreateLeaveTime(buStartTime,buEndTime, SecurityUtils.getCurrentUserId()); |
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.checkCreateLeaveTime(buStartTime,buEndTime, userId); |
| | | if(attendanceLeaveList.size() > 0){ |
| | | AttendanceLeave errorSysAskForLeave = attendanceLeaveList.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
| | |
| | | + "已经存在请假记录,请调整时间"); |
| | | } |
| | | // 查询外出表 |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.checkCreateTime(buStartTime, buEndTime, SecurityUtils.getCurrentUserId()); |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.checkCreateTime(buStartTime, buEndTime, userId); |
| | | if(attendanceGoOutList.size() > 0){ |
| | | AttendanceGoOut errorSysAskForLeave = attendanceGoOutList.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
| | |
| | | String goStartTime = df.format(resources.getOutStartTime()); |
| | | String goEndTime = df.format(resources.getOutEndTime()); |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(goStartTime, goEndTime); |
| | | repeatValidation(goStartTime, goEndTime, resources.getUserId()); |
| | | // 验证请假时间是否冲突 |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.checkCreateTime(goStartTime, goEndTime, SecurityUtils.getCurrentUserId()); |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.checkCreateTime(goStartTime, goEndTime, resources.getUserId()); |
| | | if(attendanceGoOutList.size() > 0){ |
| | | AttendanceGoOut errTime = attendanceGoOutList.get(0); |
| | | //LocalDateTime转换为Date |
| | |
| | | + "已经存在外出记录,请调整时间"); |
| | | }else { |
| | | // 获取当前登陆人信息,设置为请假发起人 |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | List<String> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | | // 查询节假日 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll(); |
| | |
| | | String goStartTime = df.format(resources.getOutStartTime()); |
| | | String goEndTime = df.format(resources.getOutEndTime()); |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(goStartTime, goEndTime); |
| | | repeatValidation(goStartTime, goEndTime, resources.getUserId()); |
| | | // 验证是否存在时间冲突的请假记录 |
| | | Set<Long> ids = new HashSet<>(); |
| | | ids.add(attendanceGoOut.getId()); |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.checkCreateUpdateTime(goStartTime, goEndTime, SecurityUtils.getCurrentUserId(), ids); |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.checkCreateUpdateTime(goStartTime, goEndTime, resources.getUserId(), ids); |
| | | if(attendanceGoOutList.size() > 0){ |
| | | AttendanceGoOut errorSysAskForLeave = attendanceGoOutList.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
| | |
| | | attendanceGoOutRepository.deleteById(id); |
| | | } |
| | | // 获取当前登陆人信息,设置为请假发起人 |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | List<String> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | | // 查询节假日 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll(); |
| | |
| | | * @param goStartTime |
| | | * @param goEndTime |
| | | */ |
| | | public void repeatValidation(String goStartTime, String goEndTime){ |
| | | public void repeatValidation(String goStartTime, String goEndTime, Long userId){ |
| | | // 查询请假表(时单位) |
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.checkCreateLeaveTime(goStartTime,goEndTime, SecurityUtils.getCurrentUserId()); |
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.checkCreateLeaveTime(goStartTime,goEndTime, userId); |
| | | if(attendanceLeaveList.size() > 0){ |
| | | AttendanceLeave errorSysAskForLeave = attendanceLeaveList.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
| | |
| | | + "已经存在请假记录,请调整时间"); |
| | | } |
| | | // 查询出差表 |
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.checkCreateTime(goStartTime.substring(0,10),goEndTime.substring(0,10), SecurityUtils.getCurrentUserId()); |
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.checkCreateTime(goStartTime.substring(0,10),goEndTime.substring(0,10), userId); |
| | | if(attendanceBusinessTravelList.size() > 0){ |
| | | AttendanceBusinessTravel errorSysAskForLeave = attendanceBusinessTravelList.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
| | |
| | | // 如果按天为单位请假拼接请假时间的时分秒,取上下班基准时间 |
| | | if(resources.getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_DAY)){ |
| | | //查询用户的排班时间 |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | LeaStartTime = LeaStartTime.substring(0,10) + " " + user.getSysRostering().getWorkStartTime().toString() + ":00"; |
| | | LeaEndTime = LeaEndTime.substring(0,10) + " " + user.getSysRostering().getWorkEndTime().toString() + ":00"; |
| | | } |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(LeaStartTime, LeaEndTime); |
| | | repeatValidation(LeaStartTime, LeaEndTime, resources.getUserId()); |
| | | // 验证请假时间是否冲突 |
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.checkCreateLeaveTime(LeaStartTime,LeaEndTime, SecurityUtils.getCurrentUserId()); |
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.checkCreateLeaveTime(LeaStartTime,LeaEndTime, resources.getUserId()); |
| | | if(attendanceLeaveList.size() > 0){ |
| | | AttendanceLeave errTime = attendanceLeaveList.get(0); |
| | | //LocalDateTime转换为Date |
| | |
| | | + "已经存在请假记录,请调整时间"); |
| | | }else { |
| | | // 获取当前登陆人信息,设置为请假发起人 |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | List<String> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | | // 查询节假日 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll(); |
| | |
| | | // 如果按天为单位请假拼接请假时间的时分秒,取上下班基准时间 |
| | | if(resources.getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_DAY)){ |
| | | //查询用户的排班时间 |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | LeaStartTime = LeaStartTime.substring(0,10) + " " + user.getSysRostering().getWorkStartTime().toString() + ":00"; |
| | | LeaEndTime = LeaEndTime.substring(0,10) + " " + user.getSysRostering().getWorkEndTime().toString() + ":00"; |
| | | } |
| | | // 查询其他状态的表是否有重复 |
| | | repeatValidation(LeaStartTime, LeaEndTime); |
| | | repeatValidation(LeaStartTime, LeaEndTime, resources.getUserId()); |
| | | // 验证是否存在时间冲突的请假记录 |
| | | Set<Long> ids = new HashSet<>(); |
| | | ids.add(attendanceLeave.getId()); |
| | |
| | | attendanceLeaveRepository.deleteById(id); |
| | | } |
| | | // 获取当前登陆人信息,设置为请假发起人 |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | List<String> holiday = new ArrayList<>(), isWork = new ArrayList<>(); |
| | | // 查询节假日 |
| | | List<SysConfigHoliday> sysConfigHolidayList = sysConfigHolidayRepository.findAll(); |
| | |
| | | * 验证其他状态的表是否有重复 |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param userId |
| | | */ |
| | | public void repeatValidation(String startTime, String endTime){ |
| | | public void repeatValidation(String startTime, String endTime, Long userId){ |
| | | // 查询外出表 |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.checkCreateTime(startTime, endTime, SecurityUtils.getCurrentUserId()); |
| | | List<AttendanceGoOut> attendanceGoOutList = attendanceGoOutRepository.checkCreateTime(startTime, endTime, userId); |
| | | if(attendanceGoOutList.size() > 0){ |
| | | AttendanceGoOut errorSysAskForLeave = attendanceGoOutList.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
| | |
| | | + "已经存在外出记录,请调整时间"); |
| | | } |
| | | // 查询出差表 |
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.checkCreateTime(startTime.substring(0,10),endTime.substring(0,10), SecurityUtils.getCurrentUserId()); |
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.checkCreateTime(startTime.substring(0,10),endTime.substring(0,10), userId); |
| | | if(attendanceBusinessTravelList.size() > 0){ |
| | | AttendanceBusinessTravel errorSysAskForLeave = attendanceBusinessTravelList.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
| | |
| | | * 获取用户年假剩余时长 |
| | | */ |
| | | @Override |
| | | public Double getYearTimeLength() throws ParseException { |
| | | public Double getYearTimeLength(Long userId) throws ParseException { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 获取当前日期 |
| | | Date date = new Date(); |
| | |
| | | Date dateTime = sdf.parse(nowTime); |
| | | Double surplusYearTime = new Double(0.00); |
| | | // 查询用户剩余年假时长 |
| | | List<SysUserLevelOther> sysUserLevelOtherList = sysUserLevelOtherRepository.findByUserId(SecurityUtils.getCurrentUserId()); |
| | | List<SysUserLevelOther> sysUserLevelOtherList = sysUserLevelOtherRepository.findByUserId(userId); |
| | | for(SysUserLevelOther sysUserLevelOther : sysUserLevelOtherList){ |
| | | if(ObjectUtils.isNotEmpty(sysUserLevelOther.getStartDate()) && ObjectUtils.isNotEmpty(sysUserLevelOther.getEndDate())){ |
| | | Date dateStart = new Date(sysUserLevelOther.getStartDate().getTime()); |
| | | Date dateEnd = new Date(sysUserLevelOther.getEndDate().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){ |
| | | 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); |
| | | //已使用年假时长 |
| | |
| | | Double usedYearTime = attendanceLeaveRepository.getSurplusYearTime(sysUserLevelOther.getUserId(),startTime,endTime); |
| | | //剩余年假 |
| | | surplusYearTime = yearTime - (usedYearTime == null ? 0.0 : usedYearTime); |
| | | } |
| | | } |
| | | } |
| | | return surplusYearTime; |
| | |
| | | }) |
| | | } |
| | | |
| | | export function getYearTimeLength() { |
| | | export function getYearTimeLength(data) { |
| | | return request({ |
| | | url: 'api/attendanceLeave/getYearTimeLength', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="申请用户" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="userRolesLevelMin == roleLevelOrdinary"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批用户" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择审批员工" style="width: 370px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | |
| | | 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' |
| | |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '用户id不能为空', trigger: 'blur' } |
| | | { required: true, message: '用户不能为空', trigger: 'blur' } |
| | | ], |
| | | approvalUserId: [ |
| | | { required: true, message: '审批用户id不能为空', trigger: 'blur' } |
| | | { required: true, message: '审批用户不能为空', trigger: 'blur' } |
| | | ], |
| | | travelStartTime: [ |
| | | { required: true, message: '出差开始时间不能为空', trigger: 'blur' } |
| | |
| | | dictLeaveTimeTypeDay: constant.LEAVE_TIME_TYPE_DAY, |
| | | dictLeaveTimeType: constant.LEAVE_TIME_TYPE, |
| | | makeUpCardVisible: false, |
| | | successLoading: false } |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'user' |
| | | ]) |
| | | }, |
| | | created() { |
| | | this.getUsers() |
| | |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | return true |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 判断用户最大角色级别是否是角色级别:普通用户 |
| | | if (this.userRolesLevelMin === this.roleLevelOrdinary) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="申请人" prop="userId"> |
| | | <el-select v-model="form.userId" clearable filterable placeholder="请选择申请人" style="width: 310px;"> |
| | | <el-form-item label="申请用户" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="userRolesLevelMin == roleLevelOrdinary"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批者" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" clearable filterable placeholder="请选择审批者" style="width: 310px;"> |
| | | <el-select v-model="form.approvalUserId" clearable filterable placeholder="请选择审批者" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | v-model="form.cardReplacementTime" |
| | | type="datetime" |
| | | placeholder="选择补卡时间" |
| | | style="width: 310px;" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | default-time="09:00:00" |
| | |
| | | import crudAttendanceCardreplacement from '@/api/attendance/attendanceCardreplacement' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import crudUser from '@/api/system/user' |
| | | import { mapGetters } from 'vuex' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | |
| | | dictCardApproveStatusReviewed: constant.CARD_APPROVE_STATUS_REVIEWED, |
| | | dictCardApproveStatusAgree: constant.CARD_APPROVE_STATUS_AGREE, |
| | | dictCardApproveStatusRefuse: constant.CARD_APPROVE_STATUS_REFUSE, |
| | | dictCardReplacement: constant.CARD_REPLACEMENT_DIFFERENTIATION } |
| | | dictCardReplacement: constant.CARD_REPLACEMENT_DIFFERENTIATION, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'user' |
| | | ]) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | this.getUsers() |
| | | return true |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 判断用户最大角色级别是否是角色级别:普通用户 |
| | | if (this.userRolesLevelMin === this.roleLevelOrdinary) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="申请用户" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="userRolesLevelMin == roleLevelOrdinary"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批员工" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择审批员工" style="width: 370px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | |
| | | 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' |
| | |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '用户id不能为空', trigger: 'change' } |
| | | { required: true, message: '用户不能为空', trigger: 'change' } |
| | | ], |
| | | approvalUserId: [ |
| | | { required: true, message: '审批用户id不能为空', trigger: 'change' } |
| | | { required: true, message: '审批用户不能为空', trigger: 'change' } |
| | | ], |
| | | outStartTime: [ |
| | | { required: true, message: '外出开始时间不能为空', trigger: 'change' } |
| | |
| | | dictGoOutAgree: constant.GO_OUT_APPROVE_STATUS_AGREE, |
| | | dictGoOutReturn: constant.GO_OUT_APPROVE_STATUS_REFUSE, |
| | | makeUpCardVisible: false, |
| | | successLoading: false } |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'user' |
| | | ]) |
| | | }, |
| | | created() { |
| | | this.getUsers() |
| | |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | return true |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 判断用户最大角色级别是否是角色级别:普通用户 |
| | | if (this.userRolesLevelMin === this.roleLevelOrdinary) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="申请用户" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="userRolesLevelMin == roleLevelOrdinary" @change="checkLeaveTime"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批员工" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择审批员工" style="width: 370px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | |
| | | <script> |
| | | import crudAttendanceLeave from '@/api/attendance/attendanceLeave' |
| | | import crudUser from '@/api/system/user' |
| | | import { mapGetters } from 'vuex' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | |
| | | download: ['admin', 'attendanceLeave:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '申请用户不能为空', trigger: 'change' } |
| | | ], |
| | | approvalUserId: [ |
| | | { required: true, message: '审批用户ID不能为空', trigger: 'change' } |
| | | { required: true, message: '审批用户不能为空', trigger: 'change' } |
| | | ], |
| | | leaveType: [ |
| | | { required: true, message: '请假类型不能为空', trigger: 'change' } |
| | |
| | | dictLeaveTimeTypeDay: constant.LEAVE_TIME_TYPE_DAY, |
| | | yearTimeLenght: null, |
| | | makeUpCardVisible: false, |
| | | successLoading: false } |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'user' |
| | | ]) |
| | | }, |
| | | created() { |
| | | this.getUsers() |
| | | this.getUserTimes() |
| | | // this.getUserTimes() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | return true |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 判断用户最大角色级别是否是角色级别:普通用户 |
| | | if (this.userRolesLevelMin === this.roleLevelOrdinary) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | }, |
| | | // 钩子:在编辑之前执行 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | this.getUserTimes() |
| | | }, |
| | | // [CRUD.HOOK.beforeToEdit]() { |
| | | // this.getUserTimes() |
| | | // }, |
| | | // 钩子:在提交表单之后执行 |
| | | [CRUD.HOOK.afterSubmit]() { |
| | | this.getUserTimes() |
| | | }, |
| | | // [CRUD.HOOK.afterSubmit]() { |
| | | // this.getUserTimes() |
| | | // }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | |
| | | if (this.form.leaveType == null || this.form.leaveStartTime == null || this.form.leaveEndTime == null) { |
| | | return |
| | | } |
| | | // 获取年假剩余时长 |
| | | crudAttendanceLeave.getYearTimeLength((this.form.userId == null ? 1 : this.form.userId)).then(res => { |
| | | console.log(res) |
| | | this.yearTimeLenght = res |
| | | }) |
| | | // 通过后台计算时长 |
| | | var data = JSON.stringify({ |
| | | 'leaveType': this.form.leaveType, |
| | |
| | | }) |
| | | }, |
| | | // 查询员工剩余年假时长 |
| | | getUserTimes() { |
| | | crudAttendanceLeave.getYearTimeLength().then(res => { |
| | | console.log(res) |
| | | this.yearTimeLenght = res |
| | | }) |
| | | }, |
| | | // getUserTimes() { |
| | | // crudAttendanceLeave.getYearTimeLength().then(res => { |
| | | // console.log(res) |
| | | // this.yearTimeLenght = res |
| | | // }) |
| | | // }, |
| | | // 审批页面赋值 |
| | | toApprove(data) { |
| | | this.makeUpCardVisible = true |