PageSourceSearch

https://www.nia.gov.cn/News/new/js/index.js

js nia.gov.cn collected 2026-09-24 17:39:33 UTC 15,275 bytes, 564 lines download raw bytes

1var pages=2;         //页码总数
2var displayNum=15;//每页显示条数
3var culPage=1;        //当前页码
4var totalSize=0;
5var codeDn = ''   //编码表值
6var categoryName='';  //分类名称
7var advanceFlag = false;//是否为高级检索
8var doRepeated = "1";   //标题去重标识
9
10
11function goSearch(){
12	$('#searchForm').submit();
13}
14
15function search(iSadvanceFlag){
16	if(iSadvanceFlag==0) {
17		advanceFlag = false;
18		doRepeated = '0';
19	}else if(iSadvanceFlag==1){
20		var searchJson=$("#searchJson").val();
21		if(searchJson!=''){
22			advanceFlag = true;
23			doRepeated = '1';
24			searchJson=decodeURIComponent(searchJson);
25			buildJson(searchJson);
26		}
27	}
28	goPage(1);
29}
30
31function buildJson(searchJson){
32	var arrs = JSON.parse(searchJson);
33	if(arrs.length>0){
34		$.each(arrs,function(i,n){
35			var name=n.name;
36			var val=n.value;
37			
38			if(name=='title'){
39				title=val;
40			}else if(name=='wh'){
41				wh=val;
42			}else if(name=='themecat'){
43				themecat=val;
44			}else if(name=='themecatHid'){
45				themecatHid=val;
46			}else if(name=='svobjcat'){
47				svobjcat=val;
48			}else if(name=='svobjcatHid'){
49				svobjcatHid=val;
50			}else if(name=='organcat'){
51				organcat=val;
52			}else if(name=='organcatHid'){
53				organcatHid=val;
54			}else if(name=='searchBfzw'){
55				searchBfzw=val;
56			}else if(name=='publishStartTime'){
57				publishStartTime=val;
58			}else if(name=='publishEndTime'){
59				publishEndTime=val;
60			}
61		});
62	}
63}
64
65
66function goPage(num){
67	if(!isNaN(num)){
68		num = num<1 ? 1 : num;
69		num = num > pages ? pages : num;
70		culPage = num;
71	}else{
72		alert("无效数字!" + num);
73	}
74	var param={};
75	var params = new Array();
76	var paramYear = {};
77	if(advanceFlag){
78		title=trimStr(title);
79		if(title){
80			param.shortName='title';
81		    param.value= title;
82		    param.type="anlyzeStr";
83		    params.push(param);
84		}
85		wh=trimStr(wh);
86		if(wh){
87			param={};
88			param.shortName='wh';
89		    param.value= wh;
90		    params.push(param);
91		}
92		var content=trimStr(searchBfzw);
93		if(content){
94			param={};
95			param.shortName='content';
96		    param.value= content;
97		    param.type="anlyzeStr";
98		    params.push(param);
99		}
100
101		if(svobjcat){
102			param={};
103			param.shortName='ztfl';
104			param.value= svobjcatHid;
105			params.push(param);
106		}
107		if(themecat){
108			param={};
109			param.shortName='tcfl';
110		    param.value= themecatHid;
111		    params.push(param);
112		}
113		if(organcat){
114			param={};
115			param.shortName='fbjg';
116		    param.value= organcatHid;
117		    params.push(param);
118		}
119		if(publishStartTime && publishEndTime){
120			publishStartTime = publishStartTime.replace(new RegExp("-","g"), "");
121			publishEndTime = publishEndTime.replace(new RegExp("-","g"), "");
122			paramYear.shortName='publishTime';
123			paramYear.value= publishStartTime + '000000';
124			paramYear.min = publishStartTime + '000000';
125			paramYear.max = publishEndTime + '235959' ;
126			paramYear.type="number";
127		}
128	} else{
129		var keyWord = $('#searchText').val();
130		keyWord=trimStr(keyWord);
131		if(keyWord=="关键字"){
132			keyWord=null;
133		}
134		if(keyWord){
135		    param.shortName="all";
136		    param.value= keyWord;
137		    param.type="anlyzeStr"; 
138		}
139	}
140	searchContent(param, paramYear, params);
141	 
142}
143function gotoGipsSearch(name, dn, id){
144	advanceFlag = false;
145	codeDn = dn;
146	categoryName=name;
147	goPage(1);
148}
149
150function getSearchOrderByParams(){
151  var params = new Array();
152  var param = {};
153
154  param.orderBy = 'publishTime';
155  param.reverse = true;
156  params.push(param);
157  
158  param = {};
159  param.orderBy = 'orderTime';
160  param.reverse = true;
161  params.push(param); 
162  return params;
163}
164function initSearchYear(){
165	var option = '<option value="all" selected="">全部时间</option>';
166	var d = new Date();
167	var year = d.getFullYear();
168	for(var i=year; i>=year-9; i--) {
169		option += "<option value='" + i + "' >" + i + "</option>";
170	}
171	$('#searchYear').html(option);
172}
173
174function searchContent(param, paramYear, params){
175	 var qparams = advanceFlag ? params : getSearchParams();
176	 if(param && !advanceFlag) qparams.push(param);
177	 if(paramYear) qparams.push(paramYear);
178	 var params={};
179	 params.goPage=culPage;
180	 params.orderBy=getSearchOrderByParams();
181	 params.pageSize=displayNum;
182	 params.queryParam=qparams;
183	 var str=JSON2.stringify(params);
184	 str=encodeURIComponent(str);
185	 str=encodeURIComponent(str);
186	 jQuery.getJSON(appName + "/searchIndex.jsp?params="+str+"&callback=?", function(result){
187		 var con=result.resultMap;
188	  	 pages=result.totalPageNum;
189	  	 totalSize = result.totalContentNum;
190		 listCon(con);
191	  	 reWritePage();
192	});
193	return totalSize;
194}
195
196
197function reWritePage(){
198	var allPageVal = '共' + totalSize + '条  ' + pages + '页    ' + culPage + '/' + pages;
199	$('#allPageId').html(allPageVal);
200	
201	var goPageVal = getGoPageVal();
202	$('#goPageId').html(goPageVal);
203	
204	var jumpPageVal = getJumpPageVal();
205	$('#jumpPage').html(jumpPageVal);
206}
207
208function getJumpPageVal(){
209	var option = "";
210	var selected = '';
211	for(var i=1; i<=pages; i++) {
212		selected = i == culPage ? 'selected' : '';
213		option += "<option value='" + i + "' " + selected + " >" + i + "</option>";
214	}
215	return option;
216}
217function getGoPageVal(){
218	var val = '<a href="javascript:goPage(1)">首页</a>&nbsp;&nbsp;';
219	pages = pages == 0 ? 1 : pages;
220	var nextPage = parseInt(culPage) + 1;
221	nextPage = nextPage > pages ? pages : nextPage;
222	nextPage = nextPage == 0 ? 1 : nextPage;
223	var prePage =  parseInt(culPage) - 1;
224	prePage = prePage < 1 ? 1 : prePage;
225	val +='<a href="javascript:goPage(' + prePage + ')">上一页</a>&nbsp;&nbsp;';
226	val += '<a href="javascript:goPage(' + nextPage + ')">下一页</a>&nbsp;&nbsp;';
227    val += '<a href="javascript:goPage(' + pages + ')">尾页 </a>';
228    return val;
229}
230
231function listCon(contents){
232	if(!categoryName){
233		categoryName='信息公开目录';
234	}
235	var html="<div class=\"title\"><span class=\"w200\">"+categoryName+"</span></div>";
236		html+="<div class=\"txtbox mar30\"><ul>";
237
238	$(contents).each(function(i){
239		var content = this;
240		html+="<li><a target=\"_blank\" href=\"../news/content.jsp?id="+content['id']+"\">"+content['title']+"</a><span class=\"sty9\">"+(formatTimegkrq(content['publishTime']))+"</span></li>";
241	});
242	html+="</ul>";
243	html+=buildPage();
244	html+="</div>";
245	$('#rightDiv').html(html);
246	$('#zcDiv').hide();
247	$('#rightDiv').show();
248}
249
250function buildPage(){
251	if(pages<1){
252		return "";
253	}
254	var j=0;
255	var f=0;
256	var html="<div class=\"page txt14 fr mar40\">";
257	if(culPage>1) {
258		html+="<a href='javascript:void(0);' onclick='javascript:goPage("+(1)+")'>首页</a>";
259		html+="<a href='javascript:void(0);' onclick='javascript:goPage("+(parseInt(culPage)-1)+")'>上一页</a>";
260	}
261	if(culPage<5) {
262		j=5;
263		f=1;
264	}else if(culPage>=5){
265		j=culPage+2;
266		f=culPage-2;
267	}
268	for(var i=f;i<=pages;i++){
269		if(i!=culPage) {
270			if(parseInt(i)<=parseInt(j)) {
271				html+="<a href='javascript:void(0)' onclick='javascript:goPage("+(parseInt(i))+")'>"+(parseInt(i))+"</a>";	
272			}
273		}else {
274			html+="<a href='javascript:void(0)' class='on' onclick='javascript:goPage("+culPage+")'>"+culPage+"</a>";
275		}
276	}
277	if(culPage<pages) {
278		html+="<a href='javascript:void(0);' onclick='javascript:goPage("+(parseInt(culPage)+1)+")'>下一页</a>";
279		html+="<a href='javascript:void(0);' onclick='javascript:goPage("+(pages)+")'>尾页</a>";
280	}
281	html+="<span>共"+pages+"页/"+totalSize+"条</span>";
282	html+="</div>";
283	return html;
284}
285
286function getShortName(name){
287	for(var i=0; i<names.length; i++){
288		if(name == names[i][0])
289			return names[i][1];
290	}
291	return names[0][1];
292}
293
294function getSearchParams(){
295	var shortName = codeDn.indexOf('/') != -1 ? (codeDn ? codeDn.substring(0, codeDn.indexOf('/')) : 'svobjcat') : codeDn;
296    var params=new Array();
297    var param={};
298    if(shortName==''){
299    	shortName ="ownSubjectDn";
300    }else if(shortName!=''){
301    	shortName =getShortName(shortName);
302    }
303    
304    param.shortName=shortName;
305    param.value= codeDn;
306    
307    if(param.value){
308        params.push(param);
309        return params;
310    }
311    return params;
312 }
313 
314function formatTime(time) {
315	if (time && time.length == 14) {
316		return time.substring(0, 4) + "-" + time.substring(4, 6) + "-"
317				+ time.substring(6, 8) + " " + time.substring(8, 10) + ":"
318				+ time.substring(10, 12) + ":" + time.substring(12, 14);
319	} else {
320		return "";
321	}
322}
323
324function formatTimegkrq(time){
325	if(time && time.length==14){
326		return time.substring(0,4)+"-"+time.substring(4,6)+"-"+time.substring(6,8);
327	}else{
328		return "";
329	}
330}
331
332function trimStr(str){
333	if(!str){
334		return '';
335	}
336	return str.replace(/^\s+|\s+$/g,'');
337}
338
339function searchContent_zc() {
340	var title = $('#fullText').val();
341	var content = title;
342	title = trimStr(title);
343	var searchType = $("[name='posi']").filter(':checked');
344	var type = searchType.val();
345	if (type == '2') {
346		title = '';
347	} else {
348		content = '';
349	}
350	jQuery.getJSON(appName + "/new/searchIndex.jsp?callback=?", {
351		goPage : culPage,
352		pageSize : displayNum,
353		zhengce : '1',
354		ownSubjectDn : ownSubjectDn,
355		title : encodeURIComponent(title),
356		content : encodeURIComponent(content)
357	}, function(result) {
358		var con = result.resultMap;
359		pages = result.totalPageNum;
360		totalSize = result.totalContentNum;
361		listCon_zc(con);
362		buildPage_zc();
363	});
364	return totalSize;
365}
366function listCon_zc(contents) {
367	var html = '';
368	html += '<tr><th align="center">序号</th><th>标题</th><th>下载</th></tr>';
369	$(contents)
370			.each(
371					function(i) {
372						var content = this;
373						var time = content['zlrq'] || '';
374						var baseUrl = "/News/files/c" + content['id'] + "/";
375						var index = (culPage - 1) * displayNum + i + 1;
376						html += "<tr>"
377								+ "<td class=\"id-num\">"
378								+ index
379								+ "</td>"
380								+ "<td class=\"id-title\">"
381								+ "<p class=\"it-name\"><a href=\""
382								+ appName
383								+ "/new/content.jsp?id="
384								+ content['id']
385								+ "\" target=\"_blank\">"
386								+ content['title']
387								+ "</a></p>"
388								+ "<p class=\"it-time\"><a href=\""
389								+ appName
390								+ "/new/content.jsp?id="
391								+ content['id']
392								+ "\" target=\"_blank\">("
393								+ (content['fbt'] ? content['fbt'] : "")
394								+ ")</a></p></td>"
395								+ "<td class=\"id-function-btn\">"
396								+ "<a href=\""+baseUrl+content['wzb']+"\" download target=\"_blank\" class=\"ifb-size fl\">下载文字版</a>"
397								+ "<a href=\""+baseUrl+content['tpb']+"\" download target=\"_blank\" class=\"ifb-img fr\">下载图片版</a></td>"
398								+ "</tr>";
399					});
400	$('#rightDiv').hide();
401	$('#contentList').html(html);
402	$('#zcDiv').show();
403}
404function buildPage_zc() {
405	if (pages < 2) {
406		return "";
407	}
408	var j = 0;
409	var f = 0;
410	var html = "";
411	if (culPage > 1) {
412		html += "<a href='javascript:void(0);' target=\"_self\" onclick='javascript:goPage_zc("
413				+ (1) + ")'>首页</a>";
414		html += "<a href='javascript:void(0);' target=\"_self\" onclick='javascript:goPage_zc("
415				+ (parseInt(culPage) - 1) + ")'>上一页</a>";
416	}
417	if (culPage < 5) {
418		j = 5;
419		f = 1;
420	} else if (culPage >= 5) {
421		j = culPage + 2;
422		f = culPage - 2;
423	}
424	for (var i = f; i <= pages; i++) {
425		if (i != culPage) {
426			if (parseInt(i) <= parseInt(j)) {
427				html += "<a href='javascript:void(0)' target=\"_self\"  onclick='javascript:goPage_zc("
428						+ (parseInt(i)) + ")'>" + (parseInt(i)) + "</a>";
429			}
430		} else {
431			html += "<a href='javascript:void(0)' target=\"_self\"  class='on' onclick='javascript:goPage_zc("
432					+ culPage + ")'>" + culPage + "</a>";
433		}
434	}
435	if (culPage < pages) {
436		html += "<a href='javascript:void(0);' target=\"_self\"  onclick='javascript:goPage_zc("
437				+ (parseInt(culPage) + 1) + ")'>下一页</a>";
438		html += "<a href='javascript:void(0);' target=\"_self\"  onclick='javascript:goPage_zc("
439				+ (pages) + ")'>尾页</a>";
440	}
441	html += "<span> 共" + pages + "页 </span>";
442	html += "<span> 跳至 </span><input type=\"text\" id=\"jumpPage_zc\" style=\"width: 50px;height: 27px;border: 1px solid #ccc;margin-left: 5px;\">";
443	html += "<a href='javascript:void(0);' target=\"_self\"  onclick='javascript:jumpPage_zc(pages)'>确认</a>";
444	$('#page').html(html);
445}
446
447function showSecondList(obj,t,c,m,n) {
448	var type;
449 	var code;
450 	var more;
451 	var name;
452	if(!obj){
453		type=t;code=c;more=m;name=n;
454	}else{
455		type = $(obj).attr("atype");
456		code = $(obj).attr("acode");
457		name = $(obj).attr("aname");
458		more = $(obj).attr("amore");
459		mtype= $(obj).attr("mtype");
460	}
461 	var url=appName + "/news/newSearchIndex.jsp";
462 	if(more=='1'){
463 		gotoGipsSearch(name,code);
464 	}else{
465		codeDn = code;
466		var data = {};
467		data.type = type;
468		data.code = code;
469		$.ajax({
470			type : 'POST',
471			url : url,
472			data : data,
473			dataType : "json",
474			success : function(msg) {
475				var html = buildSecondHtml(msg);
476				$('#zcDiv').hide();
477				$("#rightDiv").html(html);
478				$("#rightDiv").show();
479			}
480		});
481 	}
482}
483
484function buildSecondHtml(data) {
485	var html = "";
486	for (i = 0; i < data.length; i++) {
487		var result = data[i];
488		html += buildHtml(result);
489	}
490	return html;
491}
492
493function buildHtml(obj) {
494	var totalContentNum = obj[1].totalContentNum;
495	var contents = obj[1].resultMap;
496	
497	if (contents.length == 0) {//栏目下无数据 不显示该栏目信息
498		return '';
499	}
500	
501	var html = "<div class=\"title\"><span class=\"w200\">" + obj[0]
502			+ "</span></div>";
503
504	html += "<div class=\"item\"><ul>";
505	for (j = 0; j < contents.length; j++) {
506		var content = contents[j];
507		var id = content['id'];
508		var ownSubjectDn = content['ownSubjectDn'];
509		var href = appName + '/news/content.jsp?id=' + id;
510		if (ownSubjectDn.indexOf("/1/741421/741440/741587/1316094/1459238") != -1) {
511			href = appName + '/new/content.jsp?id=' + id;
512		}
513		html += "<li>";
514		html += "<a target=\"_blank\" href=\""+href+"\">"
515				+ content['title'] + "</a>" + "<span class=\"sty9\">"
516				+ (formatTimegkrq(content['publishTime'])) + "</span>";
517		html += "</li>";
518	}
519	html += "</ul>";
520	if (totalContentNum > 5) {
521		html += "<a href=\"javascript:void(0)\" onclick=\"gotoGipsSearch('"
522				+ obj[0] + "','" + obj[2] + "')\" class=\"more\">更多</a>";
523	}
524	html += "</div>";
525	return html;
526}
527
528function showLeftBtn(){
529	if(mtype=='1'){
530		$("#zc").click();
531		showLeft('zc');
532		document.getElementById("zcul").style.display = "block";
533		searchContent_zc();
534	}else if(mtype=='2'){
535		showLeft('gkzn');
536		$("#gkzn").click();
537	}else if(mtype=='3'){
538		showLeft('gkzd');
539		$("#gkzd").click();
540	}else if(mtype=='4'){
541		showLeft('gknr');
542		var gknrLi=$("#gknrul").find('li')[0];
543		if(gknrLi){
544			gknrLi.lastChild.click();
545		}
546	}else if(mtype=='5'){
547		showLeft('gknb');
548		var nbaoLi=$("#gknbul").find('li')[0];
549		if(nbaoLi){
550			nbaoLi.lastChild.click();
551		}
552	}else if(mtype=='6'){
553		showLeft('sqgk');
554		$("#sqgk").click();
555	}
556}
557
558function showLeft(id){
559	$("#"+id).css({"background-color":"#2d66a5","color":"#fff"});
560}
561
562function openUrl() {
563	window.location.href = "../new/list.jsp";
564}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.