Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into zhaoss
10 files added
11 files modified
| | |
| | | */ |
| | | String blurry() default ""; |
| | | |
| | | //wcd加 |
| | | String isOr() default ""; |
| | | // |
| | | |
| | | enum Type { |
| | | // jie 2019/6/4 相等 |
| | | EQUAL |
| | |
| | | String propName = q.propName(); |
| | | String joinName = q.joinName(); |
| | | String blurry = q.blurry(); |
| | | // wcd加 |
| | | String isOr = q.isOr(); |
| | | // |
| | | String attributeName = isBlank(propName) ? field.getName() : propName; |
| | | Class<?> fieldType = field.getType(); |
| | | Object val = field.get(query); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // wcd加 |
| | | if (ObjectUtil.isNotEmpty(isOr)) { |
| | | String[] isOrs = isOr.split(","); |
| | | List<Predicate> orP = new ArrayList<>(); |
| | | for (String s : isOrs) { |
| | | orP.add(cb.equal(root.get(s) |
| | | .as(String.class), val)); |
| | | } |
| | | Predicate[] orpr = new Predicate[orP.size()]; |
| | | list.add(cb.or(orP.toArray(orpr))); |
| | | continue; |
| | | } |
| | | // |
| | | |
| | | switch (q.type()) { |
| | | case EQUAL: |
| | | list.add(cb.equal(getExpression(attributeName,join,root) |
| 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.attendance.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2022-12-21 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="attendance_cardreplacement") |
| | | public class AttendanceCardreplacement extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "主键id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | @Column(name = "`approval_user_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "审批用户id") |
| | | private Long approvalUserId; |
| | | |
| | | @Column(name = "`card_replacement_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "补卡时间") |
| | | private Timestamp cardReplacementTime; |
| | | |
| | | @Column(name = "`card_replacement_reason`") |
| | | @ApiModelProperty(value = "补卡原因") |
| | | private String cardReplacementReason; |
| | | |
| | | @Column(name = "`approval_status`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "审批状态") |
| | | private String approvalStatus; |
| | | |
| | | @Column(name = "`approval_description`") |
| | | @ApiModelProperty(value = "审批说明") |
| | | private String approvalDescription; |
| | | |
| | | @Column(name = "`card_replacement_distinguish`") |
| | | @ApiModelProperty(value = "补卡区分") |
| | | private String cardReplacementDistinguish; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | |
| | | public void copy(AttendanceCardreplacement source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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.attendance.repository; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceCardreplacement; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2022-12-21 |
| | | **/ |
| | | public interface AttendanceCardreplacementRepository extends JpaRepository<AttendanceCardreplacement, Long>, JpaSpecificationExecutor<AttendanceCardreplacement> { |
| | | |
| | | //查询补卡记录是否存 |
| | | @Query(value = "SELECT * from attendance_cardreplacement WHERE user_id = ? and card_replacement_time = ? and approval_status != 'card_approve_status_refuse'",nativeQuery = true) |
| | | AttendanceCardreplacement findByUserIdAndCardReplacementTime(Long userId, Timestamp checkTime); |
| | | } |
| 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.attendance.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceCardreplacement; |
| | | import me.zhengjie.modules.attendance.service.AttendanceCardreplacementService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceCardreplacementQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2022-12-21 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "补卡管理") |
| | | @RequestMapping("/api/attendanceCardreplacement") |
| | | public class AttendanceCardreplacementController { |
| | | |
| | | private final AttendanceCardreplacementService attendanceCardreplacementService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('attendanceCardreplacement:download')") |
| | | public void exportAttendanceCardreplacement(HttpServletResponse response, AttendanceCardreplacementQueryCriteria criteria) throws IOException { |
| | | attendanceCardreplacementService.download(attendanceCardreplacementService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询补卡") |
| | | @ApiOperation("查询补卡") |
| | | @PreAuthorize("@el.check('attendanceCardreplacement:list')") |
| | | public ResponseEntity<Object> queryAttendanceCardreplacement(AttendanceCardreplacementQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(attendanceCardreplacementService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询补卡") |
| | | @ApiOperation("查询补卡") |
| | | @PreAuthorize("@el.check('attendanceCardreplacement:list')") |
| | | public ResponseEntity<Object> queryAttendanceCardreplacement(AttendanceCardreplacementQueryCriteria criteria){ |
| | | return new ResponseEntity<>(attendanceCardreplacementService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增补卡") |
| | | @ApiOperation("新增补卡") |
| | | @PreAuthorize("@el.check('attendanceCardreplacement:add')") |
| | | public ResponseEntity<Object> createAttendanceCardreplacement(@Validated @RequestBody AttendanceCardreplacement resources) throws Exception { |
| | | return new ResponseEntity<>(attendanceCardreplacementService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改补卡") |
| | | @ApiOperation("修改补卡") |
| | | @PreAuthorize("@el.check('attendanceCardreplacement:edit')") |
| | | public ResponseEntity<Object> updateAttendanceCardreplacement(@Validated @RequestBody AttendanceCardreplacement resources){ |
| | | attendanceCardreplacementService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除补卡") |
| | | @ApiOperation("删除补卡") |
| | | @PreAuthorize("@el.check('attendanceCardreplacement:del')") |
| | | public ResponseEntity<Object> deleteAttendanceCardreplacement(@RequestBody Long[] ids) { |
| | | attendanceCardreplacementService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping(value = "/approve") |
| | | @Log("审核功能") |
| | | @ApiOperation("审核功能") |
| | | public ResponseEntity<Object> checkApprove(@Validated @RequestBody AttendanceCardreplacement resources){ |
| | | attendanceCardreplacementService.updateApprove(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @PutMapping(value = "/revoke") |
| | | @Log("补卡撤销") |
| | | @ApiOperation("补卡撤销") |
| | | public ResponseEntity<Object> checkInApplicationPass(@Validated @RequestBody AttendanceCardreplacement resources){ |
| | | attendanceCardreplacementService.cardRevoke(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | } |
| 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.attendance.service; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceCardreplacement; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceCardreplacementDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceCardreplacementQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author wcd |
| | | * @date 2022-12-21 |
| | | **/ |
| | | public interface AttendanceCardreplacementService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(AttendanceCardreplacementQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<AttendanceCardreplacementDto> |
| | | */ |
| | | List<AttendanceCardreplacementDto> queryAll(AttendanceCardreplacementQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return AttendanceCardreplacementDto |
| | | */ |
| | | AttendanceCardreplacementDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return AttendanceCardreplacementDto |
| | | */ |
| | | AttendanceCardreplacementDto create(AttendanceCardreplacement resources) throws Exception; |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(AttendanceCardreplacement resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<AttendanceCardreplacementDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 审核 |
| | | * @param resources / |
| | | */ |
| | | void updateApprove(AttendanceCardreplacement resources); |
| | | |
| | | /** |
| | | * 补卡撤销 |
| | | * @param resources |
| | | */ |
| | | void cardRevoke(AttendanceCardreplacement resources); |
| | | } |
| 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.attendance.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2022-12-21 |
| | | **/ |
| | | @Data |
| | | public class AttendanceCardreplacementDto extends BaseDTO implements Serializable { |
| | | |
| | | /** 主键id */ |
| | | private Long id; |
| | | |
| | | /** 用户id */ |
| | | private Long userId; |
| | | |
| | | /** 审批用户id */ |
| | | private Long approvalUserId; |
| | | |
| | | /** 补卡时间 */ |
| | | private Timestamp cardReplacementTime; |
| | | |
| | | /** 补卡原因 */ |
| | | private String cardReplacementReason; |
| | | |
| | | /** 审批状态 */ |
| | | private String approvalStatus; |
| | | |
| | | /** 审批说明 */ |
| | | private String approvalDescription; |
| | | |
| | | /** 补卡区分 */ |
| | | private String cardReplacementDistinguish; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 申请人 */ |
| | | private String userName; |
| | | |
| | | /** 审批人 */ |
| | | private String appUserName; |
| | | |
| | | } |
| 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.attendance.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2022-12-21 |
| | | **/ |
| | | @Data |
| | | public class AttendanceCardreplacementQueryCriteria{ |
| | | |
| | | //员工查询 |
| | | @Query |
| | | private Long userId; |
| | | |
| | | //日期查询 |
| | | @Query(type = Query.Type.INNER_LIKE, propName = "cardReplacementTime") |
| | | private String cardReplacementTime; |
| | | |
| | | //审批查询 |
| | | @Query |
| | | private String approvalStatus; |
| | | |
| | | //区分查询 |
| | | @Query |
| | | private String cardReplacementDistinguish; |
| | | |
| | | @Query(isOr = "userId,approvalUserId") |
| | | private Long approver; |
| | | } |
| 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.attendance.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.attendance.domain.Attendance; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceCardreplacement; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceRepository; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.RoleRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceCardreplacementRepository; |
| | | import me.zhengjie.modules.attendance.service.AttendanceCardreplacementService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceCardreplacementDto; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceCardreplacementQueryCriteria; |
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceCardreplacementMapper; |
| | | 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 java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2022-12-21 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class AttendanceCardreplacementServiceImpl implements AttendanceCardreplacementService { |
| | | |
| | | private final AttendanceCardreplacementRepository attendanceCardreplacementRepository; |
| | | private final AttendanceCardreplacementMapper attendanceCardreplacementMapper; |
| | | private final UserRepository userRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final RoleRepository roleRepository; |
| | | private final AttendanceRepository attendanceRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceCardreplacementQueryCriteria criteria, Pageable pageable){ |
| | | //查询当前登录人 |
| | | User user = userRepository.findById(SecurityUtils.getCurrentUserId()).get(); |
| | | //当前登录人角色包含职员就添加查询条件只能查询自己申请的或审批人是自己的记录 |
| | | if (user.getRoles().contains(roleRepository.findById(Constant.JOB_STAFF).get())) { |
| | | criteria.setApprover(SecurityUtils.getCurrentUserId()); |
| | | } |
| | | Page<AttendanceCardreplacement> page = attendanceCardreplacementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | //将实体转换为Dto(重写) |
| | | Function<AttendanceCardreplacement, AttendanceCardreplacementDto> func = new Function<AttendanceCardreplacement,AttendanceCardreplacementDto >(){ |
| | | |
| | | @Override |
| | | public AttendanceCardreplacementDto apply(AttendanceCardreplacement attendanceCardreplacement) { |
| | | // 将实体类转换成DTO |
| | | AttendanceCardreplacementDto attendanceCardreplacementDto = attendanceCardreplacementMapper.toDto(attendanceCardreplacement); |
| | | //查询申请人信息 |
| | | 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 attendanceCardreplacementDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<AttendanceCardreplacementDto> queryAll(AttendanceCardreplacementQueryCriteria criteria){ |
| | | return attendanceCardreplacementMapper.toDto(attendanceCardreplacementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public AttendanceCardreplacementDto findById(Long id) { |
| | | AttendanceCardreplacement attendanceCardreplacement = attendanceCardreplacementRepository.findById(id).orElseGet(AttendanceCardreplacement::new); |
| | | ValidationUtil.isNull(attendanceCardreplacement.getId(),"AttendanceCardreplacement","id",id); |
| | | return attendanceCardreplacementMapper.toDto(attendanceCardreplacement); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AttendanceCardreplacementDto create(AttendanceCardreplacement resources) throws Exception { |
| | | //查询补卡记录是否存在 |
| | | AttendanceCardreplacement attendanceCardreplacement = attendanceCardreplacementRepository.findByUserIdAndCardReplacementTime(resources.getUserId(),resources.getCardReplacementTime()); |
| | | if(ObjectUtils.isNotEmpty(attendanceCardreplacement)) { |
| | | throw new BadRequestException("补卡记录已存在"); |
| | | } |
| | | //查询考勤表是否有记录 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String attDate = sdf.format(resources.getCardReplacementTime()); |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),attDate.substring(0,10)); |
| | | if(ObjectUtils.isEmpty(attendance)){ |
| | | throw new BadRequestException("考勤记录不存在"); |
| | | } |
| | | |
| | | resources.setApprovalStatus(Constant.CARD_APPROVE_STATUS_REVIEWED); |
| | | //查询补卡次数(待加入)? |
| | | |
| | | //发送给审批者 |
| | | List<String> sendList = new ArrayList<>(); |
| | | //查询申请人信息 |
| | | User user = userRepository.getOne(resources.getUserId()); |
| | | //查询审批者信息 |
| | | User appUser = userRepository.getOne(resources.getApprovalUserId()); |
| | | sendList.add(appUser.getDingding()); |
| | | opaiDingTalkService.sendNotice(sendList, "审批提醒", "### 审批提示 \n >" + user.getNickName() + " 提交了补卡审批,请登录PMS系统处理", "card"); |
| | | return attendanceCardreplacementMapper.toDto(attendanceCardreplacementRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(AttendanceCardreplacement resources) { |
| | | AttendanceCardreplacement attendanceCardreplacement = attendanceCardreplacementRepository.findById(resources.getId()).orElseGet(AttendanceCardreplacement::new); |
| | | ValidationUtil.isNull( attendanceCardreplacement.getId(),"AttendanceCardreplacement","id",resources.getId()); |
| | | attendanceCardreplacement.copy(resources); |
| | | |
| | | //查询考勤表是否有记录 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String attDate = sdf.format(resources.getCardReplacementTime()); |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(),attDate.substring(0,10)); |
| | | if(ObjectUtils.isEmpty(attendance)){ |
| | | throw new BadRequestException("考勤记录不存在"); |
| | | } |
| | | |
| | | attendanceCardreplacementRepository.save(attendanceCardreplacement); |
| | | } |
| | | |
| | | /** |
| | | * 审核功能 |
| | | * @param resources |
| | | */ |
| | | @Override |
| | | public void updateApprove(AttendanceCardreplacement resources) { |
| | | AttendanceCardreplacement attendanceCardreplacement = attendanceCardreplacementRepository.findById(resources.getId()).orElseGet(AttendanceCardreplacement::new); |
| | | ValidationUtil.isNull(attendanceCardreplacement.getId(), "AttendanceCardreplacement", "id", resources.getId()); |
| | | attendanceCardreplacement.copy(resources); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String attDate = sdf.format(resources.getCardReplacementTime()); |
| | | // 根据userId和日期查询考勤记录表 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(resources.getUserId(), attDate.substring(0, 10)); |
| | | // 判断是上班补卡还是下班补卡 |
| | | if (resources.getCardReplacementDistinguish().equals(Constant.CARD_REPLACEMENT_DIFFERENTIATION_GOON)) { |
| | | // 通过 |
| | | if (resources.getApprovalStatus().equals(Constant.CARD_APPROVE_STATUS_AGREE)) { |
| | | // set考勤打卡时间和打卡状态 |
| | | attendance.setActualWorkStartTime(resources.getCardReplacementTime()); |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_NORMAL); |
| | | attendance.setStartLocationResults(Constant.LOCATION_RESULTS_NORMAL); |
| | | // 减少补卡次数待加入? |
| | | } |
| | | } else { |
| | | // 通过 |
| | | if (resources.getApprovalStatus().equals(Constant.CARD_APPROVE_STATUS_AGREE)) { |
| | | // set考勤打卡时间和打卡状态 |
| | | attendance.setActualWorkEndTime(resources.getCardReplacementTime()); |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_NORMAL); |
| | | attendance.setEndLocationResults(Constant.LOCATION_RESULTS_NORMAL); |
| | | // 减少补卡次数待加入? |
| | | } |
| | | } |
| | | attendanceRepository.save(attendance); |
| | | attendanceCardreplacementRepository.save(attendanceCardreplacement); |
| | | } |
| | | |
| | | /** |
| | | * 补卡撤销 |
| | | * @param resources |
| | | */ |
| | | @Override |
| | | public void cardRevoke(AttendanceCardreplacement resources) { |
| | | AttendanceCardreplacement attendanceCardreplacement = attendanceCardreplacementRepository.findById(resources.getId()).orElseGet(AttendanceCardreplacement::new); |
| | | ValidationUtil.isNull( attendanceCardreplacement.getId(),"AttendanceCardreplacement","id",resources.getId()); |
| | | attendanceCardreplacement.copy(resources); |
| | | //如果审批状态为已通过,补卡次数加回来? |
| | | if(resources.getApprovalStatus().equals(Constant.CARD_APPROVE_STATUS_AGREE)) { |
| | | } |
| | | attendanceCardreplacement.setApprovalStatus(Constant.CARD_APPROVE_STATUS_REVIEWED); |
| | | attendanceCardreplacementRepository.save(attendanceCardreplacement); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | attendanceCardreplacementRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<AttendanceCardreplacementDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceCardreplacementDto attendanceCardreplacement : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("用户id", attendanceCardreplacement.getUserId()); |
| | | map.put("审批用户id", attendanceCardreplacement.getApprovalUserId()); |
| | | map.put("补卡时间", attendanceCardreplacement.getCardReplacementTime()); |
| | | map.put("补卡原因", attendanceCardreplacement.getCardReplacementReason()); |
| | | map.put("审批状态", attendanceCardreplacement.getApprovalStatus()); |
| | | map.put("审批说明", attendanceCardreplacement.getApprovalDescription()); |
| | | map.put("补卡区分", attendanceCardreplacement.getCardReplacementDistinguish()); |
| | | map.put("备注", attendanceCardreplacement.getRemarks()); |
| | | map.put("创建者", attendanceCardreplacement.getCreateBy()); |
| | | map.put("创建时间", attendanceCardreplacement.getCreateTime()); |
| | | map.put("更新者", attendanceCardreplacement.getUpdateBy()); |
| | | map.put("更新时间", attendanceCardreplacement.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| | |
| | | import me.zhengjie.modules.attendance.domain.Attendance; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | 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.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | |
| | | private final AttendanceRepository attendanceRepository; |
| | | private final AttendanceMapper attendanceMapper; |
| | | private final UserRepository userRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AttendanceQueryCriteria criteria, Pageable pageable){ |
| | |
| | | public void download(List<AttendanceDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (AttendanceDto attendance : all) { |
| | | String startLocationResults = attendance.getStartLocationResults() != null ? dictDetailRepository.findByDictNameAndValue("location_results", attendance.getStartLocationResults()).getLabel() : ""; |
| | | String startClockResults = attendance.getStartClockResults() != null ? dictDetailRepository.findByDictNameAndValue("attendance_state", attendance.getStartClockResults()).getLabel() : ""; |
| | | String endLocationResults = attendance.getEndLocationResults() != null ? dictDetailRepository.findByDictNameAndValue("location_results", attendance.getEndLocationResults()).getLabel() : ""; |
| | | String endClockResults = attendance.getEndClockResults() != null ? dictDetailRepository.findByDictNameAndValue("attendance_state", attendance.getEndClockResults()).getLabel() : ""; |
| | | String dateType = attendance.getDateType() != null ? dictDetailRepository.findByDictNameAndValue("date_type", attendance.getDateType()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("员工", attendance.getUserName()); |
| | | map.put("考勤日期", attendance.getAttendanceDate()); |
| | | map.put("排班工作开始时间", attendance.getRosteringWorkStartTime()); |
| | | map.put("实际工作开始时间", attendance.getActualWorkStartTime()); |
| | | //开始位置判断 |
| | | if(ObjectUtils.isNotEmpty(attendance.getStartLocationResults()) && attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_NORMAL)) { |
| | | map.put("开始位置结果","范围内"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getStartLocationResults()) && attendance.getStartLocationResults().equals(Constant.LOCATION_RESULTS_OUTSIDE)) { |
| | | map.put("开始位置结果","范围外"); |
| | | } else{ |
| | | map.put("开始位置结果","未打卡"); |
| | | } |
| | | //开始打卡判断 |
| | | if(ObjectUtils.isNotEmpty(attendance.getStartClockResults()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)) { |
| | | map.put("开始打卡结果","等待"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getStartClockResults()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_NORMAL)){ |
| | | map.put("开始打卡结果","正常"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getStartClockResults()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_NOTSIGNED)){ |
| | | map.put("开始打卡结果","缺卡"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getStartClockResults()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_GOOUT)){ |
| | | map.put("开始打卡结果","外出"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getStartClockResults()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_BUSINESS)){ |
| | | map.put("开始打卡结果","出差"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getStartClockResults()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_LEAVE)){ |
| | | map.put("开始打卡结果","请假"); |
| | | } |
| | | map.put("开始位置结果",startLocationResults); |
| | | map.put("开始打卡结果",startClockResults); |
| | | map.put("排班工作结束时间", attendance.getRosteringWorkEndTime()); |
| | | map.put("实际工作结束时间", attendance.getActualWorkEndTime()); |
| | | //结束位置判断 |
| | | if(ObjectUtils.isNotEmpty(attendance.getEndLocationResults()) && attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_NORMAL)) { |
| | | map.put("结束位置结果","范围内"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getEndLocationResults()) && attendance.getEndLocationResults().equals(Constant.LOCATION_RESULTS_OUTSIDE)) { |
| | | map.put("结束位置结果","范围外"); |
| | | } else{ |
| | | map.put("结束位置结果","未打卡"); |
| | | } |
| | | //结束打卡判断 |
| | | if(ObjectUtils.isNotEmpty(attendance.getEndClockResults()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)) { |
| | | map.put("结束打卡结果","等待"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getEndClockResults()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_NORMAL)){ |
| | | map.put("结束打卡结果","正常"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getEndClockResults()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_NOTSIGNED)){ |
| | | map.put("结束打卡结果","缺卡"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getEndClockResults()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_GOOUT)){ |
| | | map.put("结束打卡结果","外出"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getEndClockResults()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_BUSINESS)){ |
| | | map.put("结束打卡结果","出差"); |
| | | } else if(ObjectUtils.isNotEmpty(attendance.getEndClockResults()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_LEAVE)){ |
| | | map.put("结束打卡结果","请假"); |
| | | } |
| | | //日期类型判断 |
| | | if(attendance.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){ |
| | | map.put("日期类型","工作日"); |
| | | } else if(attendance.getDateType().equals(Constant.DATE_TYPE_HOLIDAYS)){ |
| | | map.put("日期类型","节假日(串休)"); |
| | | } else{ |
| | | map.put("日期类型","节假日(法定)"); |
| | | } |
| | | map.put("结束位置结果",endLocationResults); |
| | | map.put("结束打卡结果",endClockResults); |
| | | map.put("日期类型",dateType); |
| | | map.put("备注", attendance.getRemarks()); |
| | | map.put("创建者", attendance.getCreateBy()); |
| | | map.put("创建时间", attendance.getCreateTime()); |
| 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.attendance.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceCardreplacement; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceCardreplacementDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2022-12-21 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface AttendanceCardreplacementMapper extends BaseMapper<AttendanceCardreplacementDto, AttendanceCardreplacement> { |
| | | |
| | | } |
| | |
| | | |
| | | public class Constant { |
| | | |
| | | /** |
| | | * 人员岗位:系统负责人 |
| | | */ |
| | | public static final Long JOB_SYSTEM_LEADER = 1L; |
| | | |
| | | /** |
| | | * 人员岗位:负责人 |
| | | */ |
| | | public static final Long JOB_LEADER = 2L; |
| | | |
| | | /** |
| | | * 人员岗位:职员 |
| | | */ |
| | | public static final Long JOB_STAFF = 3L; |
| | | |
| | | |
| | | // 日期类型 |
| | | public static final String DATE_TYPE = "date_type"; |
| | | // 日期类型:工作日 |
| | | public static final String DATE_TYPE_WEEKDAY = "date_type_weekday"; |
| | | // 日期类型:节假日(法定) |
| | | public static final String DATE_TYPE_LEGAL_HOLIDAYS = "date_type_legal_holid"; |
| | | public static final String DATE_TYPE_LEGAL_HOLIDAYS = "date_type_legal_holidays"; |
| | | // 日期类型:节假日(串休) |
| | | 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"; |
| | |
| | | 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"; |
| | |
| | | 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"; |
| | | |
| | | //补卡区分 |
| | | public static final String CARD_REPLACEMENT_DIFFERENTIATION = "card_replacement_differentiation"; |
| | | // 补卡区分: 上班补卡 |
| | | public static final String CARD_REPLACEMENT_DIFFERENTIATION_GOON = "card_replacement_differentiation_goOn"; |
| | | // 补卡区分: 下班补卡 |
| | | public static final String CARD_REPLACEMENT_DIFFERENTIATION_GOOFF = "card_replacement_differentiation_goOff"; |
| | | |
| | | //补卡审批状态 |
| | | public static final String CARD_APPROVE_STATUS = "card_approve_status"; |
| | | // 补卡审批状态: 待审核 |
| | | public static final String CARD_APPROVE_STATUS_REVIEWED = "card_approve_status_reviewed"; |
| | | // 补卡审批状态: 已同意 |
| | | public static final String CARD_APPROVE_STATUS_AGREE = "card_approve_status_agree"; |
| | | // 补卡审批状态: 已拒绝 |
| | | public static final String CARD_APPROVE_STATUS_REFUSE = "card_approve_status_refuse"; |
| | | |
| | | |
| | | //批准状态 |
| | | public static final String APPROVE_STATUS = "approve_status"; |
| | |
| | | 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; |
| | |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | @Async |
| | | public class OapiDingTalkMethod { |
| | | |
| | |
| | | |
| | | 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点执行,新增用户考勤信息 |
| | | * @throws Exception |
| | |
| | | //获取今天时间 |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | 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"); |
| | | //查询节假日表是否有记录 |
| | | SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(todayDate); |
| | | //遍历在职员工向考勤记录添加数据 |
| | | for (User user : userList){ |
| | | //查询当前用户的排班 |
| | | SysRostering sysRostering = sysRosteringRepository.findByRosId(user.getSysRostering().getId()); |
| | | //查询考勤记录是否存在 |
| | | Attendance attendance = attendanceRepository.findAllByUserIdAndAttendanceDate(user.getId(), todayDate); |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); |
| | | if (ObjectUtil.isEmpty(attendance)) { |
| | | attendance = new 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); |
| | | 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 && sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)){ |
| | | //法定 |
| | | attendance.setDateType(Constant.DATE_TYPE_LEGAL_HOLIDAYS); |
| | | }else{ |
| | | //除了法定节假日和双休都属于工作日 |
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKDAY); |
| | | } |
| | | |
| | | attendance.setRosteringWorkStartTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(sysRostering.getWorkStartTime()))); |
| | | attendance.setRosteringWorkEndTime(Timestamp.valueOf(todayDate + " " + dateTimeFormatter.format(sysRostering.getWorkEndTime()))); |
| | | attendance.setDateType(Constant.DATE_TYPE_WEEKDAY); |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 中午12点30执行定时任务 |
| | | * 中午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); |
| | | 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"); |
| | | //获取今天或昨天时间 |
| | | Calendar calDay = Calendar.getInstance(); |
| | | //标识 |
| | | Boolean day = false; |
| | | //定时任务的执行时间大于等于12:30说明是更新早上打卡的考勤记录 |
| | | if(sdf.parse(nowDate).compareTo(sdf.parse(Constant.DATE_TIME_NOON)) >= 0){ |
| | | calDay.setTime(Timestamp.valueOf(todayDate + " 00:00:00")); |
| | | day = true; |
| | | }else { |
| | | calDay.setTime(Timestamp.valueOf(yesterday + " 00:00:00")); |
| | | } |
| | | //遍历在职员工向考勤记录添加数据 |
| | | 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(), todayDate); |
| | | //访问钉钉获取数据 |
| | | //钉钉数据 |
| | | List<OapiDingTalkRecordResult> oapiDingTalkRecordResultList = new ArrayList<>(); |
| | | userDinDingList.add(user.getDingding()); |
| | | 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); |
| | |
| | | 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); |
| | |
| | | attendance.setActualWorkEndTime(oapiDingTalkRecordResult.getUserCheckTime()); |
| | | } |
| | | } |
| | | attendanceRepository.save(attendance); |
| | | //如果是周六或者周日或节假日,打卡状态为等待的话,就改状态为休息(oapiDingTalkRecordResultList为空的情况下) |
| | | if(calDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || attendance.getDateType().equals(Constant.DATE_TYPE_LEGAL_HOLIDAYS)){ |
| | | //上午 |
| | | if(day && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_WAITFOR)){ |
| | | 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.setEndClockResults(Constant.ATTENDANCE_STATE_REST); |
| | | attendance.setEndLocationResults(Constant.LOCATION_RESULTS_REST); |
| | | attendance.setActualWorkEndTime(null); |
| | | } |
| | | } |
| | | |
| | | // 判断修改考勤状态 |
| | | updateRecord(user,yesterday); |
| | | if(day){ |
| | | attendance = updateRecord(user,attendance,todayDate); |
| | | }else{ |
| | | attendance = updateRecord(user,attendance,yesterday); |
| | | } |
| | | attendanceRepository.save(attendance); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | throw new BadRequestException(oapiDingTalkAccessToken.getErrmsg()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param user |
| | | * @param date |
| | | */ |
| | | public void updateRecord(User user, String date){ |
| | | public Attendance updateRecord(User user, Attendance attendance, String date){ |
| | | //根据日期查询请假表 |
| | | |
| | | //根据日期查询外出表 |
| | | |
| | | //根据日期查询出差表 |
| | | return attendance; |
| | | } |
| | | |
| | | } |
| | |
| | | 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 |
| | |
| | | */ |
| | | void updateCenter(User resources); |
| | | |
| | | /** |
| | | * 查询在职的员工 |
| | | * @return |
| | | */ |
| | | List<User> getUsers(); |
| | | } |
| | |
| | | import me.zhengjie.exception.EntityExistException; |
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday; |
| | | 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 lombok.RequiredArgsConstructor; |
| | |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final SysConfigHolidayMapper sysConfigHolidayMapper; |
| | | private final UserRepository userRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysConfigHolidayQueryCriteria criteria, Pageable pageable){ |
| | |
| | | public void download(List<SysConfigHolidayDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (SysConfigHolidayDto sysConfigHoliday : all) { |
| | | String dateType = sysConfigHoliday.getDateType() != null ? dictDetailRepository.findByDictNameAndValue("date_type", sysConfigHoliday.getDateType()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("节日日期", sysConfigHoliday.getHolidayDate()); |
| | | map.put("名称", sysConfigHoliday.getName()); |
| | | map.put("日期类型", sysConfigHoliday.getDateType()); |
| | | map.put("日期类型", dateType); |
| | | map.put("备注", sysConfigHoliday.getRemarks()); |
| | | map.put("创建者", sysConfigHoliday.getCreateBy()); |
| | | map.put("创建时间", sysConfigHoliday.getCreateTime()); |
| | |
| | | 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 { |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/attendanceCardreplacement/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/attendanceCardreplacement', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/attendanceCardreplacement/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/attendanceCardreplacement', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function approve(data) { |
| | | return request({ |
| | | url: 'api/attendanceCardreplacement/approve', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function revoke(data) { |
| | | return request({ |
| | | url: 'api/attendanceCardreplacement/revoke', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, revoke, approve } |
| | |
| | | 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' |
| | |
| | | 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' |
| | |
| | | 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 const CARD_REPLACEMENT_DIFFERENTIATION = 'card_replacement_differentiation' |
| | | // 考勤补卡区分: 上班补卡 |
| | | export const CARD_REPLACEMENT_DIFFERENTIATION_GOON = 'card_replacement_differentiation_goOn' |
| | | // 考勤补卡区分:下班补卡 |
| | | export const CARD_REPLACEMENT_DIFFERENTIATION_GOOFF = 'card_replacement_differentiation_goOff' |
| | | |
| | | // 考勤补卡审核状态 |
| | | export const CARD_APPROVE_STATUS = 'card_approve_status' |
| | | // 考勤补卡审核状态: 待审核 |
| | | export const CARD_APPROVE_STATUS_REVIEWED = 'card_approve_status_reviewed' |
| | | // 考勤补卡审核状态: 已同意 |
| | | export const CARD_APPROVE_STATUS_AGREE = 'card_approve_status_agree' |
| | | // 考勤补卡审核状态: 已拒绝 |
| | | export const CARD_APPROVE_STATUS_REFUSE = 'card_approve_status_refuse' |
| | | |
| | | // 项目区分 |
| | | export const PROJECT_DISTINGUISH = 'project_distinguish' |
| | |
| | | DATE_TYPE_WEEKDAY, |
| | | DATE_TYPE_LEGAL_HOLIDAYS, |
| | | DATE_TYPE_HOLIDAYS, |
| | | DATE_TYPE_WEEKEND, |
| | | STANDARD_UNIT_CURRENCY, |
| | | STANDARD_UNIT_CURRENCY_RENMINBI, |
| | | STANDARD_UNIT_CURRENCY_DOLLAR, |
| | |
| | | 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_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, |
| | | CARD_REPLACEMENT_DIFFERENTIATION, |
| | | CARD_REPLACEMENT_DIFFERENTIATION_GOON, |
| | | CARD_REPLACEMENT_DIFFERENTIATION_GOOFF, |
| | | CARD_APPROVE_STATUS, |
| | | CARD_APPROVE_STATUS_REVIEWED, |
| | | CARD_APPROVE_STATUS_AGREE, |
| | | CARD_APPROVE_STATUS_REFUSE |
| | | LOCATION_RESULTS_NOTSIGNED, |
| | | PROJECT_DISTINGUISH, |
| | | PROJECT_DISTINGUISH_A, |
| | | PROJECT_DISTINGUISH_B, |
| | |
| | | <!--工具栏--> |
| | | <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" |
| | |
| | | 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" |
| | |
| | | :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" |
| | |
| | | :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" |
| | |
| | | :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" |
| | |
| | | <rrOperation /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <crudOperation :permission="permission"> |
| | | <template slot="left"> |
| | | <el-button |
| | | slot="right" |
| | | size="mini" |
| | | type="info" |
| | | icon="el-icon-timer" |
| | | class="filter-item" |
| | | style="margin-right: 7.5px" |
| | | :disabled="crud.selections.length !== 1" |
| | | @click="makeUpCardOnDuty(crud.selections[0],1)" |
| | | >上班补卡 |
| | | </el-button> |
| | | </template> |
| | | <template slot="left"> |
| | | <el-button |
| | | slot="right" |
| | | size="mini" |
| | | type="info" |
| | | icon="el-icon-timer" |
| | | class="filter-item" |
| | | style="margin-right: 7.5px" |
| | | :disabled="crud.selections.length !== 1" |
| | | @click="makeUpCardOnDuty(crud.selections[0],2)" |
| | | >下班补卡 |
| | | </el-button> |
| | | </template> |
| | | </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" :rules="rules" size="small" label-width="140px"> |
| | | <el-form-item label="员工" prop="userId"> |
| | | <el-select v-model="form.userId" clearable filterable placeholder="请选择" style="width: 310px;" @change="getRosteTime(form)"> |
| | | <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"> |
| | |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--补卡--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="makeUpCardVisible" :title="makeUpCardTitle" width="505px"> |
| | | <el-form ref="makeUpCardForm" :model="makeUpCardForm" :rules="makeRules" size="small" label-width="110px" style="height: 400px"> |
| | | <el-form-item label="打卡状态"> |
| | | <el-tag v-if="makeUpCardForm.timeResult === dictAttendanceStateNotSigned" type="danger">{{ dict.label[attendanceState][makeUpCardForm.timeResult] }}</el-tag> |
| | | </el-form-item> |
| | | <el-form-item label="基准时间"> |
| | | <span>{{ makeUpCardForm.rosterTime }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="补卡时间" prop="cardReplacementTime"> |
| | | <div> |
| | | <label style="margin-right: 5px">日期:</label> |
| | | <span>{{ makeUpCardForm.checkDate }}</span> |
| | | </div> |
| | | <div> |
| | | <label style="margin-right: 5px">时间:</label> |
| | | <el-time-picker |
| | | v-model="makeUpCardForm.cardReplacementTime" |
| | | format="HH:mm:ss" |
| | | value-format="HH:mm:ss" |
| | | style="width: 195px;" |
| | | /> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="审批人" prop="approvalUserId"> |
| | | <el-select v-model="makeUpCardForm.approvalUserId" clearable filterable placeholder="请选择" style="width: 240px;"> |
| | | <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="补卡原因"> |
| | | <el-input v-model="makeUpCardForm.cardReplacementReason" type="textarea" :rows="6" resize="none" style="width: 325px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeCard">取消</el-button> |
| | | <el-button :loading="makeUpCardLoading" type="primary" @click="submitMakeUpCard">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="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 /> |
| | |
| | | |
| | | <script> |
| | | import crudAttendance from '@/api/attendance/attendance' |
| | | import { getUsers } from '@/api/system/user' |
| | | import crudAttendanceCardreplacement from '@/api/attendance/attendanceCardreplacement' |
| | | import crudUser from '@/api/system/user' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | |
| | | return CRUD({ title: '考勤记录', url: 'api/attendance', idField: 'id', sort: 'id,desc', crudMethod: { ...crudAttendance }}) |
| | | }, |
| | | // 数据字典 |
| | | dicts: [constant.ATTENDANCE_STATE, constant.DATE_TYPE, constant.LOCATION_RESULTS], |
| | | dicts: [constant.ATTENDANCE_STATE, constant.DATE_TYPE, constant.LOCATION_RESULTS, constant.CARD_REPLACEMENT_DIFFERENTIATION, constant.CARD_APPROVE_STATUS], |
| | | data() { |
| | | return { |
| | | permission: { |
| | |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '用户ID 外键不能为空', trigger: 'blur' } |
| | | { required: true, message: '员工不能为空', trigger: 'change' } |
| | | ], |
| | | attendanceDate: [ |
| | | { required: true, message: '考勤日期不能为空', trigger: 'blur' } |
| | |
| | | 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' } |
| | | ] |
| | | }, |
| | | makeRules: { |
| | | cardReplacementTime: [ |
| | | { required: true, message: '补卡时间不能为空', trigger: 'change' } |
| | | ], |
| | | createBy: [ |
| | | { required: true, message: '创建者不能为空', trigger: 'blur' } |
| | | ], |
| | | createTime: [ |
| | | { required: true, message: '创建时间不能为空', trigger: 'blur' } |
| | | approvalUserId: [ |
| | | { required: true, message: '审批人不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | attendanceState: constant.ATTENDANCE_STATE, |
| | | lacationResules: constant.LOCATION_RESULTS, |
| | | dateType: constant.DATE_TYPE, |
| | | users: [] } |
| | | 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: [], |
| | | makeUpCardVisible: false, |
| | | makeUpCardLoading: false, |
| | | makeUpCardTitle: '', |
| | | makeUpCardForm: { |
| | | id: null, |
| | | userId: null, |
| | | approvalUserId: null, |
| | | cardReplacementTime: null, |
| | | cardReplacementReason: null, |
| | | approvalStatus: null, |
| | | approvalDescription: null, |
| | | cardReplacementDistinguish: null, |
| | | remarks: null, |
| | | rosterTime: null, |
| | | timeResult: null, |
| | | checkDate: null |
| | | }, |
| | | created() { |
| | | this.getUsers() |
| | | dictCardReplacementGoOn: constant.CARD_REPLACEMENT_DIFFERENTIATION_GOON, |
| | | dictCardReplacementOffOn: constant.CARD_REPLACEMENT_DIFFERENTIATION_GOOFF, |
| | | dictCardApproveStatusReviewed: constant.CARD_APPROVE_STATUS_REVIEWED } |
| | | }, |
| | | 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) |
| | | }) |
| | | } |
| | | }, |
| | | // 补卡页面 |
| | | makeUpCardOnDuty(data, Number) { |
| | | this.makeUpCardForm.checkDate = this.crud.toDate(data.attendanceDate) |
| | | this.makeUpCardForm.userId = data.userId |
| | | this.makeUpCardForm.approvalStatus = this.dictCardApproveStatusReviewed |
| | | // 判断上班打卡状态,给提示 |
| | | if (Number === 1) { |
| | | if (data.startClockResults !== null && data.startClockResults === this.dictAttendanceStateNotSigned) { |
| | | this.makeUpCardTitle = '上班补卡申请' |
| | | this.makeUpCardForm.timeResult = data.startClockResults |
| | | this.makeUpCardForm.rosterTime = data.rosteringWorkStartTime |
| | | this.makeUpCardForm.cardReplacementTime = data.rosteringWorkStartTime.substring(11, 19) |
| | | this.makeUpCardForm.cardReplacementDistinguish = this.dictCardReplacementGoOn |
| | | this.makeUpCardVisible = true |
| | | } else { |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: '上班无需补卡' |
| | | }) |
| | | } |
| | | } |
| | | // 判断下班打卡状态,给提示 |
| | | if (Number === 2) { |
| | | if (data.endClockResults !== null && data.endClockResults === this.dictAttendanceStateNotSigned) { |
| | | this.makeUpCardTitle = '下班补卡申请' |
| | | this.makeUpCardForm.timeResult = data.endClockResults |
| | | this.makeUpCardForm.rosterTime = data.rosteringWorkEndTime |
| | | this.makeUpCardForm.cardReplacementTime = data.rosteringWorkEndTime.substring(11, 19) |
| | | this.makeUpCardForm.cardReplacementDistinguish = this.dictCardReplacementOffOn |
| | | this.makeUpCardVisible = true |
| | | } else { |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: '下班无需补卡' |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | // 补卡提交 |
| | | submitMakeUpCard() { |
| | | this.$refs['makeUpCardForm'].validate(valid => { |
| | | if (!valid) { |
| | | return |
| | | } |
| | | this.makeUpCardLoading = true |
| | | this.makeUpCardForm.cardReplacementTime = this.makeUpCardForm.checkDate + ' ' + this.makeUpCardForm.cardReplacementTime |
| | | crudAttendanceCardreplacement.add(this.makeUpCardForm).then(res => { |
| | | this.makeUpCardVisible = false |
| | | this.makeUpCardLoading = false |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '补卡申请成功' |
| | | }) |
| | | }).catch(() => { |
| | | this.makeUpCardVisible = false |
| | | this.makeUpCardLoading = false |
| | | }) |
| | | }) |
| | | if (this.$refs['makeUpCardForm']) { |
| | | this.$refs['makeUpCardForm'].resetFields() |
| | | } |
| | | }, |
| | | // 关闭 |
| | | closeCard() { |
| | | if (this.$refs['makeUpCardForm']) { |
| | | this.$refs['makeUpCardForm'].resetFields() |
| | | } |
| | | this.crud.cancelCU() |
| | | this.makeUpCardVisible = false |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <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-select> |
| | | <el-date-picker |
| | | v-model="query.cardReplacementTime" |
| | | clearable |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd" |
| | | placeholder="请选择补卡时间" |
| | | /> |
| | | <el-select v-model="query.approvalStatus" filterable clearable placeholder="请选择审批状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[dictCardApproveStatus]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.cardReplacementDistinguish" filterable clearable placeholder="请选择补卡区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[dictCardReplacement]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <rrOperation /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="申请人" prop="userId"> |
| | | <el-select v-model="form.userId" clearable filterable placeholder="请选择申请人" 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="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" clearable filterable placeholder="请选择审批者" 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="cardReplacementTime"> |
| | | <el-date-picker |
| | | v-model="form.cardReplacementTime" |
| | | type="datetime" |
| | | placeholder="选择补卡时间" |
| | | style="width: 310px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | default-time="09:00:00" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="补卡原因"> |
| | | <el-input v-model="form.cardReplacementReason" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.id !== null" label="审批状态" prop="approvalStatus"> |
| | | <el-select v-model="form.approvalStatus" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[dictCardApproveStatus]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批说明"> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="补卡区分" prop="cardReplacementDistinguish"> |
| | | <el-select v-model="form.cardReplacementDistinguish" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[dictCardReplacement]" |
| | | :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" style="width: 370px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="crud.cancelCU">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--审核表单--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="makeUpCardVisible" title="补卡审批" width="500px"> |
| | | <div class="form-item"> |
| | | <div class="form-item-label"> |
| | | <label>申请人:</label> |
| | | </div> |
| | | <div class="form-item-value">{{ form.userName }}</div> |
| | | </div> |
| | | <div class="form-item"> |
| | | <div class="form-item-label"> |
| | | <label>补卡时间:</label> |
| | | </div> |
| | | <div class="form-item-value">{{ form.cardReplacementTime }}</div> |
| | | </div> |
| | | <div class="form-item" style="margin: 0px"> |
| | | <div class="form-item-label"> |
| | | <label>补卡原因:</label> |
| | | </div> |
| | | <div class="form-item-value">{{ form.cardReplacementReason }}</div> |
| | | </div> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="92px"> |
| | | <el-form-item v-if="form.approvalStatus === dictCardApproveStatusRefuse" label="退回原因:" prop="approvalDescription"> |
| | | <div style="color: red;">*审核退回需要填写退回原因,请填写后再次点击审核退回</div> |
| | | <el-input v-model="form.approvalDescription" type="textarea" :rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="danger" style="margin-right: 10px;" @click="approveFunction(1,form)">审核退回</el-button> |
| | | <el-button v-if="form.approvalStatus !== dictCardApproveStatusRefuse" :loading="successLoading" type="success" @click="approveFunction(2,form)">审核通过</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column v-if="false" prop="id" label="id" show-overflow-tooltip /> |
| | | <el-table-column v-if="false" prop="userId" label="申请人ID" show-overflow-tooltip /> |
| | | <el-table-column prop="userName" label="申请人" show-overflow-tooltip /> |
| | | <el-table-column prop="appUserName" label="审批者" show-overflow-tooltip /> |
| | | <el-table-column prop="cardReplacementTime" label="补卡时间" show-overflow-tooltip /> |
| | | <el-table-column prop="cardReplacementReason" label="补卡原因" show-overflow-tooltip /> |
| | | <el-table-column prop="approvalStatus" label="审批状态" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.approvalStatus === dictCardApproveStatusReviewed" type="warning">{{ dict.label[dictCardApproveStatus][scope.row.approvalStatus] }}</el-tag> |
| | | <el-tag v-if="scope.row.approvalStatus === dictCardApproveStatusAgree" type="success">{{ dict.label[dictCardApproveStatus][scope.row.approvalStatus] }}</el-tag> |
| | | <el-tag v-if="scope.row.approvalStatus === dictCardApproveStatusRefuse" type="danger">{{ dict.label[dictCardApproveStatus][scope.row.approvalStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="approvalDescription" label="审批说明" show-overflow-tooltip /> |
| | | <el-table-column prop="cardReplacementDistinguish" label="补卡区分" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[dictCardReplacement][scope.row.cardReplacementDistinguish] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip /> |
| | | <el-table-column label="审核操作" min-width="120px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-s-check" |
| | | :disabled="scope.row.approvalStatus === dictCardApproveStatusReviewed ? false : true" |
| | | @click="toApprove(scope.row)" |
| | | >审核 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','attendanceCardreplacement:edit','attendanceCardreplacement:del'])" label="操作" width="250px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | > |
| | | <template slot="left"> |
| | | <el-popover |
| | | :ref="`popover_${scope.row.id}`" |
| | | width="200" |
| | | > |
| | | <p>确定撤销该补卡?</p> |
| | | <div style="text-align: right; margin: 0"> |
| | | <el-button size="mini" type="primary" @click="canel(scope.row)">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | slot="reference" |
| | | type="danger" |
| | | icon="el-icon-edit-outline" |
| | | size="mini" |
| | | :disabled="scope.row.approvalStatus === dictCardApproveStatusReviewed ? true : false" |
| | | >撤销 |
| | | </el-button> |
| | | </el-popover> |
| | | </template> |
| | | </udOperation> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudAttendanceCardreplacement from '@/api/attendance/attendanceCardreplacement' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import crudUser from '@/api/system/user' |
| | | import rrOperation from '@crud/RR.operation' |
| | | 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, userId: null, userName: null, approvalUserId: null, cardReplacementTime: null, cardReplacementReason: null, approvalStatus: null, approvalDescription: null, cardReplacementDistinguish: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'AttendanceCardreplacement', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | // 数据字典 |
| | | dicts: [constant.CARD_REPLACEMENT_DIFFERENTIATION, constant.CARD_APPROVE_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '补卡', url: 'api/attendanceCardreplacement', idField: 'id', sort: 'id,desc', crudMethod: { ...crudAttendanceCardreplacement }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'attendanceCardreplacement:add'], |
| | | edit: ['admin', 'attendanceCardreplacement:edit'], |
| | | del: ['admin', 'attendanceCardreplacement:del'], |
| | | download: ['admin', 'attendanceCardreplacement:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | | { required: true, message: '员工不能为空', trigger: 'change' } |
| | | ], |
| | | approvalUserId: [ |
| | | { required: true, message: '审批者不能为空', trigger: 'change' } |
| | | ], |
| | | cardReplacementTime: [ |
| | | { required: true, message: '补卡时间不能为空', trigger: 'blur' } |
| | | ], |
| | | approvalStatus: [ |
| | | { required: true, message: '审批状态不能为空', trigger: 'change' } |
| | | ], |
| | | |
| | | approvalDescription: [ |
| | | { required: true, message: '审批说明不能为空', trigger: 'change' } |
| | | ], |
| | | cardReplacementDistinguish: [ |
| | | { required: true, message: '补卡区分不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | users: [], |
| | | makeUpCardVisible: false, |
| | | successLoading: false, |
| | | dictCardApproveStatus: constant.CARD_APPROVE_STATUS, |
| | | dictCardApproveStatusReviewed: constant.CARD_APPROVE_STATUS_REVIEWED, |
| | | dictCardApproveStatusAgree: constant.CARD_APPROVE_STATUS_AGREE, |
| | | dictCardApproveStatusRefuse: constant.CARD_APPROVE_STATUS_REFUSE, |
| | | dictCardReplacement: constant.CARD_REPLACEMENT_DIFFERENTIATION } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getUsers() |
| | | return true |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 审批页面赋值 |
| | | toApprove(data) { |
| | | this.makeUpCardVisible = true |
| | | this.form.id = data.id |
| | | this.form.userId = data.userId |
| | | this.form.userName = data.userName |
| | | this.form.cardReplacementTime = data.cardReplacementTime |
| | | this.form.cardReplacementReason = data.cardReplacementReason |
| | | this.form.cardReplacementDistinguish = data.cardReplacementDistinguish |
| | | }, |
| | | // 审核功能 |
| | | approveFunction(Number, data) { |
| | | this.form.userId = data.userId |
| | | const msg = Number === 2 ? '通过' : '拒绝' |
| | | this.$refs['form'].validate(valid => { |
| | | if (!valid) { |
| | | return |
| | | } |
| | | // 判断通过状态 |
| | | if (Number === 2) { |
| | | this.form.approvalStatus = this.dictCardApproveStatusAgree |
| | | } else { |
| | | // 退回改状态显示退回原因 |
| | | this.form.approvalStatus = this.dictCardApproveStatusRefuse |
| | | if (this.form.approvalDescription == null) { |
| | | return |
| | | } |
| | | } |
| | | crudAttendanceCardreplacement.approve(this.form).then(res => { |
| | | this.crud.refresh() |
| | | this.makeUpCardVisible = false |
| | | this.successLoading = false |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '审核' + msg + '成功' |
| | | }) |
| | | }).catch(() => { |
| | | this.makeUpCardVisible = false |
| | | this.successLoading = false |
| | | }) |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | }) |
| | | }, |
| | | // 撤消功能 |
| | | revoke(data) { |
| | | crudAttendanceCardreplacement.revoke(data).then(res => { |
| | | this.crud.refresh() |
| | | this.$message({ type: 'success', message: '撤销成功' }) |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | }).catch((error) => { |
| | | this.$message({ type: 'error', message: error.response.data.message }) |
| | | }) |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | this.crud.cancelCU() |
| | | }, |
| | | // 关闭 |
| | | closeCard() { |
| | | if (this.$refs['form']) { |
| | | this.$refs['form'].resetFields() |
| | | } |
| | | this.crud.cancelCU() |
| | | this.makeUpCardVisible = false |
| | | }, |
| | | // 取消 |
| | | canel(data) { |
| | | this.$refs[`popover_${data.id}`].showPopper = false |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .form-item { |
| | | width: 100%; |
| | | display: flex; |
| | | margin-bottom: 20px; |
| | | } |
| | | .form-item-label { |
| | | width: 20%; |
| | | display: flex; |
| | | padding-left: 20px; |
| | | } |
| | | .form-item-value { |
| | | width: 80%; |
| | | display: flex; |
| | | padding-left: 25px; |
| | | padding-right: 25px; |
| | | } |
| | | </style> |