gis.othen.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. $.ajax({
  47. url : basePath + "/zygl/"+action,
  48. data : [{"name":"id","value":id},
  49. {"name":"pagerows","value":!$("#pagerows").val()?5:$("#pagerows").val()},
  50. {"name":"currentpage","value":!$("#currentpage").val()?1:$("#currentpage").val()}
  51. ],
  52. type : "post",
  53. dataType : "json",
  54. success : function(data) {// ajax返回的数据
  55. if (data.success) {
  56. var popBody = '';
  57. if(data.attrs.Entity){
  58. var listEntity = data.attrs.Entity;
  59. var listTitleName = data.attrs.BodyTitleName.split(",");
  60. popBody += '<table style="margin-top: 5px;font-size:13px;max-width:1000px" class="table table-striped table-bordered">';
  61. popBody += '<tr class="fisrtTr">';
  62. for(var i =0;i<listTitleName.length;i++){
  63. popBody += '<th >'+ listTitleName[i] +'</th>';
  64. }
  65. popBody += '</tr>';
  66. for(var i in listEntity){
  67. popBody += '<tr>';
  68. for(var j=0;j<listEntity[i].length;j++){
  69. popBody += '<td >'+ listEntity[i][j] +'</td>';
  70. }
  71. popBody += '</tr>';
  72. }
  73. var page = data.attrs.page;
  74. popBody += "<tr><td colspan='"+listTitleName.length+"'>" +
  75. "<div class='tab_footer'>"+
  76. "<select class='' name='pagerows' id='pagerows' style='width: 50px;margin-top:3px;'>" +
  77. "<option value='5' >5</option>" +
  78. "<option value='10' >10</option>" +
  79. "<option value='15' >15</option>" +
  80. "</select>" +
  81. "<div class='pageprev' style='margin-top:3px;'>" +
  82. " <a href='#' class='prev_all' id='pagefirst'></a>" +
  83. "<a href='#' class='prev_one' id='pageprev'></a>" +
  84. "</div>" +
  85. "<div>" +
  86. "第&nbsp;<input type='text' id='currentpage' value='"+page.currentpage +"' name='currentpage' style='width: 40px;height:22px;margin-top:3px;'/>&nbsp;页 共"+page.totalpages+"页" +
  87. "</div>" +
  88. "<div class='pagenext' style='margin-top:3px;'>" +
  89. "<a class='next_one' href='#' id='pagenext'></a>" +
  90. "<a class='next_all' href='#' id='pagelast'></a>" +
  91. "</div>" +
  92. "<div>" +
  93. "<a class='refresh' id='refresh' style='margin-top:3px;'></a>" +
  94. "</div>" +
  95. "<div class='p-record' style='margin-top:3px;'>当前显示<span>"+page.datafrom+"-"+page.dataend+"</span>条记录,共<span>"+page.totalRows+"</span>条记录</div>" +
  96. "<input type='hidden' value='"+ page.totalpages+"' id='pagetotal'>" +
  97. "</div></td></tr>";
  98. popBody += '</table>'
  99. }
  100. else {
  101. popBody = data.attrs.Html;
  102. }
  103. document.getElementById('popTitle').innerHTML=data.attrs.Title;
  104. document.getElementById('popHtml').innerHTML=popBody;
  105. $.fn.popWin({
  106. PopSelector:".popupRightD", //弹出的窗体
  107. CloseSelector:".popupRightD .close", //关闭窗体的触发开关
  108. lideTime:600 //窗体出场入场动画的时间
  109. });
  110. pageinfo(id,action);
  111. } else {
  112. $.alert({
  113. title : '提示',
  114. content : data.message,
  115. confirm : function() {
  116. }
  117. });
  118. }
  119. }
  120. });
  121. }
  122. function pageinfo(id,action){
  123. $("#pagefirst").click(function() {
  124. if ($("#currentpage").val() == 1) {
  125. $.alert({
  126. title : '提示',
  127. content : '已到第一页',
  128. confirm : function() {
  129. }
  130. });
  131. return;
  132. }
  133. else {
  134. $("#currentpage").val(1);
  135. showMesg(id,action);
  136. }
  137. });
  138. $("#pageprev").click(function() {
  139. if ($("#currentpage").val() == 1) {
  140. $.alert({
  141. title : '提示',
  142. content : '已到第一页',
  143. confirm : function() {
  144. }
  145. });
  146. return;
  147. }
  148. else {
  149. if($("#currentpage").val()!=''){
  150. $("#currentpage").val(parseInt($("#currentpage").val()) - 1);
  151. showMesg(id,action);
  152. }else{
  153. $("#currentpage").val(1);
  154. showMesg(id,action);
  155. }
  156. }
  157. });
  158. $("#pagenext").click(function() {
  159. if(parseInt($("#pagetotal").val())<=1){
  160. $.alert({
  161. title : '提示',
  162. content : '已到最后一页',
  163. confirm : function() {
  164. }
  165. });
  166. return;
  167. }
  168. if ($("#currentpage").val() == $("#pagetotal").val()) {
  169. $.alert({
  170. title : '提示',
  171. content : '已到最后一页',
  172. confirm : function() {
  173. }
  174. });
  175. return;
  176. }
  177. else {
  178. if($("#currentpage").val()!=''){
  179. $("#currentpage").val(parseInt($("#currentpage").val()) + 1);
  180. showMesg(id,action);
  181. }else{
  182. $("#currentpage").val(1);
  183. showMesg(id,action);
  184. }
  185. }
  186. });
  187. $("#pagelast").click(function() {
  188. if(parseInt($("#pagetotal").val())<=1){
  189. $.alert({
  190. title : '提示',
  191. content : '已到最后一页',
  192. confirm : function() {
  193. }
  194. });
  195. return;
  196. }
  197. if ($("#currentpage").val() == $("#pagetotal").val()) {
  198. $.alert({
  199. title : '提示',
  200. content : '已到最后一页',
  201. confirm : function() {
  202. }
  203. });
  204. return;
  205. }
  206. else {
  207. $("#currentpage").val($("#pagetotal").val());
  208. showMesg(id,action);
  209. }
  210. });
  211. $("#refresh").click(function() {
  212. if($("#currentpage").val()==''){
  213. $("#currentpage").val(1);
  214. showMesg(id,action);
  215. }else{
  216. showMesg(id,action);
  217. }
  218. });
  219. $("#pagerows").change(function() {
  220. showMesg(id,action);
  221. });
  222. $("#currentpage").keydown(
  223. function(event, p) {
  224. if (event.keyCode == 13) {
  225. if ($.isNumeric($("#currentpage").val()) && (parseInt($("#currentpage").val()) >= 1)
  226. && (parseInt($("#currentpage").val()) <= parseInt($("#pagetotal").val()))) {
  227. }
  228. else {
  229. $.alert({
  230. title: '提示',
  231. content: '请输入有效数字'
  232. });
  233. return false;
  234. }
  235. showMesg(id,action);
  236. }
  237. });
  238. }
  239. function showall() {
  240. $('div').css("display", "block");
  241. }
  242. function hideexcel(that) {
  243. $(that).parent().parent().css("display", "none");
  244. }
  245. function changeBoatTab(n, m) {
  246. for ( var i = 0; i < m; i++) {
  247. var boat_menu = document.getElementById("boat_menu_" + i);
  248. var boat_main = document.getElementById("boat_main_" + i);
  249. var boat_menu_img = boat_menu.getElementsByTagName("img");
  250. boat_menu.className = i == n ? "boat_hover" : "";
  251. for ( var j = 0; j < boat_menu_img.length; j++) {
  252. boat_menu_img[j].src = i == n ?contextPath+'/theme/images/tab_hover.png' : contextPath+'/theme/images/tab.png';
  253. }
  254. boat_main.style.display = i == n ? "block" : "none";
  255. }
  256. }
  257. function changePopTab(n, m) {
  258. for ( var i = 0; i < m; i++) {
  259. var pop_menu = document.getElementById("pop_menu_" + i);
  260. var pop_main = document.getElementById("pop_main_" + i);
  261. var pop_menu_img = document.getElementById("pop_ul")
  262. .getElementsByTagName("img");
  263. pop_menu.className = i == n ? "pop_hover" : "";
  264. pop_menu_img[i].src = i == n ? "img/pop_tab_hover.png"
  265. : "img/pop_tab.png";
  266. //
  267. // alert(pop_menu.style.zIndex);
  268. pop_main.style.display = i == n ? "block" : "none";
  269. }
  270. }
  271. function move_img(that) {
  272. var y_axis = parseInt($(that).css('height')) / 2;
  273. if ($(that).css('bottom') == "0px")
  274. $(that).css('bottom', y_axis + "px");
  275. else
  276. $(that).css('bottom', '0px');
  277. }