From 87f21e11b7b71b69f61f461f8af0a311bc56ac11 Mon Sep 17 00:00:00 2001
From: BAOLH <baolh@yhzhg.cn>
Date: Wed, 16 Sep 2026 07:43:41 +0000
Subject: [PATCH] Merge branch 'wcd-2411-update' into wcd
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/PreBusinessTravelRepository.java | 28
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceBusinessTravel.java | 4
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/PreBusinessTravelQueryCriteria.java | 61 +
eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue | 136 +++
eladmin-web-master/src/views/template/bind/index.vue | 10
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/PreBusinessTravel.java | 152 ++++
eladmin-web-master/src/utils/constant.js | 5
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceBusinessTravelDto.java | 9
eladmin-web-master/src/api/attendance/preBusinessTravel.js | 58 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/PreBusinessTravelController.java | 124 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/approval/listener/ChangeApprovalStatusEventListener.java | 53 +
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/PreBusinessTravelMapper.java | 32 +
eladmin-web-master/src/views/attendance/preBusinessTravel/index.vue | 699 +++++++++++++++++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/PreBusinessTravelService.java | 102 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/PreBusinessTravelDto.java | 121 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/PreBusinessTravelServiceImpl.java | 286 ++++++++
16 files changed, 1,851 insertions(+), 29 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/approval/listener/ChangeApprovalStatusEventListener.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/approval/listener/ChangeApprovalStatusEventListener.java
index 9c62d84..3ff3fb3 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/approval/listener/ChangeApprovalStatusEventListener.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/approval/listener/ChangeApprovalStatusEventListener.java
@@ -55,6 +55,8 @@
private final AttendanceCardreplacementRepository attendanceCardreplacementRepository;
private final ProjectReimburseService projectReimburseService;
private final ProjectReimburseRepository projectReimburseRepository;
+ private final PreBusinessTravelService preBusinessTravelService;
+ private final PreBusinessTravelRepository preBusinessTravelRepository;
@EventListener
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
@@ -107,7 +109,8 @@
} else {
System.out.println("企微状态下发数据对应数据(请假)未找到:下发数据ID为" + event.getHistoryId());
}
- } else if (fieldList.get(0).getFieldTable().equals("AttendanceGoOut")) {
+ }
+ else if (fieldList.get(0).getFieldTable().equals("AttendanceGoOut")) {
// 外出
AttendanceGoOutQueryCriteria goOutCriteria = new AttendanceGoOutQueryCriteria();
goOutCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo());
@@ -124,7 +127,8 @@
} else {
System.out.println("企微状态下发数据对应数据(外出)未找到:下发数据ID为" + event.getHistoryId());
}
- } else if (fieldList.get(0).getFieldTable().equals("AttendanceBusinessTravel")) {
+ }
+ else if (fieldList.get(0).getFieldTable().equals("AttendanceBusinessTravel")) {
// 出差
AttendanceBusinessTravelQueryCriteria businessTravelCriteria = new AttendanceBusinessTravelQueryCriteria();
businessTravelCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo());
@@ -141,7 +145,8 @@
} else {
System.out.println("企微状态下发数据对应数据(出差)未找到:下发数据ID为" + event.getHistoryId());
}
- } else if (fieldList.get(0).getFieldTable().equals("AttendanceOvertime")) {
+ }
+ else if (fieldList.get(0).getFieldTable().equals("AttendanceOvertime")) {
// 换休
AttendanceOvertimeQueryCriteria overtimeCriteria = new AttendanceOvertimeQueryCriteria();
overtimeCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo());
@@ -158,7 +163,8 @@
} else {
System.out.println("企微状态下发数据对应数据(换休)未找到:下发数据ID为" + event.getHistoryId());
}
- } else if (fieldList.get(0).getFieldTable().equals("AttendanceCardreplacement")) {
+ }
+ else if (fieldList.get(0).getFieldTable().equals("AttendanceCardreplacement")) {
// 补卡
AttendanceCardreplacementQueryCriteria cardreplacementCriteria = new AttendanceCardreplacementQueryCriteria();
cardreplacementCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo());
@@ -175,7 +181,8 @@
} else {
System.out.println("企微状态下发数据对应数据(补卡)未找到:下发数据ID为" + event.getHistoryId());
}
- } else if (fieldList.get(0).getFieldTable().equals("ProjectReimburse")) {
+ }
+ else if (fieldList.get(0).getFieldTable().equals("ProjectReimburse")) {
// 补卡
ProjectReimburseQueryCriteria reimburseQueryCriteria = new ProjectReimburseQueryCriteria();
reimburseQueryCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo());
@@ -192,7 +199,26 @@
} else {
System.out.println("企微状态下发数据对应数据(报销)未找到:下发数据ID为" + event.getHistoryId());
}
- } else {
+ }
+ else if (fieldList.get(0).getFieldTable().equals("PreBusinessTravel")) {
+ // 事前出差
+ PreBusinessTravelQueryCriteria preBusinessTravelCriteria = new PreBusinessTravelQueryCriteria();
+ preBusinessTravelCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo());
+ List<PreBusinessTravel> preBusinessTravelList = preBusinessTravelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,preBusinessTravelCriteria,criteriaBuilder), Sort.by(Sort.Direction.DESC, "id"));
+ if (preBusinessTravelList.size() > 0) {
+ PreBusinessTravel preBusinessTravel = preBusinessTravelList.get(0);
+ preBusinessTravel.setApprovalStatus(switchSpStatusToSysStatus("事前出差", approvalSend.getApprovalInfo().getSpStatus()));
+ preBusinessTravel.setWecomEventId(approveEventSaved.getEventId());
+ try {
+ preBusinessTravelService.approval(preBusinessTravel);
+ } catch (Exception e) {
+ System.out.println("企微状态下发数据对应数据(事前出差)更新失败:下发数据ID为" + event.getHistoryId());
+ }
+ } else {
+ System.out.println("企微状态下发数据对应数据(事前出差)未找到:下发数据ID为" + event.getHistoryId());
+ }
+ }
+ else {
System.out.println("企微状态下发数据对应模板绑定表名未找到:下发数据ID为" + event.getHistoryId());
}
} else {
@@ -299,6 +325,21 @@
// 已支付
case "报销-10": finalStatus = Constant.REIMBURSE_APPROVE_STATUS_REVIEWED; break;
+ // 审批中
+ case "事前出差-1": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REVIEWED; break;
+ // 已通过
+ case "事前出差-2": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_AGREE; break;
+ // 已驳回
+ case "事前出差-3": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REFUSE; break;
+ // 已撤销
+ case "事前出差-4": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REFUSE; break;
+ // 通过后撤销
+ case "事前出差-6": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REFUSE; break;
+ // 已删除
+ case "事前出差-7": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REFUSE; break;
+ // 已支付
+ case "事前出差-10": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REVIEWED; break;
+
// 默认
default: finalStatus = Constant.APPROVAL_STATUS_UNDER_APPROVAL; break;
}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceBusinessTravel.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceBusinessTravel.java
index 73cfe24..538998f 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceBusinessTravel.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/AttendanceBusinessTravel.java
@@ -142,6 +142,10 @@
@ApiModelProperty(value = "企微出差类别名称")
private String wecomCategoryName;
+ @Column(name = "`pre_business_travel_id`")
+ @ApiModelProperty(value = "事前出差ID")
+ private Long preBusinessTravelId;
+
public void copy(AttendanceBusinessTravel source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/PreBusinessTravel.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/PreBusinessTravel.java
new file mode 100644
index 0000000..e4e46a4
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/domain/PreBusinessTravel.java
@@ -0,0 +1,152 @@
+/*
+* 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 baolh
+* @date 2026-09-14
+**/
+@Entity
+@Data
+@Table(name="pre_business_travel")
+public class PreBusinessTravel 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 = "`title`")
+ @ApiModelProperty(value = "标题")
+ private String title;
+
+ @Column(name = "`travel_start_time`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "出差开始时间")
+ private Timestamp travelStartTime;
+
+ @Column(name = "`travel_end_time`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "出差结束时间")
+ private Timestamp travelEndTime;
+
+ @Column(name = "`travel_duration`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "出差时长")
+ private Double travelDuration;
+
+ @Column(name = "`duration_unit`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "时长单位")
+ private String durationUnit;
+
+ @Column(name = "`travel_reason`")
+ @ApiModelProperty(value = "出差原因")
+ private String travelReason;
+
+ @Column(name = "`departure_city`")
+ @ApiModelProperty(value = "出发城市")
+ private String departureCity;
+
+ @Column(name = "`arrival_city`")
+ @ApiModelProperty(value = "到达城市")
+ private String arrivalCity;
+
+ @Column(name = "`approval_status`",nullable = false)
+ @NotBlank
+ @ApiModelProperty(value = "审批状态")
+ private String approvalStatus;
+
+ @Column(name = "`approval_description`")
+ @ApiModelProperty(value = "审批说明")
+ private String approvalDescription;
+
+ @Column(name = "`remarks`")
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+ @Column(name = "`project_id`")
+ @ApiModelProperty(value = "关联项目")
+ private Long projectId;
+
+ @Column(name = "`member_user_id`")
+ @ApiModelProperty(value = "成员ID")
+ private String memberUserId;
+
+ @Column(name = "`wecom_sp_no`")
+ @ApiModelProperty(value = "企微审批单号")
+ private String wecomSpNo;
+
+ @Column(name = "`wecom_event_id`")
+ @ApiModelProperty(value = "企微最新审批变化记录ID")
+ private Long wecomEventId;
+
+ @Column(name = "`wecom_location`")
+ @ApiModelProperty(value = "企微出差地点")
+ private String wecomLocation;
+
+ @Column(name = "`wecom_date_type`")
+ @ApiModelProperty(value = "企微时长粒度")
+ private String wecomDateType;
+
+ @Column(name = "`wecom_duration`")
+ @ApiModelProperty(value = "企微申请时长")
+ private String wecomDuration;
+
+ @Column(name = "`wecom_attendance_type`")
+ @ApiModelProperty(value = "企微假勤类型(固定值)")
+ private String wecomAttendanceType;
+
+ @Column(name = "`wecom_approve_wecom_id`")
+ @ApiModelProperty(value = "企微审批人ID")
+ private String wecomApproveWecomId;
+
+ @Column(name = "`wecom_project_name`")
+ @ApiModelProperty(value = "企微项目名称")
+ private String wecomProjectName;
+
+ @Column(name = "`wecom_member_name`")
+ @ApiModelProperty(value = "企微成员名称")
+ private String wecomMemberName;
+
+ public void copy(PreBusinessTravel source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/PreBusinessTravelRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/PreBusinessTravelRepository.java
new file mode 100644
index 0000000..9da0258
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/repository/PreBusinessTravelRepository.java
@@ -0,0 +1,28 @@
+/*
+* 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.PreBusinessTravel;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+* @website https://eladmin.vip
+* @author baolh
+* @date 2026-09-14
+**/
+public interface PreBusinessTravelRepository extends JpaRepository<PreBusinessTravel, Long>, JpaSpecificationExecutor<PreBusinessTravel> {
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/PreBusinessTravelController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/PreBusinessTravelController.java
new file mode 100644
index 0000000..1104f69
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/rest/PreBusinessTravelController.java
@@ -0,0 +1,124 @@
+/*
+* 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.AgreeUpdateRequest;
+import me.zhengjie.modules.attendance.domain.AttendanceBusinessTravel;
+import me.zhengjie.modules.attendance.domain.PreBusinessTravel;
+import me.zhengjie.modules.attendance.service.AttendanceBusinessTravelService;
+import me.zhengjie.modules.attendance.service.PreBusinessTravelService;
+import me.zhengjie.modules.attendance.service.dto.PreBusinessTravelQueryCriteria;
+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 baolh
+* @date 2026-09-14
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "事前出差管理")
+@RequestMapping("/api/preBusinessTravel")
+public class PreBusinessTravelController {
+
+ private final PreBusinessTravelService preBusinessTravelService;
+
+ private final AttendanceBusinessTravelService attendanceBusinessTravelService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('preBusinessTravel:list')")
+ public void exportPreBusinessTravel(HttpServletResponse response, PreBusinessTravelQueryCriteria criteria) throws IOException {
+ preBusinessTravelService.download(preBusinessTravelService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询事前出差")
+ @ApiOperation("查询事前出差")
+ @PreAuthorize("@el.check('preBusinessTravel:list')")
+ public ResponseEntity<Object> queryPreBusinessTravel(PreBusinessTravelQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(preBusinessTravelService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增事前出差")
+ @ApiOperation("新增事前出差")
+ @PreAuthorize("@el.check('preBusinessTravel:add')")
+ public ResponseEntity<Object> createPreBusinessTravel(@Validated @RequestBody PreBusinessTravel resources){
+ return new ResponseEntity<>(preBusinessTravelService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改事前出差")
+ @ApiOperation("修改事前出差")
+ @PreAuthorize("@el.check('preBusinessTravel:edit')")
+ public ResponseEntity<Object> updatePreBusinessTravel(@Validated @RequestBody PreBusinessTravel resources){
+ preBusinessTravelService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除事前出差")
+ @ApiOperation("删除事前出差")
+ @PreAuthorize("@el.check('preBusinessTravel:del')")
+ public ResponseEntity<Object> deletePreBusinessTravel(@RequestBody Long[] ids) {
+ preBusinessTravelService.deleteAll(ids);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+
+ @PostMapping(value = "/getRemainingTime")
+ @Log("获取出差时长")
+ @ApiOperation("获取出差时长")
+ public ResponseEntity<Object> getRemainingTime(@Validated @RequestBody AttendanceBusinessTravel resources){
+ return new ResponseEntity<>(attendanceBusinessTravelService.getRemainingTime(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping(value = "/approval")
+ @Log("审核/撤销功能")
+ @ApiOperation("审核/撤销功能")
+ @PreAuthorize("@el.check('preBusinessTravel:approval')")
+ public ResponseEntity<Object> approval(@Validated @RequestBody PreBusinessTravel resources) throws Exception {
+ preBusinessTravelService.approval(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @PutMapping(value = "/batchApproval")
+ @Log("批量审核")
+ @ApiOperation("批量审核")
+ @PreAuthorize("@el.check('preBusinessTravel:batchApproval')")
+ public ResponseEntity<Object> batchApproval(@Validated @RequestBody AgreeUpdateRequest request) throws Exception {
+ preBusinessTravelService.batchApproval(request);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @GetMapping(value = "/getAllUse")
+ @Log("查询全部可用")
+ @ApiOperation("查询全部可用")
+ public ResponseEntity<Object> getAllUse(PreBusinessTravelQueryCriteria criteria) {
+ return new ResponseEntity<>(preBusinessTravelService.queryAllUse(criteria), HttpStatus.OK);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/PreBusinessTravelService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/PreBusinessTravelService.java
new file mode 100644
index 0000000..a6e35f4
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/PreBusinessTravelService.java
@@ -0,0 +1,102 @@
+/*
+* 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.AgreeUpdateRequest;
+import me.zhengjie.modules.attendance.domain.PreBusinessTravel;
+import me.zhengjie.modules.attendance.service.dto.PreBusinessTravelDto;
+import me.zhengjie.modules.attendance.service.dto.PreBusinessTravelQueryCriteria;
+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 baolh
+* @date 2026-09-14
+**/
+public interface PreBusinessTravelService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(PreBusinessTravelQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<PreBusinessTravelDto>
+ */
+ List<PreBusinessTravelDto> queryAll(PreBusinessTravelQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return PreBusinessTravelDto
+ */
+ PreBusinessTravelDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return PreBusinessTravelDto
+ */
+ PreBusinessTravelDto create(PreBusinessTravel resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(PreBusinessTravel resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<PreBusinessTravelDto> all, HttpServletResponse response) throws IOException;
+
+ /**
+ * 审核功能
+ * @param resources /
+ */
+ void approval(PreBusinessTravel resources) throws Exception;
+
+ /**
+ * 批量审核
+ * @param
+ */
+ void batchApproval(AgreeUpdateRequest request) throws Exception;
+
+ /**
+ * 查询全部
+ * @param
+ */
+ List<PreBusinessTravelDto> queryAllUse(PreBusinessTravelQueryCriteria criteria);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceBusinessTravelDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceBusinessTravelDto.java
index 12d6af4..39b7a9f 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceBusinessTravelDto.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/AttendanceBusinessTravelDto.java
@@ -77,12 +77,15 @@
/** 备注 */
private String remarks;
+ /** 企微审批单号 */
+ private String wecomSpNo;
+
+ /** 事前出差ID */
+ private Long preBusinessTravelId;
+
private String userName;
private String appUserName;
-
- /** 企微审批单号 */
- private String wecomSpNo;
/** 企微最新审批变化记录 */
private ApproveEventDto event;
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/PreBusinessTravelDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/PreBusinessTravelDto.java
new file mode 100644
index 0000000..01a3c4d
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/PreBusinessTravelDto.java
@@ -0,0 +1,121 @@
+/*
+* 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 me.zhengjie.modules.approval.service.dto.ApproveEventDto;
+import me.zhengjie.modules.project.service.dto.ProjectDto;
+
+import java.sql.Timestamp;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author baolh
+* @date 2026-09-14
+**/
+@Data
+public class PreBusinessTravelDto extends BaseDTO implements Serializable {
+
+ /** 主键id */
+ private Long id;
+
+ /** 用户id */
+ private Long userId;
+
+ /** 审批用户id */
+ private Long approvalUserId;
+
+ /** 标题 */
+ private String title;
+
+ /** 出差开始时间 */
+ private Timestamp travelStartTime;
+
+ /** 出差结束时间 */
+ private Timestamp travelEndTime;
+
+ /** 出差时长 */
+ private Double travelDuration;
+
+ /** 时长单位 */
+ private String durationUnit;
+
+ /** 出差原因 */
+ private String travelReason;
+
+ /** 出发城市 */
+ private String departureCity;
+
+ /** 到达城市 */
+ private String arrivalCity;
+
+ /** 审批状态 */
+ private String approvalStatus;
+
+ /** 审批说明 */
+ private String approvalDescription;
+
+ /** 备注 */
+ private String remarks;
+
+ /** 关联项目 */
+ private Long projectId;
+
+ /** 成员ID */
+ private String memberUserId;
+
+ /** 企微审批单号 */
+ private String wecomSpNo;
+
+ /** 企微最新审批变化记录ID */
+ private Long wecomEventId;
+
+ /** 企微出差地点 */
+ private String wecomLocation;
+
+ /** 企微时长粒度 */
+ private String wecomDateType;
+
+ /** 企微申请时长 */
+ private String wecomDuration;
+
+ /** 企微假勤类型(固定值) */
+ private String wecomAttendanceType;
+
+ /** 企微审批人ID */
+ private String wecomApproveWecomId;
+
+ /** 企微项目名称 */
+ private String wecomProjectName;
+
+ /** 企微成员名称 */
+ private String wecomMemberName;
+
+ /** 用户名称 */
+ private String userName;
+
+ /** 审批用户名称 */
+ private String appUserName;
+
+ /** 关联项目信息 */
+ private ProjectDto project;
+
+ /** 企微最新审批变化记录 */
+ private ApproveEventDto event;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/PreBusinessTravelQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/PreBusinessTravelQueryCriteria.java
new file mode 100644
index 0000000..1cd4c37
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/dto/PreBusinessTravelQueryCriteria.java
@@ -0,0 +1,61 @@
+/*
+* 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.annotation.Query;
+
+/**
+* @website https://eladmin.vip
+* @author baolh
+* @date 2026-09-14
+**/
+@Data
+public class PreBusinessTravelQueryCriteria{
+
+ // 精确
+ @Query
+ private Long userId;
+
+ @Query
+ private Long approvalUserId;
+
+ @Query
+ private String approvalStatus;
+
+ @Query(type = Query.Type.EQUAL)
+ private String wecomSpNo;
+
+ /* 精确 */
+ @Query(type = Query.Type.EQUAL)
+ private Long projectId;
+
+ @Query(propName = "travelStartTime", type = Query.Type.GREATER_THAN)
+ private String travelStartTime;
+
+ @Query(propName = "travelEndTime", type = Query.Type.LESS_THAN)
+ private String travelEndTime;
+
+ /* 模糊 */
+ @Query(propName = "travelStartTime", type = Query.Type.INNER_LIKE)
+ private String travelStartTimeLike;
+
+ @Query(propName = "travelEndTime", type = Query.Type.INNER_LIKE)
+ private String travelEndTimeLike;
+
+ @Query(propName = "memberUserId", type = Query.Type.INNER_LIKE)
+ private String memberUserIdLike;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/PreBusinessTravelServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/PreBusinessTravelServiceImpl.java
new file mode 100644
index 0000000..a9f06fe
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/PreBusinessTravelServiceImpl.java
@@ -0,0 +1,286 @@
+/*
+* 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.approval.domain.ApproveEvent;
+import me.zhengjie.modules.approval.repository.ApproveEventRepository;
+import me.zhengjie.modules.approval.service.TemplateControlFieldService;
+import me.zhengjie.modules.approval.service.mapstruct.ApproveEventMapper;
+import me.zhengjie.modules.attendance.domain.AgreeUpdateRequest;
+import me.zhengjie.modules.attendance.domain.PreBusinessTravel;
+import me.zhengjie.modules.constant.Constant;
+import me.zhengjie.modules.project.domain.Project;
+import me.zhengjie.modules.project.repository.ProjectRepository;
+import me.zhengjie.modules.project.service.mapstruct.ProjectMapper;
+import me.zhengjie.modules.system.domain.DictDetail;
+import me.zhengjie.modules.system.domain.Role;
+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;
+import me.zhengjie.modules.attendance.repository.PreBusinessTravelRepository;
+import me.zhengjie.modules.attendance.service.PreBusinessTravelService;
+import me.zhengjie.modules.attendance.service.dto.PreBusinessTravelDto;
+import me.zhengjie.modules.attendance.service.dto.PreBusinessTravelQueryCriteria;
+import me.zhengjie.modules.attendance.service.mapstruct.PreBusinessTravelMapper;
+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.math.BigDecimal;
+import java.util.*;
+import java.io.IOException;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @description 服务实现
+* @author baolh
+* @date 2026-09-14
+**/
+@Service
+@RequiredArgsConstructor
+public class PreBusinessTravelServiceImpl implements PreBusinessTravelService {
+
+ private final TemplateControlFieldService templateControlFieldService;
+ private final PreBusinessTravelRepository preBusinessTravelRepository;
+ private final UserRepository userRepository;
+ private final ProjectRepository projectRepository;
+ private final DictDetailRepository dictDetailRepository;
+ private final ApproveEventRepository approveEventRepository;
+ private final PreBusinessTravelMapper preBusinessTravelMapper;
+ private final ProjectMapper projectMapper;
+ private final ApproveEventMapper approveEventMapper;
+ private final Function<PreBusinessTravel, PreBusinessTravelDto> toDtoFunc = new Function<PreBusinessTravel, PreBusinessTravelDto>() {
+
+ @Override
+ public PreBusinessTravelDto apply(PreBusinessTravel preBusinessTravel) {
+ // 将实体类转换成DTO
+ PreBusinessTravelDto preBusinessTravelDto = preBusinessTravelMapper.toDto(preBusinessTravel);
+ // 查询用户信息
+ User user = userRepository.findById(preBusinessTravelDto.getUserId()).orElseGet(User::new);
+ preBusinessTravelDto.setUserName(user.getNickName());
+ // 查询审批用户名
+ User appUser = userRepository.findById(preBusinessTravelDto.getApprovalUserId()).orElseGet(User::new);
+ preBusinessTravelDto.setAppUserName(appUser.getNickName());
+
+ // 查询关联项目信息
+ if (ObjectUtils.isNotEmpty(preBusinessTravelDto.getProjectId())) {
+ preBusinessTravelDto.setProject(projectMapper.toDto(projectRepository.findById(preBusinessTravelDto.getProjectId()).orElseGet(Project::new)));
+ }
+
+ // 查询企微最新审批变化记录
+ if (ObjectUtils.isNotEmpty(preBusinessTravelDto.getWecomEventId())) {
+ ApproveEvent event = approveEventRepository.findById(preBusinessTravelDto.getWecomEventId()).orElseGet(ApproveEvent::new);
+ preBusinessTravelDto.setEvent(approveEventMapper.toDto(event));
+ }
+
+ return preBusinessTravelDto;
+ }
+ };
+
+ @Override
+ public Map<String,Object> queryAll(PreBusinessTravelQueryCriteria criteria, Pageable pageable){
+ Page<PreBusinessTravel> page = preBusinessTravelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ return PageUtil.toPage(page.map(toDtoFunc));
+ }
+
+ @Override
+ public List<PreBusinessTravelDto> queryAll(PreBusinessTravelQueryCriteria criteria){
+ return preBusinessTravelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)).stream().map(toDtoFunc).collect(Collectors.toList());
+ }
+
+ @Override
+ @Transactional
+ public PreBusinessTravelDto findById(Long id) {
+ PreBusinessTravel preBusinessTravel = preBusinessTravelRepository.findById(id).orElseGet(PreBusinessTravel::new);
+ ValidationUtil.isNull(preBusinessTravel.getId(),"PreBusinessTravel","id", id);
+ return toDtoFunc.apply(preBusinessTravel);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public PreBusinessTravelDto create(PreBusinessTravel resources) {
+ // 获取当前登陆人信息,设置为请假发起人
+ User user = userRepository.getOne(resources.getUserId() == null ? SecurityUtils.getCurrentUserId() : resources.getUserId());
+ User approvalUser = userRepository.findById(resources.getApprovalUserId()).orElseGet(User::new);
+ // 获取项目信息
+ Project project = projectRepository.findById(resources.getProjectId()).orElseGet(Project::new);
+ // 获取成员信息
+ String memberUserName = Arrays.stream(resources.getMemberUserId().split("-")).filter(StringUtils::isNotBlank).map(idStr -> userRepository.findById(Long.parseLong(idStr)).orElseGet(User::new).getNickName()).collect(Collectors.joining(","));
+ // 默认数据
+ resources.setApprovalStatus(Constant.BUSSINESS_APPROVE_STATUS_REVIEWED);
+
+ // 判断是否提交企微审批
+ List<DictDetail> siteTypes = dictDetailRepository.findByDictName(Constant.APPROVAL_SITE_TYPE).stream().filter(siteType -> siteType.getValue().toLowerCase().equals("wecom")).collect(Collectors.toList());
+ if (siteTypes.size() > 0) {
+ // 添加企微申请参数
+ resources.setWecomProjectName(project.getName());
+ resources.setWecomMemberName(memberUserName);
+ resources.setWecomLocation(String.format("%s -至- %s", Optional.ofNullable(resources.getDepartureCity()).orElse("出发城市"), Optional.ofNullable(resources.getArrivalCity()).orElse("到达城市")));
+ resources.setWecomDateType(ElAdminConstant.Constant.TEMPLATE_DATE_TYPE_HALFDAY);
+ resources.setWecomDuration(String.valueOf(new BigDecimal(resources.getTravelDuration()).multiply(new BigDecimal(86400)).longValue()));
+ resources.setWecomAttendanceType("3");
+ resources.setWecomApproveWecomId(approvalUser.getWeComId());
+ // 提交申请
+ Map<String, String> approvalResultMap = templateControlFieldService.createWecomApproval(resources, user.getWeComId());
+ if (approvalResultMap.containsKey("spNo")) {
+ resources.setWecomSpNo(approvalResultMap.get("spNo"));
+ } else {
+ throw new BadRequestException(approvalResultMap.containsKey("error") ? approvalResultMap.get("error") : "企微申请提交失败");
+ }
+ }
+
+ return preBusinessTravelMapper.toDto(preBusinessTravelRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(PreBusinessTravel resources) {
+ PreBusinessTravel preBusinessTravel = preBusinessTravelRepository.findById(resources.getId()).orElseGet(PreBusinessTravel::new);
+ ValidationUtil.isNull( preBusinessTravel.getId(),"PreBusinessTravel","id", resources.getId());
+ preBusinessTravel.copy(resources);
+
+ // 审核通过或者退回不能修改
+ if (preBusinessTravel.getApprovalStatus().equals(Constant.BUSSINESS_APPROVE_STATUS_AGREE) || preBusinessTravel.getApprovalStatus().equals(Constant.BUSSINESS_APPROVE_STATUS_REFUSE)) {
+ throw new BadRequestException("审核通过或退回的不能进行修改");
+ }
+
+ // 获取当前登录者信息
+ User loginUser = userRepository.getOne(SecurityUtils.getCurrentUserId());
+ Role role = loginUser.getRoles().iterator().next();
+ // 除超管、总经理只能修改自己信息
+ if (role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL) {
+ if (!Long.valueOf(resources.getUserId()).equals(SecurityUtils.getCurrentUserId())) {
+ throw new BadRequestException("只能修改自己的记录");
+ }
+ }
+
+ preBusinessTravelRepository.save(preBusinessTravel);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ // 根据id查询记录
+ Optional<PreBusinessTravel> preBusinessTravel = preBusinessTravelRepository.findById(id);
+ // 审核通过或者退回不能删除
+ if (preBusinessTravel.get().getApprovalStatus().equals(Constant.BUSSINESS_APPROVE_STATUS_AGREE) || preBusinessTravel.get().getApprovalStatus().equals(Constant.BUSSINESS_APPROVE_STATUS_REFUSE)) {
+ throw new BadRequestException("审核通过或退回的不能进行删除");
+ }
+
+ // 获取当前登入人信息
+ User user = userRepository.getOne(SecurityUtils.getCurrentUserId());
+ Role role = user.getRoles().iterator().next();
+ // 除超管、总经理只能删除自己信息
+ if (role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL) {
+ if (!Long.valueOf(preBusinessTravel.get().getUserId()).equals(SecurityUtils.getCurrentUserId())) {
+ throw new BadRequestException("只能删除自己的记录");
+ }
+ }
+
+ preBusinessTravelRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<PreBusinessTravelDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (PreBusinessTravelDto preBusinessTravel : all) {
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("用户id", preBusinessTravel.getUserId());
+ map.put("审批用户id", preBusinessTravel.getApprovalUserId());
+ map.put("标题", preBusinessTravel.getTitle());
+ map.put("出差开始时间", preBusinessTravel.getTravelStartTime());
+ map.put("出差结束时间", preBusinessTravel.getTravelEndTime());
+ map.put("出差时长", preBusinessTravel.getTravelDuration());
+ map.put("时长单位", preBusinessTravel.getDurationUnit());
+ map.put("出差原因", preBusinessTravel.getTravelReason());
+ map.put("出发城市", preBusinessTravel.getDepartureCity());
+ map.put("到达城市", preBusinessTravel.getArrivalCity());
+ map.put("审批状态", preBusinessTravel.getApprovalStatus());
+ map.put("审批说明", preBusinessTravel.getApprovalDescription());
+ map.put("备注", preBusinessTravel.getRemarks());
+ map.put("创建者", preBusinessTravel.getCreateBy());
+ map.put("创建时间", preBusinessTravel.getCreateTime());
+ map.put("更新者", preBusinessTravel.getUpdateBy());
+ map.put("更新时间", preBusinessTravel.getUpdateTime());
+ map.put("关联项目", preBusinessTravel.getProjectId());
+ map.put("成员ID", preBusinessTravel.getMemberUserId());
+ map.put("企微审批单号", preBusinessTravel.getWecomSpNo());
+ map.put("企微最新审批变化记录ID", preBusinessTravel.getWecomEventId());
+ map.put("企微出差地点", preBusinessTravel.getWecomLocation());
+ map.put("企微时长粒度", preBusinessTravel.getWecomDateType());
+ map.put("企微申请时长", preBusinessTravel.getWecomDuration());
+ map.put("企微假勤类型(固定值)", preBusinessTravel.getWecomAttendanceType());
+ map.put("企微审批人ID", preBusinessTravel.getWecomApproveWecomId());
+ map.put("企微项目名称", preBusinessTravel.getWecomProjectName());
+ map.put("企微成员名称", preBusinessTravel.getWecomMemberName());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+
+ /**
+ * 审核/撤销功能
+ *
+ * @param resources /
+ */
+ @Override
+ public void approval(PreBusinessTravel resources) throws Exception {
+ PreBusinessTravel preBusinessTravel = preBusinessTravelRepository.findById(resources.getId()).orElseGet(PreBusinessTravel::new);
+ ValidationUtil.isNull(preBusinessTravel.getId(), "PreBusinessTravel", "id", resources.getId());
+ preBusinessTravel.copy(resources);
+ preBusinessTravelRepository.save(preBusinessTravel);
+ }
+
+ /**
+ * 批量审核(事前出差)
+ * @param request
+ */
+ @Override
+ public void batchApproval(AgreeUpdateRequest request) throws Exception {
+ for (Long id : request.getIds()) {
+ PreBusinessTravel preBusinessTravel = preBusinessTravelRepository.findById(id).orElseGet(PreBusinessTravel::new);
+ ValidationUtil.isNull(preBusinessTravel.getId(),"PreBusinessTravel","id", id);
+ if (request.getNum().equals(Long.valueOf(1))){
+ preBusinessTravel.setApprovalStatus(Constant.BUSSINESS_APPROVE_STATUS_AGREE);
+ } else {
+ preBusinessTravel.setApprovalStatus(Constant.BUSSINESS_APPROVE_STATUS_REFUSE);
+ }
+ preBusinessTravelRepository.save(preBusinessTravel);
+ }
+ }
+
+ @Override
+ public List<PreBusinessTravelDto> queryAllUse(PreBusinessTravelQueryCriteria criteria){
+ // 获取当前登入人信息
+ User user = userRepository.getOne(SecurityUtils.getCurrentUserId());
+ Role role = user.getRoles().iterator().next();
+ // 除超管、总经理只能查询自己作为成员的事前出差信息
+ if (role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL) {
+ criteria.setMemberUserIdLike(String.format("-%s-", SecurityUtils.getCurrentUserId().toString()));
+ }
+
+ return preBusinessTravelMapper.toDto(preBusinessTravelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/PreBusinessTravelMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/PreBusinessTravelMapper.java
new file mode 100644
index 0000000..527412c
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/mapstruct/PreBusinessTravelMapper.java
@@ -0,0 +1,32 @@
+/*
+* 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.PreBusinessTravel;
+import me.zhengjie.modules.attendance.service.dto.PreBusinessTravelDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author baolh
+* @date 2026-09-14
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface PreBusinessTravelMapper extends BaseMapper<PreBusinessTravelDto, PreBusinessTravel> {
+
+}
\ No newline at end of file
diff --git a/eladmin-web-master/src/api/attendance/preBusinessTravel.js b/eladmin-web-master/src/api/attendance/preBusinessTravel.js
new file mode 100644
index 0000000..b389440
--- /dev/null
+++ b/eladmin-web-master/src/api/attendance/preBusinessTravel.js
@@ -0,0 +1,58 @@
+import request from '@/utils/request'
+
+export function add(data) {
+ return request({
+ url: 'api/preBusinessTravel',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/preBusinessTravel/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/preBusinessTravel',
+ method: 'put',
+ data
+ })
+}
+
+export function getRemainingTime(data) {
+ return request({
+ url: 'api/preBusinessTravel/getRemainingTime',
+ method: 'post',
+ data
+ })
+}
+
+export function approval(data) {
+ return request({
+ url: 'api/preBusinessTravel/approval',
+ method: 'put',
+ data
+ })
+}
+
+export function batchApproval(data) {
+ return request({
+ url: 'api/preBusinessTravel/batchApproval',
+ method: 'put',
+ data
+ })
+}
+
+export function getAllUse() {
+ return request({
+ url: 'api/preBusinessTravel/getAllUse',
+ method: 'get'
+ })
+}
+
+export default { add, edit, del, getRemainingTime, approval, batchApproval, getAllUse }
diff --git a/eladmin-web-master/src/utils/constant.js b/eladmin-web-master/src/utils/constant.js
index f8a69c2..14eb13a 100644
--- a/eladmin-web-master/src/utils/constant.js
+++ b/eladmin-web-master/src/utils/constant.js
@@ -397,8 +397,10 @@
export const WECOM_BIND_OVERTIME = 'AttendanceOvertime'
// 企微审批字段绑定:补卡字段绑定
export const WECOM_BIND_REPLACEMENT = 'AttendanceCardreplacement'
-// 企微审批字段绑定:补卡字段绑定
+// 企微审批字段绑定:报销字段绑定
export const WECOM_BIND_REIMBURSE = 'ProjectReimburse'
+// 企微审批字段绑定:事前出差字段绑定
+export const WECOM_BIND_PRE_TRAVEL = 'PreBusinessTravel'
// 申请审核站点
export const APPROVAL_SITE_TYPE = 'approval_site_type'
@@ -601,6 +603,7 @@
WECOM_BIND_OVERTIME,
WECOM_BIND_REPLACEMENT,
WECOM_BIND_REIMBURSE,
+ WECOM_BIND_PRE_TRAVEL,
APPROVAL_SITE_TYPE,
REIMBURSE_APPROVE_STATUS,
REIMBURSE_APPROVE_STATUS_REVIEWED,
diff --git a/eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue b/eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue
index 04eff5d..ef63fb8 100644
--- a/eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue
+++ b/eladmin-web-master/src/views/attendance/attendanceBusinessTravel/index.vue
@@ -202,21 +202,38 @@
/>
</el-select>
</el-form-item>
+ <el-form-item label="关联事前" prop="preBusinessTravelId">
+ <el-select
+ v-model="form.preBusinessTravelId"
+ filterable
+ clearable
+ placeholder="请选择"
+ :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null"
+ style="width: 340px;"
+ @change="handlePreBusinessTravelChange"
+ >
+ <el-option v-for="item in preBusinessTravels" :key="item.id" :label="item.title" :value="item.id" />
+ </el-select>
+ </el-form-item>
<el-form-item label="出差开始日期" prop="travelStartTime">
<el-date-picker
v-model="form.travelStartTime"
type="datetime"
- placeholder="选择日期"
+ :placeholder="validateEmptyStr(form.preBusinessTravelId) ? '请选择关联事前' : '选择日期'"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 340px;"
align="right"
:picker-options="{
disabledDate(time) {
- return form.travelEndTime ? time.getTime() > new Date(form.travelEndTime).getTime() - 8.64e7 : false;
+ return (
+ (form.travelEndTime && time.getTime() > new Date(`${crud.toDate(form.travelEndTime)} 23:59:59`).getTime()) ||
+ (preBusinessTravelTime.startTime && time.getTime() < new Date(`${crud.toDate(preBusinessTravelTime.startTime)} 00:00:00`).getTime()) ||
+ (preBusinessTravelTime.endTime && time.getTime() > new Date(`${crud.toDate(preBusinessTravelTime.endTime)} 23:59:59`).getTime())
+ );
}
}"
:default-time="$store.state.user.user.sysRostering.workStartTime + ':00'"
- :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null"
+ :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null || validateEmptyStr(form.preBusinessTravelId)"
@change="checkTime"
/>
</el-form-item>
@@ -224,17 +241,21 @@
<el-date-picker
v-model="form.travelEndTime"
type="datetime"
- placeholder="选择日期"
+ :placeholder="validateEmptyStr(form.preBusinessTravelId) ? '请选择关联事前' : '选择日期'"
style="width: 340px;"
value-format="yyyy-MM-dd HH:mm:ss"
align="right"
:picker-options="{
disabledDate(time) {
- return form.travelStartTime ? time.getTime() < new Date(form.travelStartTime).getTime() - 8.64e7 : false;
+ return (
+ (form.travelStartTime && time.getTime() < new Date(`${crud.toDate(form.travelStartTime)} 00:00:00`).getTime()) ||
+ (preBusinessTravelTime.startTime && time.getTime() < new Date(`${crud.toDate(preBusinessTravelTime.startTime)} 00:00:00`).getTime()) ||
+ (preBusinessTravelTime.endTime && time.getTime() > new Date(`${crud.toDate(preBusinessTravelTime.endTime)} 23:59:59`).getTime())
+ );
}
}"
:default-time="$store.state.user.user.sysRostering.workEndTime + ':00'"
- :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null"
+ :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null || validateEmptyStr(form.preBusinessTravelId)"
@change="checkTime"
/>
</el-form-item>
@@ -289,12 +310,9 @@
v-model="form.projectId"
filterable
clearable
- placeholder="请选择"
+ :placeholder="validateEmptyStr(form.preBusinessTravelId) ? '请选择关联事前' : '请选择'"
style="width: 340px;"
- :disabled="
- form.approvalStatus == dictBussinessAppAgree ||
- form.approvalStatus == dictBussinessAppReturn
- "
+ :disabled="true"
>
<el-option
v-for="item in projects"
@@ -676,10 +694,11 @@
<script>
import crudAttendanceBusinessTravel from '@/api/attendance/attendanceBusinessTravel'
-import CRUD, { presenter, header, form, crud } from '@crud/crud'
import crudProject from '@/api/project/project'
-import rrOperation from '@crud/RR.operation'
import crudUser from '@/api/system/user'
+import crudPreBusinessTravel from '@/api/attendance/preBusinessTravel'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import rrOperation from '@crud/RR.operation'
import { mapGetters } from 'vuex'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
@@ -710,7 +729,8 @@
updateTime: null,
wecomSpNo: null,
event: null,
- project: null
+ project: null,
+ preBusinessTravelId: null
}
export default {
name: 'AttendanceBusinessTravel',
@@ -729,6 +749,17 @@
// 数据字典constant
dicts: [constant.BUSSINESS_APPROVE_STATUS, constant.LEAVE_TIME_TYPE, constant.BUSINESS_TRAVEL_CATEGORY, constant.APPROVAL_SITE_TYPE],
data() {
+ // 出差时间验证
+ var travelTimeValidate = (_rule, value, callback) => {
+ const that = this
+ if (value != null && value !== '' && that.preBusinessTravelTime.startTime != null && that.preBusinessTravelTime.endTime != null &&
+ (new Date(value).getTime() < new Date(that.preBusinessTravelTime.startTime).getTime() || new Date(value).getTime() > new Date(that.preBusinessTravelTime.endTime).getTime())
+ ) {
+ callback(new Error(`可选时间范围:${that.preBusinessTravelTime.startTime} 至 ${that.preBusinessTravelTime.endTime}`))
+ } else {
+ callback()
+ }
+ }
return {
permission: {
add: ['admin', 'attendanceBusinessTravel:add'],
@@ -746,10 +777,28 @@
{ required: true, message: '审批者不能为空', trigger: 'change' }
],
travelStartTime: [
- { required: true, message: '出差开始日期不能为空', trigger: 'change' }
+ { required: true, message: '出差开始日期不能为空', trigger: 'change' },
+ { validator: travelTimeValidate, trigger: 'change' },
+ { validator: (_rule, value, callback) => {
+ const that = this
+ if (value != null && value !== '' && that.form.travelEndTime != null && that.form.travelEndTime !== '' && new Date(value).getTime() > new Date(that.form.travelEndTime).getTime()) {
+ callback(new Error('出差开始日期不可大于出差结束日期'))
+ } else {
+ callback()
+ }
+ }, trigger: 'change' }
],
travelEndTime: [
- { required: true, message: '出差结束日期不能为空', trigger: 'change' }
+ { required: true, message: '出差结束日期不能为空', trigger: 'change' },
+ { validator: travelTimeValidate, trigger: 'change' },
+ { validator: (_rule, value, callback) => {
+ const that = this
+ if (value != null && value !== '' && that.form.travelStartTime != null && that.form.travelStartTime !== '' && new Date(value).getTime() < new Date(that.form.travelStartTime).getTime()) {
+ callback(new Error('出差结束日期不可小于出差开始日期'))
+ } else {
+ callback()
+ }
+ }, trigger: 'change' }
],
travelDuration: [
{ required: true, message: '出差时长不能为空', trigger: 'blur' }
@@ -772,6 +821,7 @@
},
users: [],
approvalUsers: [],
+ preBusinessTravels: [],
// 项目列表
projects: [],
dictBussinessStatus: constant.BUSSINESS_APPROVE_STATUS,
@@ -790,7 +840,12 @@
// 角色级别: 总经理
roleLevelGenerl: constant.ROLE_LEVEL_GENERAL,
// 企微审核判断
- wecomApprovalVisible: false
+ wecomApprovalVisible: false,
+ // 事前出差时间范围
+ preBusinessTravelTime: {
+ startTime: null,
+ endTime: null
+ }
}
},
computed: {
@@ -800,6 +855,7 @@
const that = this
that.getUsers()
that.getApprovalUsers()
+ that.getPreBusinessTravels()
that.$on('dictReady', () => {
const dictData = { ...that.dict }
const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom')
@@ -848,6 +904,13 @@
}
return true
},
+ // 钩子:提交 - 之后
+ [CRUD.HOOK.afterSubmit]() {
+ const that = this
+ that.$set(that.preBusinessTravelTime, 'startTime', null)
+ that.$set(that.preBusinessTravelTime, 'endTime', null)
+ return true
+ },
// 禁用
disabledUser(data) {
if (this.userRolesLevelMin > this.roleLevelGenerl) {
@@ -884,10 +947,38 @@
this.approvalUsers = res
})
},
+ // 查询事前出差
+ getPreBusinessTravels() {
+ const that = this
+ crudPreBusinessTravel.getAllUse({ approvalStatus: that.dictBussinessAppAgree }).then(res => {
+ that.preBusinessTravels = res
+ })
+ },
// 设定条件查询日期结尾
handleDateChange(value) {
if (value) {
this.query.travelEndTime = value.substring(0, 11) + '23:59:59'
+ }
+ },
+ // 关联事前变更
+ handlePreBusinessTravelChange(value) {
+ const that = this
+ if (value) {
+ const selectedData = that.preBusinessTravels.filter(item => item.id === value)[0]
+ if (selectedData) {
+ that.$set(that.form, 'projectId', selectedData.projectId)
+ that.validateEmptyStr(that.form.travelReason) && that.$set(that.form, 'travelReason', selectedData.travelReason)
+ that.validateEmptyStr(that.form.departureCity) && that.$set(that.form, 'departureCity', selectedData.departureCity)
+ that.validateEmptyStr(that.form.arrivalCity) && that.$set(that.form, 'arrivalCity', selectedData.arrivalCity)
+ that.$set(that.preBusinessTravelTime, 'startTime', selectedData.travelStartTime)
+ that.$set(that.preBusinessTravelTime, 'endTime', selectedData.travelEndTime)
+ }
+ } else {
+ that.$set(that.form, 'projectId', null)
+ that.$set(that.form, 'travelStartTime', null)
+ that.$set(that.form, 'travelEndTime', null)
+ that.$set(that.preBusinessTravelTime, 'startTime', null)
+ that.$set(that.preBusinessTravelTime, 'endTime', null)
}
},
// 计算时长
@@ -1048,6 +1139,17 @@
that.$set(that.form, 'projectId', data.projectId)
that.$set(that.form, 'category', data.category)
that.$set(that.form, 'remarks', data.remarks)
+ that.$set(that.form, 'preBusinessTravelId', data.preBusinessTravelId)
+ // 事前出差数据补充
+ const selectedData = that.preBusinessTravels.filter(item => item.id === data.preBusinessTravelId)[0]
+ if (selectedData) {
+ that.$set(that.preBusinessTravelTime, 'startTime', selectedData.travelStartTime)
+ that.$set(that.preBusinessTravelTime, 'endTime', selectedData.travelEndTime)
+ }
+ },
+ // 验证字符串
+ validateEmptyStr(value) {
+ return value === undefined || value === null || (typeof value === 'string' && value.trim() === '')
}
}
}
diff --git a/eladmin-web-master/src/views/attendance/preBusinessTravel/index.vue b/eladmin-web-master/src/views/attendance/preBusinessTravel/index.vue
new file mode 100644
index 0000000..3b353c6
--- /dev/null
+++ b/eladmin-web-master/src/views/attendance/preBusinessTravel/index.vue
@@ -0,0 +1,699 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <div class="head-container">
+ <div>
+ <el-select v-model="query.userId" filterable clearable placeholder="申请人" class="filter-item" style="width: 185px;" @keyup.enter.native="crud.toQuery">
+ <el-option v-for="item in users" :key="item.id" :label="item.nickName" :value="item.id" />
+ </el-select>
+ <el-select v-model="query.approvalUserId" filterable clearable placeholder="审批者" class="filter-item" style="width: 185px;" @keyup.enter.native="crud.toQuery">
+ <el-option v-for="item in users" :key="item.id" :label="item.nickName" :value="item.id" />
+ </el-select>
+ <el-select v-model="query.approvalStatus" filterable clearable placeholder="审批状态" class="filter-item" style="width: 185px;" @keyup.enter.native="crud.toQuery">
+ <el-option v-for="item in dict[dictBussinessStatus]" :key="item.value" :label="item.label" :value="item.value" />
+ </el-select>
+ <el-select v-model="query.projectId" filterable clearable placeholder="关联项目" class="filter-item" style="width: 185px;" @keyup.enter.native="crud.toQuery">
+ <el-option v-for="item in projects" :key="item.id" :label="item.name" :value="item.id" />
+ </el-select>
+ <el-date-picker v-model="query.travelStartTime" type="date" clearable value-format="yyyy-MM-dd HH:mm:ss" placeholder="出差开始日期" class="filter-item" style="width: 185px;" />
+ <el-date-picker v-model="query.travelEndTime" type="date" clearable value-format="yyyy-MM-dd HH:mm:ss" placeholder="出差结束日期" class="filter-item" style="width: 185px;" @change="handleDateChange" />
+ <rrOperation />
+ </div>
+ <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
+ <crudOperation :permission="permission">
+ <el-button
+ slot="right"
+ class="filter-item"
+ size="mini"
+ type="primary"
+ icon="el-icon-circle-check"
+ :disabled="crud.selections.length < 1 || !crud.selections.every(selection => selection.approvalStatus === dictBussinessAppRev)"
+ style="margin-left: 4px !important;"
+ @click="handleBatchApproval(1, crud.selections)"
+ >
+ 批量同意
+ </el-button>
+ <el-button
+ slot="right"
+ class="filter-item"
+ size="mini"
+ type="primary"
+ icon="el-icon-error"
+ :disabled="crud.selections.length < 1 || !crud.selections.every(selection => selection.approvalStatus === dictBussinessAppRev)"
+ style="margin-left: 4px !important;"
+ @click="handleBatchApproval(2, crud.selections)"
+ >
+ 批量拒绝
+ </el-button>
+ </crudOperation>
+ <!--表单组件-->
+ <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="530px">
+ <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px">
+ <el-form-item label="主键id" hidden>
+ <el-input v-model="form.id" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="申请人" prop="userId">
+ <el-select v-model="form.userId" filterable clearable placeholder="请选择" :disabled="disabledUser(form) || form.wecomSpNo !== null" style="width: 370px;">
+ <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" :hidden="form.wecomSpNo !== null || (form.id == null && wecomApprovalVisible)">
+ <el-select
+ v-if="form.wecomSpNo !== null || (form.id == null && wecomApprovalVisible)"
+ v-model="form.approvalUserId"
+ filterable
+ clearable
+ placeholder="请选择"
+ style="width: 370px;"
+ :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null"
+ >
+ <el-option v-for="item in users" :key="item.id" :label="item.nickName" :value="item.id" />
+ </el-select>
+ <el-select
+ v-else
+ v-model="form.approvalUserId"
+ filterable
+ clearable
+ placeholder="请选择"
+ style="width: 370px;"
+ :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null"
+ >
+ <el-option v-for="item in approvalUsers" :key="item.id" :label="item.nickName" :value="item.id" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="标题" prop="title">
+ <el-input v-model="form.title" placeholder="请输入" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="出差开始时间" prop="travelStartTime">
+ <el-date-picker
+ v-model="form.travelStartTime"
+ type="datetime"
+ placeholder="选择日期"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ style="width: 370px;"
+ align="right"
+ :picker-options="{
+ disabledDate(time) {
+ return form.travelEndTime ? time.getTime() > new Date(form.travelEndTime).getTime() - 8.64e7 : false;
+ }
+ }"
+ :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'"
+ :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null"
+ @change="handleCheckTime"
+ />
+ </el-form-item>
+ <el-form-item label="出差结束时间" prop="travelEndTime">
+ <el-date-picker
+ v-model="form.travelEndTime"
+ type="datetime"
+ placeholder="选择日期"
+ style="width: 370px;"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ align="right"
+ :picker-options="{
+ disabledDate(time) {
+ return form.travelStartTime ? time.getTime() < new Date(form.travelStartTime).getTime() - 8.64e7 : false;
+ }
+ }"
+ :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'"
+ :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null"
+ @change="handleCheckTime"
+ />
+ </el-form-item>
+ <el-form-item label="出差时长" prop="travelDuration">
+ <el-input v-model="form.travelDuration" disabled style="width: 370px;">
+ <template slot="append">{{ dict.label[dictLeaveTimeType][form.durationUnit] }}</template>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="出差原因" prop="travelReason">
+ <el-input v-model="form.travelReason" type="textarea" rows="3" :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="出发城市" prop="departureCity">
+ <el-input v-model="form.departureCity" :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="到达城市" prop="arrivalCity">
+ <el-input v-model="form.arrivalCity" :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="关联项目" prop="projectId">
+ <el-select v-model="form.projectId" filterable clearable placeholder="请选择" :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn" style="width: 370px;">
+ <el-option v-for="item in projects" :key="item.id" :label="item.name" :value="item.id" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="成员" prop="memberUserIds">
+ <el-select v-model="form.memberUserIds" filterable clearable multiple placeholder="请选择" :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn" style="width: 370px;">
+ <el-option v-for="item in users" :key="'memberUserId_' + item.id" :label="item.nickName" :value="item.id" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="审批说明">
+ <el-input v-model="form.approvalDescription" type="textarea" rows="3" disabled style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="备注" prop="remarks">
+ <el-input v-model="form.remarks" type="textarea" rows="3" :disabled="form.approvalStatus == dictBussinessAppAgree || form.approvalStatus == dictBussinessAppReturn || form.wecomSpNo !== null" 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="handleCloseApproval" :visible.sync="approvalDialog.visible" :title="approvalDialog.title" width="500px">
+ <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px">
+ <el-form-item label="申请人">
+ {{ form.userName }}
+ </el-form-item>
+ <el-form-item label="出发城市">
+ {{ form.departureCity }}
+ </el-form-item>
+ <el-form-item label="到达城市">
+ {{ form.arrivalCity }}
+ </el-form-item>
+ <el-form-item label="出差开始时间">
+ {{ crud.toDate(form.travelStartTime) }}
+ </el-form-item>
+ <el-form-item label="出差结束时间">
+ {{ crud.toDate(form.travelEndTime) }}
+ </el-form-item>
+ <el-form-item label="出差时长">
+ {{ `${form.travelDuration}(${dict.label[dictLeaveTimeType][form.durationUnit]})` }}
+ </el-form-item>
+ <el-form-item label="出差原因">
+ {{ form.travelReason }}
+ </el-form-item>
+ <el-form-item v-if="form.approvalStatus === dictBussinessAppReturn" label="退回原因" prop="approvalDescription">
+ <div style="color: red;">
+ *审核退回需要填写退回原因,请填写后再次点击审核退回
+ </div>
+ <el-input v-model="form.approvalDescription" type="textarea" :rows="3" style="width: 340px;" />
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="danger" style="margin-right: 10px;" @click="handleApproval(1, form)">
+ 审核退回
+ </el-button>
+ <el-button v-if="form.approvalStatus !== dictBussinessAppReturn" :loading="approvalDialog.loading" type="success" @click="handleApproval(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 prop="userName" label="申请人" width="100" fixed="left" show-overflow-tooltip>
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.userName }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="appUserName" label="审批者" width="100" fixed="left" show-overflow-tooltip>
+ <template slot-scope="scope">
+ <el-popover v-if="scope.row.wecomSpNo && scope.row.event" placement="right-start" width="600" trigger="click">
+ <approvalLine :event-data="scope.row.event" :user-list="users" />
+ <el-tag slot="reference" effect="dark">
+ <i class="el-icon-search" />
+ <span>详细</span>
+ </el-tag>
+ </el-popover>
+
+ <el-tag v-else-if="scope.row.appUserName">{{ scope.row.appUserName }}</el-tag>
+ <el-tag v-else>暂无</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="title" label="标题" width="100" fixed="left" show-overflow-tooltip>
+ <template slot-scope="scope">
+ <el-tag>{{ scope.row.title }}</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="travelStartTime" label="出差开始时间" width="140" show-overflow-tooltip />
+ <el-table-column prop="travelEndTime" label="出差结束时间" width="140" show-overflow-tooltip />
+ <el-table-column prop="travelDuration" label="出差时长" width="80" show-overflow-tooltip>
+ <template slot-scope="scope">
+ {{ `${scope.row.travelDuration}(${dict.label[dictLeaveTimeType][scope.row.durationUnit]})` }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="travelReason" label="出差原因" width="140" show-overflow-tooltip />
+ <el-table-column prop="departureCity" label="出发城市" width="80" show-overflow-tooltip />
+ <el-table-column prop="arrivalCity" label="到达城市" width="80" show-overflow-tooltip />
+ <el-table-column prop="project.name" label="关联项目" width="80" show-overflow-tooltip />
+ <el-table-column prop="wecomMemberName" label="成员" />
+ <el-table-column prop="approvalStatus" label="审批状态" width="80" show-overflow-tooltip>
+ <template slot-scope="scope">
+ <el-tag v-if="scope.row.approvalStatus === dictBussinessAppRev" type="warning">
+ {{ dict.label[dictBussinessStatus][scope.row.approvalStatus] }}
+ </el-tag>
+ <el-tag v-if="scope.row.approvalStatus === dictBussinessAppAgree" type="success">
+ {{ dict.label[dictBussinessStatus][scope.row.approvalStatus] }}
+ </el-tag>
+ <el-tag v-if="scope.row.approvalStatus === dictBussinessAppReturn" type="danger">
+ {{ dict.label[dictBussinessStatus][scope.row.approvalStatus] }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="approvalDescription" label="审批说明" width="140" show-overflow-tooltip />
+ <el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip />
+ <el-table-column prop="createTime" label="创建时间" width="140" show-overflow-tooltip />
+ <el-table-column v-if="checkPer(['admin', 'preBusinessTravel:approval'])" label="审核操作" width="180" align="center" fixed="right">
+ <template slot-scope="scope">
+ <el-button
+ v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo"
+ v-permission="permission.approval"
+ :loading="crud.status.cu === 2"
+ size="mini"
+ type="primary"
+ icon="el-icon-s-check"
+ :disabled="scope.row.approvalStatus === dictBussinessAppRev ? false : true"
+ @click="toApproval(scope.row)"
+ >
+ 审核
+ </el-button>
+ <el-popover :ref="`popover_${scope.row.id}`" width="200">
+ <p>确定撤销该记录?</p>
+ <div style="text-align: right; margin: 0">
+ <el-button size="mini" type="primary" @click="handleRevokeCanel(scope.row)">取消</el-button>
+ <el-button :loading="successLoading" type="primary" size="mini" @click="handleRevoke(scope.row)">确定</el-button>
+ </div>
+ <el-button
+ v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo"
+ slot="reference"
+ v-permission="permission.approval"
+ type="danger"
+ icon="el-icon-edit-outline"
+ size="mini"
+ :disabled="scope.row.approvalStatus === dictBussinessAppRev ? true : false"
+ >
+ 撤销
+ </el-button>
+ </el-popover>
+ <el-link v-if="scope.row.wecomSpNo" type="primary">请前往企微审核</el-link>
+ </template>
+ </el-table-column>
+ <el-table-column v-if="checkPer(['admin','preBusinessTravel:edit','preBusinessTravel:del'])" label="操作" width="150px" align="center" fixed="right">
+ <template slot-scope="scope">
+ <udOperation v-if="!scope.row.wecomSpNo" :data="scope.row" :permission="permission" />
+ <el-button
+ v-if="scope.row.wecomSpNo && user.id === scope.row.userId && scope.row.approvalStatus === dictBussinessAppReturn"
+ size="mini"
+ type="primary"
+ icon="el-icon-refresh-right"
+ @click="handleReAdd(scope.row)"
+ />
+ </template>
+ </el-table-column>
+ </el-table>
+ <!--分页组件-->
+ <pagination />
+
+ <cp-approval-del-dialog ref="cpApprovalDelDialog" />
+ </div>
+ </div>
+</template>
+
+<script>
+import crudPreBusinessTravel from '@/api/attendance/preBusinessTravel'
+import crudProject from '@/api/project/project'
+import crudUser from '@/api/system/user'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import rrOperation from '@crud/RR.operation'
+import crudOperation from '@crud/CRUD.operation'
+import udOperation from '@crud/UD.operation'
+import pagination from '@crud/Pagination'
+import { mapGetters } from 'vuex'
+import approvalLine from '@/components/ApprovalLine'
+import cpApprovalDelDialog from '@/components/CpApprovalDelDialog'
+import constant from '@/utils/constant'
+
+const defaultForm = { id: null, userId: null, approvalUserId: null, title: null, travelStartTime: null, travelEndTime: null, travelDuration: null, durationUnit: null, travelReason: null, departureCity: null, arrivalCity: null, approvalStatus: null, approvalDescription: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, projectId: null, memberUserId: null, wecomSpNo: null, wecomEventId: null, wecomLocation: null, wecomDateType: null, wecomDuration: null, wecomAttendanceType: null, wecomApproveWecomId: null, wecomProjectName: null, wecomMemberName: null }
+export default {
+ name: 'PreBusinessTravel',
+ components: { pagination, crudOperation, rrOperation, udOperation, approvalLine, cpApprovalDelDialog },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ cruds() {
+ return CRUD({ title: '事前出差', url: 'api/preBusinessTravel', idField: 'id', sort: 'travelStartTime,desc', crudMethod: { ...crudPreBusinessTravel }})
+ },
+ // 数据字典
+ dicts: [constant.BUSSINESS_APPROVE_STATUS, constant.LEAVE_TIME_TYPE, constant.APPROVAL_SITE_TYPE],
+ data() {
+ return {
+ permission: {
+ add: ['admin', 'preBusinessTravel:add'],
+ edit: ['admin', 'preBusinessTravel:edit'],
+ del: ['admin', 'preBusinessTravel:del'],
+ approval: ['admin', 'preBusinessTravel:approval'],
+ batchApproval: ['admin', 'preBusinessTravel:batchApproval']
+ },
+ rules: {
+ userId: [
+ { required: true, message: '申请人不能为空', trigger: 'change' }
+ ],
+ approvalUserId: [
+ { required: true, message: '审批者不能为空', trigger: 'change' }
+ ],
+ title: [
+ { required: true, message: '标题不能为空', trigger: 'blur' }
+ ],
+ travelStartTime: [
+ { required: true, message: '出差开始时间不能为空', trigger: 'blur' }
+ ],
+ travelEndTime: [
+ { required: true, message: '出差结束时间不能为空', trigger: 'blur' }
+ ],
+ travelDuration: [
+ { required: true, message: '出差时长不能为空', trigger: 'blur' }
+ ],
+ durationUnit: [
+ { required: true, message: '时长单位不能为空', trigger: 'change' }
+ ],
+ approvalDescription: [
+ { required: true, message: '退回原因不能为空', trigger: 'blur' }
+ ],
+ approvalStatus: [
+ { required: true, message: '审批状态不能为空', trigger: 'change' }
+ ],
+ projectId: [
+ { required: true, message: '请选择项目', trigger: 'change' }
+ ],
+ memberUserIds: [
+ { required: true, message: '请选择成员', trigger: 'change' }
+ ]
+ },
+ // 数据
+ users: [],
+ approvalUsers: [],
+ projects: [],
+ // 项目状态
+ dictBussinessStatus: constant.BUSSINESS_APPROVE_STATUS,
+ dictBussinessAppRev: constant.BUSSINESS_APPROVE_STATUS_REVIEWED,
+ dictBussinessAppAgree: constant.BUSSINESS_APPROVE_STATUS_AGREE,
+ dictBussinessAppReturn: constant.BUSSINESS_APPROVE_STATUS_REFUSE,
+ dictLeaveTimeTypeDay: constant.LEAVE_TIME_TYPE_DAY,
+ dictLeaveTimeType: constant.LEAVE_TIME_TYPE,
+ dictApprovalSiteType: constant.APPROVAL_SITE_TYPE,
+ // 审核弹窗
+ approvalDialog: {
+ title: '事前出差审批',
+ visible: false,
+ loading: false
+ },
+ // 角色级别:普通用户
+ roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY,
+ // 角色级别: 总经理
+ roleLevelGenerl: constant.ROLE_LEVEL_GENERAL,
+ // 企微审核判断
+ wecomApprovalVisible: false
+ }
+ },
+ computed: { ...mapGetters(['user']) },
+ created() {
+ const that = this
+ that.queryUsers()
+ that.queryApprovalUsers()
+ that.$on('dictReady', () => {
+ const dictData = { ...that.dict }
+ const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom')
+ if (filterData.length > 0) {
+ that.wecomApprovalVisible = true
+ }
+ })
+ },
+ methods: {
+ // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+ [CRUD.HOOK.beforeRefresh]() {
+ const that = this
+ // 用户角色级别数组
+ const userRolesLevel = that.user.roles.map(({ level }) => level)
+ // 用户最大角色级别
+ that.userRolesLevelMin = Math.min(...userRolesLevel)
+ // 获取项目列表
+ that.queryProjects()
+ return true
+ },
+ // 钩子:新建 - 之前
+ [CRUD.HOOK.beforeToAdd]() {
+ const that = this
+ // that.form.durationUnit = that.dictLeaveTimeTypeDay
+ // that.form.memberUserIds = []
+ that.$set(that.form, 'durationUnit', that.dictLeaveTimeTypeDay)
+ that.$set(that.form, 'memberUserIds', [])
+ // 判断用户最大角色级别是否大于总经理角色:赋值
+ if (that.userRolesLevelMin > that.roleLevelGenerl) {
+ // 表单赋值
+ // that.form.userId = that.user.id
+ that.$set(that.form, 'userId', that.user.id)
+ }
+
+ if (that.wecomApprovalVisible) {
+ // this.form.approvalUserId = 0
+ that.$set(that.form, 'approvalUserId', 0)
+ }
+ },
+ // 钩子:编辑 - 之前
+ [CRUD.HOOK.beforeToEdit]() {
+ const that = this
+ // that.form.memberUserIds = that.form.memberUserId.split('-').filter(Boolean)
+ that.$set(that.form, 'memberUserIds', that.form.memberUserId.split('-').filter(Boolean))
+ },
+ // 钩子:提交 - 之前
+ [CRUD.HOOK.beforeSubmit]() {
+ const that = this
+ // that.form.memberUserId = `-${that.form.memberUserIds.join('--')}-`
+ that.$set(that.form, 'memberUserId', `-${that.form.memberUserIds.join('--')}-`)
+ },
+ // 钩子:删除 - 之前
+ [CRUD.HOOK.beforeDelete]() {
+ const that = this
+ if (that.crud.selections.some(selection => selection.wecomSpNo !== null && selection.wecomSpNo !== undefined && selection.wecomSpNo !== '')) {
+ that.$refs.cpApprovalDelDialog.handleOpen()
+ that.crud.delAllLoading = false
+ return false
+ }
+ return true
+ },
+
+ // 禁用申请人
+ disabledUser(data) {
+ if (this.userRolesLevelMin > this.roleLevelGenerl || (data.approvalStatus !== null && data.approvalStatus === this.dictBussinessAppAgree) || data.approvalStatus === this.dictBussinessAppReturn) {
+ return true
+ }
+ },
+ // 获取项目列表
+ queryProjects() {
+ const that = this
+ // 获取项目列表
+ crudProject.getRelevant({ 'projectStatusIn': ['project_status_not_started', 'project_status_under_way'], 'approve_status': 'approve_status_acknowledged' })
+ .then(res => {
+ that.projects = res
+ })
+ },
+ // 查询员工
+ queryUsers() {
+ const that = this
+ crudUser.getAll().then(res => {
+ that.users = res
+ })
+ },
+ // 查询审核人
+ queryApprovalUsers() {
+ crudUser.getApprovalUsers().then(res => {
+ this.approvalUsers = res
+ })
+ },
+ // 设定条件查询日期结尾
+ handleDateChange(value) {
+ if (value) {
+ this.query.travelEndTime = value.substring(0, 11) + '23:59:59'
+ }
+ },
+ // 计算时长
+ handleCheckTime() {
+ const that = this
+ if (that.form.travelStartTime && that.form.travelEndTime) {
+ var data = JSON.stringify({
+ id: that.form.id,
+ travelStartTime: that.form.travelStartTime,
+ travelEndTime: that.form.travelEndTime,
+ userId: that.form.userId
+ })
+ crudPreBusinessTravel.getRemainingTime(data).then(res => {
+ // that.form.travelDuration = res
+ that.$set(that.form, 'travelDuration', res)
+ })
+ }
+ },
+ // 审批页面赋值
+ toApproval(data, opType) {
+ const that = this
+ if (opType !== '1') {
+ // that.approvalDialog.visible = true
+ that.$set(that.approvalDialog, 'visible', true)
+ }
+ // that.form.id = data.id
+ // that.form.userId = data.userId
+ // that.form.userName = data.userName
+ // that.form.title = data.title
+ // that.form.travelStartTime = data.travelStartTime
+ // that.form.travelEndTime = data.travelEndTime
+ // that.form.departureCity = data.departureCity
+ // that.form.arrivalCity = data.arrivalCity
+ // that.form.travelDuration = data.travelDuration
+ // that.form.durationUnit = data.durationUnit
+ // that.form.approvalStatus = data.approvalStatus
+ // that.form.travelReason = data.travelReason
+ // that.form.remarks = data.remarks
+ that.$set(that.form, 'id', data.id)
+ that.$set(that.form, 'userId', data.userId)
+ that.$set(that.form, 'userName', data.userName)
+ that.$set(that.form, 'title', data.title)
+ that.$set(that.form, 'travelStartTime', data.travelStartTime)
+ that.$set(that.form, 'travelEndTime', data.travelEndTime)
+ that.$set(that.form, 'departureCity', data.departureCity)
+ that.$set(that.form, 'arrivalCity', data.arrivalCity)
+ that.$set(that.form, 'travelDuration', data.travelDuration)
+ that.$set(that.form, 'durationUnit', data.durationUnit)
+ that.$set(that.form, 'approvalStatus', data.approvalStatus)
+ that.$set(that.form, 'travelReason', data.travelReason)
+ that.$set(that.form, 'remarks', data.remarks)
+ },
+ // 审核提交功能
+ handleApproval(type, data) {
+ const that = this
+ // that.form.userId = data.userId
+ that.$set(that.form, 'userId', data.userId)
+ const msg = type === 2 ? '通过' : '拒绝'
+ that.$refs['form'].validate(valid => {
+ if (!valid) {
+ return
+ }
+ // 判断通过状态
+ if (type === 2) {
+ // that.form.approvalStatus = that.dictBussinessAppAgree
+ that.$set(that.form, 'approvalStatus', that.dictBussinessAppAgree)
+ } else {
+ // 退回改状态显示退回原因
+ // that.form.approvalStatus = that.dictBussinessAppReturn
+ that.$set(that.form, 'approvalStatus', that.dictBussinessAppReturn)
+ if (that.form.approvalDescription == null) {
+ return
+ }
+ }
+ // that.approvalDialog.loading = true
+ that.$set(that.approvalDialog, 'loading', true)
+ crudPreBusinessTravel.approval(that.form).then(_res => {
+ that.crud.refresh()
+ // that.approvalDialog.visible = false
+ // that.approvalDialog.loading = false
+ that.$set(that.approvalDialog, 'visible', false)
+ that.$set(that.approvalDialog, 'loading', false)
+ that.$message({ type: 'success', message: '审核' + msg + '成功' })
+ }).catch(() => {
+ // that.approvalDialog.visible = false
+ // that.approvalDialog.loading = false
+ that.$set(that.approvalDialog, 'visible', false)
+ that.$set(that.approvalDialog, 'loading', false)
+ })
+ if (that.$refs['form']) {
+ that.$refs['form'].resetFields()
+ }
+ })
+ },
+ // 批量审核
+ handleBatchApproval(type, data) {
+ const that = this
+ const msg = type === 2 ? '批量拒绝' : '批量同意'
+ const status = type === 2 ? 'error' : 'success'
+ // 确认框
+ that.$confirm('此操作将' + msg + '审核内容是否继续?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: status
+ }).then(() => {
+ const ids = []
+ // 循环数据
+ for (let i = 0; i < data.length; i++) {
+ // ID列表
+ if (data[i].wecomSpNo) {
+ continue
+ }
+ ids.push(data[i].id)
+ }
+ crudPreBusinessTravel.batchApproval({ num: type, ids: ids }).then(_res => {
+ // 消息提示
+ that.$message({ type: 'success', message: msg + '!' })
+ // 刷新数据
+ that.crud.refresh()
+ })
+ })
+ },
+ // 撤消功能
+ handleRevoke(data) {
+ const that = this
+ that.toApproval(data, '1')
+ // that.form.approvalStatus = that.dictBussinessAppRev
+ that.$set(that.form, 'approvalStatus', that.dictBussinessAppRev)
+ // that.approvalDialog.loading = true
+ that.$set(that.approvalDialog, 'loading', true)
+ crudPreBusinessTravel.approval(that.form).then(_res => {
+ that.crud.refresh()
+ // that.approvalDialog.loading = false
+ that.$set(that.approvalDialog, 'loading', false)
+ that.$message({ type: 'success', message: '撤销成功' })
+ that.$refs[`popover_${data.id}`].showPopper = false
+ }).catch(error => {
+ that.$message({ type: 'error', message: error.response.data.message })
+ })
+ if (that.$refs['form']) {
+ that.$refs['form'].resetFields()
+ }
+ that.crud.cancelCU()
+ },
+ // 关闭审核弹窗
+ handleCloseApproval() {
+ const that = this
+ if (that.$refs['form']) {
+ that.$refs['form'].resetFields()
+ }
+ that.crud.cancelCU()
+ // that.approvalDialog.visible = false
+ that.$set(that.approvalDialog, 'visible', false)
+ },
+ // 取消撤销操作
+ handleRevokeCanel(data) {
+ const that = this
+ that.$refs[`popover_${data.id}`].showPopper = false
+ },
+ // 再新增(企微)
+ handleReAdd(data) {
+ const that = this
+ that.crud.toAdd()
+ that.$set(that.form, 'userId', data.userId)
+ that.$set(that.form, 'approvalUserId', data.approvalUserId)
+ that.$set(that.form, 'title', data.title)
+ that.$set(that.form, 'travelStartTime', data.travelStartTime)
+ that.$set(that.form, 'travelEndTime', data.travelEndTime)
+ that.$set(that.form, 'travelDuration', data.travelDuration)
+ that.$set(that.form, 'travelReason', data.travelReason)
+ that.$set(that.form, 'departureCity', data.departureCity)
+ that.$set(that.form, 'arrivalCity', data.arrivalCity)
+ that.$set(that.form, 'projectId', data.projectId)
+ that.$set(that.form, 'remarks', data.remarks)
+ }
+ }
+}
+</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>
diff --git a/eladmin-web-master/src/views/template/bind/index.vue b/eladmin-web-master/src/views/template/bind/index.vue
index bc4e466..eab973b 100644
--- a/eladmin-web-master/src/views/template/bind/index.vue
+++ b/eladmin-web-master/src/views/template/bind/index.vue
@@ -155,7 +155,7 @@
rules: {}
}
},
- dicts: [constant.WECOM_BIND_LEAVE, constant.WECOM_BIND_GOOUT, constant.WECOM_BIND_TRAVEL, constant.WECOM_BIND_OVERTIME, constant.WECOM_BIND_REPLACEMENT, constant.WECOM_BIND_REIMBURSE, constant.APPROVAL_SITE_TYPE],
+ dicts: [constant.WECOM_BIND_LEAVE, constant.WECOM_BIND_GOOUT, constant.WECOM_BIND_TRAVEL, constant.WECOM_BIND_OVERTIME, constant.WECOM_BIND_REPLACEMENT, constant.WECOM_BIND_REIMBURSE, constant.WECOM_BIND_PRE_TRAVEL, constant.APPROVAL_SITE_TYPE],
created() {
const that = this
that.queryLoading = true
@@ -192,8 +192,14 @@
dictData[constant.WECOM_BIND_REIMBURSE].forEach(reimburse => {
reimburseTableDate.fieldNames.push({ label: reimburse.label, propName: reimburse.value })
})
- that.tableInfoData.push(leaveTableDate, goOutTableDate, travelTableDate, overtimeTableDate, replacementTableDate, reimburseTableDate)
+ // 事前出差字段绑定信息制作
+ const preTravelTableDate = { name: '事前出差', fieldTable: constant.WECOM_BIND_PRE_TRAVEL, fieldNames: [] }
+ dictData[constant.WECOM_BIND_PRE_TRAVEL].forEach(preTravel => {
+ preTravelTableDate.fieldNames.push({ label: preTravel.label, propName: preTravel.value })
+ })
+ // 填充数据
+ that.tableInfoData.push(leaveTableDate, goOutTableDate, travelTableDate, overtimeTableDate, replacementTableDate, reimburseTableDate, preTravelTableDate)
that.queryLoading = false
// 判断申请审核站点
--
Gitblit v1.9.3