97947373446018cd02da699b5485b8004ff569f0.svn-base 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. var wg = null;// gis对象
  2. var gisUtil = null;// gis工具类
  3. var ai = null;
  4. var quilayoutpages = null;
  5. var gislayerpages = null;
  6. var userInfo = null;// 用户信息
  7. $(function() {
  8. userInfo = resolveUrl();//用户信息
  9. loadMarqueeid();//滚动公告
  10. init();//应急预警与响应、应急资源的表格、图例初始化
  11. initHeight();//页面高度
  12. initORG();//初始化组织机构
  13. initObject();
  14. initGisMap();
  15. $(window).resize(function(){
  16. initHeight();
  17. });
  18. });
  19. /**
  20. * gis登录
  21. */
  22. function initGisMap() {
  23. var userName = "ces@csg.cn";
  24. var password = "Nfdw@123456";
  25. var ticket = userInfo["token"];
  26. // var ticket = "TGT-5404-0TTKEY7jyVic1WTOrrhhlPl2ZQTodHljtzL9BkeKxNiDZAYlgH-ssov16801.csg.cn";
  27. var params = {
  28. InitType : "Defalut",
  29. Background : "#ff00ff00",
  30. MapType : "0",
  31. InitExtent : "113.175670022751,23.1614514994855,113.749183141629,24.1676051184671"
  32. };
  33. // if(ticket==null||ticket==undefined||ticket==""||ticket=="null"||ticket=="undefined"){
  34. if(!ticket){
  35. login(userName, password, params);
  36. }else{
  37. console.log("4A");
  38. loginWith4A(ticket, params);
  39. }
  40. }
  41. function login(userName, password, params) {
  42. var webgis = document.getElementById("centermap");
  43. initWebGIS(webgis);
  44. wg.addEvent("onInitCompleted", function() {
  45. wg.login(userName, password, params);
  46. });
  47. wg.addEvent("onLoginSuccessed", function() {
  48. wg.setZoomLevel(7);
  49. });
  50. }
  51. function loginWith4A(ticket, params) {
  52. var webgis = document.getElementById("centermap");
  53. initWebGIS(webgis);
  54. wg.addEvent("onInitCompleted", function() {
  55. wg.loginWith4ATicket(ticket, params);
  56. });
  57. wg.addEvent("onLoginSuccessed", function() {
  58. wg.setZoomLevel(7);
  59. });
  60. }
  61. /**
  62. * 页面高度初始化
  63. */
  64. function initHeight() {
  65. var hei = $(".gis_map_main").height();
  66. $("#centermap").height(hei);
  67. $("#leftceladows").height(hei);
  68. $(".sear_tab").height(hei);
  69. var sgh = hei - $(".gis_title_plan").height() - $(".dw_plan").height();
  70. $(".sear_tab").height(hei);
  71. $("._search_gis").height(sgh);
  72. }
  73. /**
  74. * 对象初始化
  75. */
  76. function initObject() {
  77. gisUtil = new GisUtil();
  78. ai = new AlertIframe();//弹窗
  79. quilayoutpages = new QUIlayoutpage();
  80. quilayoutpages.tableInit();//初始化表格选项卡
  81. gislayerpages = new Gislayerpage();
  82. wg = new WebGisMap();//地图服务
  83. }
  84. function init(){
  85. /**
  86. * 表格事件绑定
  87. */
  88. $(".std").click(function(){
  89. opendatatable($(this).attr("value"));
  90. });
  91. /**
  92. * 图例事件绑定
  93. */
  94. $(".tl").click(function(){
  95. if(!$(this).hasClass("tl_show")){
  96. $(this).addClass("tl_show");
  97. var tog = $(this).attr("toggle");
  98. if($("#"+tog).hasClass("tl_show")){
  99. $("#"+tog).removeClass("tl_show");
  100. removeIconAlter(tog);
  101. }
  102. if($(this).attr("id")=="ewerlenge"){
  103. openLegend($(this).attr("id"),getGisLengen());
  104. }else{
  105. openLegend($(this).attr("id"),getErGisLengen());
  106. };
  107. }else{
  108. $(this).removeClass("tl_show");
  109. removeIconAlter($(this).attr("id"));
  110. };
  111. });
  112. }
  113. /**
  114. * 显示查询框
  115. */
  116. function displayGisSearch() {
  117. $("#leftceladows").fadeIn(500);
  118. var offset = $("#leftceladows").offset();
  119. var offleft = $("#leftceladows").width();
  120. $("#gisMes").css({
  121. top : offset.top,
  122. left : (offleft + offset.left)
  123. });
  124. }
  125. /**
  126. * 隐藏查询框
  127. */
  128. function noneGisSearch() {
  129. $("#leftceladows").fadeOut(500);
  130. var offset = $("#searchByGis").offset();
  131. $("#gisMes").css({
  132. top : offset.top,
  133. left : (offset.left + 50)
  134. });
  135. }
  136. /**
  137. * 导航栏开关按钮点击事件
  138. *
  139. * @param id 11--日常气象,12--台风图层,21--应急预警与响应图层,41--应急资源图层,82--电网资源工具
  140. */
  141. function getValue(id) {
  142. var menuId = $("#" + id).attr("relValue");
  143. var s_id = $("#" + id).prev().attr("id");
  144. if (menuId == 0) {
  145. loadLayer(id);
  146. $("#" + s_id).removeClass("mouse_dis").addClass("mouse_point");
  147. $("#" + s_id).bind('click', function() {
  148. shrink(event, this);
  149. });
  150. $("#" + s_id).click();
  151. } else {
  152. $("." + s_id).find("._bsc_plan").find(".zy_toolbar").find("._bsc_plan_sub").each(function() {
  153. var ss_id = $(this).find(".zy_bar").find(".zb").attr("id");
  154. if ($("#" + ss_id).hasClass("oc_close"))
  155. $("#" + ss_id).click();
  156. $("#" + ss_id).removeClass("mouse_point").addClass("mouse_dis");
  157. $("#" + ss_id).unbind('click');
  158. if ($("#" + ss_id).next().attr("relValue") != 0) {
  159. $("#" + ss_id).next().removeClass("toggle");
  160. }
  161. });
  162. removeAlter();
  163. $(".tl").removeClass("tl_show");
  164. removeLayer(id);
  165. if (id == 412 || id == 41) {
  166. clearInterval(tracingTimer);
  167. }
  168. if ($("#" + s_id).hasClass("oc_close")) {
  169. $("#" + id).prev().click();
  170. }
  171. $("#" + s_id).removeClass("mouse_point").addClass("mouse_dis");
  172. $("#" + s_id).unbind('click');
  173. }
  174. }
  175. /**
  176. * 收缩三角
  177. */
  178. function shrink(e, _this) {
  179. var id = $(_this).attr("id");
  180. if ($(_this).hasClass("oc_open")) {
  181. $(_this).removeClass("oc_open").addClass("oc_close");
  182. $("." + id).slideDown(600);
  183. } else {
  184. $(_this).removeClass("oc_close").addClass("oc_open");
  185. $("." + id).slideUp(600);
  186. }
  187. }
  188. /**
  189. * 增加图层
  190. *
  191. * @param menuID
  192. * @returns {Boolean}
  193. */
  194. function loadLayer(menuID) {
  195. switch (menuID) {
  196. // 日常气象 图层
  197. case "11":
  198. Dailyweather(true);
  199. return true;
  200. // 台风图层
  201. case "12":
  202. Typhoon(true);
  203. return true;
  204. // 台风模拟路径
  205. case "121":
  206. drawTyphoonPathInit();
  207. return true;
  208. // 历史模拟台风
  209. case "122":
  210. historyTyphoonSearch();
  211. historyTyphoonPathInit();
  212. return true;
  213. // 暴雨图层
  214. case "13":
  215. ai.setMes(320, 186, 200, 500, "系统提示", "界面集成,缺少URL");
  216. ai.createAlert();
  217. return false;
  218. // 冰灾图层
  219. case "14":
  220. ai.setMes(320, 186, 200, 500, "系统提示", "界面集成,缺少URL");
  221. ai.createAlert();
  222. return false;
  223. // 应急预警与响应
  224. case "21":
  225. ewerLay_init();
  226. return true;
  227. // 应急资源图层
  228. case "41":
  229. ai.addSummaryIframe();
  230. ersoLay_init();
  231. return true;
  232. // 应急资源队伍分布
  233. case "413":
  234. er_team_init();
  235. searchErTeam();
  236. return true;
  237. // 应急资源发电车分布
  238. case "414":
  239. er_car_init();
  240. searchErCar();
  241. return true;
  242. // 应急资源发电机分布
  243. case "415":
  244. er_gen_init();
  245. searchErGen();
  246. return true;
  247. // 应急资临时安置点分布
  248. case "416":
  249. er_place_init();
  250. searchErPlace();
  251. return true;
  252. // 应急资源仓库分布
  253. case "417":
  254. er_house_init();
  255. searchErHouse();
  256. return true;
  257. // 应急资源分布
  258. case "410":
  259. ersoLay_er_dist_init();
  260. searchErDist("261,262,381", userInfo.dept_id, "18,19,20,21", "0");
  261. return true;
  262. // 应急资源投入
  263. case "411":
  264. var inicID = $("#inic").attr("relValue");
  265. searchDrawByUserInfo(inicID);
  266. return true;
  267. // 绘图工具
  268. case "412":
  269. locationPosition();
  270. return true;
  271. // 应急队伍列表
  272. case "423":
  273. return true;
  274. case "61":
  275. ai.setMes(320, 186, 200, 500, "系统提示", "界面集成,缺少URL");
  276. ai.createAlert();
  277. return false;
  278. // 用户停电图层
  279. case "71":
  280. ai.setMes(320, 186, 200, 500, "系统提示", "界面集成,缺少URL");
  281. ai.createAlert();
  282. return false;
  283. // 电网资源工具图层
  284. case "81":
  285. return true;
  286. }
  287. }
  288. /**
  289. * 删除图层
  290. *
  291. * @param id
  292. * @returns {Boolean}
  293. */
  294. function removeLayer(id) {
  295. switch (id) {
  296. // 日常气象 图层
  297. case "11":
  298. Dailyweather(false);
  299. break;
  300. // 台风图层
  301. case "12":
  302. Typhoon(false);
  303. break;
  304. case "121":
  305. closeDrawTyphoonPath();
  306. return true;
  307. // 历史模拟台风
  308. case "122":
  309. delHistoryLay();
  310. removeHistoryTyphoonWin();
  311. break;
  312. // 暴雨图层
  313. case "13":
  314. break;
  315. // 冰灾图层
  316. case "14":
  317. break;
  318. // 地震图层
  319. case "15":
  320. break;
  321. // 山火图层
  322. case "16":
  323. break;
  324. // 应急预警与响应图层
  325. case "21":
  326. closeEwerLayer();
  327. break;
  328. // 应急资源图层
  329. case "41":
  330. $("#gisMes").remove();
  331. closeErsource();
  332. var idArr = [ "alertChar" ];
  333. delChartWin(idArr);
  334. removeDrawWin();
  335. break;
  336. // 应急资源队伍分布
  337. case "413":
  338. closeErTeam();
  339. break;
  340. // 应急资源发电车分布
  341. case "414":
  342. closeErCar();
  343. break;
  344. // 应急资源发电车分布
  345. case "415":
  346. closeErGen();
  347. break;
  348. // 应急资源发电车分布
  349. case "416":
  350. closeErPlace();
  351. break;
  352. case "417":
  353. delLayer(erso_lay_so.name);
  354. break;
  355. case "410":
  356. closeErDist();
  357. var idArr = [ "alertChar" ];
  358. delChartWin(idArr);
  359. removeDrawWin();
  360. break;
  361. // 绘图工具
  362. case "411":
  363. delLayer(erso_lay_show.name);
  364. delLayer(erso_lay_draw.name);
  365. return true;
  366. // 应急队伍列表
  367. case "412":
  368. closeTeam();
  369. return true;
  370. // 设备损失图层
  371. case "61":
  372. break;
  373. // 用户停电图层
  374. case "71":
  375. break;
  376. }
  377. }
  378. /**
  379. * 用户信息
  380. * @returns {___anonymous_userInfo}
  381. */
  382. function resolveUrl(){
  383. var encondeCondition = window.location.search;
  384. var condition= decodeURI(decodeURI(encondeCondition.substring(1,encondeCondition.length)));
  385. var conditionArr=condition.split("&");
  386. var condJson={};
  387. for(var item in conditionArr){
  388. var temArr=conditionArr[item].split("=");
  389. condJson[temArr[0]]=temArr[1];
  390. }
  391. userInfo = condJson;
  392. return condJson;
  393. };
  394. function initORG() {
  395. var userDeptID = userInfo["dept_id"];// 得到用户单位
  396. var parentID = userInfo["parentId"];// 得到用户单位
  397. var deptId = "";
  398. /* 应急响应、资源标注单位查询初始化 */
  399. var deptUrl = $.pathname() + "/ws/cockpit/CockpitService/selectTreeDept";
  400. $.post(deptUrl, {unitId : userDeptID,parentId : parentID},function(data) {
  401. for ( var key in data) {
  402. deptId += data[key]["id"] + ",";
  403. }
  404. deptId = deptId.substring(0, deptId.length - 1);
  405. $("#unitId").data("data", data);
  406. $("#unitId").render();
  407. $("#unitIdByEr").data("data", data);
  408. $("#unitIdByEr").render();
  409. $("#unitIdByErCar").data("data", data);
  410. $("#unitIdByErCar").render();
  411. $("#unitIdByErGen").data("data", data);
  412. $("#unitIdByErGen").render();
  413. $("#unitIdByErPlace").data("data", data);
  414. $("#unitIdByErPlace").render();
  415. },"json");
  416. }
  417. /**
  418. * @param 关闭数据表
  419. */
  420. function closedatatable(){
  421. $("#tabTitle").hide();
  422. };
  423. /**
  424. * @param 右键菜单中查看数据表格的功能
  425. * @version 1.0
  426. * @Date 2015-11-11
  427. */
  428. function opendatatable(id){
  429. $("#tabTitle").show();
  430. quilayoutpages.getPageTitle(id);
  431. quilayoutpages.hideRMenu();
  432. };
  433. /**
  434. * 打形图例
  435. */
  436. function openLegend(id,icons){
  437. var url = $.pathname() + "/page/cockpit/alert/alert_icon_iframe.html?fd_id=" + id;
  438. if(ai.createIconAlert(420, 270, 30, 20, url)){
  439. setTimeout(function(){
  440. iconFrame.window.createLengen(icons);
  441. },100);
  442. };
  443. };
  444. /**
  445. * @param 初始化加载的数据表格
  446. * @version 1.0
  447. * @Date 2015-09-26
  448. */
  449. function onloadinitgrid()
  450. {
  451. if ((window.location.href).indexOf('?') > -1)
  452. {
  453. var fd = (window.location.href).split('?')[1];
  454. paramsGridChange[fd] = quilayoutpages.getColumnsAndaddLayers(fd,paramsGird[fd]);
  455. }
  456. }
  457. function createLengen(icons){
  458. document.getElementById("aler").find("#icon_ul").empty();
  459. for(var key in icons){
  460. var img = "/nwyj/images/cockpit/gis/"+ icons[key].name +".png";
  461. document.getElementById("aler").find("#icon_ul").append("<div class='icon_li'><li><div class='fl'><img class='fl' src='" + img + "' alt='" + icons[key].describe + "'/></div><div class='fl'>" + icons[key].describe + "<div></li><div>");
  462. }
  463. }
  464. /**
  465. * @param 导出图片
  466. * @version 1.0
  467. * @Date 2016-04-15
  468. */
  469. function ecportPicture()
  470. {
  471. picturebase64 = printPic();
  472. if(picturebase64==null)
  473. {
  474. ai.setMes(320, 186, 200, 500, "系统提示", "获取变编码失败!请确定地图是否登录成功?");
  475. ai.createAlert();
  476. }
  477. else
  478. {
  479. window.open("/nwyj/page/cockpit/webgis/exportPicture.html");
  480. }
  481. };
  482. function printPic(){
  483. return wg.exportPicture("png");
  484. };
  485. function loadMarqueeid(){
  486. var url = "/nwyj/ws/getNotice/GetNoticeService/getNotice";
  487. var param = { corpId : userInfo.dept_id };
  488. var data = getJsonData(url, param);
  489. if(!data){return;}else{
  490. setMainIndexTab(data);
  491. };
  492. };
  493. function setMainIndexTab(myData){
  494. if(myData.length==0){
  495. return;
  496. }
  497. var alertdata = "";
  498. var responsedata = "";
  499. var responseval = "";
  500. var alertval = "";
  501. var alertcol = "";
  502. var responsecol = "";
  503. for(var i=0;i<myData.length;i++){
  504. if(myData[i].isAlert==1){
  505. var rcdn = myData[i].responsecol;
  506. responsecol = rcdn == "29"?"-28px -64px":rcdn == "30"?"-64px -62px":rcdn == "31"?"-102px -63px":rcdn == "32"?"-139px -63px":"";
  507. responsedata = "最新响应信息:"+ myData[i].corpName+" - "+myData[i].writeTime+" - "+myData[i].warningName;
  508. responseval = myData[i].isAlert+"|"+myData[i].fd_objectid;
  509. }
  510. if(myData[i].isAlert==0){
  511. var acdn = myData[i].alertcol;
  512. alertcol = (acdn == "35"?"-32px -20px":(acdn == "36"?"-65px -20px":(acdn == "37"?"-101px -22px":(acdn == "38"?"-139px -20px":""))));
  513. alertdata = "最新预警信息:"+ myData[i].corpName+" - "+myData[i].writeTime+" - "+myData[i].warningName;
  514. alertval = myData[i].isAlert+"|"+myData[i].fd_objectid;
  515. }
  516. }
  517. $("#main_index_tab_cont").html("");
  518. var marhtml = "<marquee id='marqueeid' scrollamount='3' scrolldelay='50' >";
  519. if(alertdata!=""){
  520. marhtml += "<span value="+alertval+" class='aresphref' ><u style='background-position:"+alertcol+";'></u><b>"+alertdata+"</b></span>";
  521. }
  522. marhtml += "&nbsp;&nbsp;&nbsp;&nbsp;";
  523. if(responsedata!=""){
  524. marhtml += "<span value="+responseval+" class='aresphref' ><u style='background-position:"+responsecol+";'></u><b>"+responsedata+"</b></span>";
  525. }
  526. marhtml += "</marquee>";
  527. $("#main_index_tab_cont").append(marhtml);
  528. alertdata = null;
  529. responsedata = null;
  530. responseval = null;
  531. alertval = null;
  532. $("#main_index_tab").show();
  533. $("#marqueeid").bind("mouseover",function(){
  534. this.stop();
  535. });
  536. $("#marqueeid").bind("mouseout",function(){
  537. this.start();
  538. });
  539. $(".aresphref").bind("click",function(){
  540. var value = $(this).attr("value");
  541. var valueArr = value.split("|");
  542. var dddurl = "";
  543. if(valueArr[0]==1){
  544. dddurl = "/nwyj/page/business/em/response/emergencyResponse/WarningView.jsp?fd_id="+valueArr[1];
  545. }else{
  546. dddurl = "/nwyj/page/business/em/alert/warning/WarningView.jsp?fd_id="+valueArr[1];
  547. }
  548. window.open("/nwyj/page/cockpit/webgis/EventAllInfo.jsp?fd_id="+valueArr[1]+"&dept_id="+top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids());
  549. $(this).remove();
  550. if($("#marqueeid").html()=="&nbsp;&nbsp;&nbsp;&nbsp;"){
  551. $("#marqueeid").remove();
  552. $("#main_index_tab").hide();
  553. }
  554. value = null;
  555. valueArr = null;
  556. dddurl = null;
  557. dddopener = null;
  558. });
  559. /*移除按钮的监听方法 */
  560. $("#main_index_closeimg").bind("mouseenter",function(){
  561. $(this).show().removeClass("cont_close1").addClass("cont_close2");
  562. });
  563. $("#main_index_closeimg").bind("mouseleave",function(){
  564. $(this).show().removeClass("cont_close2").addClass("cont_close1");
  565. });
  566. $("#main_index_closeimg").bind("click",function(){
  567. $(this).parent().hide();
  568. });
  569. $("#main_index_tab").bind("mouseover",function(){
  570. $("#main_index_closeimg").show();
  571. });
  572. $("#main_index_tab").bind("mouseout",function(){
  573. $("#main_index_closeimg").hide();
  574. });
  575. }