searchResult.jsp
10.4 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
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="weaver.mobile.webservices.workflow.WorkflowRequestInfo" %>
<%@ page import="weaver.mobile.webservices.workflow.WorkflowBaseInfo" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ include file="/hrm/resource/simpleHrmResource_wev8.jsp" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="WFManager" class="weaver.workflow.workflow.WFManager" scope="session"/>
<jsp:useBean id="resourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="session"/>
<jsp:useBean id="workflowServiceImpl" class="weaver.mobile.webservices.workflow.WorkflowServiceImpl" scope="session"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
int pageNo = 1;
int pageSize = 10;
List<String> searchList = new ArrayList<String>();
String requestname = Util.null2String(request.getParameter("requestname"));
String typeid = Util.null2String(request.getParameter("typeid"));
String createrid = Util.null2String(request.getParameter("createrid"));
String createdatefrom = Util.null2String(request.getParameter("createdatefrom"));
String createdateto = Util.null2String(request.getParameter("createdateto"));
String wfstatu = Util.null2String(request.getParameter("wfstatu"));
if(!"".equals(requestname)){
searchList.add(" t1.requestname like '%"+requestname+"%' ");
}
if(!"".equals(typeid)){
searchList.add(" t1.workflowid in (select wb.id from workflow_base wb,workflow_type wt where wb.workflowtype=wt.id and wt.id= "+typeid+") ");
}
if(!"".equals(createrid)){
searchList.add(" t1.creater = " + createrid + " and t1.creatertype = 0 ");
}
if(!"".equals(createdatefrom)){
searchList.add(" t1.createdate >= '"+createdatefrom+"' ");
}
if(!"".equals(createdateto)){
searchList.add(" t1.createdate <= '"+createdateto+"' ");
}
if("1".equals(wfstatu)){
searchList.add(" t2.isremark in('0','1','5','8','9','7') ");
}else if("2".equals(wfstatu)){
searchList.add(" t2.isremark in('2','4') ");
}
//String [] sqlConditions = searchList.toArray();
String [] sqlConditions = searchList.toArray(new String[searchList.size()]);
int userid = user.getUID();
int recordCount = workflowServiceImpl.getAllWorkflowRequestCount(userid, sqlConditions);
WorkflowRequestInfo[] wriarrays = workflowServiceImpl.getAllWorkflowRequestList(pageNo,pageSize,recordCount,userid,sqlConditions);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="/js/ecology8/lang/weaver_lang_<%=user.getLanguage()%>_wev8.js"></script>
<link rel="stylesheet" type="text/css" href="/rdeploy/assets/css/wf/requestshow.css">
<script type="text/javascript">
jQuery(document).ready(function(){
//运行瀑布流主函数
//设置滚动加载
window.onscroll = function(){
//校验数据请求
if(getCheck()){
//------
$.ajax({
type: "post",
url: "/rdeploy/chatproject/workflow/requestLiatAjax.jsp?_" + new Date().getTime() + "=1&",
data: {"actionkey":"searchresult",
"pageNo":jQuery("#pageNo").val(),
"requestname":jQuery("#requestname").val(),
"typeid":jQuery("#typeid").val(),
"createrid":jQuery("#createrid").val(),
"createdatefrom":jQuery("#createdatefrom").val(),
"createdateto":jQuery("#createdateto").val(),
"wfstatu":jQuery("#wfstatu").val()
},
contentType : "application/x-www-form-urlencoded; charset=UTF-8",
complete: function(){
},
error:function (XMLHttpRequest, textStatus, errorThrown) {
} ,
success:function (data, textStatus) {
var _data;
if(!jQuery.isArray(data) && jQuery.trim(data) != "")
_data = JSON.parse(data);
else
_data=eval(data);
/////////////
var contentbox = jQuery("#contentbox");
for(var j=0;j<_data.length;j++){
//创建box、line
var html = "<div class=\"box\"> "+
" <div style=\"height: 84px;\"> "+
" <div class=\"pic\"> "+
" <img src=\""+_data[j].createrurl+"\" style=\"width:45px;height:45px;border-radius:30px;margin-top:29px;\"> "+
" </div> "+
" <div class=\"info\"> "+
" <div class=\"title\"> "+
" <a href=\"#\">"+_data[j].requestname+"</a> "+
" </div> "+
" <div class=\"createrinfo\"> "+
" <a href=\"javaScript:openhrm("+_data[j].createrid+");\" onclick=\"pointerXY(event);\">"+_data[j].creatername+"</a> "+
" "+_data[j].creatertime+" "+
" </div> "+
" </div> "+
" <div class=\"showtype\">"+_data[j].wftypename+"</div> "+
" </div> "+
" <div class=\"showrequestline1\"> </div> "+
" </div> ";
contentbox.append(html);
}
waterfall('contentbox','box');
try {
var index = parseInt(jQuery("#pageNo").val());
//ismodify = parseInt(jQuery("input[name=ismodify_"+id+"]").val());
} catch (e) {}
jQuery("#pageNo").val(index+1);
/////////////
}
});
//--
}
}
jQuery(".resultshow",window.parent.document).html("搜索结果(共<%=recordCount%>条记录)");
jQuery("html").mousedown(function (e){
parent.$(".hiddensearch").animate({
height: 0
}, 200,null,function() {
parent.jQuery(".hiddensearch").hide();
});
parent.jQuery(".opensright").hide();
parent.jQuery(".selectstatus").hide();
parent.jQuery(".sbPerfectBar").hide();
});
});
/**
* 瀑布流主函数
* @param contentbox [Str] 外层元素的ID
* @param box [Str] 每一个box的类名
*/
function waterfall(contentbox,box){
//1.获得外层以及每一个box
var contentbox = document.getElementById(contentbox);
var boxs = getClass(contentbox,box);
//2.获得屏幕可显示的列数
var boxW = boxs[0].offsetWidth;
var colsNum = Math.floor(document.documentElement.clientWidth/boxW);
contentbox.style.width = boxW*colsNum+'px';//为外层赋值宽度
//3.循环出所有的box并按照瀑布流排列
var everyH = [];//定义一个数组存储每一列的高度
for (var i = 0; i < boxs.length; i++) {
if(i<colsNum){
everyH[i] = boxs[i].offsetHeight;
}else{
var minH = Math.min.apply(null,everyH);//获得最小的列的高度
var minIndex = getIndex(minH,everyH); //获得最小列的索引
getStyle(boxs[i],minH,boxs[minIndex].offsetLeft,i);
everyH[minIndex] += boxs[i].offsetHeight;//更新最小列的高度
}
}
}
/**
* 获取类元素
* @param warp [Obj] 外层
* @param className [Str] 类名
*/
function getClass(contentbox,className){
var obj = contentbox.getElementsByTagName('*');
var arr = [];
for(var i=0;i<obj.length;i++){
if(obj[i].className == className){
arr.push(obj[i]);
}
}
return arr;
}
/**
* 获取最小列的索引
* @param minH [Num] 最小高度
* @param everyH [Arr] 所有列高度的数组
*/
function getIndex(minH,everyH){
for(index in everyH){
if (everyH[index] == minH ) return index;
}
}
/**
* 数据请求检验
*/
function getCheck(){
var documentH = document.documentElement.clientHeight;
var scrollH = document.documentElement.scrollTop || document.body.scrollTop;
return documentH+scrollH>=getLastH() ?true:false;
}
/**
* 获得最后一个box所在列的高度
*/
function getLastH(){
var contentbox = document.getElementById('contentbox');
var boxs = getClass(contentbox,'box');
return boxs[boxs.length-1].offsetTop+boxs[boxs.length-1].offsetHeight;
}
/**
* 设置加载样式
* @param box [obj] 设置的Box
* @param top [Num] box的top值
* @param left [Num] box的left值
* @param index [Num] box的第几个
*/
var getStartNum = 0;//设置请求加载的条数的位置
function getStyle(box,top,left,index){
if (getStartNum>=index) return;
$(box).css({
'position':'absolute',
'top':top,
"left":left,
"opacity":"0"
});
$(box).stop().animate({
"opacity":"1"
},999);
getStartNum = index;//更新请求数据的条数位置
}
</script>
</head>
<body>
<%if(wriarrays.length>0){%>
<div class="contentbox" id="contentbox">
<!-- item block 循环开始 -->
<% //RecordSet.executeSql(viewsql);
for(int i = 0;i<wriarrays.length;i++){
WorkflowBaseInfo wbi = wriarrays[i].getWorkflowBaseInfo();
%>
<div class="box">
<div style="height: 84px;">
<div class="pic">
<img src="<%=resourceComInfo.getMessagerUrls(wriarrays[i].getCreatorId())%>" style="width:45px;height:45px;border-radius:30px;margin-top:29px;">
</div>
<div class="info">
<div class="title">
<a href="javaScript:openFullWindowHaveBarForWFList('/workflow/request/ViewRequest.jsp?requestid=<%=wriarrays[i].getRequestId()%>&isovertime=0',<%=wriarrays[i].getRequestId()%>)"><%=wriarrays[i].getRequestName() %></a>
</div>
<div class="createrinfo">
<a href="javaScript:openhrm(<%=wriarrays[i].getCreatorId()%>);" onclick="pointerXY(event);"><%=resourceComInfo.getResourcename(wriarrays[i].getCreatorId())%></a>
<%=wriarrays[i].getCreateTime()%>
</div>
</div>
<div class="showtype"><%=wbi.getWorkflowTypeName()%></div>
</div>
<div class="showrequestline1"> </div>
</div>
<% }%>
</div>
<%}else{ %>
<div class="norecord">
<div class="recordpicture"></div>
<div class="recordmessage">暂无记录</div>
</div>
<%} %>
<input type="hidden" name="pageNo" id="pageNo" value="<%=pageNo+1%>">
<input type="hidden" name="requestname" id="requestname" value="<%=requestname%>">
<input type="hidden" name="typeid" id="typeid" value="<%=typeid%>">
<input type="hidden" name="createrid" id="createrid" value="<%=createrid%>">
<input type="hidden" name="createdatefrom" id="createdatefrom" value="<%=createdatefrom%>">
<input type="hidden" name="createdateto" id="createdateto" value="<%=createdateto%>">
<input type="hidden" name="wfstatu" id="wfstatu" value="<%=wfstatu%>">
</body>
</html>