var cityJson; var departmentJson; $(document).ready(function() { $("#name").keyup(function(){ if(event.keyCode == 13){ ssClick(); } }); }); function myBrowser(){ var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 var isOpera = userAgent.indexOf("Opera") > -1; if (isOpera) { return "Opera" }; //判断是否Opera浏览器 if (userAgent.indexOf("Firefox") > -1) { return "FF"; } //判断是否Firefox浏览器 if (userAgent.indexOf("Chrome") > -1){ return "Chrome"; } if (userAgent.indexOf("Safari") > -1) { return "Safari"; } //判断是否Safari浏览器 if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) { return "IE"; }; //判断是否IE浏览器 } /** * 附件下载 * @param attachId 附件id */ function attachDowmload(attachId){ $.ajax({ type : "POST", url : ctx+"/attach/download.do", data: {attachId:attachId}, dataType : "json", success : function(data) { if(data.url){ var mb = myBrowser(); if('IE' == mb){ window.location.href = data.url; }else{ window.open(data.url,"_blank"); } }else{ alert("获取不到当前附件下载"); } } }); } /** * 搜索跳转,搜索页 */ function ssClick(){ var url = window.location.href; var key = $("#name").val(); if('请输入关键词进行办事查询' == key){ key = ''; } if(checkQuote(key)){ alert("请输入英文字母或者中文字符"); }else{ if(jQuery.trim(key).length == 0){ key = ''; }else if(key.length > 100){ key = key.substr(0,100); } key = encodeURI(encodeURI(key)); var querytypeid = $('.querytype>a.sel-on').attr('id') ; if('2' == querytypeid){ if(url.toLowerCase().indexOf('frsx')>0){ window.location.href = ctx+"/search/frsx/item.do?querytype="+querytypeid+"&key="+key; }else if(url.toLowerCase().indexOf('grsx')>0){ window.location.href = ctx+"/search/grsx/item.do?querytype="+querytypeid+"&key="+key; }else if(url.indexOf('/allItem/')>0){ window.location.href = ctx+"/search/allItem/item.do?querytype="+querytypeid+"&key="+key; }else{ window.location.href = ctx+"/search/frsx/item.do?querytype="+querytypeid+"&key="+key; } }else if('5' == querytypeid){ return false; //window.location.href = ctx+"/search/cjwt/result.do?querytype="+querytypeid+"&key="+key; }else if('6' == querytypeid){ return false; //window.location.href = ctx+"/search/consultation/result.do?querytype="+querytypeid+"&key="+key; }else{ window.location.href = ctx+"/search/globalItemSearch.do?querytype="+querytypeid+"&key="+key; } } } /** * 服务部门跳转搜索页 * @param fwbmCode * @param xzqhdm */ function flbm_searchAction(fwbmCode,xzqhdm){ var url = window.location.href; var querytypeid = $('.querytype>a.on').attr('id') ; if(url.toLowerCase().indexOf('frsx')>0){ window.location.href = ctx+"/search/frsx/item.do?querytype=2&fwbmCode="+fwbmCode; }else if(url.toLowerCase().indexOf('grsx')>0){ window.location.href = ctx+"/search/grsx/item.do?querytype=2&fwbmCode="+fwbmCode; } } function window_action(url){ if(!checkStrIsBlank(url)){ window.open(ctx+"/oauth/sso/jump.do?url="+encodeURIComponent(url),"_blank"); } } function dsft_action(url){ if(!checkStrIsBlank(url)){ window.open(ctx+"/oauth/sso/jump.do?url="+encodeURIComponent(url),"_blank"); } } /** * 热门搜索 * @param catalogCode 事项分类代码 */ function searchHot(key){ key = encodeURI(encodeURI(key)); var querytypeid = '2'; if(url.toLowerCase().indexOf('frsx')>0){ window.location.href = ctx+"/search/frsx/item.do?querytype="+querytypeid+"&key="+key; }else if(url.toLowerCase().indexOf('grsx')>0){ window.location.href = ctx+"/search/grsx/item.do?querytype="+querytypeid+"&key="+key; } } /** * 法人事项个人事项页面广告链接 * @param key 关键字 * @param catalogCode 事项分类代码 */ function advertisement(key,catalogCode){ var url = window.location.href; key = encodeURI(encodeURI(key)); if(url.toLowerCase().indexOf('frsx')>0){ window.location.href = ctx+"/search/frsx/item.do?catalogCode="+catalogCode+"&key="+key; }else if(url.toLowerCase().indexOf('grsx')>0){ window.location.href = ctx+"/search/grsx/item.do?catalogCode="+catalogCode+"&key="+key; } } /** * 输入限制,只能输入数字 * function onkeyup() * function onafterpaste() */ function onKeyUp(obj){ if(obj.value.length==1){ obj.value=obj.value.replace(/[^1-9]/g,'') }else{ obj.value=obj.value.replace(/\D/g,'') } } function onAfterPaste(obj){ if(obj.value.length==1){ obj.value=obj.value.replace(/[^1-9]/g,'') }else{ obj.value=obj.value.replace(/\D/g,'') } } /** 检查输入的字符是否具有特殊字符 输入:str 字符串 返回:true 或 flase; true表示包含特殊字符 */ function checkQuote(str) { var items = new Array("~", "`", "!", "@", "#", "$", "%", "^", "&", "{", "}", "[", "]", "(", ")"); items.push(":", ";", "'", "|", "\\", "<", ">", "?", "/", "<<", ">>", "||" ,"\""); items.push("+", "_" ,"*"); str = str.toLowerCase(); for (var i = 0; i < items.length; i++) { if (str.indexOf(items[i]) >= 0) { return true; } } return false; } function menutab_action(url){ window.location.href = ctx+"/"+url; } /** * 事项分类调整到搜索页 * @param catalogCode 事项分类代码 */ function ssfl_searchAction(catalogCode){ var url = window.location.href; var querytypeid = $('.querytype>a.on').attr('id') ; if(url.toLowerCase().indexOf('frsx')>0 || catalogCode.indexOf('root_qy')>=0){ window.location.href = ctx+"/search/frsx/item.do?querytype=2&catalogCode="+catalogCode; }else if(url.toLowerCase().indexOf('grsx')>0 || catalogCode.indexOf('root_gr')>=0){ window.location.href = ctx+"/search/grsx/item.do?querytype=2&catalogCode="+catalogCode; } } /** * 办事指南跳转 * @param url 办事指南地址 */ function bszn_action(itemCode){ window.open(ctx+"/guide/"+itemCode+".html","_blank"); } /** * 在线申办跳转 * @param url 在线申办地址 */ function zxsb_action(url){ window.open(ctx+"/oauth/sso/jump.do?url="+encodeURIComponent(url),"_blank"); } function fwbm_action(orgId){ var szckUrl = ""; if(departmentJson[orgId].flag == '0'){ szckUrl = departmentJson[orgId].url; }else{ szckUrl = ctx+"/departmentItemList.do?orgId="+orgId+"&flag="+departmentJson[orgId].flag; } window.open(szckUrl,"_blank"); } /** * 事项写进页面 * @param data 事项数据 */ function write_itemhtml(data){ var resultData = data.result; var hightlight = data.highlighting $("#itemCount").text(data.numFound); $("#zxsbItemsCount").text(data.zxsbCount); //事项列表写进页面 write_items(resultData,hightlight); } function write_items(resultData,hightlight){ $(".items").remove(); var html = []; for(i=0;i"); }else{ html.push(""); } if(hightlight[unique]){ try{ html.push(""+hightlight[unique].v_item_info_ITEMNAME[0]+"[详情]"); }catch(e){ html.push(""+resultData[i].v_item_info_ITEMNAME+"[详情]"); } }else{ html.push(""+resultData[i].v_item_info_ITEMNAME+"[详情]"); } if(resultData[i].v_item_info_TYSXMC){ if(resultData[i].v_item_info_TYSXMC.length<=6){ html.push(""+resultData[i].v_item_info_TYSXMC+""); }else{ html.push(""+resultData[i].v_item_info_TYSXMC.substr(0,6)+"..."); } } else { html.push(""); } html.push(""); var ssjg = resultData[i].v_item_info_SSJG; if(ssjg){ if(ssjg.length>6){ ssjg = ssjg.substring(0,6)+"..."; } if(resultData[i].v_item_info_PORTAL_URL != null){ html.push(""+ssjg+""); }else{ html.push(""+ssjg+""); } } html.push(""); html.push(""); if(resultData[i].v_item_info_AREADETAIL){ html.push(resultData[i].v_item_info_AREADETAIL); } html.push(""); html.push(""); html.push("表格下载"); if(resultData[i].v_item_info_ZXSBFW == '1' && !checkStrIsBlank(resultData[i].v_item_info_ZXSBFWDZ)){ html.push("在线申办"); }else{ html.push("在线申办"); } html.push(""); html.push(""); } $(".itemTitle").after(html.join("")); } /** * * @param pageNo * @param pageSize */ function write_Items_pager(pageNo,pageSize){ $(".Epages").empty(); var html = []; pageNo = parseInt(pageNo); html.push("
"); if(pageSize > 0){ if(pageNo == '1'){ html.push("首页"); html.push("<"); }else{ html.push("首页"); html.push("<"); } if(pageSize>5 && pageNo<=pageSize){ if(pageNo<5){ //结果集在8页显示之内 for(j=1;j<=5;j++){ if(pageNo == j){ html.push(""+j+""); }else{ html.push(""+j+""); } } }else if(pageNo>=5 && pageNo"+j+""); }else{ html.push(""+j+""); } } }else{ for(j=pageNo-3;j<=pageNo;j++){ if(pageNo == j){ html.push(""+j+""); }else{ html.push(""+j+""); } } } }else{ for(j=1;j<=pageSize;j++){ if(pageNo == j){ html.push(""+j+""); }else{ html.push(""+j+""); } } } if(pageNo == pageSize){ html.push(">"); html.push("尾页"); }else{ html.push(">"); html.push("尾页"); } }else{ html.push("首页"); html.push("<"); html.push("1"); html.push(">"); html.push("尾页"); } html.push("
"); html.push("
"); html.push(""+pageSize+"页,到第 "); html.push("确定"); $(".Epages").append(html.join('')); } /** * 搜索选项切换 * @param obj */ function ssfw(obj){ $(".sel-on").removeClass("sel-on gradient-light-blue").removeAttr("aria-pressed"); $(obj).addClass("sel-on gradient-light-blue").attr("aria-pressed","true"); } function checkXzqhJb(xzqh){ var xzqhArr = xzqh.split(''); var tanslatorStr = ''; for(var i = 0;i