123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650 |
- var wg = null;// gis对象
- var gisUtil = null;// gis工具类
- var ai = null;
- var quilayoutpages = null;
- var gislayerpages = null;
- var userInfo = null;// 用户信息
- $(function() {
- userInfo = resolveUrl();//用户信息
- loadMarqueeid();//滚动公告
- init();//应急预警与响应、应急资源的表格、图例初始化
- initHeight();//页面高度
- initORG();//初始化组织机构
- initObject();
- initGisMap();
-
- $(window).resize(function(){
- initHeight();
- });
- });
- /**
- * gis登录
- */
- function initGisMap() {
- var userName = "ces@csg.cn";
- var password = "Nfdw@123456";
- var ticket = userInfo["token"];
- // var ticket = "TGT-5404-0TTKEY7jyVic1WTOrrhhlPl2ZQTodHljtzL9BkeKxNiDZAYlgH-ssov16801.csg.cn";
- var params = {
- InitType : "Defalut",
- Background : "#ff00ff00",
- MapType : "0",
- InitExtent : "113.175670022751,23.1614514994855,113.749183141629,24.1676051184671"
- };
- // if(ticket==null||ticket==undefined||ticket==""||ticket=="null"||ticket=="undefined"){
- if(!ticket){
- login(userName, password, params);
- }else{
- console.log("4A");
- loginWith4A(ticket, params);
- }
- }
- function login(userName, password, params) {
- var webgis = document.getElementById("centermap");
- initWebGIS(webgis);
- wg.addEvent("onInitCompleted", function() {
- wg.login(userName, password, params);
- });
- wg.addEvent("onLoginSuccessed", function() {
- wg.setZoomLevel(7);
- });
- }
- function loginWith4A(ticket, params) {
- var webgis = document.getElementById("centermap");
- initWebGIS(webgis);
- wg.addEvent("onInitCompleted", function() {
- wg.loginWith4ATicket(ticket, params);
- });
- wg.addEvent("onLoginSuccessed", function() {
- wg.setZoomLevel(7);
- });
- }
- /**
- * 页面高度初始化
- */
- function initHeight() {
- var hei = $(".gis_map_main").height();
- $("#centermap").height(hei);
- $("#leftceladows").height(hei);
- $(".sear_tab").height(hei);
- var sgh = hei - $(".gis_title_plan").height() - $(".dw_plan").height();
- $(".sear_tab").height(hei);
- $("._search_gis").height(sgh);
- }
- /**
- * 对象初始化
- */
- function initObject() {
- gisUtil = new GisUtil();
- ai = new AlertIframe();//弹窗
- quilayoutpages = new QUIlayoutpage();
- quilayoutpages.tableInit();//初始化表格选项卡
- gislayerpages = new Gislayerpage();
- wg = new WebGisMap();//地图服务
- }
- function init(){
- /**
- * 表格事件绑定
- */
- $(".std").click(function(){
- opendatatable($(this).attr("value"));
- });
- /**
- * 图例事件绑定
- */
- $(".tl").click(function(){
- if(!$(this).hasClass("tl_show")){
- $(this).addClass("tl_show");
- var tog = $(this).attr("toggle");
- if($("#"+tog).hasClass("tl_show")){
- $("#"+tog).removeClass("tl_show");
- removeIconAlter(tog);
- }
- if($(this).attr("id")=="ewerlenge"){
- openLegend($(this).attr("id"),getGisLengen());
- }else{
- openLegend($(this).attr("id"),getErGisLengen());
- };
-
- }else{
- $(this).removeClass("tl_show");
- removeIconAlter($(this).attr("id"));
- };
- });
- }
- /**
- * 显示查询框
- */
- function displayGisSearch() {
- $("#leftceladows").fadeIn(500);
- var offset = $("#leftceladows").offset();
- var offleft = $("#leftceladows").width();
- $("#gisMes").css({
- top : offset.top,
- left : (offleft + offset.left)
- });
- }
- /**
- * 隐藏查询框
- */
- function noneGisSearch() {
- $("#leftceladows").fadeOut(500);
- var offset = $("#searchByGis").offset();
- $("#gisMes").css({
- top : offset.top,
- left : (offset.left + 50)
- });
- }
- /**
- * 导航栏开关按钮点击事件
- *
- * @param id 11--日常气象,12--台风图层,21--应急预警与响应图层,41--应急资源图层,82--电网资源工具
- */
- function getValue(id) {
- var menuId = $("#" + id).attr("relValue");
- var s_id = $("#" + id).prev().attr("id");
- if (menuId == 0) {
- loadLayer(id);
- $("#" + s_id).removeClass("mouse_dis").addClass("mouse_point");
- $("#" + s_id).bind('click', function() {
- shrink(event, this);
- });
- $("#" + s_id).click();
- } else {
- $("." + s_id).find("._bsc_plan").find(".zy_toolbar").find("._bsc_plan_sub").each(function() {
- var ss_id = $(this).find(".zy_bar").find(".zb").attr("id");
- if ($("#" + ss_id).hasClass("oc_close"))
- $("#" + ss_id).click();
- $("#" + ss_id).removeClass("mouse_point").addClass("mouse_dis");
- $("#" + ss_id).unbind('click');
- if ($("#" + ss_id).next().attr("relValue") != 0) {
- $("#" + ss_id).next().removeClass("toggle");
- }
- });
- removeAlter();
- $(".tl").removeClass("tl_show");
- removeLayer(id);
- if (id == 412 || id == 41) {
- clearInterval(tracingTimer);
- }
- if ($("#" + s_id).hasClass("oc_close")) {
- $("#" + id).prev().click();
- }
- $("#" + s_id).removeClass("mouse_point").addClass("mouse_dis");
- $("#" + s_id).unbind('click');
- }
- }
- /**
- * 收缩三角
- */
- function shrink(e, _this) {
- var id = $(_this).attr("id");
- if ($(_this).hasClass("oc_open")) {
- $(_this).removeClass("oc_open").addClass("oc_close");
- $("." + id).slideDown(600);
- } else {
- $(_this).removeClass("oc_close").addClass("oc_open");
- $("." + id).slideUp(600);
- }
- }
- /**
- * 增加图层
- *
- * @param menuID
- * @returns {Boolean}
- */
- function loadLayer(menuID) {
- switch (menuID) {
- // 日常气象 图层
- case "11":
- Dailyweather(true);
- return true;
-
- // 台风图层
- case "12":
- Typhoon(true);
- return true;
- // 台风模拟路径
- case "121":
- drawTyphoonPathInit();
- return true;
-
- // 历史模拟台风
- case "122":
- historyTyphoonSearch();
- historyTyphoonPathInit();
- return true;
-
- // 暴雨图层
- case "13":
- ai.setMes(320, 186, 200, 500, "系统提示", "界面集成,缺少URL");
- ai.createAlert();
- return false;
-
- // 冰灾图层
- case "14":
- ai.setMes(320, 186, 200, 500, "系统提示", "界面集成,缺少URL");
- ai.createAlert();
- return false;
-
- // 应急预警与响应
- case "21":
- ewerLay_init();
- return true;
-
- // 应急资源图层
- case "41":
- ai.addSummaryIframe();
- ersoLay_init();
- return true;
-
- // 应急资源队伍分布
- case "413":
- er_team_init();
- searchErTeam();
- return true;
- // 应急资源发电车分布
- case "414":
- er_car_init();
- searchErCar();
- return true;
- // 应急资源发电机分布
- case "415":
- er_gen_init();
- searchErGen();
- return true;
- // 应急资临时安置点分布
- case "416":
- er_place_init();
- searchErPlace();
- return true;
- // 应急资源仓库分布
- case "417":
- er_house_init();
- searchErHouse();
- return true;
- // 应急资源分布
- case "410":
- ersoLay_er_dist_init();
- searchErDist("261,262,381", userInfo.dept_id, "18,19,20,21", "0");
- return true;
-
- // 应急资源投入
- case "411":
- var inicID = $("#inic").attr("relValue");
- searchDrawByUserInfo(inicID);
- return true;
-
- // 绘图工具
- case "412":
- locationPosition();
- return true;
-
- // 应急队伍列表
- case "423":
-
- return true;
- case "61":
- ai.setMes(320, 186, 200, 500, "系统提示", "界面集成,缺少URL");
- ai.createAlert();
- return false;
-
- // 用户停电图层
- case "71":
- ai.setMes(320, 186, 200, 500, "系统提示", "界面集成,缺少URL");
- ai.createAlert();
- return false;
-
- // 电网资源工具图层
- case "81":
- return true;
- }
- }
- /**
- * 删除图层
- *
- * @param id
- * @returns {Boolean}
- */
- function removeLayer(id) {
- switch (id) {
- // 日常气象 图层
- case "11":
- Dailyweather(false);
- break;
- // 台风图层
- case "12":
- Typhoon(false);
- break;
- case "121":
- closeDrawTyphoonPath();
- return true;
- // 历史模拟台风
- case "122":
- delHistoryLay();
- removeHistoryTyphoonWin();
- break;
- // 暴雨图层
- case "13":
- break;
- // 冰灾图层
- case "14":
- break;
- // 地震图层
- case "15":
- break;
- // 山火图层
- case "16":
- break;
- // 应急预警与响应图层
- case "21":
- closeEwerLayer();
- break;
- // 应急资源图层
- case "41":
- $("#gisMes").remove();
- closeErsource();
- var idArr = [ "alertChar" ];
- delChartWin(idArr);
- removeDrawWin();
- break;
- // 应急资源队伍分布
- case "413":
- closeErTeam();
- break;
- // 应急资源发电车分布
- case "414":
- closeErCar();
- break;
- // 应急资源发电车分布
- case "415":
- closeErGen();
- break;
- // 应急资源发电车分布
- case "416":
- closeErPlace();
- break;
- case "417":
- delLayer(erso_lay_so.name);
- break;
- case "410":
- closeErDist();
- var idArr = [ "alertChar" ];
- delChartWin(idArr);
- removeDrawWin();
- break;
- // 绘图工具
- case "411":
- delLayer(erso_lay_show.name);
- delLayer(erso_lay_draw.name);
- return true;
- // 应急队伍列表
- case "412":
- closeTeam();
- return true;
- // 设备损失图层
- case "61":
- break;
- // 用户停电图层
- case "71":
- break;
- }
- }
- /**
- * 用户信息
- * @returns {___anonymous_userInfo}
- */
- function resolveUrl(){
- var encondeCondition = window.location.search;
- var condition= decodeURI(decodeURI(encondeCondition.substring(1,encondeCondition.length)));
- var conditionArr=condition.split("&");
- var condJson={};
- for(var item in conditionArr){
- var temArr=conditionArr[item].split("=");
- condJson[temArr[0]]=temArr[1];
- }
- userInfo = condJson;
- return condJson;
- };
- function initORG() {
- var userDeptID = userInfo["dept_id"];// 得到用户单位
- var parentID = userInfo["parentId"];// 得到用户单位
- var deptId = "";
- /* 应急响应、资源标注单位查询初始化 */
- var deptUrl = $.pathname() + "/ws/cockpit/CockpitService/selectTreeDept";
- $.post(deptUrl, {unitId : userDeptID,parentId : parentID},function(data) {
- for ( var key in data) {
- deptId += data[key]["id"] + ",";
- }
- deptId = deptId.substring(0, deptId.length - 1);
- $("#unitId").data("data", data);
- $("#unitId").render();
- $("#unitIdByEr").data("data", data);
- $("#unitIdByEr").render();
- $("#unitIdByErCar").data("data", data);
- $("#unitIdByErCar").render();
- $("#unitIdByErGen").data("data", data);
- $("#unitIdByErGen").render();
- $("#unitIdByErPlace").data("data", data);
- $("#unitIdByErPlace").render();
- },"json");
- }
- /**
- * @param 关闭数据表
- */
- function closedatatable(){
- $("#tabTitle").hide();
- };
- /**
- * @param 右键菜单中查看数据表格的功能
- * @version 1.0
- * @Date 2015-11-11
- */
- function opendatatable(id){
- $("#tabTitle").show();
- quilayoutpages.getPageTitle(id);
- quilayoutpages.hideRMenu();
- };
- /**
- * 打形图例
- */
- function openLegend(id,icons){
- var url = $.pathname() + "/page/cockpit/alert/alert_icon_iframe.html?fd_id=" + id;
- if(ai.createIconAlert(420, 270, 30, 20, url)){
- setTimeout(function(){
- iconFrame.window.createLengen(icons);
- },100);
- };
- };
- /**
- * @param 初始化加载的数据表格
- * @version 1.0
- * @Date 2015-09-26
- */
- function onloadinitgrid()
- {
- if ((window.location.href).indexOf('?') > -1)
- {
- var fd = (window.location.href).split('?')[1];
- paramsGridChange[fd] = quilayoutpages.getColumnsAndaddLayers(fd,paramsGird[fd]);
- }
- }
- function createLengen(icons){
- document.getElementById("aler").find("#icon_ul").empty();
- for(var key in icons){
- var img = "/nwyj/images/cockpit/gis/"+ icons[key].name +".png";
- 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>");
- }
- }
- /**
- * @param 导出图片
- * @version 1.0
- * @Date 2016-04-15
- */
- function ecportPicture()
- {
- picturebase64 = printPic();
- if(picturebase64==null)
- {
- ai.setMes(320, 186, 200, 500, "系统提示", "获取变编码失败!请确定地图是否登录成功?");
- ai.createAlert();
- }
- else
- {
- window.open("/nwyj/page/cockpit/webgis/exportPicture.html");
- }
-
- };
- function printPic(){
- return wg.exportPicture("png");
- };
- function loadMarqueeid(){
- var url = "/nwyj/ws/getNotice/GetNoticeService/getNotice";
- var param = { corpId : userInfo.dept_id };
- var data = getJsonData(url, param);
- if(!data){return;}else{
- setMainIndexTab(data);
- };
- };
- function setMainIndexTab(myData){
- if(myData.length==0){
- return;
- }
- var alertdata = "";
- var responsedata = "";
- var responseval = "";
- var alertval = "";
- var alertcol = "";
- var responsecol = "";
-
- for(var i=0;i<myData.length;i++){
- if(myData[i].isAlert==1){
- var rcdn = myData[i].responsecol;
- responsecol = rcdn == "29"?"-28px -64px":rcdn == "30"?"-64px -62px":rcdn == "31"?"-102px -63px":rcdn == "32"?"-139px -63px":"";
- responsedata = "最新响应信息:"+ myData[i].corpName+" - "+myData[i].writeTime+" - "+myData[i].warningName;
- responseval = myData[i].isAlert+"|"+myData[i].fd_objectid;
- }
- if(myData[i].isAlert==0){
- var acdn = myData[i].alertcol;
- alertcol = (acdn == "35"?"-32px -20px":(acdn == "36"?"-65px -20px":(acdn == "37"?"-101px -22px":(acdn == "38"?"-139px -20px":""))));
- alertdata = "最新预警信息:"+ myData[i].corpName+" - "+myData[i].writeTime+" - "+myData[i].warningName;
- alertval = myData[i].isAlert+"|"+myData[i].fd_objectid;
- }
- }
- $("#main_index_tab_cont").html("");
- var marhtml = "<marquee id='marqueeid' scrollamount='3' scrolldelay='50' >";
- if(alertdata!=""){
- marhtml += "<span value="+alertval+" class='aresphref' ><u style='background-position:"+alertcol+";'></u><b>"+alertdata+"</b></span>";
- }
- marhtml += " ";
- if(responsedata!=""){
- marhtml += "<span value="+responseval+" class='aresphref' ><u style='background-position:"+responsecol+";'></u><b>"+responsedata+"</b></span>";
- }
- marhtml += "</marquee>";
- $("#main_index_tab_cont").append(marhtml);
- alertdata = null;
- responsedata = null;
- responseval = null;
- alertval = null;
- $("#main_index_tab").show();
-
- $("#marqueeid").bind("mouseover",function(){
- this.stop();
- });
- $("#marqueeid").bind("mouseout",function(){
- this.start();
- });
- $(".aresphref").bind("click",function(){
- var value = $(this).attr("value");
- var valueArr = value.split("|");
- var dddurl = "";
- if(valueArr[0]==1){
- dddurl = "/nwyj/page/business/em/response/emergencyResponse/WarningView.jsp?fd_id="+valueArr[1];
-
- }else{
- dddurl = "/nwyj/page/business/em/alert/warning/WarningView.jsp?fd_id="+valueArr[1];
- }
- window.open("/nwyj/page/cockpit/webgis/EventAllInfo.jsp?fd_id="+valueArr[1]+"&dept_id="+top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids());
- $(this).remove();
- if($("#marqueeid").html()==" "){
- $("#marqueeid").remove();
- $("#main_index_tab").hide();
- }
- value = null;
- valueArr = null;
- dddurl = null;
- dddopener = null;
- });
- /*移除按钮的监听方法 */
- $("#main_index_closeimg").bind("mouseenter",function(){
- $(this).show().removeClass("cont_close1").addClass("cont_close2");
- });
- $("#main_index_closeimg").bind("mouseleave",function(){
- $(this).show().removeClass("cont_close2").addClass("cont_close1");
- });
- $("#main_index_closeimg").bind("click",function(){
- $(this).parent().hide();
- });
- $("#main_index_tab").bind("mouseover",function(){
- $("#main_index_closeimg").show();
- });
- $("#main_index_tab").bind("mouseout",function(){
- $("#main_index_closeimg").hide();
- });
- }
|