Commit 4695d424 by 啦啦啦

提交新的请假流程代码

parent fc10f2ca
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencies> <dependencies>
...@@ -66,7 +67,19 @@ ...@@ -66,7 +67,19 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
...@@ -53,6 +53,7 @@ public class MiaoController { ...@@ -53,6 +53,7 @@ public class MiaoController {
map.put("title", form.getTitle()); map.put("title", form.getTitle());
map.put("content", form.getContent()); map.put("content", form.getContent());
map.put("applicant", form.getApplicant()); map.put("applicant", form.getApplicant());
map.put("days", form.getDays());
map.put("state", form.getState()); map.put("state", form.getState());
formsMap.add(map); formsMap.add(map);
} }
...@@ -83,6 +84,54 @@ public class MiaoController { ...@@ -83,6 +84,54 @@ public class MiaoController {
return "indexApprover"; return "indexApprover";
} }
//管理层的首页
@GetMapping( "/homeApproverzjl")
public String homeApproverzjl(ModelMap model){
List<VacationForm> forms = miaoService.formList();
List<HashMap<String, Object>> formsMap = new ArrayList<HashMap<String, Object>>();
for(VacationForm form : forms) {
//审核者只能看到待审核状态的请假单
if("管理层审核".equals(form.getState())) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("id", form.getId());
map.put("title", form.getTitle());
map.put("content", form.getContent());
map.put("applicant", form.getApplicant());
map.put("state", form.getState());
formsMap.add(map);
}
}
model.addAttribute("forms",formsMap);
return "indexApproverzjl";
}
//人事的首页
@GetMapping( "/homeApproverHr")
public String homeApproverHr(ModelMap model){
List<VacationForm> forms = miaoService.formList();
List<HashMap<String, Object>> formsMap = new ArrayList<HashMap<String, Object>>();
for(VacationForm form : forms) {
//审核者只能看到待审核状态的请假单
if("通知人事".equals(form.getState())||"已结束".equals(form.getState())) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("id", form.getId());
map.put("title", form.getTitle());
map.put("content", form.getContent());
map.put("applicant", form.getApplicant());
map.put("state", form.getState());
map.put("approver",form.getApprover());
formsMap.add(map);
}
}
model.addAttribute("forms",formsMap);
return "indexApproverHr";
}
//请假单页面 //请假单页面
@GetMapping( "/form") @GetMapping( "/form")
public String form(){ public String form(){
...@@ -139,9 +188,10 @@ public class MiaoController { ...@@ -139,9 +188,10 @@ public class MiaoController {
public ResultInfo writeForm(HttpServletRequest request){ public ResultInfo writeForm(HttpServletRequest request){
ResultInfo result = new ResultInfo(); ResultInfo result = new ResultInfo();
String title = request.getParameter("title"); String title = request.getParameter("title");
String days = request.getParameter("days");
String content = request.getParameter("content"); String content = request.getParameter("content");
String operator = request.getParameter("operator"); String operator = request.getParameter("operator");
VacationForm form = miaoService.writeForm(title,content,operator); VacationForm form = miaoService.writeForm(title,content,operator,days);
result.setCode(200); result.setCode(200);
result.setMsg("填写请假条成功"); result.setMsg("填写请假条成功");
result.setInfo(form); result.setInfo(form);
...@@ -154,13 +204,31 @@ public class MiaoController { ...@@ -154,13 +204,31 @@ public class MiaoController {
public ResultInfo giveup(HttpServletRequest request){ public ResultInfo giveup(HttpServletRequest request){
ResultInfo result = new ResultInfo(); ResultInfo result = new ResultInfo();
String formId = request.getParameter("formId"); String formId = request.getParameter("formId");
String days = request.getParameter("days");
String operator = request.getParameter("operator"); String operator = request.getParameter("operator");
miaoService.completeProcess(formId, operator, "giveup"); miaoService.completeProcess(days,formId, operator, "giveup");
result.setCode(200); result.setCode(200);
result.setMsg("放弃请假成功"); result.setMsg("放弃请假成功");
return result; return result;
} }
//申请未通过
@GetMapping( "/giveups")
@ResponseBody
public ResultInfo giveups(HttpServletRequest request){
ResultInfo result = new ResultInfo();
String formId = request.getParameter("formId");
String days = request.getParameter("days");
String operator = request.getParameter("operator");
miaoService.completeProcesss(days,formId, operator, "giveup");
result.setCode(200);
result.setMsg("放弃请假成功");
return result;
}
//申请者申请请假 //申请者申请请假
@GetMapping( "/apply") @GetMapping( "/apply")
@ResponseBody @ResponseBody
...@@ -168,7 +236,8 @@ public class MiaoController { ...@@ -168,7 +236,8 @@ public class MiaoController {
ResultInfo result = new ResultInfo(); ResultInfo result = new ResultInfo();
String formId = request.getParameter("formId"); String formId = request.getParameter("formId");
String operator = request.getParameter("operator"); String operator = request.getParameter("operator");
miaoService.completeProcess(formId, operator, "apply"); String days = request.getParameter("days");
miaoService.completeProcess(days,formId, operator, "apply");
result.setCode(200); result.setCode(200);
result.setMsg("申请请假成功"); result.setMsg("申请请假成功");
return result; return result;
......
...@@ -24,6 +24,17 @@ public class VacationForm { ...@@ -24,6 +24,17 @@ public class VacationForm {
@Transient @Transient
private String state; private String state;
private Integer days;
public Integer getDays() {
return days;
}
public void setDays(Integer days) {
this.days = days;
}
public VacationForm(){ public VacationForm(){
} }
......
...@@ -9,15 +9,15 @@ import java.util.List; ...@@ -9,15 +9,15 @@ import java.util.List;
public interface MiaoService { public interface MiaoService {
public VacationForm writeForm(String title, String content, String applicant); public VacationForm writeForm(String title, String content, String applicant,String days);
public boolean giveupVacation(String formId, String operator); public boolean giveupVacation(String formId, String operator);
public boolean applyVacation(String formId, String operator); public boolean applyVacation(String formId, String operator,String days);
public boolean approverVacation(String formId, String operator); public boolean approverVacation(String formId, String operator);
public void completeProcess(String formId, String operator, String input); public void completeProcess(String days,String formId, String operator, String input);
public HashMap<String,String> getCurrentState(String formId); public HashMap<String,String> getCurrentState(String formId);
...@@ -26,4 +26,6 @@ public interface MiaoService { ...@@ -26,4 +26,6 @@ public interface MiaoService {
public User loginSuccess(String user); public User loginSuccess(String user);
public List historyState(String formId); public List historyState(String formId);
void completeProcesss(String days, String formId, String operator, String input);
} }
...@@ -6,6 +6,7 @@ import com.bbd.bpm.domain.VacationForm; ...@@ -6,6 +6,7 @@ import com.bbd.bpm.domain.VacationForm;
import com.bbd.bpm.service.MiaoService; import com.bbd.bpm.service.MiaoService;
import com.bbd.bpm.service.UserService; import com.bbd.bpm.service.UserService;
import com.bbd.bpm.service.VacationFormService; import com.bbd.bpm.service.VacationFormService;
import io.swagger.models.auth.In;
import org.activiti.engine.HistoryService; import org.activiti.engine.HistoryService;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
...@@ -16,10 +17,7 @@ import org.springframework.stereotype.Service; ...@@ -16,10 +17,7 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("miaoService") @Service("miaoService")
public class MiaoServiceImpl implements MiaoService { public class MiaoServiceImpl implements MiaoService {
...@@ -40,10 +38,11 @@ public class MiaoServiceImpl implements MiaoService { ...@@ -40,10 +38,11 @@ public class MiaoServiceImpl implements MiaoService {
//填写请假信息 //填写请假信息
@Override @Override
public VacationForm writeForm(String title, String content, String applicant) { public VacationForm writeForm(String title, String content, String applicant,String days) {
VacationForm form = new VacationForm(); VacationForm form = new VacationForm();
String approver = "未知审批者"; String approver = "未知审批者";
form.setTitle(title); form.setTitle(title);
form.setDays(Integer.valueOf(days));
form.setContent(content); form.setContent(content);
form.setApplicant(applicant); form.setApplicant(applicant);
form.setApprover(approver); form.setApprover(approver);
...@@ -52,20 +51,20 @@ public class MiaoServiceImpl implements MiaoService { ...@@ -52,20 +51,20 @@ public class MiaoServiceImpl implements MiaoService {
Map<String, Object> variables = new HashMap<String, Object>(); Map<String, Object> variables = new HashMap<String, Object>();
variables.put("employee", form.getApplicant()); variables.put("employee", form.getApplicant());
//开始请假流程,使用formId作为流程的businessKey //开始请假流程,使用formId作为流程的businessKey
runtimeService.startProcessInstanceByKey("myProcess", form.getId().toString(), variables); runtimeService.startProcessInstanceByKey("myProcee", form.getId().toString(), variables);
return form; return form;
} }
//根据选择,申请或放弃请假 //根据选择,申请或放弃请假
@Override @Override
public void completeProcess(String formId, String operator, String input) { public void completeProcess(String days,String formId, String operator, String input) {
//根据businessKey找到当前任务节点 //根据businessKey找到当前任务节点
Task task = taskService.createTaskQuery().processInstanceBusinessKey(formId).singleResult(); Task task = taskService.createTaskQuery().processInstanceBusinessKey(formId).singleResult();
//设置输入参数,使流程自动流转到对应节点 //设置输入参数,使流程自动流转到对应节点
taskService.setVariable(task.getId(), "input", input); taskService.setVariable(task.getId(), "input", input);
taskService.complete(task.getId()); taskService.complete(task.getId());
if ("apply".equals(input)) { if ("apply".equals(input)) {
applyVacation(formId, operator); applyVacation(formId, operator,days);
} else { } else {
giveupVacation(formId, operator); giveupVacation(formId, operator);
} }
...@@ -84,8 +83,7 @@ public class MiaoServiceImpl implements MiaoService { ...@@ -84,8 +83,7 @@ public class MiaoServiceImpl implements MiaoService {
return true; return true;
} }
@Override public boolean applyVacation(String formId, String operator,String days) {
public boolean applyVacation(String formId, String operator) {
Task task = taskService.createTaskQuery().processInstanceBusinessKey(formId).singleResult(); Task task = taskService.createTaskQuery().processInstanceBusinessKey(formId).singleResult();
Map<String, Object> variables = new HashMap<String, Object>(); Map<String, Object> variables = new HashMap<String, Object>();
List<User> users = userService.findAll(); List<User> users = userService.findAll();
...@@ -99,6 +97,8 @@ public class MiaoServiceImpl implements MiaoService { ...@@ -99,6 +97,8 @@ public class MiaoServiceImpl implements MiaoService {
managers = managers.substring(0, managers.length() - 1); managers = managers.substring(0, managers.length() - 1);
variables.put("employee", operator); variables.put("employee", operator);
variables.put("managers", managers); variables.put("managers", managers);
Integer day= Integer.valueOf(days);
variables.put("days",day);
taskService.claim(task.getId(), operator); taskService.claim(task.getId(), operator);
taskService.complete(task.getId(), variables); taskService.complete(task.getId(), variables);
return true; return true;
...@@ -107,8 +107,22 @@ public class MiaoServiceImpl implements MiaoService { ...@@ -107,8 +107,22 @@ public class MiaoServiceImpl implements MiaoService {
@Override @Override
public boolean approverVacation(String formId, String operator) { public boolean approverVacation(String formId, String operator) {
Task task = taskService.createTaskQuery().processInstanceBusinessKey(formId).singleResult(); Task task = taskService.createTaskQuery().processInstanceBusinessKey(formId).singleResult();
Map<String, Object> variables = new HashMap<String, Object>();
List<User> users = userService.findAll();
String managers = "";
//获取所有具有审核权限的用户
for (User user : users) {
if (user.getType().equals(3)) {
managers += user.getName() + ",";
}
}
managers = managers.substring(0, managers.length() - 1);
variables.put("employee", operator);
variables.put("managers", managers);
taskService.claim(task.getId(), operator); taskService.claim(task.getId(), operator);
taskService.complete(task.getId()); taskService.complete(task.getId(),variables);
//更新请假信息的审核人 //更新请假信息的审核人
try{ try{
VacationForm form = vacationFormService.findById(Integer.parseInt(formId)).get(); VacationForm form = vacationFormService.findById(Integer.parseInt(formId)).get();
...@@ -197,4 +211,26 @@ public class MiaoServiceImpl implements MiaoService { ...@@ -197,4 +211,26 @@ public class MiaoServiceImpl implements MiaoService {
} }
return processList; return processList;
} }
@Override
public void completeProcesss(String days, String formId, String operator, String input) {
//根据businessKey找到当前任务节点
Task task = taskService.createTaskQuery().processInstanceBusinessKey(formId).singleResult();
//设置输入参数,使流程自动流转到对应节点
taskService.setVariable(task.getId(), "input", input);
taskService.complete(task.getId());
giveupVacations(formId, operator);
}
//放弃请假
public boolean giveupVacations(String formId, String operator) {
Task task = taskService.createTaskQuery().processInstanceBusinessKey(formId).singleResult();
Map<String, Object> variables = new HashMap<String, Object>();
VacationForm vacationForm = vacationFormService.getOne(Integer.valueOf(formId));
variables.put("employee", vacationForm.getApplicant());
variables.put("managers", operator);
//认领任务
taskService.claim(task.getId(), vacationForm.getApplicant());
return true;
}
} }
#端口 #�˿�
server.port=8081 server.port=8081
spring.datasource.url=jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai spring.datasource.url=jdbc:mysql://localhost:3306/activititest?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=root spring.datasource.password=root
...@@ -11,32 +11,32 @@ spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowS ...@@ -11,32 +11,32 @@ spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowS
spring.datasource.driverClassName=com.mysql.jdbc.Driver spring.datasource.driverClassName=com.mysql.jdbc.Driver
##Druid## ##Druid##
#spring.datasource.type=com.alibaba.druid.pool.DruidDataSource #spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
#连接池启动时创建的连接数量的初始值 #���ӳ�����ʱ���������������ij�ʼֵ
spring.datasource.initialSize=5 spring.datasource.initialSize=5
#最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 #��С����ֵ.�����е����������ڷ�ֵʱ�����ӳؾͻ�Ԥ����ȥһЩ���ӣ���������ʱ����������
spring.datasource.minIdle=5 spring.datasource.minIdle=5
#连接池的最大值,同一时间可以从池分配的最多连接数量,0时无限制 #���ӳص����ֵ��ͬһʱ����Դӳط�����������������0ʱ������
spring.datasource.maxActive=100 spring.datasource.maxActive=100
#最大建立连接等待时间。单位为 ms,如果超过此时间将接到异常。设为-1表示无限制 #��������ӵȴ�ʱ�䡣��λΪ ms�����������ʱ�佫�ӵ��쳣����Ϊ-1��ʾ������
spring.datasource.maxWait=60000 spring.datasource.maxWait=60000
#1) Destroy线程会检测连接的间隔时间2) testWhileIdle的判断依据,详细看testWhileIdle属性的说明 #1) Destroy�̻߳������ӵļ��ʱ��2) testWhileIdle���ж����ݣ���ϸ��testWhileIdle���Ե�˵��
spring.datasource.timeBetweenEvictionRunsMillis=60000 spring.datasource.timeBetweenEvictionRunsMillis=60000
#配置一个连接在池中最小生存的时间,单位是毫秒 #����һ�������ڳ�����С�����ʱ�䣬��λ�Ǻ���
spring.datasource.minEvictableIdleTimeMillis=300000 spring.datasource.minEvictableIdleTimeMillis=300000
#用来检测连接是否有效的sql,要求是一个查询语句 #������������Ƿ���Ч��sql��Ҫ����һ����ѯ���
spring.datasource.validationQuery=SELECT 1 spring.datasource.validationQuery=SELECT 1
#建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效 #��������Ϊtrue����Ӱ�����ܣ����ұ�֤��ȫ�ԡ��������ӵ�ʱ���⣬�������ʱ�����timeBetweenEvictionRunsMillis��ִ��validationQuery��������Ƿ���Ч
spring.datasource.testWhileIdle=true spring.datasource.testWhileIdle=true
#申请连接时执行validationQuery检测连接是否有效,配置true会降低性能 #��������ʱִ��validationQuery��������Ƿ���Ч������true�ή������
spring.datasource.testOnBorrow=false spring.datasource.testOnBorrow=false
#归还连接时执行validationQuery检测连接是否有效,配置true会降低性能 #�黹����ʱִ��validationQuery��������Ƿ���Ч������true�ή������
spring.datasource.testOnReturn=false spring.datasource.testOnReturn=false
#是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql5.5以下的版本中没有PSCache功能,建议关闭掉。 #�Ƿ񻺴�preparedStatement��Ҳ����PSCache��PSCache��֧���α�����ݿ����������޴󣬱���˵oracle����mysql5.5���µİ汾��û��PSCache���ܣ�����رյ���
spring.datasource.poolPreparedStatements=true spring.datasource.poolPreparedStatements=true
#指定每个连接上PSCache的大 ��ÿ��������PSCache�Ĵ�С
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
#属性类型是字符串,通过别名的方式配置扩展插件, #�����������ַ�����ͨ�������ķ�ʽ������չ�����
#常用的插件有:监控统计用的filter:stat日志用的filter:log4j防御sql注入的filter:wall #���õIJ���У����ͳ���õ�filter:stat��־�õ�filter:log4j����sqlע���filter:wall
spring.datasource.filters=stat,wall,log4j spring.datasource.filters=stat,wall,log4j
spring.datasource.useGlobalDataSourceStat=true spring.datasource.useGlobalDataSourceStat=true
############################### ###############################
......
<?xml version="1.0" encoding="UTF-8"?> <?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.processes.org/test"> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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" xmlns:xsd="http://www.w3.org/2001/XMLSchema" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.processes.org/test">
<process id="myProcess" name="My process" isExecutable="true"> <process id="myProcess" name="My process" isExecutable="true">
<startEvent id="start" name="Start"></startEvent> <startEvent id="start" name="Start"></startEvent>
<userTask id="usertask1" name="提出请假申请" activiti:assignee="${employee}"></userTask> <userTask id="usertask1" name="提出请假申请" activiti:assignee="${employee}"></userTask>
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
<userTask id="usertask2" name="领导审核" activiti:candidateUsers="${managers}"></userTask> <userTask id="usertask2" name="领导审核" activiti:candidateUsers="${managers}"></userTask>
<sequenceFlow id="flow4" sourceRef="usertask1" targetRef="usertask2"></sequenceFlow> <sequenceFlow id="flow4" sourceRef="usertask1" targetRef="usertask2"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent> <endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow5" sourceRef="usertask2" targetRef="endevent1"></sequenceFlow>
<userTask id="usertask3" name="填写请假单" activiti:assignee="${employee}"></userTask> <userTask id="usertask3" name="填写请假单" activiti:assignee="${employee}"></userTask>
<userTask id="usertask4" name="放弃请假"></userTask> <userTask id="usertask4" name="放弃请假"></userTask>
<sequenceFlow id="flow6" name="想了想还是不请了" sourceRef="exclusivegateway1" targetRef="usertask4"> <sequenceFlow id="flow6" name="想了想还是不请了" sourceRef="exclusivegateway1" targetRef="usertask4">
...@@ -19,20 +18,28 @@ ...@@ -19,20 +18,28 @@
</sequenceFlow> </sequenceFlow>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway> <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow2" sourceRef="usertask3" targetRef="exclusivegateway1"></sequenceFlow> <sequenceFlow id="flow2" sourceRef="usertask3" targetRef="exclusivegateway1"></sequenceFlow>
<exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow8" sourceRef="usertask2" targetRef="exclusivegateway2"></sequenceFlow>
<sequenceFlow id="flow9" name="审核通过" sourceRef="exclusivegateway2" targetRef="endevent1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${input=='apply'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow10" name="审核未通过" sourceRef="exclusivegateway2" targetRef="usertask3">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${input=='giveup'}]]></conditionExpression>
</sequenceFlow>
</process> </process>
<bpmndi:BPMNDiagram id="BPMNDiagram_myProcess"> <bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
<bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess"> <bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start"> <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="35.0" width="35.0" x="10.0" y="124.0"></omgdc:Bounds> <omgdc:Bounds height="35.0" width="35.0" x="0.0" y="124.0"></omgdc:Bounds>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1"> <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55.0" width="105.0" x="340.0" y="20.0"></omgdc:Bounds> <omgdc:Bounds height="55.0" width="105.0" x="340.0" y="20.0"></omgdc:Bounds>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2"> <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
<omgdc:Bounds height="55.0" width="105.0" x="492.0" y="20.0"></omgdc:Bounds> <omgdc:Bounds height="55.0" width="105.0" x="502.0" y="22.0"></omgdc:Bounds>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1"> <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="527.0" y="240.0"></omgdc:Bounds> <omgdc:Bounds height="35.0" width="35.0" x="537.0" y="240.0"></omgdc:Bounds>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3"> <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
<omgdc:Bounds height="55.0" width="105.0" x="110.0" y="114.0"></omgdc:Bounds> <omgdc:Bounds height="55.0" width="105.0" x="110.0" y="114.0"></omgdc:Bounds>
...@@ -43,43 +50,64 @@ ...@@ -43,43 +50,64 @@
<bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1"> <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
<omgdc:Bounds height="40.0" width="40.0" x="250.0" y="121.0"></omgdc:Bounds> <omgdc:Bounds height="40.0" width="40.0" x="250.0" y="121.0"></omgdc:Bounds>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
<omgdc:Bounds height="40.0" width="40.0" x="535.0" y="140.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"> <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="45.0" y="141.0"></omgdi:waypoint> <omgdi:waypoint x="35.0" y="141.0"></omgdi:waypoint>
<omgdi:waypoint x="110.0" y="141.0"></omgdi:waypoint> <omgdi:waypoint x="110.0" y="141.0"></omgdi:waypoint>
<bpmndi:BPMNLabel> <bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="36.0" x="45.0" y="141.0"></omgdc:Bounds> <omgdc:Bounds height="16.0" width="48.0" x="35.0" y="141.0"></omgdc:Bounds>
</bpmndi:BPMNLabel> </bpmndi:BPMNLabel>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4"> <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="445.0" y="47.0"></omgdi:waypoint> <omgdi:waypoint x="445.0" y="47.0"></omgdi:waypoint>
<omgdi:waypoint x="492.0" y="47.0"></omgdi:waypoint> <omgdi:waypoint x="502.0" y="49.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="544.0" y="75.0"></omgdi:waypoint>
<omgdi:waypoint x="544.0" y="240.0"></omgdi:waypoint>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6"> <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="270.0" y="161.0"></omgdi:waypoint> <omgdi:waypoint x="270.0" y="161.0"></omgdi:waypoint>
<omgdi:waypoint x="392.0" y="230.0"></omgdi:waypoint> <omgdi:waypoint x="392.0" y="230.0"></omgdi:waypoint>
<bpmndi:BPMNLabel> <bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="96.0" x="270.0" y="161.0"></omgdc:Bounds> <omgdc:Bounds height="48.0" width="96.0" x="270.0" y="161.0"></omgdc:Bounds>
</bpmndi:BPMNLabel> </bpmndi:BPMNLabel>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7"> <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
<omgdi:waypoint x="445.0" y="257.0"></omgdi:waypoint> <omgdi:waypoint x="445.0" y="257.0"></omgdi:waypoint>
<omgdi:waypoint x="527.0" y="257.0"></omgdi:waypoint> <omgdi:waypoint x="537.0" y="257.0"></omgdi:waypoint>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3"> <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="270.0" y="121.0"></omgdi:waypoint> <omgdi:waypoint x="270.0" y="121.0"></omgdi:waypoint>
<omgdi:waypoint x="392.0" y="75.0"></omgdi:waypoint> <omgdi:waypoint x="392.0" y="75.0"></omgdi:waypoint>
<bpmndi:BPMNLabel> <bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="96.0" x="270.0" y="121.0"></omgdc:Bounds> <omgdc:Bounds height="48.0" width="96.0" x="270.0" y="121.0"></omgdc:Bounds>
</bpmndi:BPMNLabel> </bpmndi:BPMNLabel>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"> <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="215.0" y="141.0"></omgdi:waypoint> <omgdi:waypoint x="215.0" y="141.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="141.0"></omgdi:waypoint> <omgdi:waypoint x="250.0" y="141.0"></omgdi:waypoint>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
<omgdi:waypoint x="554.0" y="77.0"></omgdi:waypoint>
<omgdi:waypoint x="555.0" y="140.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
<omgdi:waypoint x="555.0" y="180.0"></omgdi:waypoint>
<omgdi:waypoint x="554.0" y="240.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="16.0" width="64.0" x="565.0" y="180.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
<omgdi:waypoint x="575.0" y="160.0"></omgdi:waypoint>
<omgdi:waypoint x="676.0" y="160.0"></omgdi:waypoint>
<omgdi:waypoint x="676.0" y="351.0"></omgdi:waypoint>
<omgdi:waypoint x="365.0" y="351.0"></omgdi:waypoint>
<omgdi:waypoint x="162.0" y="351.0"></omgdi:waypoint>
<omgdi:waypoint x="162.0" y="169.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="16.0" width="80.0" x="679.0" y="300.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane> </bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram> </bpmndi:BPMNDiagram>
</definitions> </definitions>
\ No newline at end of file
<?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: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" xmlns:xsd="http://www.w3.org/2001/XMLSchema" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.processes.org/test">
<process id="myProcesss" name="My process" isExecutable="true">
<startEvent id="start" name="Start"></startEvent>
<userTask id="usertask1" name="提出请假申请" activiti:assignee="${employee}"></userTask>
<sequenceFlow id="flow1" name="想请假" sourceRef="start" targetRef="usertask3"></sequenceFlow>
<userTask id="usertask2" name="领导审核" activiti:candidateUsers="${managers}"></userTask>
<endEvent id="endevent1" name="End"></endEvent>
<userTask id="usertask3" name="填写请假单" activiti:assignee="${employee}"></userTask>
<userTask id="usertask4" name="放弃请假"></userTask>
<sequenceFlow id="flow6" name="想了想还是不请了" sourceRef="exclusivegateway1" targetRef="usertask4">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${input=='giveup'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow7" sourceRef="usertask4" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="flow3" name="下定决心准备请假" sourceRef="exclusivegateway1" targetRef="usertask1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${input=='apply'}]]></conditionExpression>
</sequenceFlow>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow2" sourceRef="usertask3" targetRef="exclusivegateway1"></sequenceFlow>
<exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow8" sourceRef="usertask2" targetRef="exclusivegateway2"></sequenceFlow>
<sequenceFlow id="flow9" name="审核通过" sourceRef="exclusivegateway2" targetRef="endevent1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${input=='apply'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow10" name="审核未通过" sourceRef="exclusivegateway2" targetRef="usertask3">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${input=='giveup'}]]></conditionExpression>
</sequenceFlow>
<exclusiveGateway id="exclusivegateway4" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow4" sourceRef="usertask1" targetRef="exclusivegateway4"></sequenceFlow>
<sequenceFlow id="flow5" sourceRef="exclusivegateway4" targetRef="usertask2">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${days>10}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow11" sourceRef="exclusivegateway4" targetRef="endevent1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${days<10}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_myProcesss">
<bpmndi:BPMNPlane bpmnElement="myProcesss" id="BPMNPlane_myProcesss">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="35.0" width="35.0" x="0.0" y="124.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55.0" width="105.0" x="340.0" y="20.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
<omgdc:Bounds height="55.0" width="105.0" x="655.0" y="20.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="537.0" y="240.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
<omgdc:Bounds height="55.0" width="105.0" x="110.0" y="114.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask4" id="BPMNShape_usertask4">
<omgdc:Bounds height="55.0" width="105.0" x="340.0" y="230.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
<omgdc:Bounds height="40.0" width="40.0" x="250.0" y="121.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
<omgdc:Bounds height="40.0" width="40.0" x="535.0" y="140.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway4" id="BPMNShape_exclusivegateway4">
<omgdc:Bounds height="40.0" width="40.0" x="490.0" y="28.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="35.0" y="141.0"></omgdi:waypoint>
<omgdi:waypoint x="110.0" y="141.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="16.0" width="48.0" x="35.0" y="141.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="270.0" y="161.0"></omgdi:waypoint>
<omgdi:waypoint x="392.0" y="230.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="48.0" width="96.0" x="270.0" y="161.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
<omgdi:waypoint x="445.0" y="257.0"></omgdi:waypoint>
<omgdi:waypoint x="537.0" y="257.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="270.0" y="121.0"></omgdi:waypoint>
<omgdi:waypoint x="392.0" y="75.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="48.0" width="96.0" x="270.0" y="121.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="215.0" y="141.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="141.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
<omgdi:waypoint x="707.0" y="75.0"></omgdi:waypoint>
<omgdi:waypoint x="555.0" y="140.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
<omgdi:waypoint x="555.0" y="180.0"></omgdi:waypoint>
<omgdi:waypoint x="554.0" y="240.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="16.0" width="64.0" x="565.0" y="180.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
<omgdi:waypoint x="575.0" y="160.0"></omgdi:waypoint>
<omgdi:waypoint x="676.0" y="160.0"></omgdi:waypoint>
<omgdi:waypoint x="676.0" y="351.0"></omgdi:waypoint>
<omgdi:waypoint x="365.0" y="351.0"></omgdi:waypoint>
<omgdi:waypoint x="162.0" y="351.0"></omgdi:waypoint>
<omgdi:waypoint x="162.0" y="169.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="16.0" width="80.0" x="679.0" y="300.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="445.0" y="47.0"></omgdi:waypoint>
<omgdi:waypoint x="490.0" y="48.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="530.0" y="48.0"></omgdi:waypoint>
<omgdi:waypoint x="655.0" y="47.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
<omgdi:waypoint x="510.0" y="68.0"></omgdi:waypoint>
<omgdi:waypoint x="510.0" y="257.0"></omgdi:waypoint>
<omgdi:waypoint x="537.0" y="257.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<div> <div>
<span>填写请假单</span> <span>填写请假单</span>
<input id="title" placeholder="题目" /><br /> <input id="title" placeholder="题目" /><br />
<input id="days" placeholder="请假天数" /><br />
<textarea id="content" placeholder="内容" rows="10"></textarea> <textarea id="content" placeholder="内容" rows="10"></textarea>
<button onclick="submit()">提交</button> <button onclick="submit()">提交</button>
</div> </div>
...@@ -53,6 +54,7 @@ button { ...@@ -53,6 +54,7 @@ button {
data : { data : {
"title" : $("#title").val(), "title" : $("#title").val(),
"content" : $("#content").val(), "content" : $("#content").val(),
"days" : $("#days").val(),
"operator" : operator "operator" : operator
}, },
success : function(data) { success : function(data) {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<td>请假标题</td> <td>请假标题</td>
<td>请假内容</td> <td>请假内容</td>
<td>请假人</td> <td>请假人</td>
<td>请假天数</td>
<td>状态</td> <td>状态</td>
<td>操作</td> <td>操作</td>
</tr> </tr>
...@@ -23,11 +24,12 @@ ...@@ -23,11 +24,12 @@
<tr th:each="form:${forms}"> <tr th:each="form:${forms}">
<td th:text="${form.title}"></td> <td th:text="${form.title}"></td>
<td th:text="${form.content}"></td> <td th:text="${form.content}"></td>
<td th:text="${form.days}"></td>
<td th:text="${form.applicant}"></td> <td th:text="${form.applicant}"></td>
<td th:text="${form.state}"></td> <td th:text="${form.state}"></td>
<td> <td>
<button th:if="${form.state} == '填写请假单'" <button th:if="${form.state} == '填写请假单'"
th:onclick="'javascript:apply(\''+${form.id}+'\')'">申请请假</button> th:onclick="'javascript:apply(\''+${form.id}+'\',\''+${form.days}+'\')'">申请请假</button>
<button th:if="${form.state} == '填写请假单'" <button th:if="${form.state} == '填写请假单'"
th:onclick="'javascript:giveup(\''+${form.id}+'\')'">放弃请假</button> th:onclick="'javascript:giveup(\''+${form.id}+'\')'">放弃请假</button>
<button th:onclick="'javascript:checkState(\''+${form.id}+'\')'" data-toggle="modal" data-target="#myModal">查看流程</button> <button th:onclick="'javascript:checkState(\''+${form.id}+'\')'" data-toggle="modal" data-target="#myModal">查看流程</button>
...@@ -111,7 +113,7 @@ button { ...@@ -111,7 +113,7 @@ button {
}); });
} }
function apply(formId) { function apply(formId,days) {
var operator = getUser(); var operator = getUser();
if (operator == "") { if (operator == "") {
location.href = "/"; location.href = "/";
...@@ -120,7 +122,8 @@ button { ...@@ -120,7 +122,8 @@ button {
url : "/apply", url : "/apply",
data : { data : {
"formId" : formId, "formId" : formId,
"operator" : operator "operator" : operator,
"days":days
}, },
success : function(data) { success : function(data) {
if (data.code == 200) { if (data.code == 200) {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<td th:text="${form.state}"></td> <td th:text="${form.state}"></td>
<td> <td>
<button th:onclick="'javascript:approve(\''+${form.id}+'\')'">审批通过</button> <button th:onclick="'javascript:approve(\''+${form.id}+'\')'">审批通过</button>
<button th:onclick="'javascript:giveup(\''+${form.id}+'\')'">审批不通过</button>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -96,6 +97,25 @@ button { ...@@ -96,6 +97,25 @@ button {
}); });
} }
function giveup(formId) {
var operator = getUser();
if (operator == "") {
location.href = "/";
}
$.ajax({
url : "/giveups",
data : {
"formId" : formId,
"operator" : operator
},
success : function(data) {
if (data.code == 200) {
location.href = "/homeApprover";
}
}
});
}
//获取cookie中的用户信息 //获取cookie中的用户信息
function getUser(){ function getUser(){
var name="userInfo="; var name="userInfo=";
......
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>工作流</title>
</head>
<body>
<div>
<button class="log" onclick="logout()">退出</button>
</div>
<table th:if="${forms.size()}>0">
<thead>
<tr>
<td>请假标题</td>
<td>请假内容</td>
<td>请假人</td>
<td>审批人</td>
<td>状态</td>
<td>操作</td>
</tr>
</thead>
<tr th:each="form:${forms}">
<td th:text="${form.title}"></td>
<td th:text="${form.content}"></td>
<td th:text="${form.applicant}"></td>
<td th:text="${form.approver}"></td>
<td th:text="${form.state}"></td>
<td>
<span th:if="${form.state!='已结束'}" ><button th:onclick="'javascript:approve(\''+${form.id}+'\')'">人事收到</button></span>
<span th:if="${form.state=='已结束'}" >完成</span>
</td>
</tr>
</table>
<div th:if="${forms.size()}==0">
<br />暂无请假数据
</div>
</body>
</html>
<style>
* {
font-family: "微软雅黑";
font-size: 15px;
}
td {
padding: 5px 10px;
border: 1px solid #ccc;
}
button {
padding: 5px;
margin: 5px 0;
border: 1px solid #aaa;
border-radius: 4px;
}
.log{
float:right;
padding:5px 8px;
background:#ec5757;
color:#fff;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script>
function writeForm(){
location.href = "/form";
}
function logout(){
$.ajax({
url : "/logout",
success : function(data) {
if(data.code == 200){
location.href="/";
}
}
});
}
function approve(formId){
var operator = getUser();
debugger;
if(operator == ""){
location.href = "/";
}
$.ajax({
url : "/approve",
data : {
"formId" : formId,
"operator" : operator
},
success : function(data) {
if(data.code == 200){
location.href="/homeApproverHr";
}
}
});
}
//获取cookie中的用户信息
function getUser(){
var name="userInfo=";
var user = "";
var ca = document.cookie.split(';');
$.each(ca, function(i, item){
if(item.indexOf(name) != -1){
user = item.substring(name.length,item.length);
}
});
return user;
}
</script>
\ No newline at end of file
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>工作流</title>
</head>
<body>
<div>
<button class="log" onclick="logout()">退出</button>
</div>
<table th:if="${forms.size()}>0">
<thead>
<tr>
<td>请假标题</td>
<td>请假内容</td>
<td>请假人</td>
<td>状态</td>
<td>操作</td>
</tr>
</thead>
<tr th:each="form:${forms}">
<td th:text="${form.title}"></td>
<td th:text="${form.content}"></td>
<td th:text="${form.applicant}"></td>
<td th:text="${form.state}"></td>
<td>
<button th:onclick="'javascript:approve(\''+${form.id}+'\')'">审批通过</button>
<button th:onclick="'javascript:giveup(\''+${form.id}+'\')'">审批不通过</button>
</td>
</tr>
</table>
<div th:if="${forms.size()}==0">
<br />暂无请假数据
</div>
</body>
</html>
<style>
* {
font-family: "微软雅黑";
font-size: 15px;
}
td {
padding: 5px 10px;
border: 1px solid #ccc;
}
button {
padding: 5px;
margin: 5px 0;
border: 1px solid #aaa;
border-radius: 4px;
}
.log{
float:right;
padding:5px 8px;
background:#ec5757;
color:#fff;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script>
function writeForm(){
location.href = "/form";
}
function logout(){
$.ajax({
url : "/logout",
success : function(data) {
if(data.code == 200){
location.href="/";
}
}
});
}
function approve(formId){
var operator = getUser();
debugger;
if(operator == ""){
location.href = "/";
}
$.ajax({
url : "/approve",
data : {
"formId" : formId,
"operator" : operator
},
success : function(data) {
if(data.code == 200){
location.href="/homeApproverzjl";
}
}
});
}
function giveup(formId) {
var operator = getUser();
if (operator == "") {
location.href = "/";
}
$.ajax({
url : "/giveups",
data : {
"formId" : formId,
"operator" : operator
},
success : function(data) {
if (data.code == 200) {
location.href = "/homeApproverzjl";
}
}
});
}
//获取cookie中的用户信息
function getUser(){
var name="userInfo=";
var user = "";
var ca = document.cookie.split(';');
$.each(ca, function(i, item){
if(item.indexOf(name) != -1){
user = item.substring(name.length,item.length);
}
});
return user;
}
</script>
\ No newline at end of file
...@@ -55,8 +55,12 @@ button { ...@@ -55,8 +55,12 @@ button {
if(data.code == 200){ if(data.code == 200){
if(data.info.type == 1){ if(data.info.type == 1){
location.href="/home"; location.href="/home";
}else{ }else if(data.info.type == 2){
location.href="/homeApprover"; location.href="/homeApprover";
}else if(data.info.type == 3){
location.href="/homeApproverHr";
}else{
location.href="/homeApproverzjl";
} }
}else{ }else{
alert(data.msg); alert(data.msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment