workflowshowpaperchange_wev8.js
15.3 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
(function($){
$.fn.selectForK13 = function(options){
var defaults = {
"width": "",
"id": "",
"class": "",
"pageSize":"10",
"pageId":"",
"callback":null,
"isWrap" : true
}
var options = $.extend(defaults, options);
var idm = jQuery(this).attr("id") || jQuery(this).attr("name");
if(!idm){
return jQuery(this);
}
return this.each(function(){
if (options.isWrap == true) {
$(this).wrap("<div class='K13_select'></div>");
$(this).before("<div class='K13_select_checked'><input class='_pageSizeInput' AUTOCOMPLETE='off' maxLength=3 style='width:"+options.width+";background:transparent;text-align:center;border:1px solid transparent;color:#fff;height:26px;vertical-align:top;' type='text' value='"+options.pageSize+"' name='" + idm + "inputText' id='" + idm+ "inputText'/></div><div class='K13_select_list'><ol></ol></div>");
$(this).children("option").each(function () {
$(this).parent("select").siblings(".K13_select_list").children("ol")
.append("<li>" + $(this).text() + "</li>");
}).end().hide();
}
$(this).parent(".K13_select")
.click(function () {
$(this).css("z-index","10000").children(".K13_select_list").toggle();
if(document.documentMode==5){
$(this).children(".K13_select_list").width($(this).width());
}
})
.mouseleave(function () {
$(this).css("z-index","99").children(".K13_select_list").hide();
})
.children(".K13_select_list").find("li")
.click(function (e) {
$(this).parents(".K13_select_list").siblings(".K13_select_checked")
.find("input").val(($(this).text()))
.siblings("select").children("option").eq($(this).index())
.attr("selected",true)
.siblings("option")
.attr("selected",false);
var inputtext = jQuery("#" + idm + "inputText");
inputtext.val(jQuery(this).text());
savePageSize(e,inputtext,options.pageId,true);
}).hover(function(){
jQuery(this).addClass("hover");
},function(){jQuery(this).removeClass("hover")});
var height = $(".K13_select_list").height();
if(!height)height = 124;
$(".K13_select_list").css("padding-bottom", "1px");
var _top = jQuery("#"+idm+"inputText").offset().top;
if(_top<=height+1){
_top = jQuery("#"+idm+"inputText").height()+5;
}else{
_top = -(height+1);
}
$(".K13_select_list").css("top", _top + "px");
if (options.width) {
$(this).parent(".K13_select").css("width",options.width);
}
if (options.id) {
$(this).parent(".K13_select").attr("id",options.id)
}
if(!!options.callback){
jQuery("#" + idm + "inputText").bind("keyup",function(e){
options.callback(e,this,options.pageId)
}).bind("keypress",function(e){
if((e.keyCode<48&&e.keyCode!=8&&e.keyCode!=13&&e.keyCode!=0) || e.keyCode>57)return false;
});
}
})
};
})(jQuery);
var kkpager = {
//divID
pagerid : 'div_pager',
//当前页码
pno : 1,
//总页码
total : 1,
pageId:"SIGNVIEW_VIEWID",
pagesize:'5',
//总数据条数
totalRecords : 0,
//是否显示总页数
//isShowTotalPage : false,
//是否显示总记录数
//isShowTotalRecords : false,
//是否显示页码跳转输入框
isGoPage : false,
//链接前部
hrefFormer : '',
//链接尾部
hrefLatter : '',
/****链接算法****/
getLink : function(n){
//这里的算法适用于比如:
//hrefFormer=http://www.xx.com/news/20131212
//hrefLatter=.html
//那么首页(第1页)就是http://www.xx.com/news/20131212.html
//第2页就是http://www.xx.com/news/20131212_2.html
//第n页就是http://www.xx.com/news/20131212_n.html
if(n == 1){
return this.hrefFormer + this.hrefLatter;
}else{
return this.hrefFormer + '_' + n + this.hrefLatter;
}
},
//跳转框得到输入焦点时
focus_gopage : function (){
var btnGo = jQuery('#btn_go' + this.pagerid);
jQuery('#btn_go_input' + this.pagerid).attr('hideFocus',true);
btnGo.show();
btnGo.css('left','0px');
btnGo.css('margin-top','1px');
btnGo.css('z-index','100');
jQuery('#go_page_wrap' + this.pagerid).css('border-color','#6694E3');
btnGo.animate({left: '+=30'}, 50,function(){
//jQuery('#go_page_wrap').css('width','88px');
});
},
//跳转框失去输入焦点时
blur_gopage : function(){
setTimeout(function(){
var btnGo = jQuery('#btn_go' + this.pagerid);
//jQuery('#go_page_wrap').css('width','44px');
btnGo.animate({
left: '-=44'
}, 100, function() {
jQuery('#btn_go' + this.pagerid).css('left','0px');
jQuery('#btn_go' + this.pagerid).hide();
jQuery('#go_page_wrap' + this.pagerid).css('border-color','#DFDFDF');
});
},400);
},
//跳转框页面跳转
gopage : function(){
var str_page = jQuery("#btn_go_input" + this.pagerid).val();
if(isNaN(str_page)){
jQuery("#btn_go_input" + this.pagerid).val(this.next);
return;
}
var n = parseInt(str_page);
if(n < 1){
jQuery("#btn_go_input" + this.pagerid).val(this.next);
return;
}
if(n >this.total){
jQuery("#btn_go_input" + this.pagerid).val(this.pno);
return;
}
//这里可以按需改window.open
//window.location = this.getLink(n);
flipOver(4,n);
},
//分页按钮控件初始化
init : function(config){
this.pagerid = !!!config.pagerid ? 'div_pager' : config.pagerid;
//赋值
this.pno = isNaN(config.pno) ? 1 : parseInt(config.pno);
this.total = isNaN(config.total) ? 1 : parseInt(config.total);
this.pagesize = isNaN(config.pagesize) ? 5 : parseInt(config.pagesize);
this.totalRecords = isNaN(config.totalRecords) ? 0 : parseInt(config.totalRecords);
if(config.pagerid){this.pagerid = config.pagerid;}
if(config.isShowTotalPage != undefined){this.isShowTotalPage=config.isShowTotalPage;}
if(config.isShowTotalRecords != undefined){this.isShowTotalRecords=config.isShowTotalRecords;}
if(config.isGoPage != undefined){this.isGoPage=config.isGoPage;}
this.hrefFormer = config.hrefFormer || '';
this.hrefLatter = config.hrefLatter || '';
if(config.getLink && typeof(config.getLink) == 'function'){this.getLink = config.getLink;}
//验证
if(this.pno < 1) this.pno = 1;
this.total = (this.total <= 1) ? 1: this.total;
if(this.pno > this.total) this.pno = this.total;
this.prv = (this.pno<=2) ? 1 : (this.pno-1);
this.next = (this.pno >= this.total-1) ? this.total : (this.pno + 1);
this.hasPrv = (this.pno > 1);
this.hasNext = (this.pno < this.total);
this.inited = true;
},
//生成分页控件Html
generPageHtml : function(){
if(!this.inited){
return;
}
var str_prv='',str_next='';
if(this.hasPrv){
str_prv="<span style='padding:0px;margin:0px;font-weight:normal;' class=\"e8_numberspan weaverTablePrevPage weaverTablePage\" id=\""+this.pagerid+"-pre\" onClick=\"javascript:flipOver(4,"+this.prv+")\"><</span>";
}else{
str_prv='<span style="padding:0px;margin:0px;font-weight:normal;" class=\"e8_numberspan weaverTablePrevPageOfDisabled weaverTablePage\"><</span>';
}
var dot = '<span>...</span>';
if(this.hasNext){
str_next = "<span class=\"e8_numberspan weaverTableNextPage weaverTablePage\" style='padding:0px;margin:0px;font-weight:normal;' id=\""+this.pagerid+"-next\" onClick=\"javascript:flipOver(4,"+this.next+")\">></span>";
}else{
str_next = '<span style="padding:0px;margin:0px;font-weight:normal;" class=\"e8_numberspan weaverTableNextPageOfDisabled weaverTablePage\">></span>';
}
var str = '';
var total_info='';
//设置每页大小
var selPageId = "pageSizeSel" + this.pagerid;
var pageSizeInput = "<select class='_pageSize' id='"+selPageId+"' name='"+selPageId+"' style=\"font-weight:normal;background:transparent;border:none;width:50px;text-align:center;TEXT-DECORATION:none;height:20px;padding-right:2px;margin-left:5px;margin-right:5px;line-height:20px;display:none;\">"+
"<option value='10'>10</option>"+
"<option value='20'>20</option>"+
"<option value='50'>50</option>"+
"<option value='100'>100</option>"+
"</select>";
var pageSizeInputLis = "<li>10</li>"+
"<li>20</li>"+
"<li>50</li>"+
"<li>100</li>";
pageSizeInput = "<div class='K13_select'>"
+ " <div class='K13_select_checked'><input class='_pageSizeInput' AUTOCOMPLETE='off' maxLength=3 style='width:"+"40px"+";background:transparent;text-align:center;border:1px solid transparent;color:#fff;height:26px;vertical-align:top;' type='text' value='"+this.pagesize+"' name='" + selPageId + "inputText' id='" + selPageId+ "inputText'/></div><div class='K13_select_list'><ol>" + pageSizeInputLis + "</ol></div>"
+ " " + pageSizeInput
+ "</div>"
total_info="<span class=\"e8_splitpageinfo\" style='padding:0px;margin:0px;font-weight:normal;'><span style=\"font-weight:normal;padding:0px;margin:0px;position:relative;TEXT-DECORATION:none;height:21px;padding-top:2px;\">"+pageSizeInput+SystemEnv.getHtmlNoteName(3585,languageid)+" | "+SystemEnv.getHtmlNoteName(3586,languageid)+this.totalRecords+SystemEnv.getHtmlNoteName(3524,languageid)+"</span></span><span class=\"e8_splitpageinfo\" style='padding:0px;margin:0px;'> </span>";
//}
var gopage_info = '';
if(this.isGoPage){
gopage_info = '<span class=\"e8_numberspan\" style="font-weight:normal;padding:0px;margin:0px;">'+SystemEnv.getHtmlNoteName(3525,languageid)+'</span><span class=\"e8_numberspan\" style="font-weight:normal;display:inline-block;width:30px;height:20px;border:0px solid #DFDFDF;margin:-1px 1px;padding:0px;position:relative;left:0px;top:5px;">'+
'<input type="button" id="btn_go' + this.pagerid + '" class="btn_go" onclick="kkpager.gopage();" style="font-weight:normal;width:30px;height:22px;line-height:22px;padding:0px;font-family:arial,宋体,sans-serif;text-align:center;border:0px;background-color:#0063DC;color:#FFF;position:absolute;left:0px;top:-1px;display:none;" value="'+SystemEnv.getHtmlNoteName(3588 ,languageid)+'" />'+
'<input type="text" id="btn_go_input' + this.pagerid + '" class="btn_go_input" onfocus="kkpager.focus_gopage()" onkeypress="if(event.keyCode<48 || event.keyCode>57)return false;" onblur="kkpager.blur_gopage()" style="background-color:#f8f8f8;font-weight:normal;width:30px;height:20px;text-align:center;border:1px;position:absolute;left:0px;top:0px;outline:none;" value="'+this.pno+'" /></span>'+
'<span class=\"e8_numberspan\" style="font-weight:normal;padding:0px;margin:0px;">'+SystemEnv.getHtmlNoteName(3526 ,languageid)+'</span>';
}
//分页处理
var z_index = parseInt(this.pno) - 1;
var y_num = parseInt(this.pno) + 2;
var tempCent = "";
var tempLeft = "";
var tempRight = "";
if (z_index > 1) {
tempLeft += "<span class=\"e8_numberspan\" style='font-weight:normal;padding:0px;margin:0px;' _jumpTo=\"" + this.pagerid + "\" onClick=\"javascript:flipOver(4,1)\">1</span>";;
}
if (z_index > 2) {
tempLeft += "<span class=\"e8_numberspan\" style='font-weight:normal;padding:0px;margin:0px;'> ... </span>";
}
if (y_num < (this.total - 1)) {
tempRight += "<span class=\"e8_numberspan\" style='font-weight:normal;padding:0px;margin:0px;'> ... </span>";
}
if (y_num < this.total) {
tempRight += "<span class=\"e8_numberspan weaverTableNextPage\" style='padding:0px;margin:0px;font-weight:normal;' id=\""+this.pagerid+"-next\" onClick=\"javascript:flipOver(4,"+this.total+")\">"+this.total+"</span>";
}
for(;z_index<=y_num; z_index++) {
if (z_index>0 && z_index<=this.total) {
if (z_index == this.pno) {
tempCent +="<span _jumpTo=\"" + this.pagerid + "\" style='font-weight:normal;padding:0px;margin:0px;' onClick=\"javascript:flipOver(4," +z_index+ ")\" class=\"e8_numberspan weaverTableCurrentPageBg\" >" +z_index+ "</span>";
} else {
tempCent +="<span class=\"e8_numberspan\" style='font-weight:normal;padding:0px;margin:0px;' _jumpTo=\"" + this.pagerid + "\" onClick=\"javascript:flipOver(4,"+z_index+")\">" +z_index+ "</span>";
}
}
}
str = tempLeft + tempCent + tempRight;
str = "<div align='right' ><span class='e8_pageinfo' style='font-weight:normal;padding:0px;margin:0px;'>"+str_prv + str + str_next + gopage_info + total_info +"</span></div>";
jQuery("#"+this.pagerid).html(str);
jQuery("#pageSizeSel" + this.pagerid).selectForK13({
"width":"40px",
pageSize:this.pagesize,
pageId:this.pageId,
callback:savePageSize,
isWrap:false
});
}
};
function getParameter(name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|jQuery)");
var r = window.location.search.substr(1).match(reg);
if (r!=null) return unescape(r[2]); return null;
}
//保存每页显示的记录数
function savePageSize(e,obj,pageId,save){
var event = e||window.event;
var pageSize = parseInt(jQuery(obj).val());
var minPageSize = 1;
var defaultPageSize = 10;
var maxPageSize = 100;
if((event.type.toLowerCase()=="keyup"&&event.keyCode==13) || !!save){
if(pageSize!=0 && pageSize<minPageSize){
jQuery(obj).val(minPageSize);
window.top.Dialog.alert("每页记录数必须不小于"+minPageSize+"条!");
return;
}else{
if(pageSize!=0&&pageSize>maxPageSize){
jQuery(obj).val(maxPageSize);
window.top.Dialog.alert("每页记录数必须不大于"+maxPageSize+"条!");
return;
}
}
if(!!pageId){
// try{
// var flag = e8beforeJump();
// if(!flag)return;
// }catch(e){}
jQuery.ajax({
url:"/weaver/weaver.common.util.taglib.ShowColServlet?src=savePageSize",
type:"get",
dataType:"json",
data:{
pageSize:pageSize,
pageId:pageId
},
success:function(data){
if(data.result==0){
window.top.Dialog.alert(data.msg);
}else{
try{
/*
if(jQuery("span#searchblockspan",parent.document).find("img:first").length>0){
jQuery("span#searchblockspan",parent.document).find("img:first").click();
}else{
reloadPage();
}
*/
wfsignlddtcnt = pageSize;
flipOver(-1);
}catch(e){
//window.location.reload();
}
}
},
failure:function(xhr,status,e){
window.top.Dialog.alert("出现错误!记录保存失败!");
}
});
}else{
window.top.Dialog.alert("未定义页面ID!记录保存失败!");
return;
}
}else if(event.type.toLowerCase()=="keyup"){
if(pageSize<0){
jQuery(obj).val(defaultPageSize);
}
}
}