655fbb91313f22ad7a697b9daa34fa3e79430e46.svn-base
11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>请假办理</title>
<meta name="decorator" content="default"/>
<script type="text/javascript">
$(document).ready(function() {
$(".handle").click(function(){
var obj = $(this);
var taskId = obj.data("tid");
var leaveId = obj.data("id");
var tkey=obj.data("tkey");
//部门领导审批
if(tkey=="deptLeaderAudit") {
$.getJSON("${ctx}/oa/leave/detail/" + leaveId , function(data){
var html= Mustache.render($("#auditTemplate").html(),data);
top.$.jBox(html, { title: "流程办理["+obj.data("tname") + "]",buttons:{"同意":"yes","驳回":"no","取消":"cancel"},submit: function (v, h, f) {
//同意
if(v=="yes") {
complete(taskId, [{
key: 'deptLeaderPass',
value: true,
type: 'B'
}]);
//驳回
} else if (v=="no") {
top.$.jBox("<div style='padding:10px;'><textarea id='leaderBackReason' style='width: 250px; height: 60px;'></textarea></div>", { title: "请填写驳回理由", submit: function () {
var leaderBackReason=top.$("#leaderBackReason").val();
//必须填写驳回理由
if($.trim(leaderBackReason)=="") {
top.$.jBox.error('请填写驳回理由', '错误');
return false;
} else {
complete(taskId, [{
key: 'deptLeaderPass',
value: false,
type: 'B'
}, {
key: 'leaderBackReason',
value: leaderBackReason,
type: 'S'
}]);
}
}
});
}
}
});
});
}
//人事审批
if(tkey=="hrAudit") {
$.getJSON("${ctx}/oa/leave/detail/" + leaveId , function(data){
var html= Mustache.render($("#auditTemplate").html(),data);
top.$.jBox(html, { title: "流程办理["+obj.data("tname") + "]",buttons:{"同意":"yes","驳回":"no","取消":"cancel"},submit: function (v, h, f) {
//同意
if(v=="yes") {
complete(taskId, [{
key: 'hrPass',
value: true,
type: 'B'
}]);
}
//驳回
else if (v=="no") {
top.$.jBox("<div style='padding:10px;'><textarea id='hrBackReason' style='width: 250px; height: 60px;'></textarea></div>", { title: "请填写驳回理由", submit: function () {
var hrBackReason=top.$("#hrBackReason").val();
//必须填写驳回理由
if($.trim(hrBackReason)=="") {
top.$.jBox.error('请填写驳回理由', '错误');
return false;
} else {
complete(taskId, [{
key: 'hrPass',
value: false,
type: 'B'
}, {
key: 'hrBackReason',
value: hrBackReason,
type: 'S'
}]);
}
}
});
}
}
});
});
}
//调整申请
if(tkey=="modifyApply") {
$.getJSON("${ctx}/oa/leave/detail-with-vars/" + leaveId + "/" + taskId, function(data){
var html= Mustache.render($("#modifyApplyTemplate").html(),data);
top.$.jBox(html, { title: "流程办理["+obj.data("tname") + "]",buttons:{"重新申请":"yes","放弃申请":"no","取消":"cancel"},submit: function (v, h, f) {
//重新申请或者取消申请
var reApply=true;
if(v=="no") {
reApply=false;
}
if(v=="yes"|| v=="no") {
complete(taskId, [{
key: 'reApply',
value: reApply,
type: 'B'
}, {
key: 'leaveType',
value: top.$('#modifyApplyContent #leaveType').val(),
type: 'S'
}, {
key: 'startTime',
value: top.$('#modifyApplyContent #startTime').val(),
type: 'D'
}, {
key: 'endTime',
value: top.$('#modifyApplyContent #endTime').val(),
type: 'D'
}, {
key: 'reason',
value: top.$('#modifyApplyContent #reason').val(),
type: 'S'
}]);
}
}
});
top.$("#leaveType").val(data.leaveType);
});
}
//销假
if(tkey=="reportBack") {
$.getJSON("${ctx}/oa/leave/detail/" +leaveId , function(data){
var html= Mustache.render($("#reportBackTemplate").html(),data);
top.$.jBox(html, { title: "流程办理["+obj.data("tname") + "]",buttons:{"提交":"yes","取消":"cancel"},submit: function (v, h, f) {
//同意
if(v=="yes") {
var realityStartTime = top.$('#realityStartTime').val();
var realityEndTime = top.$('#realityEndTime').val();
if (realityStartTime == '' || realityEndTime=="") {
top.$.jBox.error('请选择实际开始时间和实际结束日期!');
return false;
} else {
complete(taskId, [{
key: 'realityStartTime',
value: realityStartTime,
type: 'D'
}, {
key: 'realityEndTime',
value: realityEndTime,
type: 'D'
}]);
}
}
}
});
});
}
})
});
/**
* 完成任务
* @param {Object} taskId
*/
function complete(taskId, variables) {
// 转换JSON为字符串
var keys = "", values = "", types = "";
if (variables) {
$.each(variables, function(idx) {
if (keys != "") {
keys += ",";
values += ",";
types += ",";
}
keys += this.key;
values += this.value;
types += this.type;
});
}
// 发送任务完成请求
$.post('${ctx}/act/task/complete/', {
taskId: taskId,
"vars.keys": keys,
"vars.values": values,
"vars.types": types
}, function(data) {
top.$.jBox.tip('任务完成');
//location = '${pageContext.request.contextPath}' + data;
location.reload();
});
}
/**
* 签收任务
* @param {Object} taskId
*/
function claim(taskId) {
$.get('${ctx}/act/task/claim' ,{taskId: taskId}, function(data) {
top.$.jBox.tip('签收完成');
//location = '${pageContext.request.contextPath}' + data;
location.reload();
});
}
</script>
<script type="text/template" id="auditTemplate">
<table class="table table-striped ">
<tr>
<td width="100px;">申请人:</td>
<td>{{user.name}}</td>
</tr>
<tr>
<td>假种:</td>
<td>{{leaveTypeDictLabel}}</td>
</tr>
<tr>
<td>申请时间:</td>
<td>{{createDate}}</td>
</tr>
<tr>
<td>请假<font color="red">开始</font>时间:</td>
<td>{{startTime}}</td>
</tr>
<tr>
<td>请假<font color="red">结束</font>时间:</td>
<td>{{endTime}}</td>
</tr>
<tr>
<td>请假事由:</td>
<td>{{reason}}</td>
</tr>
</table>
</script>
<script type="text/template" id="reportBackTemplate">
<table class="table table-striped ">
<tr>
<td width="100px;">申请人:</td>
<td>{{user.name}}</td>
</tr>
<tr>
<td>假种:</td>
<td>{{leaveTypeDictLabel}}</td>
</tr>
<tr>
<td>申请时间:</td>
<td>{{createDate}}</td>
</tr>
<tr>
<td>请假<font color="red">开始</font>时间:</td>
<td>{{startTime}}</td>
</tr>
<tr>
<td>请假<font color="red">结束</font>时间:</td>
<td>{{endTime}}</td>
</tr>
<tr>
<td>请假事由:</td>
<td>{{reason}}</td>
</tr>
<tr>
<td>实际开始时间:</td>
<td>
<input id="realityStartTime" readonly="readonly" maxlength="20" class=" Wdate required"
onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm' });"/>
</td>
</tr>
<tr>
<td>实际结束时间:</td>
<td>
<input id="realityEndTime" readonly="readonly" maxlength="20" class=" Wdate required"
onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm' });"/>
</td>
</tr>
</table>
</script>
<script type="text/template" id="modifyApplyTemplate">
<table class="table table-striped " id="modifyApplyContent">
<tr>
<td>部门领导意见:</td>
<td>
{{variables.leaderBackReason}}
</td>
</tr>
<tr>
<td>人事意见:</td>
<td>
{{variables.hrBackReason}}
</td>
</tr>
<tr>
<td>假种:</td>
<td>
<select id="leaveType" name="leaveType">
<c:forEach items="${fns:getDictList('oa_leave_type')}" var="leaveType">
<option value="${leaveType.value}">${leaveType.label}</option>
</c:forEach>
</select>
</td>
</tr>
<tr>
<td>请假<font color="red">开始</font>时间:</td>
<td>
<input id="startTime" name="startTime" type="text" readonly="readonly" maxlength="20" class=" Wdate required"
onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm' });" value="{{startTime}}"/>
</td>
</tr>
<tr>
<td>请假<font color="red">结束</font>时间:</td>
<td>
<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class=" Wdate required"
onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm' });" value="{{endTime}}"/>
</td>
</tr>
<tr>
<td>请假事由:</td>
<td><textarea id="reason" name="reason" class="required" rows="5">{{reason}}</textarea></td>
</tr>
</table>
</script>
</head>
<body>
<ul class="nav nav-tabs">
<li class="active"><a href="${ctx}/oa/leave/">待办任务</a></li>
<li><a href="${ctx}/oa/leave/list">所有任务</a></li>
<shiro:hasPermission name="oa:leave:edit"><li><a href="${ctx}/oa/leave/form">请假申请</a></li></shiro:hasPermission>
</ul>
<sys:message content="${message}"/>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
<tr>
<th>假种</th>
<th>申请人</th>
<th>申请时间</th>
<th>开始时间</th>
<th>结束时间</th>
<th>当前节点</th>
<th>任务创建时间</th>
<th>流程状态</th>
<th>操作</th>
</tr>
<tbody>
<c:forEach items="${leaves}" var="leave">
<c:set var="task" value="${leave.task}" />
<c:set var="pi" value="${leave.processInstance}" />
<tr id="${leave.id }" tid="${task.id}">
<td>${leave.leaveTypeDictLabel}</td>
<td>${leave.user.name}</td>
<td><fmt:formatDate value="${leave.createDate}" type="both"/></td>
<td><fmt:formatDate value="${leave.startTime}" type="both"/></td>
<td><fmt:formatDate value="${leave.endTime}" type="both"/></td>
<td>${task.name}</td>
<td><fmt:formatDate value="${task.createTime}" type="both"/></td>
<td>${pi.suspended ? "已挂起" : "正常" };<b title='流程版本号'>V: ${leave.processDefinition.version}</b></td>
<td>
<a target="_blank" href="${ctx}/act/task/trace/photo/${task.processDefinitionId}/${task.executionId}">跟踪</a>
<c:if test="${empty task.assignee}">
<a class="claim" href="#" onclick="javescript:claim('${task.id}');">签收</a>
</c:if>
<c:if test="${not empty task.assignee}">
<%-- 此处用tkey记录当前节点的名称 --%>
<a class="handle" href="#" data-tkey="${task.taskDefinitionKey}" data-tname="${task.name}" data-id="${leave.id}" data-tid="${task.id}">办理</a>
</c:if>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>