gis.other.js 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. (function($j){$j.positionFixed=function(el){$j(el).each(function(){new fixed(this)});return el;};$j.fn.positionFixed=function(){return $j.positionFixed(this)}
  2. var fixed=$j.positionFixed.impl=function(el){var o=this;o.sts={target:$j(el).css('position','fixed'),container:$j(window)}
  3. o.sts.currentCss={top:o.sts.target.css('top'),right:o.sts.target.css('right'),bottom:o.sts.target.css('bottom'),left:o.sts.target.css('left')}
  4. if(!o.ie6)return;o.bindEvent();}
  5. $j.extend(fixed.prototype,{ie6:false,bindEvent:function(){var o=this;o.sts.target.css('position','absolute')
  6. o.overRelative().initBasePos();o.sts.target.css(o.sts.basePos)
  7. o.sts.container.scroll(o.scrollEvent()).resize(o.resizeEvent());o.setPos();},overRelative:function(){var o=this;var relative=o.sts.target.parents().filter(function(){if($j(this).css('position')=='relative')return this;})
  8. if(relative.size()>0)relative.after(o.sts.target)
  9. return o;},initBasePos:function(){var o=this;o.sts.basePos={top:o.sts.target.offset().top-(o.sts.currentCss.top=='auto'?o.sts.container.scrollTop():0),left:o.sts.target.offset().left-(o.sts.currentCss.left=='auto'?o.sts.container.scrollLeft():0)}
  10. return o;},setPos:function(){var o=this;o.sts.target.css({top:o.sts.container.scrollTop()+o.sts.basePos.top,left:o.sts.container.scrollLeft()+o.sts.basePos.left})},scrollEvent:function(){var o=this;return function(){o.setPos();}},resizeEvent:function(){var o=this;return function(){setTimeout(function(){o.sts.target.css(o.sts.currentCss)
  11. o.initBasePos();o.setPos()},1)}}})})(jQuery);(function($){$.fn.popWin=function(options){var def={PopSelector:"",CloseSelector:"",slideTime:600};var options=$.extend(def,options);
  12. var noie6=!(false&&!$.support.style);
  13. var PopSelector=options.PopSelector,CloseSelector=options.CloseSelector,slideTime=options.slideTime;
  14. if(noie6){$(PopSelector).slideDown(slideTime)}
  15. else{$(PopSelector).fadeIn(slideTime);var thisPop=$(PopSelector);jQuery(function($j){$j(thisPop).positionFixed()})}
  16. if(noie6){$(CloseSelector).click(function(){$(PopSelector).slideUp(slideTime);});}
  17. else{$(CloseSelector).click(function(){$(PopSelector).fadeOut(slideTime);});}}})(jQuery);
  18. var basePath=contextPath;
  19. function changeBoatTab(n,m){
  20. for(var i=0;i<m;i++)
  21. {
  22. var boat_menu=document.getElementById('boat_menu_' + i);
  23. var boat_main=document.getElementById('boat_main_' + i);
  24. var boat_menu_img=boat_menu.getElementsByTagName('img');
  25. boat_menu.className=i==n?'boat_hover':'';
  26. for(var j=0;j<boat_menu_img.length;j++){
  27. boat_menu_img[j].src=i==n? '${basePath}/static/image/pop/tab_hover.png': '${basePath}/static/image/pop/tab.png';
  28. }
  29. boat_main.style.display=i==n?'block':'none';
  30. }
  31. }
  32. function changepopxkzTab(n,m){
  33. for(var i=0;i<m;i++)
  34. {
  35. var pop_xkz_menu=document.getElementById('pop_xkz_menu_' + i);
  36. var pop_xkz_main=document.getElementById('pop_xkz_main_' + i);
  37. var pop_xkz_menu_img=pop_xkz_menu.getElementsByTagName('img');
  38. pop_xkz_menu.className=i==n?'pop_xkz_hover':'';
  39. for(var j=0;j<pop_xkz_menu_img.length;j++){
  40. pop_xkz_menu_img[j].src=i==n? '../static/image/pop/tab_hover.png': '../static/image/pop/tab.png';
  41. }
  42. pop_xkz_main.style.display=i==n?'block':'none';
  43. }
  44. }
  45. function showMesg(id,action){
  46. //如果是 危货附证 的点击事件,将该事件的ID和action保存下来。用作返回
  47. if(action == 'queryWHZYFZByJYRId.html'){
  48. fanhuiId = id;
  49. fanhuiAction = action;
  50. }
  51. //如果是 危货附证 显示列表的 展示点击事件,显示返回按钮。并添加onclick操作。
  52. if(action == 'queryWHZYFZById.html'){
  53. document.getElementById('fanhui').style.display='';
  54. $("#fanhui").click(function(){
  55. showMesg(fanhuiId,fanhuiAction);
  56. });
  57. }
  58. else{
  59. document.getElementById('fanhui').style.display='none';
  60. }
  61. $.ajax({
  62. url : basePath + "/zygl/"+action,
  63. data : [{"name":"id","value":id}],
  64. type : "post",
  65. dataType : "json",
  66. success : function(data) {// ajax返回的数据
  67. if (data.success) {
  68. var popBody = '';
  69. if(data.attrs.Entity){
  70. var listEntity = data.attrs.Entity;
  71. var listTitleName = data.attrs.BodyTitleName.split(",");
  72. var hiddenFunction = data.attrs.HiddenFunction;
  73. var lengthT = listTitleName.length;
  74. //如果存在影藏方法,则说明最后一列为影藏方法所需属性值,无需展示。
  75. if(hiddenFunction){
  76. lengthT = listTitleName.length-1;
  77. }
  78. popBody += '<table style="margin-top: 5px;font-size:13px;" class="table table-striped table-bordered">';
  79. popBody += '<tr class="fisrtTr">';
  80. for(var i =0;i<lengthT;i++){
  81. popBody += '<th >'+ listTitleName[i] +'</th>';
  82. }
  83. popBody += '</tr>';
  84. for(var i in listEntity){
  85. if(hiddenFunction){
  86. popBody += "<tr style='cursor:pointer;' onclick=\""+hiddenFunction+"('"+listEntity[i][listTitleName.length-1]+"')"+"\">";
  87. }
  88. else{
  89. popBody += "<tr>";
  90. }
  91. for(var j=0;j<lengthT;j++){
  92. popBody += '<td >'+ getBrMessage(listEntity[i][j],15) +'</td>';
  93. }
  94. popBody += '</tr>';
  95. }
  96. popBody += '</table>'
  97. }
  98. else {
  99. popBody = data.attrs.Html;
  100. }
  101. document.getElementById('popTitle').innerHTML=data.attrs.Title;
  102. document.getElementById('popHtml').innerHTML=popBody;
  103. $.fn.popWin({
  104. PopSelector:".popupRightD", //弹出的窗体
  105. CloseSelector:".popupRightD .close", //关闭窗体的触发开关
  106. lideTime:600 //窗体出场入场动画的时间
  107. })
  108. } else {
  109. $.alert({
  110. title : '提示',
  111. content : data.message,
  112. confirm : function() {
  113. }
  114. });
  115. }
  116. }
  117. });
  118. }
  119. function queryZYQbyZYID(id){
  120. gis.script.loadgisService({treeNodeType:"GK_BASIC_JSJY_GK_ZYQ"},{id:id,showPop:"true"});
  121. }
  122. function queryGQByGKId(id){
  123. gis.script.loadgisService({treeNodeType:"GK_BASIC_JSJY_GK_GQ"},{id:id,showPop:"true"});
  124. }
  125. function queryJYRByGKId(id){
  126. //alert(id);
  127. gis.script.loadgisService({treeNodeType:"GK_BASIC_JSJY_JYR"},{id:id,showPop:"true"});
  128. }
  129. function queryMTByGKId(id){
  130. //alert(id);return;
  131. gis.script.loadgisService({treeNodeType:"GK_BASIC_JSJY_JYR_MT"},{id:id,showPop:"true"});
  132. }
  133. function queryBWByGKId(id){
  134. //alert(id);return;
  135. gis.script.loadgisService({treeNodeType:"GK_BASIC_JSJY_JYR_BW"},{id:id,showPop:"true"});
  136. }
  137. function getBrMessage(message,leng){
  138. var i = message.length;
  139. //排除操作列的换行
  140. //!i排除非字符项
  141. if( !i ||(i >0 && message.indexOf('showMesg')>-1)){
  142. return message;
  143. }
  144. var j = parseInt(i/leng)+1;
  145. var rsl='';
  146. for (var k=0;k<j;k++){
  147. rsl = rsl + message.substring(k*leng , (k+1)*leng) +'<br/>';
  148. }
  149. return rsl;
  150. }
  151. function showall() {
  152. $('div').css("display", "block");
  153. }
  154. function hideexcel(that) {
  155. $(that).parent().parent().css("display", "none");
  156. }
  157. function changeBoatTab(n, m) {
  158. for ( var i = 0; i < m; i++) {
  159. var boat_menu = document.getElementById("boat_menu_" + i);
  160. var boat_main = document.getElementById("boat_main_" + i);
  161. var boat_menu_img = boat_menu.getElementsByTagName("img");
  162. boat_menu.className = i == n ? "boat_hover" : "";
  163. for ( var j = 0; j < boat_menu_img.length; j++) {
  164. boat_menu_img[j].src = i == n ?contextPath+'/theme/images/tab_hover.png' : contextPath+'/theme/images/tab.png';
  165. }
  166. boat_main.style.display = i == n ? "block" : "none";
  167. }
  168. }
  169. function changePopTab(n, m) {
  170. for ( var i = 0; i < m; i++) {
  171. var pop_menu = document.getElementById("pop_menu_" + i);
  172. var pop_main = document.getElementById("pop_main_" + i);
  173. var pop_menu_img = document.getElementById("pop_ul")
  174. .getElementsByTagName("img");
  175. pop_menu.className = i == n ? "pop_hover" : "";
  176. pop_menu_img[i].src = i == n ? "img/pop_tab_hover.png"
  177. : "img/pop_tab.png";
  178. //
  179. // alert(pop_menu.style.zIndex);
  180. pop_main.style.display = i == n ? "block" : "none";
  181. }
  182. }
  183. function move_img(that) {
  184. var y_axis = parseInt($(that).css('height')) / 2;
  185. if ($(that).css('bottom') == "0px")
  186. $(that).css('bottom', y_axis + "px");
  187. else
  188. $(that).css('bottom', '0px');
  189. }
  190. //经营许可证图片
  191. function detailShow(objs){
  192. $("#overlay").fadeTo(500, 0.5);
  193. $("#divpop"+objs).html($("#dv"+objs).html());
  194. divpopup($("#divpop"+objs));
  195. //$("#divpop"+objs).show(500);
  196. //$("#divpop"+objs).css("left",pageWidth()*0.1);
  197. //$("#divpop"+objs).css("top",pageHeight()*0.1);
  198. }
  199. function detailHide(objs){
  200. $("#divpop"+objs).hide(300);
  201. $("#overlay").fadeOut(300);
  202. }
  203. function divpopup(popupName){
  204. _windowHeight = $(".smMap").height(),//获取当前窗口高度
  205. _windowWidth = $(".smMap").width(),//获取当前窗口宽度
  206. _popupHeight = popupName.height(),//获取弹出层高度
  207. _popupWeight = popupName.width();//获取弹出层宽度
  208. _posiTop = (_windowHeight - _popupHeight)/2;
  209. _posiLeft = (_windowWidth - _popupWeight)/2+450;
  210. popupName.css({"left": _posiLeft + "px","top":_posiTop + "px","display":"block"});//设置position
  211. }