retrieve.js
14.7 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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
var title = "";
var fileadress = "";
var docviewservice = "";
var searchtype = "";
var url = "";
var anaylerUrl = "";
$(document).ready(function(){
url=$("#esserver").val()+"/find";
anaylerUrl=$("#esserver").val()+"/analyzer";
});
function search_submit(curId){
title = $("#title").val().trim();
fileadress = $("#fileadress").val();
docviewservice = $("#docviewservice").val();
// 点击访问
$.ajax({
type: 'POST',
url: url,
headers:{
"token":$.cookie('ftoken')
},
data: "keyword="+title,
dataType: "json",
success: function(data){
createcontent(data,curId);
}
});
}
function getGWsearch(type,pid){
var curId = pid || "";
searchtype = type;
var data = "keyword="+title+"&term="+type;
ajaxFun(data,curId);
}
function ajaxFun(data_,curId){
$.ajax({
type: 'POST',
url: url,
data: data_,
dataType: "json",
success: function(data){
createcontent(data,curId);
}
});
}
var currentPage = 1; //当前页
var totalpage= 0; //总页数
var pageNum = 5; //最多显示页数
function createcontent(data,curId){
var obj = data.resultList;
// 当前页码
currentPage = data.curPageIndex;
// 开始页码
var startNum = data.startNum;
// 每页显示条数
var pageSize = data.pageSize;
// 结束页码
var endNum = data.endNum;
//总页数
totalpage = Math.ceil(data.totalCount / pageSize);
var content_ = "";
for(var i=0;i<pageSize;i++){
var json = obj[i];
for(var key in json){
if(key == "GW"){
var ogw = json[key];
if(curId != "" && curId != ogw.id){
content_ = content_ +"<div class='div-relate-document-attachment'>";
//var refnumber=ogw.refnumber==null?"暂无":ogw.refnumber;
var title = ogw.title || "暂无";
var sendunit = ogw.sendunit || "暂无";
var refnumber = ogw.refnumber || "暂无";
var signdate = ogw.signdate || "暂无";
var comefiles = ogw.comefiles || "暂无";
var documentid = ogw.documentid || "暂无";
var seeker = ogw.seeker || "暂无";
var personinfor = ogw.personinfor || "暂无";
//由于全文检索返回来的标题含有代码字符串,所以无法当做参数,默认给title一个值
title = title.replace(/<.*?>/ig,"");
if(ogw.documentType=="发文"){
content_ = content_ +
//"<tr><td>"
"<div class='title-distance'>" +
"<label class=\"bluefont\" style='font-size:16px;'>[公文]</label>"+
"<a href=\"javascript:void(0)\" style='font-size:16px;' onclick=\"openGW('"+ogw.id+"','"+ogw.documentType+"','"+title+"')\" class=\"div-related-doumnetnew-title\">"+ogw.title+"</a>"+
"</div>" +
"<div class='distance' style='font-size:13px;'>主送单位:"+ sendunit +"</div>"+
"<div class='distance' style='font-size:13px;'>发文字号:"+ refnumber +" | 登记时间:"+ signdate +"</div>"
//"<div class='distance'>登记时间:"+ + "</div>"
// +"</td></tr>"
}else if(ogw.documentType=="收文"){
content_ = content_ +
"<div class='title-distance'>" +
"<label class=\"bluefont\" style='font-size:16px;'>[公文]</label>"+
"<a href=\"javascript:void(0)\" style='font-size:16px;' onclick=\"openGW('"+ogw.id+"','"+ogw.documentType+"','"+title+"')\" class=\"div-related-doumnetnew-title\">"+ogw.title+"</a>"+
"</div>" +
"<div class='distance' style='font-size:13px;'>来文单位:"+ comefiles +"</div>"+
"<div class='distance' style='font-size:13px;'> 办文号:"+ documentid +" | 登记时间:"+ signdate +"</div>"
}else if(ogw.documentType=="传阅"){
content_ = content_ +
"<div class='title-distance'>" +
"<label class=\"bluefont\" style='font-size:16px;'>[公文]</label>"+
"<a href=\"javascript:void(0)\" style='font-size:16px;' onclick=\"openGW('"+ogw.id+"','"+ogw.documentType+"','"+title+"')\" class=\"div-related-doumnetnew-title\">"+ogw.title+"</a>"+
"</div>" +
"<div class='distance' style='font-size:13px;'>"+refnumber+"</div>"
}else{
content_ = content_ +
"<div class='title-distance'>" +
"<label class=\"bluefont\" style='font-size:16px;'>[公文]</label>"+
"<a href=\"javascript:void(0)\" style='font-size:16px;' onclick=\"openGW('"+ogw.id+"','"+ogw.documentType+"','"+title+"')\" class=\"div-related-doumnetnew-title\">"+ogw.title+"</a>"+
"</div>" +
"<div class='distance' style='font-size:13px;'> 咨询者:"+ seeker +"</div>"+
"<div class='distance' style='font-size:13px;'> 办文号:"+ documentid +" | 个人信息:"+ personinfor +"</div>"
//"<div class='distance'>个人信息:"+ personinfor + "</div>"
}
content_ = content_ +"</div>";
}
// "<div class='content'>" +
// "<h3><span class='type'><b>[</b>公文<b>] </b><span><a href='"+ogw.id+"'>"+ogw.title+"</a></h3>" +
// "<div class='distance'>"+ogw.refnumber+"</div>"+
// "</div>"
}
if(key == "FJ"){
var ofj = json[key];
var str = ofj.contents || "暂无";
var title = ofj.title || "暂无";
content_ = content_ +
"<div class=\"div-relate-document-attachment\">" +
"<div class='title-distance'>" +
"<label class=\"bluefont\" style='font-size:16px;'>[附件]</label>"+
// "<a href=\"javascript:void(0)\" onclick=\"openFJ('"+vieWurl(ofj.viewurl)+"')\" class=\"div-relate-document-preview\">[预览]</a>"+
"<a href=\"javascript:void(0)\" style='font-size:16px;' onclick=\"openFJ('"+vieWurl(ofj.viewurl)+"')\">"+title+"</a>" +
"</div>" +
"<div class='threeRow distance' style='text-overflow: ellipsis;overflow:hidden;white-space:nowrap;font-size:13px;'>"+str+"</div>" +
"</div>"
}
if(key == "HY"){
var ohy = json[key];
var str = ohy.baseinfor || "暂无";
var ohyid = ohy.id
var projectName = ohy.projectName || "暂无";
var buildunit = ohy.buildunit || "暂无";
var buildunitAddress = ohy.buildunitAddress || "暂无";
str = str.substring(0) + "..."
content_ = content_ +
"<div class=\"div-relate-document-attachment\">" +
"<div class='title-distance'>" +
"<label class=\"bluefont\" style='font-size:16px;'>[会议]</label>"+
// "<a href=\""+hrefUrl(ohy.id)+"\"target=\"_blank\" class=\"div-related-doumnetnew-title\">"+ohy.projectName+"</a>"+
"<a href=\"javascript:void(0)\" style='font-size:16px;' onclick=\"openMeeting('"+ohyid+"')\" class=\"div-related-doumnetnew-title\">"+ projectName +"</a>"+
"</div>" +
"<div>" +
"<div class='distance' style='font-size:13px;'>建设单位:"+ buildunit +" | 地址:"+ buildunitAddress +"</div>" +
"<div class='distance' style='text-overflow: ellipsis;overflow:hidden;white-space:nowrap;font-size:13px;'>"+str+"</div>" +
//"<div class='distance'>地址:"+ buildunitAddress +"</div>" +
"</div>" +
"</div>"
}
if(key == "DA"){
var oda = json[key];
var archiveName = oda.archiveName || "暂无";
var archiveNum = oda.archiveNum || "暂无";
var archiveType = oda.archiveType || "暂无";
content_ = content_ +
"<div class=\"div-relate-document-attachment\">" +
"<div class='title-distance'>" +
"<label class=\"bluefont\" style='font-size:16px;'>[档案]</label>"+
"<a href=\"javascript:void(0)\" style='font-size:16px;' onclick=\"openArchive('"+oda.id+"')\" class=\"div-related-doumnetnew-title\">"+ archiveName +"</a>"+
"</div>" +
"<div>" +
"<div class='distance' style='font-size:13px;'>档案类型:"+ archiveType +"</div>" +
"<div class='distance' style='font-size:13px;'>档案编号:"+ archiveNum +"</div>" +
"</div>" +
"</div>"
}
if(key == "SP"){
var osp = json[key];
var spProjectName = osp.projectname || "暂无";
var spPuildUnit = osp.buildunit || "暂无";
var spPuildAddress = osp.buildaddress || "暂无";
var spRegisterTime = osp.createtime || "暂无";
var taskid = osp.taskid || null;
content_ = content_ +
"<div class=\"div-relate-document-attachment\">" +
"<div class='title-distance'>" +
"<label class=\"bluefont\" style='font-size:16px;'>[审批]</label>"+
"<a href=\"javascript:void(0)\" style='font-size:16px;' onclick=\"openApprove('"+osp.projectid+"','"+taskid+"')\" class=\"div-related-doumnetnew-title\">"+ spProjectName +"</a>"+
"</div>" +
"<div>" +
"<div class='distance' style='font-size:13px;'>建设单位:"+ spPuildUnit +"</div>" +
"<div class='distance' style='font-size:13px;'>建设地址:"+ spPuildAddress +" | 登记时间:"+ spRegisterTime +"</div>" +
//"<div class='distance'>登记时间:"+ spRegisterTime +"</div>" +
"</div>" +
"</div>"
}
}
}
$(".div-related-doumnetnew").empty();
$(".div-related-doumnetnew").append(content_);
threeRow();
if(obj.length > 0){
var pageStart = "";
var pageEnd = "";
if(currentPage<=Math.round(pageNum/2)+1){
pageStart = 1;
pageEnd = pageNum;
}
if(currentPage>Math.round(pageNum/2)+1){
pageStart = currentPage-Math.round(pageNum/2);
pageEnd = currentPage+Math.round(pageNum/2)-2;
}
if(pageEnd>totalpage){
pageEnd = totalpage;
}
var page_ = "";
// 上一页
page_ = page_ + "<li><a onclick=\"retrievePage(0)\" aria-label=\"Previous\">" +
"<span aria-hidden=\"true\">上一页</span></a></li>"
// 显示页码
for(var i=pageStart;i<=pageEnd;i++){
if(currentPage==i)
page_ = page_ + "<li class=\"active\"><a onclick=\"targetPage("+i+")\">"+i+"</a></li>"
else
page_ = page_ + "<li><a onclick=\"targetPage("+i+")\">"+i+"</a></li>"
// if(curPage == i){
// page_ = page_ + "<li class='num active' value='"+i+"'><a href='javascript:void(0)' class='targetPage'>"+i+"</a></li>"
// }else {
// page_ = page_ + "<li class='num' value='"+i+"'><a href='javascript:void(0)' class='targetPage'>"+i+"</a></li>"
// }
}
// 下一页
// if(curPage == endNum){
// /* page_ = page_ + "<li><a href='javascript:void(0)'>下一页</a></li>" */
// }else {
// page_ = page_ + "<li class='next' value='"+parseInt(curPage+1)+"'><a href='javascript:void(0)' class='targetPage'>下一页</a></li>"
// }
page_ = page_ + "<li> <a onclick=\"retrievePage(1)\" aria-label=\"Next\">" +
"<span aria-hidden=\"true\">下一页</span></a></li> "
var pageObj = $(".pagination");
pageObj.empty();
pageObj.append(page_);
}else {
var null_content = "<div class='null_content'>未搜索到相关信息...</div>";
$(".index_content").append(null_content);
}
}
// 分页访问
function targetPage(pageindex){
var data_ = title;
var number = pageindex
if(number > 50){
alert("只能访问前50页数据");
return;
}
if(searchtype=="GW"){
var search = "keyword="+title+"&number="+number+"&term=GW";
ajaxFun(search);
}
if(searchtype=="FJ"){
var search = "keyword="+title+"&number="+number+"&term=FJ";
ajaxFun(search);
}
if(searchtype=="HY"){
var search = "keyword="+title+"&number="+number+"&term=HY";
ajaxFun(search);
}
if(searchtype=="SP"){
var search = "keyword="+title+"&number="+number+"&term=SP";
ajaxFun(search);
}
if(searchtype=="DA"){
var search = "keyword="+title+"&number="+number+"&term=DA";
ajaxFun(search);
}
if(searchtype==""){
$.ajax({
type: 'POST',
url: url,
data: "keyword="+data_+"&number="+number,
dataType: "json",
success: function(data){
createcontent(data);
}
});
}
}
function retrievePage(index) {
var pageindex = 1;
if (index == 0) {// 上一页
pageindex = currentPage - 1 <= 1 ? 1 : currentPage - 1;
} else {
pageindex = currentPage + 1 >= totalpage ? totalpage : currentPage + 1;
}
targetPage(pageindex);
}
function hrefUrl(id){
var state = "retrieve";
var url = global.contextPath+"/mvc/meetingProject/configureProject.do?id="+id+"&state="+state;
return url;
}
function vieWurl(url){
var viewurl =docviewservice+ encodeURI(fileadress+url);//预览url
return viewurl;
}
function openFJ(url){
window.open(url);
}
function openApprove(id,taskid){
// /projecttask/detailproject.jsp?taskId=892517&projectid=1377
window.open(global.contextPath+'/projecttask/detailproject.jsp?taskId='+taskid+'&projectid='+id);
}
function openGW(id,type,title){
var documentType = "";
if(type=="发文")
documentType = "fwform.jsp";
else if(type="收文")
documentType = "swform.jsp";
else if(type=="传阅")
documentType = "cyform.jsp";
else
documentType = "xjform.jsp";
var state = "gwRetrieve";
window.open(encodeURI(encodeURI(global.contextPath+'/officialdocument/form/'+documentType+"?pid="+id+'&outdispatches=""&fid=""&state='+state+"&title="+title)));
}
function openMeeting(id){
var state = "retrieve";
window.open(global.contextPath+'/mvc/meetingProject/configureProject.do?id='+id+"&state="+state);
}
function openArchive(id){
// /archive/archive_detail.jsp?archiveId=4028888f58c4a7c30158c4ad396a0000
window.open(global.contextPath+'/archive/archive_detail.jsp?archiveId='+id);
}
function threeRow(){
var obj = $(".threeRow");
obj.dotdotdot({
ellipsis : '... ',
wrap : 'word',
fallbackToLetter: true,
after : null,
watch : false,
height :null,
tolerance : null,
callback : function( isTruncated, orgContent ) {},
lastCharacter : {
remove : [ ' ', ',', ';', '.', '!', '?' ],
noEllipsis : []
}
});
}
var wordtitle = "";
function analyzer(word,pid){
var analyzerWord = $("#analyzerWord");
wordtitle = word;
var contentStr = "";
$.ajax({
type: 'POST',
url: anaylerUrl,
data: "word="+word,
dataType: "json",
success: function(data){
if(data.length > 0){
analyzerWord.empty();
for(var i=0;i<data.length;i++){
contentStr = contentStr +
"<li>" +
"<span class=\"label label-info\"><a class='sword' onclick='analyzerSearch(\""+data[i]+"\",\""+pid+"\",event)' href='javascript:void(0);'>"+data[i]+"</a></span>" +
"</li>";
}
analyzerWord.append(contentStr);
}
}
});
}
function analyzerSearch(word,pid,evt){
var current = evt.currentTarget;
if(current.className=="sword"){
$(current).addClass('sword myact');
$.ajax({
type: 'POST',
url: url,
data: "keyword="+word,
dataType: "json",
success: function(data){
createcontent(data,pid);
}
});
}else{
$(current).removeClass('myact');
$.ajax({
type: 'POST',
url: url,
data: "keyword="+wordtitle,
dataType: "json",
success: function(data){
createcontent(data,pid);
}
});
}
// var current = evt.currentTarget;
// $.ajax({
// type: 'POST',
// url: url,
// data: "keyword="+word,
// dataType: "json",
// success: function(data){
// var ws = $(".sword");
//
// for(var i=0;i<ws.length;i++){
// $(ws[i]).removeClass('myact');
// }
// $(current).addClass('sword myact');
// createcontent(data,pid);
// }
// });
//
}