Ver código fonte

请假申请流程

Wang Zi Wen 1 ano atrás
pai
commit
406730c71a

+ 19 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/branch/TApproveDangerController.java

@@ -1,9 +1,11 @@
 package com.ruoyi.web.controller.branch;
 
 import com.alibaba.fastjson.JSON;
+import com.ruoyi.branch.domain.TBranchLeaveApply;
 import com.ruoyi.branch.domain.TBranchMember;
 import com.ruoyi.branch.domain.approve.DevProcess;
 import com.ruoyi.branch.domain.approve.DevTask;
+import com.ruoyi.branch.service.ITBranchLeaveApplyService;
 import com.ruoyi.branch.service.ITBranchMemberService;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.entity.SysUser;
@@ -61,6 +63,9 @@ public class TApproveDangerController extends BaseController {
     @Autowired
     private ITBranchMemberService memberService;
 
+    @Autowired
+    private ITBranchLeaveApplyService tBranchLeaveApplyService;
+
     /**
      * 我的申请列表
      */
@@ -93,6 +98,10 @@ public class TApproveDangerController extends BaseController {
                         TBranchMember member = memberService.selectTBranchMemberByMemberId(Long.parseLong(h.getBusinessKey()));
                         devProcess.setObj(member);
                         devProcess.setApNo(member.getApNo());
+                    } else if (pi.getProcessDefinitionName().equals("支部请假申请")) {
+                        TBranchLeaveApply apply = tBranchLeaveApplyService.selectTBranchLeaveApplyByLeaveId(Long.parseLong(h.getBusinessKey()));
+                        devProcess.setObj(apply);
+                        devProcess.setApNo(apply.getApNo());
                     }
                 } catch (Exception e) {
                     logger.error(e.toString());
@@ -157,6 +166,10 @@ public class TApproveDangerController extends BaseController {
                     TBranchMember member = memberService.selectTBranchMemberByMemberId(Long.parseLong(pi.getBusinessKey()));
                     devTask.setObj(member);
                     devTask.setApNo(member.getApNo());
+                } else if (pi.getProcessDefinitionName().equals("支部请假申请")) {
+                    TBranchLeaveApply apply = tBranchLeaveApplyService.selectTBranchLeaveApplyByLeaveId(Long.parseLong(pi.getBusinessKey()));
+                    devTask.setObj(apply);
+                    devTask.setApNo(apply.getApNo());
                 }
                 list.add(devTask);
             }
@@ -196,6 +209,12 @@ public class TApproveDangerController extends BaseController {
                     devProcess.setApNo(member.getApNo());
                     devProcess.setApName(user.getNickName());
                     devProcess.setObj(member);
+                } else if (pi.getProcessDefinitionName().equals("支部请假申请")) {
+                    TBranchLeaveApply apply = tBranchLeaveApplyService.selectTBranchLeaveApplyByLeaveId(Long.parseLong(pi.getBusinessKey()));
+                    SysUser user = sysUserService.selectUserById(apply.getUserId());
+                    devProcess.setApNo(apply.getApNo());
+                    devProcess.setApName(user.getNickName());
+                    devProcess.setObj(apply);
                 }
                 devProcess.setBusinessKey(pi.getBusinessKey());
                 devProcess.setProcessCreateTime(pi.getStartTime());

+ 201 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/branch/TBranchLeaveApplyController.java

@@ -0,0 +1,201 @@
+package com.ruoyi.web.controller.branch;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.branch.domain.approve.DevTask;
+import com.ruoyi.common.utils.DateUtils;
+import org.activiti.engine.ProcessEngine;
+import org.activiti.engine.ProcessEngines;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.TaskService;
+import org.activiti.engine.impl.identity.Authentication;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.branch.domain.TBranchLeaveApply;
+import com.ruoyi.branch.service.ITBranchLeaveApplyService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 请假申请Controller
+ * 
+ * @author ruoyi
+ * @date 2023-09-27
+ */
+@RestController
+@RequestMapping("/branch/leave")
+public class TBranchLeaveApplyController extends BaseController
+{
+    @Autowired
+    private ITBranchLeaveApplyService tBranchLeaveApplyService;
+
+    @Autowired
+    private RuntimeService runtimeService;
+
+    /**
+     * 审批处理
+     *
+     * @param devTask
+     * @return
+     */
+    @PutMapping("/handle")
+    public AjaxResult handle(@RequestBody DevTask devTask) {
+        TBranchLeaveApply apply = tBranchLeaveApplyService.selectTBranchLeaveApplyByLeaveId(devTask.getObjId());
+        String taskId = devTask.getTaskId();
+        String taskName = devTask.getTaskName();
+        String condition = devTask.getCondition();
+        Map<String, Object> param = new HashMap<>();
+        param.put("condition", condition);
+
+        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
+        TaskService taskService = processEngine.getTaskService();
+        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
+        String processInstancesId = task.getProcessInstanceId();
+        processEngine.getTaskService().claim(taskId, getUserId().toString());
+        taskService.complete(taskId, param);
+
+        if (taskName.equals("支部书记审核")) {
+            if (condition.equals("1")) {
+                apply.setLeaveStatus("2");
+            } else if (condition.equals("0")) {
+                apply.setLeaveStatus("3");
+            }
+            apply.setApproveDate(new Date());
+        }
+        tBranchLeaveApplyService.updateTBranchLeaveApply(apply);
+
+        return AjaxResult.success();
+    }
+
+    /**
+     * 提交申请
+     */
+    @PutMapping("/apply/{leaveId}")
+    public AjaxResult apply(@PathVariable Long leaveId)
+    {
+        TBranchLeaveApply tBranchLeaveApply = tBranchLeaveApplyService.selectTBranchLeaveApplyByLeaveId(leaveId);
+        String userId = getUserId().toString();
+
+        // 开始流程
+        Authentication.setAuthenticatedUserId(userId);
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("applicant", userId);
+        variables.put("verifier", "120");
+        long businessKey = tBranchLeaveApply.getLeaveId();
+        ProcessInstance pi = runtimeService.startProcessInstanceByKey("branchLeaveApplyProcess", String.valueOf(businessKey), variables);
+
+        // 提交申请
+        Map<String, Object> param = new HashMap<>();
+        param.put("condition", "1");
+        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
+        TaskService taskService = processEngine.getTaskService();
+        List<Task> list = taskService.createTaskQuery().taskCandidateOrAssigned(userId).list();
+        String taskId = null;
+        String processInstanceId = null;
+        for (Task task : list) {
+            processInstanceId = task.getProcessInstanceId();
+            if (processInstanceId.equals(pi.getProcessInstanceId())) {
+                taskId = task.getId();
+            }
+        }
+        processEngine.getTaskService().claim(taskId, getUserId().toString());
+        taskService.complete(taskId, param);
+
+        tBranchLeaveApply.setProcessId(pi.getProcessInstanceId());
+        tBranchLeaveApply.setApNo(DateUtils.dateTimeNow() + userId);
+        tBranchLeaveApply.setLeaveStatus("1");
+        tBranchLeaveApply.setApplyDate(new Date());
+        tBranchLeaveApplyService.updateTBranchLeaveApply(tBranchLeaveApply);
+
+        return AjaxResult.success();
+    }
+
+    /**
+     * 查询请假申请列表
+     */
+    @PreAuthorize("@ss.hasPermi('branch:leave:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TBranchLeaveApply tBranchLeaveApply)
+    {
+        startPage();
+        List<TBranchLeaveApply> list = tBranchLeaveApplyService.selectTBranchLeaveApplyList(tBranchLeaveApply);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出请假申请列表
+     */
+    @PreAuthorize("@ss.hasPermi('branch:leave:export')")
+    @Log(title = "请假申请", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, TBranchLeaveApply tBranchLeaveApply)
+    {
+        List<TBranchLeaveApply> list = tBranchLeaveApplyService.selectTBranchLeaveApplyList(tBranchLeaveApply);
+        ExcelUtil<TBranchLeaveApply> util = new ExcelUtil<TBranchLeaveApply>(TBranchLeaveApply.class);
+        util.exportExcel(response, list, "请假申请数据");
+    }
+
+    /**
+     * 获取请假申请详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('branch:leave:query')")
+    @GetMapping(value = "/{leaveId}")
+    public AjaxResult getInfo(@PathVariable("leaveId") Long leaveId)
+    {
+        return success(tBranchLeaveApplyService.selectTBranchLeaveApplyByLeaveId(leaveId));
+    }
+
+    /**
+     * 新增请假申请
+     */
+    @PreAuthorize("@ss.hasPermi('branch:leave:add')")
+    @Log(title = "请假申请", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TBranchLeaveApply tBranchLeaveApply)
+    {
+        tBranchLeaveApply.setUserId(getUserId());
+        tBranchLeaveApply.setDeptId(getDeptId());
+        tBranchLeaveApply.setLeaveStatus("0");
+        return toAjax(tBranchLeaveApplyService.insertTBranchLeaveApply(tBranchLeaveApply));
+    }
+
+    /**
+     * 修改请假申请
+     */
+    @PreAuthorize("@ss.hasPermi('branch:leave:edit')")
+    @Log(title = "请假申请", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TBranchLeaveApply tBranchLeaveApply)
+    {
+        return toAjax(tBranchLeaveApplyService.updateTBranchLeaveApply(tBranchLeaveApply));
+    }
+
+    /**
+     * 删除请假申请
+     */
+    @PreAuthorize("@ss.hasPermi('branch:leave:remove')")
+    @Log(title = "请假申请", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{leaveIds}")
+    public AjaxResult remove(@PathVariable Long[] leaveIds)
+    {
+        return toAjax(tBranchLeaveApplyService.deleteTBranchLeaveApplyByLeaveIds(leaveIds));
+    }
+}

+ 4 - 56
ruoyi-common/src/main/java/com/ruoyi/common/config/ActivitiConfig.java

@@ -92,62 +92,10 @@ public class ActivitiConfig {
         DeploymentBuilder deploymentBuilder = repositoryService().createDeployment();
         Resource common = resourceLoader.getResource("classpath:/processes/common.bpmn"); //加载流程图资源文件
         deploymentBuilder.enableDuplicateFiltering().addInputStream(common.getFilename(), common.getInputStream()).name("通用审批流程").deploy(); //按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder1 = repositoryService().createDeployment();
-//        Resource major= resourceLoader.getResource("classpath:/processes/major.bpmn");
-//        deploymentBuilder1.enableDuplicateFiltering().addInputStream(major.getFilename(), major.getInputStream()).name("重大隐患审批流程").deploy();
-//
-//        DeploymentBuilder deploymentBuilder2 = repositoryService().createDeployment();
-//        Resource accident = resourceLoader.getResource("classpath:/processes/accident.bpmn"); //加载流程图资源文件
-//        deploymentBuilder2.enableDuplicateFiltering().addInputStream(accident.getFilename(), accident.getInputStream()).name("事件审批流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder3 = repositoryService().createDeployment();
-//        Resource spec = resourceLoader.getResource("classpath:/processes/MyProcess.bpmn"); //加载流程图资源文件
-//        deploymentBuilder3.enableDuplicateFiltering().addInputStream(spec.getFilename(), spec.getInputStream()).name("特种设备审批流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder4 = repositoryService().createDeployment();
-//        Resource spec2 = resourceLoader.getResource("classpath:/processes/his/semsAddDelProcess.bpmn"); //加载流程图资源文件
-//        deploymentBuilder4.enableDuplicateFiltering().addInputStream(spec2.getFilename(), spec2.getInputStream()).name("特种设备新增修改流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder5 = repositoryService().createDeployment();
-//        Resource spec3 = resourceLoader.getResource("classpath:/processes/sems/yearProcess.bpmn"); //加载流程图资源文件
-//        deploymentBuilder5.enableDuplicateFiltering().addInputStream(spec3.getFilename(), spec3.getInputStream()).name("特种设备年检报告流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder6 = repositoryService().createDeployment();
-//        Resource spec4 = resourceLoader.getResource("classpath:/processes/sems/monthProcess.bpmn"); //加载流程图资源文件
-//        deploymentBuilder6.enableDuplicateFiltering().addInputStream(spec4.getFilename(), spec4.getInputStream()).name("特种设备月度检验流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder7 = repositoryService().createDeployment();
-//        Resource spec7 = resourceLoader.getResource("classpath:/processes/specTraining/specTrainingPlanProcess.bpmn"); //加载流程图资源文件
-//        deploymentBuilder7.enableDuplicateFiltering().addInputStream(spec7.getFilename(), spec7.getInputStream()).name("专项培训计划审核").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder8 = repositoryService().createDeployment();
-//        Resource spec8 = resourceLoader.getResource("classpath:/processes/maintenance.bpmn"); //加载流程图资源文件
-//        deploymentBuilder8.enableDuplicateFiltering().addInputStream(spec8.getFilename(), spec8.getInputStream()).name("设备维修审核").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder9 = repositoryService().createDeployment();
-//        Resource spec9 = resourceLoader.getResource("classpath:/processes/intact/intactChangeApplicationProcess.bpmn"); //加载流程图资源文件
-//        deploymentBuilder9.enableDuplicateFiltering().addInputStream(spec9.getFilename(), spec9.getInputStream()).name("设备变更申请流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder10 = repositoryService().createDeployment();
-//        Resource spec10 = resourceLoader.getResource("classpath:/processes/kekao/reliability.bpmn"); //加载流程图资源文件
-//        deploymentBuilder10.enableDuplicateFiltering().addInputStream(spec10.getFilename(), spec10.getInputStream()).name("可靠性管理申请流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder11 = repositoryService().createDeployment();
-//        Resource spec11 = resourceLoader.getResource("classpath:/processes/reserveInvoice.bpmn"); //加载流程图资源文件
-//        deploymentBuilder11.enableDuplicateFiltering().addInputStream(spec11.getFilename(), spec11.getInputStream()).name("预约开票审批流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder12 = repositoryService().createDeployment();
-//        Resource spec12 = resourceLoader.getResource("classpath:/processes/apply/offlinevalve.bpmn"); //加载流程图资源文件
-//        deploymentBuilder12.enableDuplicateFiltering().addInputStream(spec12.getFilename(), spec12.getInputStream()).name("安全阀离线/切出申请流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder13 = repositoryService().createDeployment();
-//        Resource spec13 = resourceLoader.getResource("classpath:/processes/apply/safetychange.bpmn"); //加载流程图资源文件
-//        deploymentBuilder13.enableDuplicateFiltering().addInputStream(spec13.getFilename(), spec13.getInputStream()).name("组织保护措施状态变更申请流程").deploy();//按流程id部署
-//
-//        DeploymentBuilder deploymentBuilder14 = repositoryService().createDeployment();
-//        Resource spec14 = resourceLoader.getResource("classpath:/processes/sai/saiApply.bpmn"); //加载流程图资源文件
-//        deploymentBuilder14.enableDuplicateFiltering().addInputStream(spec14.getFilename(), spec14.getInputStream()).name("SAI开项申请流程").deploy();//按流程id部署
+
+        DeploymentBuilder deploymentBuilder1 = repositoryService().createDeployment();
+        Resource major= resourceLoader.getResource("classpath:/processes/leaveApply.bpmn");
+        deploymentBuilder1.enableDuplicateFiltering().addInputStream(major.getFilename(), major.getInputStream()).name("支部请假申请").deploy();
     }
 }
 

+ 64 - 0
ruoyi-common/src/main/resources/processes/leaveApply.bpmn

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
+  <process id="branchLeaveApplyProcess" name="支部请假申请" isExecutable="true">
+    <startEvent id="startevent1" name="Start"></startEvent>
+    <endEvent id="endevent1" name="End"></endEvent>
+    <userTask id="apply" name="支部成员申请" activiti:assignee="#{applicant}"></userTask>
+    <userTask id="verify" name="支部书记审核" activiti:assignee="#{verifier}"></userTask>
+    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="apply"></sequenceFlow>
+    <sequenceFlow id="flow2" name="提交" sourceRef="apply" targetRef="verify">
+      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${condition == 1}]]></conditionExpression>
+    </sequenceFlow>
+    <sequenceFlow id="flow3" name="批准" sourceRef="verify" targetRef="endevent1">
+      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${condition == 1}]]></conditionExpression>
+    </sequenceFlow>
+    <endEvent id="endevent2" name="End"></endEvent>
+    <sequenceFlow id="flow4" name="驳回" sourceRef="verify" targetRef="endevent2">
+      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${condition == 0}]]></conditionExpression>
+    </sequenceFlow>
+  </process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_branchLeaveApplyProcess">
+    <bpmndi:BPMNPlane bpmnElement="branchLeaveApplyProcess" id="BPMNPlane_branchLeaveApplyProcess">
+      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
+        <omgdc:Bounds height="35.0" width="35.0" x="120.0" y="250.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
+        <omgdc:Bounds height="35.0" width="35.0" x="680.0" y="250.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="apply" id="BPMNShape_apply">
+        <omgdc:Bounds height="55.0" width="105.0" x="260.0" y="240.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="verify" id="BPMNShape_verify">
+        <omgdc:Bounds height="55.0" width="105.0" x="480.0" y="240.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
+        <omgdc:Bounds height="35.0" width="35.0" x="515.0" y="380.0"></omgdc:Bounds>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
+        <omgdi:waypoint x="155.0" y="267.0"></omgdi:waypoint>
+        <omgdi:waypoint x="260.0" y="267.0"></omgdi:waypoint>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
+        <omgdi:waypoint x="365.0" y="267.0"></omgdi:waypoint>
+        <omgdi:waypoint x="480.0" y="267.0"></omgdi:waypoint>
+        <bpmndi:BPMNLabel>
+          <omgdc:Bounds height="16.0" width="100.0" x="399.0" y="250.0"></omgdc:Bounds>
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
+        <omgdi:waypoint x="585.0" y="267.0"></omgdi:waypoint>
+        <omgdi:waypoint x="680.0" y="267.0"></omgdi:waypoint>
+        <bpmndi:BPMNLabel>
+          <omgdc:Bounds height="16.0" width="100.0" x="599.0" y="250.0"></omgdc:Bounds>
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
+        <omgdi:waypoint x="532.0" y="295.0"></omgdi:waypoint>
+        <omgdi:waypoint x="532.0" y="380.0"></omgdi:waypoint>
+        <bpmndi:BPMNLabel>
+          <omgdc:Bounds height="16.0" width="100.0" x="540.0" y="319.0"></omgdc:Bounds>
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</definitions>

+ 197 - 0
ruoyi-system/src/main/java/com/ruoyi/branch/domain/TBranchLeaveApply.java

@@ -0,0 +1,197 @@
+package com.ruoyi.branch.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 请假申请对象 t_branch_leave_apply
+ * 
+ * @author ruoyi
+ * @date 2023-09-27
+ */
+public class TBranchLeaveApply extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键id */
+    @Excel(name = "主键id")
+    private Long leaveId;
+
+    /** 用户id */
+    @Excel(name = "用户id")
+    private Long userId;
+
+    private String nickName;
+
+    /** 状态 */
+    @Excel(name = "状态")
+    private String leaveStatus;
+
+    /** 原因 */
+    @Excel(name = "原因")
+    private String reason;
+
+    /** 申请时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date applyDate;
+
+    /** 批准时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "批准时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date approveDate;
+
+    /** 请假时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "请假时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date leaveDate;
+
+    /** 删除标志(0代表存在 2代表删除) */
+    private String delFlag;
+
+    /** 部门id */
+    @Excel(name = "部门id")
+    private Long deptId;
+
+    /**
+     * 申请编号
+     */
+    private String apNo;
+
+    /**
+     * 流程编号
+     */
+    private String processId;
+
+    public String getNickName() {
+        return nickName;
+    }
+
+    public void setNickName(String nickName) {
+        this.nickName = nickName;
+    }
+
+    public String getApNo() {
+        return apNo;
+    }
+
+    public void setApNo(String apNo) {
+        this.apNo = apNo;
+    }
+
+    public String getProcessId() {
+        return processId;
+    }
+
+    public void setProcessId(String processId) {
+        this.processId = processId;
+    }
+
+    public Date getLeaveDate() {
+        return leaveDate;
+    }
+
+    public void setLeaveDate(Date leaveDate) {
+        this.leaveDate = leaveDate;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public void setLeaveId(Long leaveId)
+    {
+        this.leaveId = leaveId;
+    }
+
+    public Long getLeaveId() 
+    {
+        return leaveId;
+    }
+
+    public void setUserId(Long userId) 
+    {
+        this.userId = userId;
+    }
+
+    public Long getUserId() 
+    {
+        return userId;
+    }
+
+    public void setLeaveStatus(String leaveStatus) 
+    {
+        this.leaveStatus = leaveStatus;
+    }
+
+    public String getLeaveStatus() 
+    {
+        return leaveStatus;
+    }
+
+    public void setApplyDate(Date applyDate) 
+    {
+        this.applyDate = applyDate;
+    }
+
+    public Date getApplyDate() 
+    {
+        return applyDate;
+    }
+
+    public void setApproveDate(Date approveDate) 
+    {
+        this.approveDate = approveDate;
+    }
+
+    public Date getApproveDate() 
+    {
+        return approveDate;
+    }
+
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+
+    public void setDeptId(Long deptId) 
+    {
+        this.deptId = deptId;
+    }
+
+    public Long getDeptId() 
+    {
+        return deptId;
+    }
+
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("leaveId", getLeaveId())
+            .append("userId", getUserId())
+            .append("leaveStatus", getLeaveStatus())
+            .append("applyDate", getApplyDate())
+            .append("approveDate", getApproveDate())
+            .append("delFlag", getDelFlag())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("deptId", getDeptId())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/branch/mapper/TBranchLeaveApplyMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.branch.mapper;
+
+import java.util.List;
+import com.ruoyi.branch.domain.TBranchLeaveApply;
+
+/**
+ * 请假申请Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-09-27
+ */
+public interface TBranchLeaveApplyMapper 
+{
+    /**
+     * 查询请假申请
+     * 
+     * @param leaveId 请假申请主键
+     * @return 请假申请
+     */
+    public TBranchLeaveApply selectTBranchLeaveApplyByLeaveId(Long leaveId);
+
+    /**
+     * 查询请假申请列表
+     * 
+     * @param tBranchLeaveApply 请假申请
+     * @return 请假申请集合
+     */
+    public List<TBranchLeaveApply> selectTBranchLeaveApplyList(TBranchLeaveApply tBranchLeaveApply);
+
+    /**
+     * 新增请假申请
+     * 
+     * @param tBranchLeaveApply 请假申请
+     * @return 结果
+     */
+    public int insertTBranchLeaveApply(TBranchLeaveApply tBranchLeaveApply);
+
+    /**
+     * 修改请假申请
+     * 
+     * @param tBranchLeaveApply 请假申请
+     * @return 结果
+     */
+    public int updateTBranchLeaveApply(TBranchLeaveApply tBranchLeaveApply);
+
+    /**
+     * 删除请假申请
+     * 
+     * @param leaveId 请假申请主键
+     * @return 结果
+     */
+    public int deleteTBranchLeaveApplyByLeaveId(Long leaveId);
+
+    /**
+     * 批量删除请假申请
+     * 
+     * @param leaveIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTBranchLeaveApplyByLeaveIds(Long[] leaveIds);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/branch/service/ITBranchLeaveApplyService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.branch.service;
+
+import java.util.List;
+import com.ruoyi.branch.domain.TBranchLeaveApply;
+
+/**
+ * 请假申请Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-09-27
+ */
+public interface ITBranchLeaveApplyService 
+{
+    /**
+     * 查询请假申请
+     * 
+     * @param leaveId 请假申请主键
+     * @return 请假申请
+     */
+    public TBranchLeaveApply selectTBranchLeaveApplyByLeaveId(Long leaveId);
+
+    /**
+     * 查询请假申请列表
+     * 
+     * @param tBranchLeaveApply 请假申请
+     * @return 请假申请集合
+     */
+    public List<TBranchLeaveApply> selectTBranchLeaveApplyList(TBranchLeaveApply tBranchLeaveApply);
+
+    /**
+     * 新增请假申请
+     * 
+     * @param tBranchLeaveApply 请假申请
+     * @return 结果
+     */
+    public int insertTBranchLeaveApply(TBranchLeaveApply tBranchLeaveApply);
+
+    /**
+     * 修改请假申请
+     * 
+     * @param tBranchLeaveApply 请假申请
+     * @return 结果
+     */
+    public int updateTBranchLeaveApply(TBranchLeaveApply tBranchLeaveApply);
+
+    /**
+     * 批量删除请假申请
+     * 
+     * @param leaveIds 需要删除的请假申请主键集合
+     * @return 结果
+     */
+    public int deleteTBranchLeaveApplyByLeaveIds(Long[] leaveIds);
+
+    /**
+     * 删除请假申请信息
+     * 
+     * @param leaveId 请假申请主键
+     * @return 结果
+     */
+    public int deleteTBranchLeaveApplyByLeaveId(Long leaveId);
+}

+ 99 - 0
ruoyi-system/src/main/java/com/ruoyi/branch/service/impl/TBranchLeaveApplyServiceImpl.java

@@ -0,0 +1,99 @@
+package com.ruoyi.branch.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.branch.mapper.TBranchLeaveApplyMapper;
+import com.ruoyi.branch.domain.TBranchLeaveApply;
+import com.ruoyi.branch.service.ITBranchLeaveApplyService;
+
+/**
+ * 请假申请Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-09-27
+ */
+@Service
+public class TBranchLeaveApplyServiceImpl implements ITBranchLeaveApplyService 
+{
+    @Autowired
+    private TBranchLeaveApplyMapper tBranchLeaveApplyMapper;
+
+    /**
+     * 查询请假申请
+     * 
+     * @param leaveId 请假申请主键
+     * @return 请假申请
+     */
+    @Override
+    public TBranchLeaveApply selectTBranchLeaveApplyByLeaveId(Long leaveId)
+    {
+        return tBranchLeaveApplyMapper.selectTBranchLeaveApplyByLeaveId(leaveId);
+    }
+
+    /**
+     * 查询请假申请列表
+     * 
+     * @param tBranchLeaveApply 请假申请
+     * @return 请假申请
+     */
+    @Override
+    @DataScope(deptAlias = "d", userAlias = "u")
+    public List<TBranchLeaveApply> selectTBranchLeaveApplyList(TBranchLeaveApply tBranchLeaveApply)
+    {
+        return tBranchLeaveApplyMapper.selectTBranchLeaveApplyList(tBranchLeaveApply);
+    }
+
+    /**
+     * 新增请假申请
+     * 
+     * @param tBranchLeaveApply 请假申请
+     * @return 结果
+     */
+    @Override
+    public int insertTBranchLeaveApply(TBranchLeaveApply tBranchLeaveApply)
+    {
+        tBranchLeaveApply.setCreateTime(DateUtils.getNowDate());
+        return tBranchLeaveApplyMapper.insertTBranchLeaveApply(tBranchLeaveApply);
+    }
+
+    /**
+     * 修改请假申请
+     * 
+     * @param tBranchLeaveApply 请假申请
+     * @return 结果
+     */
+    @Override
+    public int updateTBranchLeaveApply(TBranchLeaveApply tBranchLeaveApply)
+    {
+        tBranchLeaveApply.setUpdateTime(DateUtils.getNowDate());
+        return tBranchLeaveApplyMapper.updateTBranchLeaveApply(tBranchLeaveApply);
+    }
+
+    /**
+     * 批量删除请假申请
+     * 
+     * @param leaveIds 需要删除的请假申请主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTBranchLeaveApplyByLeaveIds(Long[] leaveIds)
+    {
+        return tBranchLeaveApplyMapper.deleteTBranchLeaveApplyByLeaveIds(leaveIds);
+    }
+
+    /**
+     * 删除请假申请信息
+     * 
+     * @param leaveId 请假申请主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTBranchLeaveApplyByLeaveId(Long leaveId)
+    {
+        return tBranchLeaveApplyMapper.deleteTBranchLeaveApplyByLeaveId(leaveId);
+    }
+}

+ 129 - 0
ruoyi-system/src/main/resources/mapper/branch/TBranchLeaveApplyMapper.xml

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.branch.mapper.TBranchLeaveApplyMapper">
+    
+    <resultMap type="TBranchLeaveApply" id="TBranchLeaveApplyResult">
+        <result property="leaveId"    column="leave_id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="nickName"    column="nick_name"    />
+        <result property="leaveStatus"    column="leave_status"    />
+        <result property="reason"    column="reason"    />
+        <result property="applyDate"    column="apply_date"    />
+        <result property="approveDate"    column="approve_date"    />
+        <result property="leaveDate"    column="leave_date"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="apNo"    column="ap_no"    />
+        <result property="processId"    column="process_id"    />
+    </resultMap>
+
+    <sql id="selectTBranchLeaveApplyVo">
+        select u.leave_id, u.ap_no, u.process_id, u.user_id, u.leave_status, u.leave_date, u.reason, u.apply_date, u.approve_date, u.del_flag, u.create_by, u.create_time, u.update_by, u.update_time, u.dept_id,
+        us.nick_name
+        from t_branch_leave_apply u
+        left join sys_dept d on u.dept_id = d.dept_id
+        left join sys_user us on u.user_id = us.user_id
+    </sql>
+
+    <select id="selectTBranchLeaveApplyList" parameterType="TBranchLeaveApply" resultMap="TBranchLeaveApplyResult">
+        <include refid="selectTBranchLeaveApplyVo"/>
+        <where>  
+            <if test="leaveId != null "> and u.leave_id = #{leaveId}</if>
+            <if test="userId != null "> and u.user_id = #{userId}</if>
+            <if test="leaveStatus != null  and leaveStatus != ''"> and u.leave_status = #{leaveStatus}</if>
+            <if test="reason != null  and reason != ''"> and u.reason like concat(concat('%', #{reason}), '%') </if>
+            <if test="applyDate != null "> and u.apply_date = #{applyDate}</if>
+            <if test="approveDate != null "> and u.approve_date = #{approveDate}</if>
+            <if test="leaveDate != null "> and u.leave_date = #{leaveDate}</if>
+            <if test="deptId != null "> and u.dept_id = #{deptId}</if>
+            and u.del_flag = 0
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+    
+    <select id="selectTBranchLeaveApplyByLeaveId" parameterType="Long" resultMap="TBranchLeaveApplyResult">
+        <include refid="selectTBranchLeaveApplyVo"/>
+        where u.leave_id = #{leaveId}
+        and u.del_flag = 0
+    </select>
+        
+    <insert id="insertTBranchLeaveApply" parameterType="TBranchLeaveApply">
+        <selectKey keyProperty="leaveId" resultType="long" order="BEFORE">
+            SELECT seq_t_branch_leave_apply.NEXTVAL as leaveId FROM DUAL
+        </selectKey>
+        insert into t_branch_leave_apply
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="leaveId != null">leave_id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="leaveStatus != null">leave_status,</if>
+            <if test="reason != null">reason,</if>
+            <if test="applyDate != null">apply_date,</if>
+            <if test="approveDate != null">approve_date,</if>
+            <if test="leaveDate != null">leave_date,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="apNo != null">ap_no,</if>
+            <if test="processId != null">process_id,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="leaveId != null">#{leaveId},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="leaveStatus != null">#{leaveStatus},</if>
+            <if test="reason != null">#{reason},</if>
+            <if test="applyDate != null">#{applyDate},</if>
+            <if test="approveDate != null">#{approveDate},</if>
+            <if test="leaveDate != null">#{leaveDate},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="apNo != null">#{apNo},</if>
+            <if test="processId != null">#{processId},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTBranchLeaveApply" parameterType="TBranchLeaveApply">
+        update t_branch_leave_apply
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="leaveStatus != null">leave_status = #{leaveStatus},</if>
+            <if test="reason != null">reason = #{reason},</if>
+            <if test="applyDate != null">apply_date = #{applyDate},</if>
+            <if test="approveDate != null">approve_date = #{approveDate},</if>
+            <if test="leaveDate != null">leave_date = #{leaveDate},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="apNo != null">ap_no = #{apNo},</if>
+            <if test="processId != null">process_id = #{processId},</if>
+        </trim>
+        where leave_id = #{leaveId}
+    </update>
+
+    <update id="deleteTBranchLeaveApplyByLeaveId" parameterType="Long">
+        update t_branch_leave_apply set del_flag = 2 where leave_id = #{leaveId}
+    </update>
+
+    <update id="deleteTBranchLeaveApplyByLeaveIds" parameterType="String">
+        update t_branch_leave_apply set del_flag = 2 where leave_id in
+        <foreach item="leaveId" collection="array" open="(" separator="," close=")">
+            #{leaveId}
+        </foreach>
+    </update>
+</mapper>

+ 61 - 0
ruoyi-ui/src/api/branch/leave.js

@@ -0,0 +1,61 @@
+import request from '@/utils/request'
+
+// 审批处理
+export function handle(data) {
+  return request({
+    url: '/branch/leave/handle',
+    method: 'put',
+    data: data
+  })
+}
+
+// 提交申请
+export function applyLeave(leaveId) {
+  return request({
+    url: '/branch/leave/apply/' + leaveId,
+    method: 'put'
+  })
+}
+
+// 查询请假申请列表
+export function listLeave(query) {
+  return request({
+    url: '/branch/leave/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询请假申请详细
+export function getLeave(leaveId) {
+  return request({
+    url: '/branch/leave/' + leaveId,
+    method: 'get'
+  })
+}
+
+// 新增请假申请
+export function addLeave(data) {
+  return request({
+    url: '/branch/leave',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改请假申请
+export function updateLeave(data) {
+  return request({
+    url: '/branch/leave',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除请假申请
+export function delLeave(leaveId) {
+  return request({
+    url: '/branch/leave/' + leaveId,
+    method: 'delete'
+  })
+}

+ 173 - 0
ruoyi-ui/src/views/branch/approve/detail/leave-apply-detail.vue

@@ -0,0 +1,173 @@
+<template>
+  <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="visible" :append-to-body="true" width="600px">
+    <el-form ref="form" :model="taskForm" :rules="rules" label-width="80px">
+      <el-form-item label="申请人" prop="nickName">
+        <el-input v-model="taskForm.nickName" placeholder="请输入申请人" disabled/>
+      </el-form-item>
+      <el-form-item label="原因" prop="reason">
+        <el-input v-model="taskForm.reason" placeholder="请输入原因" disabled/>
+      </el-form-item>
+      <el-form-item label="请假时间" prop="leaveDate">
+        <el-date-picker clearable size="small" style="width: 200px"
+                        v-model="taskForm.leaveDate"
+                        type="date"
+                        value-format="yyyy-MM-dd"
+                        placeholder="选择请假时间"
+                        disabled>
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="申请时间" prop="applyDate">
+        <el-date-picker clearable size="small" style="width: 200px"
+                        v-model="taskForm.applyDate"
+                        type="date"
+                        value-format="yyyy-MM-dd"
+                        placeholder="选择申请时间"
+                        disabled>
+        </el-date-picker>
+      </el-form-item>
+    </el-form>
+
+    <el-table :data="historyList" border v-loading="historyLoading" style="width: 100%;">
+      <el-table-column prop="taskName" header-align="center" align="center" label="流程进度"></el-table-column>
+      <el-table-column width="80" prop="userName" header-align="center" align="center" label="处理人"></el-table-column>
+      <el-table-column width="100" prop="taskCreateTime" header-align="center" align="center" label="开始时间"></el-table-column>
+      <el-table-column width="100" prop="taskEndTime" header-align="center" align="center" label="结束时间"></el-table-column>
+    </el-table>
+
+    <div slot="footer" class="dialog-footer">
+      <el-button v-if="dialogType == 1" type="success" @click="dataFormSubmit(1)">批准</el-button>
+      <el-button v-if="dialogType == 1" type="info" @click="dataFormSubmit(0)">驳回</el-button>
+      <el-button @click="visible = false">返回</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import { getToken } from "@/utils/auth";
+  import { getLeave, handle } from "@/api/branch/leave";
+  import { treeselect, listDept } from "@/api/system/dept";
+  import Treeselect from "@riophae/vue-treeselect";
+  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+  import {getHistorylist} from "@/api/branch/approvedanger";
+  import { listUserNoPage} from "@/api/system/user";
+
+export default {
+  name: "leave-apply-detail",
+  components: { Treeselect },
+  data() {
+    return {
+      // 用户列表
+      userList: [],
+      rules: {
+      },
+      taskForm: {},
+      newDeptIdDisabled: false,
+      title: null,
+      visible: false,
+      deptOptions: [],
+      //图片集合   打开关闭按钮 等等
+      // imgs:[],
+      // jpgList:[],
+      // ppt:false,
+      // pptView:false,
+      // loadingFlash:false,
+      //流转列表
+      historyList: [],
+      // rejectList: [],
+      historyLoading: true,
+      dialogType: 0,
+    }
+  },
+  methods: {
+    init(id, taskId, processId, taskName, dialogType) {
+      // 流转列表
+      getHistorylist({ "processId": processId }).then(response => {
+        this.historyList = response.rows;
+        this.historyLoading = false
+      });
+      this.reset();
+      this.visible = true;
+      this.dialogType = dialogType;
+      if (dialogType == 1) {
+        this.title =  taskName + "处理";
+      } else {
+        this.title = "查看详情";
+      }
+      this.taskForm.objId = id;
+      this.taskForm.taskId = taskId;
+      this.taskForm.taskName = taskName;
+
+
+      getLeave(id).then(response => {
+        this.taskForm.obj = response.data;
+        this.taskForm.nickName = response.data.nickName;
+        this.taskForm.reason = response.data.reason;
+        this.taskForm.leaveDate = response.data.leaveDate;
+        this.taskForm.applyDate = response.data.applyDate;
+
+        console.log(response.data)
+      });
+
+
+      this.getTreeselect();
+      this.getUserList();
+    },
+
+    /** 查询用户列表 */
+    getUserList() {
+      listUserNoPage().then(response => {
+        let rows = response.data;
+        let userList = [];
+        for(let i = 0; i < rows.length; i++) {
+          if (rows[i].userName != "admin") {
+            let user = { "dictValue" : rows[i].userId, "dictLabel" : rows[i].nickName};
+            userList.push(user);
+          }
+        }
+        this.userList = userList;
+      });
+    },
+
+    // 用户列表字典翻译
+    userListFormat(row, column) {
+      return this.selectDictLabel(this.userList, row.userId);
+    },
+
+    reset() {
+      this.taskForm =  {
+        oldDeptId: null,
+        newDeptId: null,
+        comment: '',
+      };
+    },
+
+    dataFormSubmit(condition) {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          this.taskForm.condition = condition;
+          handle(this.taskForm).then(response => {
+            this.visible = false;
+            this.$modal.msgSuccess("提交成功");
+            // refreshDataList事件:调用父组件getList方法刷新页面
+            this.$emit('refreshDataList');
+          });
+        }
+      });
+    },
+
+    /** 查询部门下拉树结构 */
+    getTreeselect() {
+      treeselect().then(response => {
+        this.deptOptions = response.data;
+      });
+    },
+  }
+}
+</script>
+
+<style scoped lang="scss">
+  ::v-deep .el-input.is-disabled .el-input__inner {
+    color: #606266;
+    background-color: transparent;
+  }
+</style>

+ 10 - 0
ruoyi-ui/src/views/branch/approve/myapprove/index.vue

@@ -58,6 +58,7 @@
     <!--<safetychange-detail v-if="safetychangeDetailVisible" ref="safetychangeDetail" @refreshDataList="getList"></safetychange-detail>-->
     <!--<sai-apply-detail v-if="saiApplyVisible" ref="saiApplyDetail" @refreshDataList="getList"></sai-apply-detail>-->
     <common-detail v-if="commonVisible" ref="commonDetail" @refreshDataList="getList"/>
+    <leave-apply-detail v-if="leaveApplyVisible" ref="leaveApplyDetail" @refreshDataList="getList"/>
   </div>
 </template>
 
@@ -68,6 +69,7 @@
   import "@riophae/vue-treeselect/dist/vue-treeselect.css";
   import ProcessImg from '../processImg'
   import CommonDetail from "@/views/branch/approve/detail/common-detail";
+  import LeaveApplyDetail from "@/views/branch/approve/detail/leave-apply-detail";
   // import AddOrUpdate from '../approveDetail/spec-detail';
   // import SpecModify from '../approveDetail/specModify-detail';
   // import SpecTrainingPlan from '../approveDetail/specTrainingPlan-detaill';
@@ -88,6 +90,7 @@
       Treeselect,
       ProcessImg,
       CommonDetail,
+      LeaveApplyDetail,
       // AddOrUpdate,
     // SpecModify,
     // SpecTrainingPlan,
@@ -112,6 +115,7 @@
         safetychangeDetailVisible:false,
         saiApplyVisible:false,
         commonVisible: false,
+        leaveApplyVisible: false,
         // 选中数组
         ids: [],
         // 非单个禁用
@@ -189,6 +193,12 @@
             this.$refs.commonDetail.init(row.obj.memberId, row.taskId, row.processId, row.taskName, 2)
           })
         }
+        if (row.processName == "支部请假申请") {
+          this.leaveApplyVisible = true
+          this.$nextTick(() => {
+            this.$refs.leaveApplyDetail.init(row.obj.leaveId, row.taskId, row.processId, row.taskName, 2)
+          })
+        }
       },
       /** 查询部门下拉树结构 */
       getTreeselect() {

+ 10 - 0
ruoyi-ui/src/views/branch/approve/pending/index.vue

@@ -127,6 +127,7 @@
     <!--<offlinevalve-detail v-if="offlinevalveDetailVisible" ref="offlinevalveDetail" @refreshDataList="getList"></offlinevalve-detail>-->
     <!--<safetychange-detail v-if="safetychangeDetailVisible" ref="safetychangeDetail" @refreshDataList="getList"></safetychange-detail>-->
     <common-detail v-if="commonVisible" ref="commonDetail" @refreshDataList="getList"/>
+    <leave-apply-detail v-if="leaveApplyVisible" ref="leaveApplyDetail" @refreshDataList="getList"/>
   </div>
 </template>
 
@@ -138,6 +139,7 @@
   import Treeselect from "@riophae/vue-treeselect";
   import "@riophae/vue-treeselect/dist/vue-treeselect.css";
   import CommonDetail from "@/views/branch/approve/detail/common-detail";
+  import LeaveApplyDetail from "@/views/branch/approve/detail/leave-apply-detail";
   // import SpecMaintenance from "@/views/approve/pending/specMaintenance-deal";
   // import KekaoResolve from '../approveDetail/kekao-resolve';
   // import InvoiceDetail from "@/views/approve/approveDetail/invoice-detail";
@@ -154,6 +156,7 @@
     name: "Pending",
     components: {
       CommonDetail,
+      LeaveApplyDetail,
     //   SaiApplyDetail,
     //   SafetychangeDetail,
     //   OfflinevalveDetail,
@@ -186,6 +189,7 @@
         safetychangeDetailVisible:false,
         saiApplyVisible:false,
         commonVisible: false,
+        leaveApplyVisible: false,
         // 选中数组
         ids: [],
         // 非单个禁用
@@ -351,6 +355,12 @@
             this.$refs.commonDetail.init(row.obj.memberId, row.taskId, row.processId, row.taskName, 1)
           })
         }
+        if (row.processName == "支部请假申请") {
+          this.leaveApplyVisible = true
+          this.$nextTick(() => {
+            this.$refs.leaveApplyDetail.init(row.obj.leaveId, row.taskId, row.processId, row.taskName, 1)
+          })
+        }
       },
       // 多选框选中数据
       handleSelectionChange(selection) {

+ 10 - 0
ruoyi-ui/src/views/branch/approve/taskdone/index.vue

@@ -62,11 +62,13 @@
     <!--<safetychange-detail v-if="safetychangeDetailVisible" ref="safetychangeDetail" @refreshDataList="getList"></safetychange-detail>-->
     <!--<sai-apply-detail v-if="saiApplyVisible" ref="saiApplyDetail" @refreshDataList="getList"></sai-apply-detail>-->
     <common-detail v-if="commonVisible" ref="commonDetail" @refreshDataList="getList"/>
+    <leave-apply-detail v-if="leaveApplyVisible" ref="leaveApplyDetail" @refreshDataList="getList"/>
   </div>
 </template>
 
 <script>
   import { getTaskdonelist } from "@/api/branch/approvedanger";
+  import LeaveApplyDetail from "@/views/branch/approve/detail/leave-apply-detail";
   // import AddOrUpdate from '../approveDetail/spec-detail';
   import { treeselect } from "@/api/system/dept";
   // import { getToken } from "@/utils/auth";
@@ -93,6 +95,7 @@
     //   OfflinevalveDetail,
       Treeselect,
       CommonDetail,
+      LeaveApplyDetail,
     // AddOrUpdate,
       ProcessImg,
       // SpecModify,SpecTrainingPlan,SpecMaintenance,IntactDetail,KekaoDetail,InvoiceDetail
@@ -113,6 +116,7 @@
         safetychangeDetailVisible:false,
         saiApplyVisible:false,
         commonVisible: false,
+        leaveApplyVisible: false,
         // 选中数组
         ids: [],
         // 非单个禁用
@@ -200,6 +204,12 @@
             this.$refs.commonDetail.init(row.obj.memberId, row.taskId, row.processId, row.taskName, 2)
           })
         }
+        if (row.processName == "支部请假申请") {
+          this.leaveApplyVisible = true
+          this.$nextTick(() => {
+            this.$refs.leaveApplyDetail.init(row.obj.leaveId, row.taskId, row.processId, row.taskName, 2)
+          })
+        }
       },
       // 装置名称字典翻译
       plantCodeFormat(row, column) {

+ 430 - 0
ruoyi-ui/src/views/branch/zbjs/leave/index.vue

@@ -0,0 +1,430 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" size="small" v-show="showSearch" label-width="68px">
+      <el-form-item label="状态" prop="leaveStatus">
+        <el-select v-model="queryParams.leaveStatus" placeholder="请选择状态" clearable size="small">
+          <el-option
+            v-for="dict in leaveStatusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="原因" prop="reason">
+        <el-input v-model="queryParams.reason" placeholder="请输入原因" />
+      </el-form-item>
+      <el-form-item label="请假时间" prop="leaveDate">
+        <el-date-picker clearable size="small" style="width: 200px"
+                        v-model="queryParams.leaveDate"
+                        type="date"
+                        value-format="yyyy-MM-dd"
+                        placeholder="选择请假时间">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="申请时间" prop="applyDate">
+        <el-date-picker clearable size="small" style="width: 200px"
+          v-model="queryParams.applyDate"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择申请时间">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="批准时间" prop="approveDate">
+        <el-date-picker clearable size="small" style="width: 200px"
+          v-model="queryParams.approveDate"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择批准时间">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="归属部门" prop="deptId" style="width: 268px;">
+        <treeselect style="width: 200px;" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['branch:leave:add']"
+        >新增</el-button>
+      </el-col>
+	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="leaveList" @selection-change="handleSelectionChange" :height="clientHeight" border>
+      <el-table-column label="状态" align="center" prop="leaveStatus" width="100">
+        <template slot-scope="scope">
+          <span v-if="scope.row.leaveStatus == 0"><el-tag type="info">未提交</el-tag></span>
+          <span v-if="scope.row.leaveStatus == 1"><el-tag type="warning">审核中</el-tag></span>
+          <span v-if="scope.row.leaveStatus == 2"><el-tag type="success">批准</el-tag></span>
+          <span v-if="scope.row.leaveStatus == 3"><el-tag type="danger">驳回</el-tag></span>
+        </template>
+      </el-table-column>
+      <el-table-column label="申请人" align="center" prop="userId" width="100" :formatter="userIdFormat"/>
+      <el-table-column label="请假时间" align="center" prop="leaveDate" width="100">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.leaveDate, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="请假原因" align="center" prop="reason" />
+      <el-table-column label="申请时间" align="center" prop="applyDate" width="100">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.applyDate, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="批准时间" align="center" prop="approveDate" width="100">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.approveDate, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <span v-if="scope.row.leaveStatus == 0">
+            <el-button
+               size="mini"
+               type="text"
+               @click="handleApply(scope.row)"
+            >提交申请</el-button>
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handleUpdate(scope.row)"
+              v-hasPermi="['branch:leave:edit']"
+            >修改</el-button>
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-delete"
+              @click="handleDelete(scope.row)"
+              v-hasPermi="['branch:leave:remove']"
+            >删除</el-button>
+          </span>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改请假申请对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="请假时间" prop="leaveDate">
+          <el-date-picker clearable size="small" style="width: 200px"
+                          v-model="form.leaveDate"
+                          type="date"
+                          value-format="yyyy-MM-dd"
+                          placeholder="选择请假时间">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="请假原因" prop="reason">
+          <el-input v-model="form.reason" placeholder="请输入原因" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { applyLeave, listLeave, getLeave, delLeave, addLeave, updateLeave, exportLeave, importTemplate} from "@/api/branch/leave";
+import { treeselect } from "@/api/system/dept";
+import { getToken } from "@/utils/auth";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { listUserNoPage } from "@/api/system/user";
+
+export default {
+  name: "Leave",
+  components: { Treeselect },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: false,
+      // 总条数
+      total: 0,
+      // 请假申请表格数据
+      leaveList: [],
+      // 弹出层标题
+      title: "",
+      // 部门树选项
+      deptOptions: undefined,
+      clientHeight:300,
+      // 是否显示弹出层
+      open: false,
+      // 状态字典
+      leaveStatusOptions: [],
+        // 用户导入参数
+        upload: {
+            // 是否显示弹出层(用户导入)
+            open: false,
+            // 弹出层标题(用户导入)
+            title: "",
+            // 是否禁用上传
+            isUploading: false,
+            // 是否更新已经存在的用户数据
+            updateSupport: 0,
+            // 设置上传的请求头部
+            headers: { Authorization: "Bearer " + getToken() },
+            // 上传的地址
+            url: process.env.VUE_APP_BASE_API + "/branch/leave/importData"
+        },
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 20,
+        leaveId: null,
+        userId: null,
+        leaveStatus: null,
+        applyDate: null,
+        approveDate: null,
+        leaveDate: null,
+        reason: null,
+        deptId: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        reason: [
+          { required: true, message: "请假原因不能为空", trigger: "blur" }
+        ],
+        leaveDate: [
+          { required: true, message: "请假时间不能为空", trigger: "blur" }
+        ],
+      },
+      // 用户列表
+      userList: [],
+    };
+  },
+  watch: {
+        // 根据名称筛选部门树
+        deptName(val) {
+            this.$refs.tree.filter(val);
+        }
+   },
+  created() {
+      //设置表格高度对应屏幕高度
+      this.$nextTick(() => {
+          this.clientHeight = document.body.clientHeight -250
+      })
+   this.getUserList();
+    this.getDicts("leave_apply_status").then(response => {
+      this.leaveStatusOptions = response.data;
+    });
+    this.getList();
+    this.getTreeselect();
+  },
+  methods: {
+    /** 查询用户列表 */
+    getUserList() {
+      listUserNoPage().then(response => {
+        let rows = response.data;
+        let userList = [];
+        for(let i = 0; i < rows.length; i++) {
+          if (rows[i].userName != "admin") {
+            let user = { "dictValue" : rows[i].userId, "dictLabel" : rows[i].nickName};
+            userList.push(user);
+          }
+        }
+        this.userList = userList;
+      });
+    },
+    handleApply(row) {
+      this.$confirm('是否确认提交?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return applyLeave(row.leaveId);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("提交成功");
+      })
+    },
+    /** 查询请假申请列表 */
+    getList() {
+      this.loading = true;
+      listLeave(this.queryParams).then(response => {
+        this.leaveList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+     /** 查询部门下拉树结构 */
+     getTreeselect() {
+          treeselect().then(response => {
+              this.deptOptions = response.data;
+          });
+     },
+    // 状态字典翻译
+    leaveStatusFormat(row, column) {
+      return this.selectDictLabel(this.leaveStatusOptions, row.leaveStatus);
+    },
+    // 用户字典翻译
+    userIdFormat(row, column) {
+      return this.selectDictLabel(this.userList, row.userId);
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        leaveId: null,
+        userId: null,
+        leaveStatus: null,
+        reason: null,
+        applyDate: null,
+        approveDate: null,
+        delFlag: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        deptId: null,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.leaveId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加请假申请";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const leaveId = row.leaveId || this.ids
+      getLeave(leaveId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改请假申请";
+      });
+    },
+      /** 提交按钮 */
+      submitForm() {
+          this.$refs["form"].validate(valid => {
+              if (valid) {
+                  if (this.form.leaveId != null) {
+                      updateLeave(this.form).then(response => {
+                          this.$modal.msgSuccess("修改成功");
+                          this.open = false;
+                          this.getList();
+                      });
+                  } else {
+                      addLeave(this.form).then(response => {
+                          this.$modal.msgSuccess("新增成功");
+                          this.open = false;
+                          this.getList();
+                      });
+                  }
+              }
+          });
+      },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const leaveIds = row.leaveId || this.ids;
+      this.$confirm('是否确认删除?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLeave(leaveIds);
+        }).then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+    },
+                                                        /** 导出按钮操作 */
+    handleExport() {
+        this.download('branch/leave/export', {
+            ...this.queryParams
+        }, `leave_${new Date().getTime()}.xlsx`)
+    },
+      /** 导入按钮操作 */
+      handleImport() {
+          this.upload.title = "用户导入";
+          this.upload.open = true;
+      },
+      /** 下载模板操作 */
+      importTemplate() {
+          importTemplate().then(response => {
+              this.download(response.msg);
+          });
+      },
+      // 文件上传中处理
+      handleFileUploadProgress(event, file, fileList) {
+          this.upload.isUploading = true;
+      },
+      // 文件上传成功处理
+      handleFileSuccess(response, file, fileList) {
+          this.upload.open = false;
+          this.upload.isUploading = false;
+          this.$refs.upload.clearFiles();
+          this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
+          this.getList();
+      },
+      // 提交上传文件
+      submitFileForm() {
+          this.$refs.upload.submit();
+      }
+  }
+};
+</script>
+
+<style>
+    /** 文本换行符处理 */
+    .el-table .cell{
+        white-space: pre-wrap;
+    }
+    /** textarea字体 */
+    textarea {
+        font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
+    }
+</style>