32f5bdeeecef220d0b17293bf84e5e867d15bf8c.svn-base 99 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840
  1. /**
  2. * gisui是针对驾驶舱的主界面进行设计的js文件
  3. * @author jyf zmy
  4. * @version 1.0
  5. * @Date 2015-09-23
  6. */
  7. //实例化接口
  8. var paramsEw = { "listId" :'365', "condition" : " 1=1 and IS_DEL='0' and is_alert = '0' and is_send = '5' " } ;
  9. var paramsEr = { "listId" :'365', "condition" : " 1=1 and IS_DEL='0' and is_alert = '1' and is_send = '5' " } ;
  10. var paramsLt = { "listId" :'411'} ;
  11. var paramsSo = { "listId" :'', "condition" : "" } ;
  12. var paramsFs = { "listId" :'411'} ;
  13. var userInfoByTop=top.conditionJson;//用户信息
  14. var userInfo ;//用户信息
  15. var gridEw ;
  16. var paramsGird = {"21a":paramsEw,"21b":paramsEr,"31a":paramsLt,"31c":paramsFs} ;
  17. var paramsGridChange = {"21a":gridEw} ;
  18. var quilayoutpages;
  19. var wg = null;
  20. var gislayerpages;
  21. $(function(){
  22. quilayoutpages =new QUIlayoutpage();
  23. wg = new WebGisMap();
  24. gislayerpages = new Gislayerpage();
  25. });
  26. //定义路径
  27. var allPath = window.location.href;
  28. var indexPath = window.location.pathname;
  29. var index = allPath.indexOf(indexPath);
  30. var pathEM = allPath.substring(0,index+1);
  31. var pathCon = pathEM + indexPath.substring(1, 26);
  32. var path = allPath.substring(0,index+1);
  33. var iarrs=[];//用于接收图层全选的id
  34. var zTree;//定义树形右键菜单
  35. var RightMenuId;//定义右键点击时获取的菜单ID
  36. var Rightflag;//定义右键菜单获取的是否选中
  37. var MenuID;//定义选中复选框得到的菜单ID
  38. var MenuCheck;//得到点击复选框当前的状态
  39. var pID = null ;//线路跳闸与变电站停运的全局设备ID
  40. var icon = null ;
  41. var lineArr = [] ; //存储线类型数组
  42. var polygonArr = [] ; //存储多边形类型数组
  43. var circleArr = [] ; //存储圆类型
  44. var rectangleArr = [] ;//矩形数组
  45. var originArr = [] ;//起点数组
  46. var siteArr = [] ;//地点
  47. var destinationArr = [] ;//终点
  48. var vehicleArr = [] ;//车辆
  49. var teamArr = [] ;//人员
  50. var lineXYArr = [] ; //存储线类型数组坐标
  51. var polygonXYArr = [] ; //存储多边形类型数组坐标
  52. var circleXYArr = [] ; //存储圆类型坐标
  53. var rectangleXYArr = [] ;//矩形数组坐标
  54. var originXYArr = [] ;//起点数组坐标
  55. var siteXYArr = [] ;//地点坐标
  56. var destinationXYArr = [] ;//终点坐标
  57. var vehicleXYArr = [] ;//车辆坐标
  58. var teamXYArr = [] ;//人员坐标
  59. var drawTypeIds = [] ;
  60. //隐藏所有设备按钮
  61. var hiddenPsr = [{key:"hiddenPsr",icon:path + "/nwyj/images/cockpit/er_storage.png"}];
  62. //显示所有设备按钮
  63. var showPsr = [{key:"showPsr",icon:path + "/nwyj/images/cockpit/ads_start.png"}];
  64. var lay1 = 'resource1' ;//添加应急资源图层
  65. var lay2 = 'resource2' ;//用户应急资源图层(用户绘制图形图层)
  66. var lay3 = 'resource3' ;//用户应急资源图层(转换后)
  67. var lay4 = 'resource4' ;//应急资源图层应急队伍图层(描绘轨迹队伍)
  68. var lay5 = 'resource5' ;//应急资源图层应急队伍图层(地点图标和描绘轨迹线)
  69. //var lay6 = 'resource6' ;//应急资源图层应急队伍图层(队伍定位)
  70. /**
  71. * 线类型数据
  72. */
  73. var lineStyle = {style:{"strokeColor": [17,57,101,255],"strokeWeight":2,opacity:0.5,fillColor:[127,188,249,255]}};//手绘线样式
  74. var lineStyle1 = {"strokeColor": [17,57,101,255],"strokeWeight":2,opacity:0.7,fillColor:[127,188,249,255]};//手绘线样式
  75. var lineStyle2 = {"strokeColor": [0,51,114,255],"strokeWeight":2,opacity:1,fillColor:[0,51,114,255]} ;//路径折线样式
  76. var lineStyle3 = {"strokeColor": [108,159,65,255],"strokeWeight":3,opacity:1,fillColor:[108,159,65,255]} ;//轨迹回放
  77. var lineStyle4 = {"strokeColor": [190,0,46,255],"strokeWeight":3,opacity:1,fillColor:[190,0,46,255]} ;//轨迹描述
  78. //应急资源各类图标,固定值
  79. var er_storageIcon = path + "nwyj/images/cockpit/er_storage.png" ;//仓库
  80. var er_groupIcon = path + "nwyj/images/cockpit/er_group.png" ;//队伍
  81. var er_GoodsIcon = path + "nwyj/images/cockpit/er_goods.png" ;//物资
  82. var er_destIcon = path + "nwyj/images/cockpit/er_destination.png" ;//终点
  83. var er_startIcon = path + "nwyj/images/cockpit/ads_start.png" ;//起点
  84. var er_adsIcon = path + "/nwyj/images/cockpit/er_adslabel.png" ;//地点
  85. var er_playBack = path + "nwyj/images/cockpit/no.png" ;//红色圆点
  86. //应急预警与响应图标的位置
  87. var em_earlywarning1 = path+"/nwyj/images/cockpit/em_earlywarning1.png";//一级预警
  88. var em_earlywarning2 = path+"/nwyj/images/cockpit/em_earlywarning2.png";//一级预警
  89. var em_earlywarning3 = path+"/nwyj/images/cockpit/em_earlywarning3.png";//一级预警
  90. var em_earlywarning4 = path+"/nwyj/images/cockpit/em_earlywarning4.png";//一级预警
  91. var em_response1 = path+"/nwyj/images/cockpit/em_response1.png";//一级响应
  92. var em_response2 = path+"/nwyj/images/cockpit/em_response2.png";//一级响应
  93. var em_response3 = path+"/nwyj/images/cockpit/em_response3.png";//一级响应
  94. var em_response4 = path+"/nwyj/images/cockpit/em_response4.png";//一级响应
  95. //应急预警与响应级别对应查询图标
  96. var level = {"35":em_earlywarning1,"36":em_earlywarning2,"37":em_earlywarning3,"38":em_earlywarning4,
  97. "29":em_response1,"30":em_response2,"31":em_response3,"32":em_response4} ;
  98. var mz_everydayWeather = [] ;//日常气象
  99. var mz_typhoon = [] ;//台风
  100. var mz_rainstorm = [] ;//暴雨
  101. var mz_ice = [] ;//冰灾
  102. var mz_temblor = [] ;//地震
  103. var mz_fire = [] ;//山火
  104. var mz_ewer = [] ;//应急预警与响应
  105. var mz_er = [] ;//应急资源
  106. var mz_device = [] ;//设备损失
  107. var mz_powerCut = [] ;//用户停电
  108. //缩放到当前图层
  109. var zoomTier = {"11":mz_everydayWeather, "12":mz_typhoon, "13":mz_rainstorm, "14":mz_ice, "15":mz_temblor,
  110. "16":mz_fire, "21":mz_ewer, "41":mz_er, "61":mz_device, "71":mz_powerCut};
  111. //var gdX = 113.175670022751 ;//广东:113.749183141629 ;
  112. //var gdY = 23.1614514994855 ;//24.1676051184671 ;
  113. //应急预警与响应图层名称
  114. //var ewer_lay1 = "Emergencyearlywarningandresponse" ;
  115. var ewer_lay1 = "ewerLay1" ;//应急预警与响应图标,网省级图层4-6级显示
  116. var ewer_lay2 = "ewerLay2" ;//应急预警与响应图标,网省级图层7-14级显示
  117. //接收应急预警与响应图标的ID数组
  118. var Emergencyearlywarningandresponseid;
  119. //应急资源图标信息
  120. var erIcons ;
  121. //定位队伍
  122. //var coordList = [113.097097830711,23.1779403082591,113.107112222063,23.1228546665349] ;
  123. //信息窗
  124. var infoWins = [{"layerName":lay1,"posX":113.109972433983,"posY":23.1454283123816,"title":"XXX物资","icon":er_GoodsIcon ,"clickable":true}] ;
  125. //根据路径坐标生成折线
  126. //var erpathA = [{"layerName":lay1,"points":er_pointsA,"lineStyle":lineStyle2,"title":"路径A"},
  127. // {"layerName":lay1,"points":er_pointsB,"lineStyle":lineStyle2,"title":"路径B"}] ;
  128. //线路跳闸与变电站停运
  129. var lt_lay1 = 'lineTripping1' ;//线路跳闸与变电站图层(系统)
  130. var lt_lay2 = 'lineTripping2' ;//线路跳闸与变电站图层
  131. var lt_lay3 = 'lineTripping3' ;//线路跳闸与变电站图层
  132. var equis = [];
  133. //设备右键菜单
  134. var menuArr = [{ "Key": "1","Name": "查看负荷曲线图"},
  135. { "Key": "2","Name": "查看变电站视频"},
  136. { "Key": "3","Name": "查看受影响的变电站、线路"}] ;
  137. var funArr = [{"key":"1",fun:"showLoadPattern()"},
  138. {"key":"2",fun:"showSubstationVideo()"},
  139. {"key":"3",fun:"showImpactEquipment()"}];
  140. //表格高度
  141. var pageSize = null ;
  142. var subDept = {} ;
  143. //关于坐标转换的全局变量
  144. //经纬度转换为墨卡托的X坐标
  145. var MercatorX1;
  146. var MercatorX2;
  147. //经纬度转换为墨卡托的Y坐标
  148. var MercatorY1;
  149. var MercatorY2;
  150. //墨卡托投影坐标下两点之间的距离
  151. var MercatorRange;
  152. ///**
  153. // * QUI需要初始化的所有内容
  154. // */
  155. //function initComplete(){
  156. // //初始花QUI布局
  157. //// quilayoutpages.QUIlayout("#centerUI",true,false);
  158. // //初始化树形复选框
  159. //// quilayoutpages.QUItreecheckbox("#ztreeMoreOpt");
  160. // //初始化树形复选框的右键菜单
  161. //// quilayoutpages.QUItreerightmeun("ztreeMoreOpt");
  162. // //初始化数据表
  163. // quilayoutpages.tableInit();
  164. //};
  165. /*
  166. function init() {
  167. var iframe = document.createElement("iframe");
  168. iframe.src = MapConfig.webGisSrc;
  169. iframe.onload = iframe.onreadystatechange = initWebGisMap;
  170. iframe.style.width = "100%";
  171. iframe.style.height = "100%";
  172. document.getElementById("centermap").appendChild(iframe);
  173. }
  174. *//**iframe加载完成**//*
  175. function initWebGisMap(){
  176. //初始化js
  177. if (this.src.length > 0) {
  178. if (!this.readyState || this.readyState == "complete") {
  179. wg = new WebGisMap();
  180. alert(JSON.stringify(wg))
  181. wg.login("gistest","Hello123*");
  182. }
  183. }
  184. }*/
  185. var ai ;
  186. $(function(){
  187. ai = new AlertIframe();
  188. $("#lw").on("click",function(){
  189. /* alert($(top.document).find("body").find("#"+resolveUrl()["conId"]));
  190. alert(top); */
  191. top.fn_list(window,$(top.document).find("body").find("#"+resolveUrl()["conId"]));
  192. });
  193. var heig = $(document).height();
  194. $("#mainTable").height(heig);
  195. $("#centermap").height(heig);
  196. $("#leftceladows").height(heig);
  197. $(".menuc").on('show.bs.collapse', function () {
  198. $(this).prev().children("a").children().removeClass("_unfold");
  199. $(this).prev().children("a").children().addClass("_shrink");
  200. });
  201. $(".menuc").on('hidden.bs.collapse', function () {
  202. $(this).prev().children("a").children().removeClass("_shrink");
  203. $(this).prev().children("a").children().addClass("_unfold");
  204. });
  205. });
  206. function displayGisSearch(){
  207. $("#leftceladows").fadeIn(500);
  208. };
  209. function noneGisSearch(){
  210. $("#leftceladows").fadeOut(500);
  211. };
  212. $(window).resize(function(){
  213. var heig = $(document).height();
  214. $("#mainTable").height(heig);
  215. $("#leftceladows").height(heig);
  216. }) ;
  217. /**
  218. * 得到当前登录用户信息
  219. * @returns {___anonymous6112_6113}
  220. */
  221. function resolveUrl(){
  222. var encondeCondition=window.location.search;
  223. var condition= decodeURI(encondeCondition.substring(1,encondeCondition.length));
  224. var conditionArr=condition.split("&");
  225. var condJson={};
  226. for(var item in conditionArr){
  227. var temArr=conditionArr[item].split("=");
  228. condJson[temArr[0]]=temArr[1];
  229. }
  230. return condJson;
  231. }
  232. /**
  233. * 获得表格显示的高度
  234. * @returns {Number} 返回表格数据的高度(不加头尾)
  235. */
  236. function getGridHieght(){
  237. var pageHeight = $(document).height() - 30 - 24 ;
  238. $("#page").width('100%');
  239. $("#page").height(pageHeight);
  240. return pageHeight;
  241. };
  242. $(function(){
  243. quilayoutpages.tableInit();
  244. var pageHeight = getGridHieght() ; //浏览器时下窗口文档的高度
  245. // window.frames["page_0"].refresh(pageHeight);
  246. $("#gisLeftSearch").height(pageHeight-35) ;
  247. // page_0.window.refresh(pageHeight) ;
  248. // page_1.window.refresh(pageHeight) ;
  249. /* $(window).resize(function(){
  250. var pageHeight = getGridHieght() ; //浏览器时下窗口文档的高度
  251. $("#gisLeftSearch").height(pageHeight-15) ;
  252. // window.frames["page_0"].refresh(pageHeight);
  253. page_0.window.refresh(pageHeight) ;
  254. page_1.window.refresh(pageHeight) ;
  255. }) ;*/
  256. userInfo = resolveUrl() ;
  257. var userDeptID = userInfo["dept_id"] ;
  258. var url ="/nwyj/ws/cockpit/CockpitService/querySubDept";
  259. var params = { unitId:userDeptID } ;
  260. $.post(url,params,function(data){
  261. subDept = data ;
  262. },"json") ;
  263. //得到当前部门及其子直属子部门ID
  264. });
  265. /*$(window).resize(function() {
  266. var pageHeight = getGridHieght() ; //浏览器时下窗口文档的高度
  267. $("#gisLeftSearch").height(pageHeight-35) ;
  268. // window.frames["page_0"].refresh(pageHeight);
  269. page_0.window.refresh(pageHeight) ;
  270. page_1.window.refresh(pageHeight) ;
  271. alert(pageHeight+"BBB");
  272. }) ;*/
  273. /**
  274. * 添加图层(公用)
  275. * @param lay 图层名
  276. * @param show 显示级别
  277. * @param hide 隐藏级别
  278. * @param appach 透明度
  279. */
  280. function addLayer(lay,show,hide,appach){
  281. wg.addShapeLayer(lay,show,hide,appach,1) ;
  282. };
  283. /**
  284. * 删除图层(公用)
  285. * @param lay 图层名
  286. */
  287. function delLayer(lay){
  288. wg.removeAllMarkers(lay);
  289. };
  290. /**
  291. * 删除自定义图形(公用)
  292. * @param lay 图层名
  293. */
  294. function delShapes(lay){
  295. wg.removeAllShapes(lay) ;
  296. }
  297. /**
  298. * 添加图标(公用)
  299. * @param erIcons 应急资源图层的图标信息组
  300. */
  301. function addResourceIco(erIcons){
  302. var iconIds = new Array() ;
  303. for(var icon in erIcons){
  304. iconIds.push(wg.addMarker(erIcons[icon])) ;
  305. };
  306. // addMarkerEvent();
  307. return iconIds ;
  308. } ;
  309. //function addMarkerEvent(){
  310. // wg.addEvent('onMarkerClicked',markerEvent);
  311. //}
  312. //function markerEvent(e){
  313. // var s = "";
  314. // s = WebGisMap.jsToJson(e);
  315. //}
  316. /**
  317. * 以坐标点形式给Marker添加信息窗口(公用)
  318. * @param infoWins 一组要添加信息窗口的Marker(要有x,y坐标属性)
  319. */
  320. function addResourceInfoWin(infoWins){
  321. var pathTex = pathCon + "infoWindow.html?";
  322. var pathText = null ;
  323. for(var icon in infoWins){
  324. pathText = pathTex + infoWins[icon].posX ;
  325. var obj = {posX:infoWins[icon].posX,posY:infoWins[icon].posY,sizeWidth:170,sizeHeight:130,content:pathText,iconPosition:'left'};
  326. wg.openInfoWindow(obj) ;
  327. };
  328. } ;
  329. /**
  330. * 打开浮动窗(公用)
  331. * @param width:宽
  332. * @param height:高
  333. * @param pathTex:打开的页面URL
  334. */
  335. function openFloatWindow(width,height,pathTex){
  336. var obj = { posX: 260, posY: 30, sizeWidth: width, sizeHeight:height, content: pathTex, iconPosition: "right" };
  337. wg.openFloatWindow(obj);
  338. } ;
  339. /**
  340. * 定位到一组指定坐标(公用)
  341. * @param cardlist为多组坐标,格式为[x1,y1,x2,y2,x3,y3...]
  342. */
  343. function zoomToCoordList (coordList){
  344. /*var posXArr = [];
  345. var posYArr = [] ;
  346. for(var i = 0 ; i < coordList.length; i++){
  347. if(i%2==0){
  348. posXArr.push(coordList[i]);
  349. }else{
  350. posYArr.push(coordList[i]);
  351. }
  352. }
  353. var maxX = Math.max.apply(Math,posXArr) + 0.5;
  354. var minX = Math.min.apply(Math,posXArr) - 0.5;
  355. var maxY = Math.max.apply(Math,posYArr) + 0.5;
  356. var minY = Math.min.apply(Math,posYArr) - 0.5;
  357. wg.zoomToExtent(minX,minY,maxX,maxY);
  358. */
  359. wg.zoomToCoordList(coordList);
  360. } ;
  361. /**
  362. * 定位到一组设备
  363. * @param psrIds
  364. */
  365. function zoomToPSRList(psrIds){
  366. wg.zoomToPSRList(psrIds) ;
  367. } ;
  368. /**
  369. * 取消设备高亮显示功能(公用)
  370. */
  371. function HighlightPSRs()
  372. {
  373. wg.removeAllHighlightPSRs();
  374. };
  375. /**
  376. * 删除一组Marker点(公用)
  377. * @param id
  378. */
  379. function delMarkers(markers){
  380. //wg.removeMarker(markers) ;
  381. for(var key in markers){
  382. wg.removeMarker(markers[key]) ;
  383. } ;
  384. } ;
  385. /**
  386. * 修改一组Marker点(公用)
  387. * @param markers
  388. */
  389. function updataMarkers(markers){
  390. for(var key in markers){
  391. wg.updateMarker(markers[key].markerId,markers[key].obj) ;
  392. } ;
  393. } ;
  394. /**
  395. * 删除图层上用户自定义的所有图形图标
  396. */
  397. function clearlay(lay){
  398. wg.removeAllShapes(lay) ;
  399. } ;
  400. /**
  401. * 轨迹点生成
  402. * @param e 一组坐标点,4个参数,x坐标 y坐标 afterX坐标 afterY坐标
  403. * @param markerId 要闪动的Marker点ID
  404. * @param iconStr 队伍开始图标(大概分两种:起点和地点)
  405. * @param icon 展示在地图上的Marker图标
  406. * @param layTrac 图层名
  407. * @param ls 线样式
  408. */
  409. function tracingHistory(e,markerId,iconStr,icon,layTrac,ls){
  410. for(var xy in e["points"]){
  411. var er_points = {"points":[{"x":e["points"][xy].afterX,"y":e["points"][xy].afterY},
  412. {"x":e["points"][xy].x,"y":e["points"][xy].y}]} ;
  413. var erpath = [{"layerName":layTrac,"points":er_points,"lineStyle":ls}] ;
  414. addResourcePath(erpath) ;//生成折线路径
  415. } ;
  416. var i = 0 ;
  417. for(var xy in e["points"]){
  418. i++;
  419. (function(){
  420. var ii=i;
  421. var tem = {layerName:layTrac,posX:e["points"][xy].x,posY:e["points"][xy].y,icon:icon,clikable:true,"title":e["inciName"]+":"+e["teamName"]} ;
  422. setTimeout(function(){
  423. updataMarkerByTeam(markerId,tem);
  424. },ii*1000);
  425. })();
  426. // markerId = wg.addMarker(obj) ;
  427. } ;
  428. } ;
  429. function updataMarkerByTeam(markerId,obj){
  430. wg.updateMarker(markerId,obj) ;//修改Marker点
  431. } ;
  432. ///**
  433. // * 轨迹点生成
  434. // * @param e 一组坐标点,4个参数,x坐标 y坐标 afterX坐标 afterY坐标
  435. // * @param markerId 要闪动的Marker点ID
  436. // * @param iconStr 队伍开始图标(大概分两种:起点和地点)
  437. // * @param icon 展示在地图上的Marker图标
  438. // */
  439. //function tracing(e,markerId,iconStr,icon,layTrac,ls){
  440. // for(var xy in e["points"]){
  441. //
  442. // if(e["points"][xy].x==e["points"][xy].afterX && e["points"][xy].y==e["points"][xy].afterY){
  443. // //1.判断是不是起点,如果是起点则添加起点坐标
  444. // var obj = {layerName:layTrac,posX:e["points"][xy].x,posY:e["points"][xy].y,icon:iconStr,clickable:true} ;
  445. // wg.addMarker(obj) ;
  446. //
  447. // obj = {layerName:layTrac,posX:e["points"][xy].x,posY:e["points"][xy].y,icon:icon,clikable:true,"title":e["inciName"]+":"+e["teamName"]} ;
  448. // markerId = wg.addMarker(obj) ;
  449. //
  450. // } ;
  451. //
  452. // var er_points = {"points":[{"x":e["points"][xy].afterX,"y":e["points"][xy].afterY},
  453. // {"x":e["points"][xy].x,"y":e["points"][xy].y}]} ;
  454. //
  455. // var erpath = [{"layerName":layTrac,"points":er_points,"lineStyle":ls}] ;
  456. //
  457. // addResourcePath(erpath) ;//生成折线路径
  458. // var obj = {layerName:layTrac,posX:e["points"][xy].x,posY:e["points"][xy].y} ;
  459. // var ma = [{"markerId":markerId,"obj":obj}] ;
  460. // updataMarkers(ma) ;
  461. // //wg.updateMarker(markerId,obj) ;//修改Marker点
  462. //
  463. //} ;
  464. //} ;
  465. //$(function(){
  466. // var handler = function(){
  467. //
  468. // }
  469. //
  470. // var timer = setInterval( handler , 5000); //每5秒调用一次方法
  471. //
  472. //// var clear = function(){
  473. //// clearInterval(timer); //清理时间
  474. //// }
  475. //});
  476. ///**
  477. // * 生成蒙版
  478. // */
  479. //function addMB()
  480. //{
  481. // wg.addShapeLayer("drowMB",3,20,1,1) ;
  482. // var mbX1 = 74.715473234801 ;
  483. // var mbY1 = 38.3054642623949 ;
  484. //
  485. // var mbX2 = 128.12832740766 ;
  486. // var mbY2 = 38.3391764467111 ;
  487. //
  488. // var mbX3 = 128.12832740766 ;
  489. // var mbY3 = 12.5481452374991 ;
  490. //
  491. // var mbX4 = 74.7584441552822 ;
  492. // var mbY4 = 12.5481452374991 ;
  493. //
  494. // var geoObj = {points:[{x:mbX1,y:mbY1},{x:mbX2,y:mbY2},{x:mbX3,y:mbY3},{x:mbX4,y:mbY4}]};
  495. //
  496. // var lineStyle2 = {"strokeColor": [0, 0, 0, 255],"strokeWeight":1.5,strokeStyle:'dashed',
  497. // opacity:0.5,fillColor:[0, 0, 0, 255]};
  498. // wg.addPolygon("drowMB",geoObj,lineStyle2,"蒙板");
  499. //};
  500. /**
  501. * @param 初始化加载的数据表格
  502. * @version 1.0
  503. * @Date 2015-09-26
  504. */
  505. function onloadinitgrid()//****
  506. {
  507. if ((window.location.href).indexOf('?') > -1)
  508. {
  509. var fd = (window.location.href).split('?')[1];
  510. paramsGridChange[fd] = quilayoutpages.getColumnsAndaddLayers(fd,paramsGird[fd]) ;//****
  511. }
  512. };
  513. function changeGridFun(fd,changeParamsGird){//****
  514. alert("222:"+paramsGridChange[fd]);
  515. quilayoutpages.changeGridData(paramsGridChange[fd],changeParamsGird) ;//****
  516. // quilayoutpages.getColumnsAndaddLayers(fd,changeParamsGird) ;//****
  517. } ;
  518. /**
  519. * @param 弹出右键面板的同时获取右键菜单的ID
  520. * @version 1.0
  521. * @Date 2015-09-26
  522. */
  523. function OnRightClick(event, treeId, treeNode)
  524. {
  525. if(treeNode && !treeNode.noR)
  526. {
  527. zTree.selectNode(treeNode);
  528. showRMenu(treeNode.menuType, event.clientX, event.clientY);
  529. //右键得到点击的ID
  530. RightMenuId = treeNode.id;
  531. Rightflag=treeNode.checked;
  532. }
  533. };
  534. /**
  535. * @param 显示右键面板中的菜单内容
  536. * @version 1.0
  537. * @Date 2015-09-26
  538. */
  539. function showRMenu(type, x, y)
  540. {
  541. quilayoutpages.ShowRightMeun(type, x, y);
  542. };
  543. ///**
  544. // * @param 右键菜单中的全选功能
  545. // * @version 1.0
  546. // * @Date 2015-09-26
  547. // */
  548. // function fullOpt(checked)
  549. // {
  550. // quilayoutpages.Rfullopt(checked);
  551. // quilayoutpages.hideRMenu();
  552. // };
  553. /**
  554. * @param 右键菜单中查看数据表格的功能
  555. * @version 1.0
  556. * @Date 2015-09-26
  557. */
  558. // function opendatatable()
  559. // {
  560. // $("#tabTitle").show();
  561. // //右键查看数据表的时候更换数据表的标题名称
  562. // quilayoutpages.getRightTitles(RightMenuId);
  563. // //右键更换数据表选项卡的名称
  564. // quilayoutpages.getPageTitle(RightMenuId);
  565. // };
  566. /**
  567. * @param 右键菜单中的打开查询面板功能
  568. * @version 1.0
  569. * @Date 2015-09-26
  570. */
  571. function openGISfind()
  572. {
  573. wg.openQueryNameUI("","");
  574. };
  575. /**
  576. * @param 关闭数据表
  577. */
  578. function closedatatable()
  579. {
  580. /*$("#tabTitle").css("display","none");*/
  581. $("#tabTitle").hide();
  582. }
  583. /**
  584. * @param 查看统计专题图
  585. * @version 1.0
  586. * @Date 2015-09-26
  587. */
  588. // function openspecial()
  589. // {
  590. // lookspecial(RightMenuId);
  591. // };
  592. /**
  593. * @param 右键菜单中缩放到图层功能
  594. * @version 1.0
  595. * @Date 2015-09-26
  596. */
  597. function zoomtolayer()
  598. {
  599. zoomToLayer(RightMenuId);
  600. quilayoutpages.hideRMenu();
  601. };
  602. /**
  603. * @param 鼠标点击复选框传点击参数
  604. * @version 1.0
  605. * @Date 2015-09-26
  606. */
  607. function onCheckID(event, treeId, treeNode)
  608. {
  609. appendMenuid("onCheck", treeNode.id, treeNode.checked);
  610. };
  611. /**
  612. * @param 左键点击选中树形复选框并获取ID和选中状态
  613. * @version 1.0
  614. * @Date 2015-09-26
  615. */
  616. function appendMenuid(eventName, nodeId, nodechecked){
  617. //得到子菜单id
  618. menuID=nodeId;
  619. //得到当前的选中状态
  620. menuCheck=nodechecked;
  621. if(menuCheck==true)
  622. {
  623. //显示id所对应的grid表头
  624. //quilayoutpages.getPageTitle(menuID);
  625. //点击更换表格标题
  626. //quilayoutpages.getRightTitles(menuID);
  627. addlayers(menuID);
  628. }
  629. else
  630. if(menuCheck==false)
  631. {
  632. removeallmarkers(menuID);
  633. }
  634. if(menuID==41)
  635. {
  636. $("#erTool").toggle();
  637. }
  638. };
  639. /*---------------------------------加载图层----------------------------------------------------------*/
  640. /**
  641. * @param 根据获取的每一个ID去加载图层
  642. * @version 1.0
  643. * @Date 2015-09-26
  644. */
  645. function addlayers(menuID)
  646. {
  647. if(tokens==null || pasrids==null){
  648. // alert("请您登录地图后在使用");
  649. ai.setMes(320, 186, 200, 500, "系统提示", "请您登录地图后在使用");
  650. ai.createAlert();
  651. return false;
  652. }else{
  653. switch(menuID){
  654. //日常气象 图层
  655. case "11":
  656. Dailyweather(true);
  657. return true;
  658. //台风图层
  659. case "12":
  660. Typhoon(true);
  661. return true;
  662. //暴雨图层
  663. case "13":
  664. // Rainstorm();
  665. alert("界面集成,缺少URL");
  666. return false ;
  667. //冰灾图层
  668. case "14":
  669. // IceDamage();
  670. alert("界面集成,缺少URL");
  671. return false ;
  672. // //地震图层
  673. // case "15":
  674. //// Earthquake();
  675. // alert("界面集成,缺少URL");
  676. // return false ;
  677. // //山火图层
  678. // case "16":
  679. //// VegetationFire();
  680. // alert("界面集成,缺少URL");
  681. // return false ;
  682. //应急预警与响应图层
  683. case "21":
  684. // var userInfo = resolveUrl() ;
  685. // var userDeptID = userInfo["dept_id"] ;
  686. // var subDept = getSubDept(userDeptID) ;
  687. var date = allGetServerTime() ;
  688. var beginTime = getThreeMonthsAgo(getNowFormatDate(date)) ;
  689. var endTime = getNowFormatDate(allGetServerTime()) ;
  690. var paramsProvEw = {
  691. RELEASE_UNIT : subDept["prov"]+"",//单位
  692. BEGINTIME : beginTime ,//开始时间
  693. ENDTIME : endTime //截止时间
  694. } ;
  695. var paramsProvEr = paramsProvEw ;
  696. var paramsPrefEw = {
  697. RELEASE_UNIT : subDept["pref"]+"",//单位
  698. BEGINTIME : beginTime ,//开始时间
  699. ENDTIME : endTime //截止时间
  700. } ;
  701. var paramsPrefEr = paramsPrefEw ;
  702. Emergencyearlywarningandresponse(paramsProvEw,paramsPrefEw,paramsProvEr,paramsPrefEr);
  703. // Emergencyearlywarningandresponse(null,null);
  704. // addEMMarkerEvent();
  705. return true ;
  706. //应急资源图层
  707. case "41":
  708. emergencyresource();
  709. // $("#erToolWin").show();
  710. // quilayoutpages.openERdrowTool();
  711. return true ;
  712. // //线路跳闸与变电站停运图层
  713. // case "31":
  714. // var ltsoVolLevelUrl = "/nwyj/ws/cockpit/CockpitService/queryVolLevelStr" ;
  715. // var volelel = getStrData(ltsoVolLevelUrl,null) ;
  716. //
  717. //
  718. // lttParams = {voltageClass:volelel,status:"1"} ;
  719. // ltfParams = {voltageClass:volelel,status:"0"} ;
  720. // Linetrippingandsubstation(lttParams,ltfParams,null,null);
  721. // break ;
  722. // //线路覆冰图层
  723. // case "51":
  724. // lineregelation();
  725. // addLineiceEvent();
  726. // break ;
  727. //设备损失图层
  728. case "61":
  729. // EquipmentLoss();
  730. alert("界面集成,缺少URL");
  731. return false ;
  732. //用户停电图层
  733. case "71":
  734. // UserOutage();
  735. alert("界面集成,缺少URL");
  736. return false ;
  737. }
  738. }
  739. };
  740. /*---------------------------------------------------------------删除图层---------------------------------------------*/
  741. /**
  742. * @param 根据获取的每一个ID删除
  743. * @version 1.0
  744. * @Date 2015-09-28
  745. */
  746. //function removeallmarkers()
  747. //{
  748. // switch(menuID){
  749. function removeallmarkers(id){
  750. switch(id){
  751. //日常气象 图层
  752. case "11":
  753. Dailyweather(false);
  754. break ;
  755. //台风图层
  756. case "12":
  757. Typhoon(false);
  758. break ;
  759. //暴雨图层
  760. case "13":
  761. //alert("删除13");
  762. break ;
  763. //冰灾图层
  764. case "14":
  765. //alert("删除14");
  766. break ;
  767. //地震图层
  768. case "15":
  769. //alert("删除15");
  770. break ;
  771. //山火图层
  772. case "16":
  773. //alert("删除16");
  774. break ;
  775. //应急预警与响应图层
  776. case "21":
  777. closeEmergencyearlywarningandresponse();
  778. break ;
  779. //应急资源图层
  780. case "41":
  781. closeemergencyresource();
  782. break ;
  783. // //线路跳闸与变电站停运图层
  784. // case "31":
  785. // HighlightPSRs();
  786. // removeCustomButton();
  787. // break ;
  788. // //线路覆冰图层
  789. // case "51":
  790. // //HighlightPSRs();
  791. // //closeLineiceEvent();
  792. // break ;
  793. //设备损失图层
  794. case "61":
  795. break ;
  796. //用户停电图层
  797. case "71":
  798. break ;
  799. }
  800. };
  801. /*-------------------------------------------以下是图层右键菜单中的功能------------------------------------------------------*/
  802. ///**
  803. // * @param 打开查询面板
  804. // * @version 1.0
  805. // * @Date 2015-11-11
  806. // */
  807. //function openfinds(menuID)
  808. //{
  809. // switch(menuID){
  810. // //日常气象 图层
  811. // case 11:
  812. // if(Rightflag==true)
  813. // {
  814. // //这个方法是打开GIS地图中的查询面板,自己做的查询面板替换即可
  815. // openGISfind();
  816. // }
  817. // else
  818. // {
  819. // alert("未加载该图层");
  820. // }
  821. // break ;
  822. // //台风图层
  823. // case 12:
  824. // if(Rightflag==true)
  825. // {
  826. // openGISfind();//这个方法是打开GIS地图中的查询面板,自己做的查询面板替换即可
  827. // }
  828. // else
  829. // {
  830. // alert("未加载该图层");
  831. // }
  832. // break ;
  833. // //暴雨图层
  834. // case 13:
  835. // if(Rightflag==true)
  836. // {
  837. // openGISfind();//这个方法是打开GIS地图中的查询面板,自己做的查询面板替换即可
  838. // }
  839. // else
  840. // {
  841. // alert("未加载该图层");
  842. // }
  843. // break ;
  844. // //冰灾图层
  845. // case 14:
  846. // if(Rightflag==true)
  847. // {
  848. // openGISfind();//这个方法是打开GIS地图中的查询面板,自己做的查询面板替换即可
  849. // }
  850. // else
  851. // {
  852. // alert("未加载该图层");
  853. // }
  854. // break ;
  855. // //地震图层
  856. // case 15:
  857. // if(Rightflag==true)
  858. // {
  859. // openGISfind();//这个方法是打开GIS地图中的查询面板,自己做的查询面板替换即可
  860. // }
  861. // else
  862. // {
  863. // alert("未加载该图层");
  864. // }
  865. // break ;
  866. // //山火图层
  867. // case 16:
  868. // if(Rightflag==true)
  869. // {
  870. // openGISfind();//这个方法是打开GIS地图中的查询面板,自己做的查询面板替换即可
  871. // }
  872. // else
  873. // {
  874. // alert("未加载该图层");
  875. // }
  876. // break ;
  877. // //应急预警与响应图层
  878. // case 21:
  879. // if(Rightflag==true)
  880. // {
  881. // $("#ewerWin").floatPanelOpen();
  882. //// frmcontent.window.ewErShow() ;
  883. // }
  884. // else
  885. // {
  886. // alert("未加载该图层");
  887. // }
  888. // break ;
  889. // //线路跳闸与变电站停运图层
  890. // case 31:
  891. // if(Rightflag==true)
  892. // {
  893. // $("#ltsoWin").floatPanelOpen();
  894. //// frmcontent.window.ltSoShow() ;
  895. // }
  896. // else
  897. // {
  898. // alert("未加载该图层");
  899. // }
  900. // break ;
  901. // //应急资源图层
  902. // case 41:
  903. // if(Rightflag==true)
  904. // {
  905. //// $("#investmentWin").floatPanelOpen();
  906. //// frmcontent.window.investmentShow() ;
  907. // $("#erToolWin").show();
  908. // }
  909. // else
  910. // {
  911. // alert("未加载该图层");
  912. // }
  913. // break ;
  914. // //线路覆冰图层
  915. // case 51:
  916. // if(Rightflag==true)
  917. // {
  918. // openGISfind();//这个方法是打开GIS地图中的查询面板,自己做的查询面板替换即可
  919. // }
  920. // else
  921. // {
  922. // alert("未加载该图层");
  923. // }
  924. // break ;
  925. // //设备损失图层
  926. // case 61:
  927. // if(Rightflag==true)
  928. // {
  929. // openGISfind();//这个方法是打开GIS地图中的查询面板,自己做的查询面板替换即可
  930. // }
  931. // else
  932. // {
  933. // alert("未加载该图层");
  934. // }
  935. // break ;
  936. // //用户停电图层
  937. // case 71:
  938. // if(Rightflag==true)
  939. // {
  940. // openGISfind();//这个方法是打开GIS地图中的查询面板,自己做的查询面板替换即可
  941. // }
  942. // else
  943. // {
  944. // alert("未加载该图层");
  945. // }
  946. // break ;
  947. // }
  948. //};
  949. function openfind()
  950. {
  951. openfinds(RightMenuId);
  952. quilayoutpages.hideRMenu();
  953. };
  954. ///**
  955. //* @param 右键菜单中查看数据表格的功能
  956. //* @version 1.0
  957. //* @Date 2015-11-11
  958. //*/
  959. //function opendatatable()
  960. // {
  961. // if(Rightflag==true)
  962. // {
  963. // $("#tabTitle").show();
  964. // //右键查看数据表的时候更换数据表的标题名称
  965. // quilayoutpages.getRightTitles(RightMenuId);
  966. // //右键更换数据表选项卡的名称
  967. // quilayoutpages.getPageTitle(RightMenuId);
  968. // quilayoutpages.hideRMenu();
  969. // }
  970. // else
  971. // {
  972. // alert("未加载该图层");
  973. // }
  974. // };
  975. /**
  976. * @param 右键菜单中查看数据表格的功能
  977. * @version 1.0
  978. * @Date 2015-11-11
  979. */
  980. function opendatatable(id)
  981. {
  982. /*var gw = $("body").width()-283;
  983. var fd = gw+"px";
  984. $("#centermap").css({width:fd}); */
  985. /*if($("#leftceladows").is(":visible")){
  986. var gw = $("body").width()-283-300;
  987. var fd = gw+"px";
  988. $("#centermap").css({width:fd});
  989. } else {
  990. var gw = $("body").width()-300;
  991. var fd = gw+"px";
  992. $("#centermap").css({width:fd});
  993. }*/
  994. $("#tabTitle").show();
  995. //右键查看数据表的时候更换数据表的标题名称
  996. // quilayoutpages.getRightTitles(id);
  997. //右键更换数据表选项卡的名称
  998. quilayoutpages.getPageTitle(id);
  999. quilayoutpages.hideRMenu();
  1000. };
  1001. ///**
  1002. // * @param 打开图例
  1003. // * @version 1.0
  1004. // * @Date 2015-11-11
  1005. // */
  1006. // function openlegend()
  1007. // {
  1008. // if(Rightflag==true)
  1009. // {
  1010. // $("#openLegend").show();
  1011. // addLegendTodiv(RightMenuId);
  1012. // quilayoutpages.hideRMenu();
  1013. // }
  1014. // else
  1015. // {
  1016. // alert("未加载该图层");
  1017. // }
  1018. // };
  1019. /**
  1020. * @param 打开图例
  1021. * @version 1.0
  1022. * @Date 2015-11-11
  1023. */
  1024. function openlegend(id){
  1025. var pageHeight = getGridHieght() + 30 + 24 ;
  1026. $("#openLegend").show();
  1027. $("#openLegend").height(pageHeight) ;
  1028. addLegendTodiv(id);
  1029. quilayoutpages.hideRMenu();
  1030. };
  1031. /**
  1032. * @author
  1033. * @param 通过ID打开响应的图例
  1034. * @version 1.0
  1035. * @Date 2015-11-11
  1036. */
  1037. function addLegendTodiv(menuID)
  1038. {
  1039. $("#openLegend").empty();
  1040. var iframe = document.createElement("iframe");
  1041. iframe.style.width = "100%";
  1042. iframe.style.height = "100%";
  1043. iframe.setAttribute('frameborder', '0',0);
  1044. iframe.src="/nwyj/page/cockpit/legend/"+menuID+".html";
  1045. document.getElementById("openLegend").appendChild(iframe);
  1046. }
  1047. /**
  1048. * @param 关闭图例
  1049. * @version 1.0
  1050. * @Date 2015-11-11
  1051. */
  1052. function closelegend(){
  1053. $("#openLegend").hide();
  1054. };
  1055. /**
  1056. * @param 查看统计专题图
  1057. * @version 1.0
  1058. * @Date 2015-10-18
  1059. */
  1060. /*function lookspecial(menuID)
  1061. {
  1062. switch(menuID){
  1063. //日常气象 图层
  1064. case 11:
  1065. if(Rightflag==true)
  1066. {
  1067. alert("正在建设中。。。");
  1068. }
  1069. else
  1070. {
  1071. alert("未加载该图层");
  1072. }
  1073. break ;
  1074. }
  1075. };*/
  1076. ///**
  1077. // * @param 缩放到图层功能
  1078. // * @version 1.0
  1079. // * @Date 2015-10-14
  1080. // */
  1081. //function zoomToLayer(menuID)
  1082. //{
  1083. // switch(menuID){
  1084. // //日常气象 图层
  1085. // case 11:
  1086. // if(Rightflag==true)
  1087. // {
  1088. // zoomToCoordList(coords);
  1089. // }
  1090. // else
  1091. // {
  1092. // alert("未加载该图层");
  1093. // }
  1094. // break ;
  1095. // //台风图层
  1096. // case 12:
  1097. // if(Rightflag==true)
  1098. // {
  1099. // zoomToCoordList(coords);
  1100. // }
  1101. // else
  1102. // {
  1103. // alert("未加载该图层");
  1104. // }
  1105. // break ;
  1106. // //暴雨图层
  1107. // case 13:
  1108. // if(Rightflag==true)
  1109. // {
  1110. // zoomToCoordList(coords);
  1111. // }
  1112. // else
  1113. // {
  1114. // alert("未加载该图层");
  1115. // }
  1116. // break ;
  1117. // //冰灾图层
  1118. // case 14:
  1119. // if(Rightflag==true)
  1120. // {
  1121. // zoomToCoordList(coords);
  1122. // }
  1123. // else
  1124. // {
  1125. // alert("未加载该图层");
  1126. // }
  1127. // break ;
  1128. // //地震图层
  1129. // case 15:
  1130. // if(Rightflag==true)
  1131. // {
  1132. // zoomToCoordList(coords);
  1133. // }
  1134. // else
  1135. // {
  1136. // alert("未加载该图层");
  1137. // }
  1138. // break ;
  1139. // //山火图层
  1140. // case 16:
  1141. // if(Rightflag==true)
  1142. // {
  1143. // zoomToCoordList(coords);
  1144. // }
  1145. // else
  1146. // {
  1147. // alert("未加载该图层");
  1148. // }
  1149. // break ;
  1150. // //应急预警与响应图层
  1151. // case 21:
  1152. // if(Rightflag==true)
  1153. // {
  1154. // zoomToCoordList(em_coords);
  1155. // }
  1156. // else
  1157. // {
  1158. // alert("未加载该图层");
  1159. // }
  1160. // break ;
  1161. // //线路跳闸与变电站停运图层
  1162. // case 31:
  1163. // if(Rightflag==true)
  1164. // {
  1165. // wg.setZoomAndCenter(gdX,gdY,13) ;
  1166. // }
  1167. // else
  1168. // {
  1169. // alert("未加载该图层");
  1170. // }
  1171. // break ;
  1172. // //应急资源图层
  1173. // case 41:
  1174. // if(Rightflag==true)
  1175. // {
  1176. // wg.zoomToPSR("9030357001559537801",13) ;
  1177. // }
  1178. // else
  1179. // {
  1180. // alert("未加载该图层");
  1181. // }
  1182. // break ;
  1183. // //线路覆冰图层
  1184. // case 51:
  1185. // if(Rightflag==true)
  1186. // {
  1187. // zoomToCoordList(ice_coords);
  1188. // }
  1189. // else
  1190. // {
  1191. // alert("未加载该图层");
  1192. // }
  1193. // break ;
  1194. // //设备损失图层
  1195. // case 61:
  1196. // if(Rightflag==true)
  1197. // {
  1198. // zoomToCoordList(coords);
  1199. // }
  1200. // else
  1201. // {
  1202. // alert("未加载该图层");
  1203. // }
  1204. // break ;
  1205. // //用户停电图层
  1206. // case 71:
  1207. // if(Rightflag==true)
  1208. // {
  1209. // zoomToCoordList(coords);
  1210. // }
  1211. // else
  1212. // {
  1213. // alert("未加载该图层");
  1214. // }
  1215. // break ;
  1216. // }
  1217. //};
  1218. /**
  1219. * @param 缩放到图层功能
  1220. * @version 1.0
  1221. * @Date 2015-10-14
  1222. */
  1223. function zoomToLayer(id)
  1224. {
  1225. var pointArr = [] ;
  1226. pointArr = zoomTier["\"" + id + "\""] ;
  1227. if(pointArr){
  1228. zoomToCoordList(pointArr);
  1229. }else{
  1230. wg.fullExtent() ;
  1231. }
  1232. };
  1233. /*-------------------------------------------以上是图层右键菜单中的功能------------------------------------------------------*/
  1234. /**
  1235. * @param 加载日常气象图层
  1236. * @version 1.0
  1237. * @Date 2015-09-26
  1238. */
  1239. function Dailyweather(isFlat)
  1240. {
  1241. wg.openWeatherFuc(isFlat);
  1242. };
  1243. /**
  1244. * @param 加载台风图层
  1245. * @version 1.0
  1246. * @Date 2015-09-26
  1247. */
  1248. function Typhoon(isFlat)
  1249. {
  1250. wg.openTyphoonFuc(isFlat);
  1251. };
  1252. /**
  1253. * @param 加载暴雨图层
  1254. * @version 1.0
  1255. * @Date 2015-09-26
  1256. */
  1257. function Rainstorm()
  1258. {
  1259. alert("界面集成,缺少URL");
  1260. fullOpt(false);
  1261. };
  1262. /**
  1263. * @param 加载冰灾图层
  1264. * @version 1.0
  1265. * @Date 2015-09-26
  1266. */
  1267. function IceDamage()
  1268. {
  1269. alert("界面集成,缺少URL");
  1270. fullOpt(false);
  1271. };
  1272. /**
  1273. * @param 加载地震图层
  1274. * @version 1.0
  1275. * @Date 2015-09-26
  1276. */
  1277. function Earthquake()
  1278. {
  1279. alert("界面集成,缺少URL");
  1280. fullOpt(false);
  1281. };
  1282. /**
  1283. * @param 加载山火图层
  1284. * @version 1.0
  1285. * @Date 2015-09-26
  1286. */
  1287. function VegetationFire()
  1288. {
  1289. alert("界面集成,缺少URL");
  1290. fullOpt(false);
  1291. };
  1292. /**
  1293. * @param 加载设备损失图层
  1294. * @version 1.0
  1295. * @Date 2015-09-26
  1296. */
  1297. function EquipmentLoss()
  1298. {
  1299. alert("界面集成,缺少URL");
  1300. fullOpt(false);
  1301. };
  1302. /**
  1303. * @param 加载用户停电图层
  1304. * @version 1.0
  1305. * @Date 2015-09-26
  1306. */
  1307. function UserOutage()
  1308. {
  1309. alert("界面集成,缺少URL");
  1310. fullOpt(false);
  1311. };
  1312. /**
  1313. * @param 加载线路覆冰图层
  1314. * @version 1.0
  1315. * @Date 2015-10-11
  1316. */
  1317. function lineregelation()
  1318. {
  1319. //zoomToCoordList(ice_coords);
  1320. //wg.addHighlightPSR(ice_lineNArrs,'#00F');
  1321. alert("界面集成,缺少URL");
  1322. } ;
  1323. /**
  1324. * @param 加载应急预警与响应图层
  1325. * @version 1.0
  1326. * @Date 2015-09-26
  1327. */
  1328. //function Emergencyearlywarningandresponse(paramsEw,paramsEr)
  1329. function Emergencyearlywarningandresponse(paramsProvEw,paramsPrefEw,paramsProvEr,paramsPrefEr)
  1330. {
  1331. //新建应急预警与响应图层
  1332. addLayer(ewer_lay1,4,6,1,1);
  1333. addLayer(ewer_lay2,6,14,1,1);
  1334. var pointPre = [] ;
  1335. var pointPro = [] ;
  1336. //查询应急预警图标(地市级)
  1337. // var url ="/nwyj/ws/cockpit/CockpitService/getEwMarkerByPrefecture";
  1338. // pointPre = pointPre.concat(searchMarkerToEwer(url,paramsEw,true,ewer_lay2)) ;
  1339. var url ="/nwyj/ws/cockpit/CockpitService/getEwMarker";
  1340. pointPre = pointPre.concat(searchMarkerToEwer(url,paramsPrefEw,true,ewer_lay2)) ;
  1341. //应急响应查询(地市级)
  1342. // url ="/nwyj/ws/cockpit/CockpitService/getErMarkerPrefecture";
  1343. // pointPre = pointPre.concat(searchMarkerToEwer(url,paramsEr,true,ewer_lay2)) ;
  1344. url ="/nwyj/ws/cockpit/CockpitService/getErMarker";
  1345. pointPre = pointPre.concat(searchMarkerToEwer(url,paramsPrefEr,true,ewer_lay2)) ;
  1346. //查询应急预警图标(网省级)
  1347. // var url ="/nwyj/ws/cockpit/CockpitService/getEwMarkerByProvince";
  1348. // pointPro = pointPro.concat(searchMarkerToEwer(url,paramsEw,true,ewer_lay1)) ;
  1349. var url ="/nwyj/ws/cockpit/CockpitService/getEwMarker";
  1350. pointPro = pointPro.concat(searchMarkerToEwer(url,paramsProvEw,true,ewer_lay1)) ;
  1351. //应急响应查询(网省级)
  1352. // url ="/nwyj/ws/cockpit/CockpitService/getErMarkerByProvince";
  1353. // pointPro = pointPro.concat(searchMarkerToEwer(url,paramsEr,true,ewer_lay1)) ;
  1354. url ="/nwyj/ws/cockpit/CockpitService/getErMarker";
  1355. pointPro = pointPro.concat(searchMarkerToEwer(url,paramsProvEr,true,ewer_lay1)) ;
  1356. if(pointPro.length != 0){
  1357. zoomToCoordList(pointPro) ;
  1358. mz_ewer = pointPro ;
  1359. // wg.fullExtent() ;
  1360. zoomToCoordList(pointPro) ;
  1361. } else if(pointPre.length != 0){
  1362. zoomToCoordList(pointPre) ;
  1363. mz_ewer = pointPre ;
  1364. } else {
  1365. ai.setMes(320, 186, 200, 500, "系统提示", "没有相关数据");
  1366. ai.createAlert();
  1367. }
  1368. addEMMarkerEvent();
  1369. };
  1370. /**
  1371. * 应急预警和响应图标查询
  1372. * @param url 查询路径
  1373. * @param params 查询条件
  1374. * @param flg 图标是否可点击Boolean
  1375. * @param lay 显示图层
  1376. * @returns {Array} 返回图标坐标数组
  1377. */
  1378. function searchMarkerToEwer(url,params,flg,lay){
  1379. var ewJsonData = getJsonData(url,params) ;
  1380. var poinArr = [] ;
  1381. for(var key in ewJsonData){
  1382. poinArr.push(ewJsonData[key]["posX"]) ;
  1383. poinArr.push(ewJsonData[key]["posY"]) ;
  1384. }
  1385. ewJsonData = addEwrAttr(ewJsonData,flg,lay) ;
  1386. addResourceIco(ewJsonData);//添加图标
  1387. return poinArr ;
  1388. }
  1389. /**
  1390. * XY定位
  1391. * @param data 后台返回的结果
  1392. * @param x 坐标对应的经度key
  1393. * @param y 坐标对应的纬度key
  1394. * @returns {Array} 返回图标坐标数组
  1395. */
  1396. function poinXY(data,x,y){
  1397. var poinArr = [] ;
  1398. for(var key in data){
  1399. poinArr.push(data[key][x]) ;
  1400. poinArr.push(data[key][y]) ;
  1401. }
  1402. return poinArr ;
  1403. }
  1404. /**
  1405. *@param 查询数据库中的应急预警与响应的字段
  1406. *@version 1.0
  1407. *@Date 2015-10-30
  1408. */
  1409. function findDB_Emergencyearlywarningandresponse()
  1410. {
  1411. }
  1412. /**
  1413. * @param 取消显示应急预警与响应图层
  1414. * @version 1.0
  1415. * @Date 2015-09-26
  1416. */
  1417. function closeEmergencyearlywarningandresponse()
  1418. {
  1419. delLayer(ewer_lay1);
  1420. delLayer(ewer_lay2);
  1421. removeEvent("onMarkerClicked") ;
  1422. };
  1423. /**
  1424. * @param 应急预警与响应图标的点击事件
  1425. * @version 1.0
  1426. * @Date 2015-09-28
  1427. */
  1428. function addEMMarkerEvent(){
  1429. // wg.addEvent('onMarkerClicked',callEmergencyearlywarningandresponse);
  1430. wg.addEvent('onMarkerClicked',openEarlywarningnotice);
  1431. };
  1432. /**
  1433. *@param 点击应急预警与响应图标弹出通知单
  1434. *//*
  1435. function callEmergencyearlywarningandresponse(e){
  1436. openEarlywarningnotice(e);
  1437. };*/
  1438. /**
  1439. * @param 弹出应急预警响应通知单
  1440. * @version 1.0
  1441. * @Date 2015-09-26
  1442. * @upDate
  1443. */
  1444. function openEarlywarningnotice(e)
  1445. {
  1446. if( e["extraData"]["IS_ALERT"] == '1'){
  1447. window.open('/nwyj/page/business/em/response/emergencyResponse/CopyWarningView.jsp?fd_id=' + e["extraData"]["FD_OBJECTID"] );
  1448. } else {
  1449. window.open('/nwyj/page/business/em/alert/warning/CopyWarningView.jsp?fd_id=' + e["extraData"]["FD_OBJECTID"] );
  1450. }
  1451. };
  1452. /**
  1453. * @param 应急仓库图标的点击事件
  1454. * @version 1.0
  1455. * @Date 2015-09-28
  1456. */
  1457. function addHouseMarkerEvent(){
  1458. // wg.addEvent('onMarkerClicked',callEmergencyearlywarningandresponse);
  1459. wg.addEvent('onMarkerClicked',openHouseInfo);
  1460. };
  1461. /**
  1462. * @param 弹出应急预警响应通知单
  1463. * @version 1.0
  1464. * @Date 2015-09-26
  1465. * @upDate
  1466. */
  1467. function openHouseInfo(e)
  1468. {
  1469. window.open('/nwyj/page/cockpit/webgis/wareHouseInfo.jsp?' + e["extraData"]["FD_OBJECTID"] );
  1470. };
  1471. var erFlagPref = {} ;
  1472. var erFlagProv = {} ;
  1473. /**
  1474. * @param 加载应急资源图层
  1475. * @version 1.0
  1476. * @Date 2015-09-26
  1477. */
  1478. function emergencyresource()
  1479. {
  1480. openDarwAddEvent() ;
  1481. // wg.zoomToPSR(id,13) ;//定位到指定设备(事件发生的终点站等)并设置缩放等级
  1482. addLayer(lay1,5,21,1) ;//添加图标图层(系统)
  1483. addLayer(lay2,5,21,1) ;//添加自定义图标图层(绘图面板)
  1484. addLayer(lay3,5,21,1) ;//添加自定义图标图层(绘图面板转换后)
  1485. // addLayer(lay4,5,21,1) ;//添加自定义图标图层(应急队伍图层)
  1486. // addLayer(lay5,5,21,1) ;//添加自定义图标图层(应急队伍图层)
  1487. // ==========================================================================================================================
  1488. var pointProv = [] ;//网省级图标坐标组
  1489. var pointPref = [] ;//地市级图标坐标组
  1490. var point = [] ;
  1491. var url ="/nwyj/ws/cockpit/CockpitService/queryMareHouse";
  1492. erIcons = getJsonData(url,null);
  1493. point = point.concat(poinXY(erIcons,"posX","posY")) ;
  1494. zoomToCoordList(point) ;
  1495. pointPref = pointPref.concat(poinXY(erIcons,"posX","posY")) ;
  1496. erIcons = addErAttr(erIcons,er_storageIcon,true,lay1) ;
  1497. addResourceIco(erIcons) ;//添加应急资源仓库图标
  1498. addHouseMarkerEvent() ;
  1499. // addResourceInfoWin(infoWins) ;//给物资添加信息窗
  1500. var date = allGetServerTime() ;
  1501. var beginTime = getThreeMonthsAgo(getNowFormatDate(date)) ;
  1502. var endTime = getNowFormatDate(allGetServerTime()) ;
  1503. params = { INNECTID:'1' } ;
  1504. url ="/nwyj/ws/cockpit/CockpitService/queryErMarker" ;//网省级应急资源标注查询
  1505. params = {classid : 265, unitId : subDept["prov"]+"", startDate : beginTime, endDate : endTime} ;
  1506. erFlagProv = getJsonData(url,params) ;
  1507. url ="/nwyj/ws/cockpit/CockpitService/queryErMarker" ;//地市级应急资源标注查询
  1508. params = {classid : 265, unitId : subDept["pref"]+"", startDate : beginTime, endDate : endTime} ;
  1509. erFlagPref = getJsonData(url,params) ;
  1510. if(erFlagPref){
  1511. var posXArr = [] ;
  1512. var posYArr = [] ;
  1513. for(var key in erFlagPref){
  1514. posXArr.push(erFlagPref[key]["x"]) ;
  1515. posYArr.push(erFlagPref[key]["y"]) ;
  1516. }
  1517. var radiu = zoomToExtent(posXArr,posYArr) ;
  1518. var rad = getErRadius(radiu) ;
  1519. drawResource(erFlagPref,1,rad["ra"],rad["ds"]) ;//####
  1520. // drawResource(res,1,600,1) ;//####
  1521. // drawResource(erFlagPref,1,600,1) ;//添加资源标注(地市级)
  1522. pointPref = pointPref.concat(poinXY(erFlagPref,"x","y")) ;
  1523. }
  1524. if(erFlagProv){
  1525. var posXArr = [] ;
  1526. var posYArr = [] ;
  1527. for(var key in erFlagProv){
  1528. posXArr.push(erFlagProv[key]["x"]) ;
  1529. posYArr.push(erFlagProv[key]["y"]) ;
  1530. }
  1531. var radiu = zoomToExtent(posXArr,posYArr) ;
  1532. var rad = getErRadius(radiu) ;
  1533. drawResource(erFlagProv,0,rad["ra"],rad["ds"]) ;//####
  1534. /*drawResource(erFlagProv,0,90000,150) ;//添加资源标注(网省级)
  1535. wg.fullExtent() ;*/
  1536. pointProv = pointProv.concat(poinXY(erFlagProv,"x","y")) ;
  1537. mz_er = pointProv ;
  1538. zoomToCoordList(pointProv) ;
  1539. } else {
  1540. zoomToCoordList(pointPref) ;
  1541. mz_er = pointPref ;
  1542. // setZoomLevel(7) ;
  1543. } ;
  1544. wg.addEvent("onMapExtentChanged",mapChanged);
  1545. };
  1546. function mapChanged(e){
  1547. delLayer("pref1") ;
  1548. delLayer("pref2") ;
  1549. delLayer("pref3") ;
  1550. delLayer("prov1") ;
  1551. delLayer("prov2") ;
  1552. delLayer("prov3") ;
  1553. var zl = e["zoomLevel"] ;
  1554. var rad = getErRadius(zl) ;
  1555. if(zl>=8){
  1556. drawResource(erFlagPref,1,rad["ra"],rad["ds"]) ;//####
  1557. } else {
  1558. drawResource(erFlagProv,0,rad["ra"],rad["ds"]) ;//####
  1559. }
  1560. }
  1561. function setZoomLevel(level){
  1562. wg.setZoomLevel(level) ;
  1563. }
  1564. /**
  1565. * 应急资源标注json格式其它参数
  1566. * @param jsonStr 从数据库中读取出来的json属性
  1567. * @param icon 图标
  1568. * @param clickable 图标是否可以点击
  1569. * @param lay 图层名
  1570. */
  1571. function addErAttr(jsonStr,icon,clickable,lay){
  1572. // alert(JSON.stringify(jsonStr));
  1573. for(var key in jsonStr){
  1574. jsonStr[key] = addJsonAttribute(jsonStr[key],"icon",icon);
  1575. jsonStr[key] = addJsonAttribute(jsonStr[key],"clickable",clickable);
  1576. jsonStr[key] = addJsonAttribute(jsonStr[key],"layerName",lay);
  1577. }
  1578. return jsonStr ;
  1579. };
  1580. /**
  1581. * 应急预警与响应标注json格式其它参数
  1582. * @param jsonStr 从数据库中读取出来的json属性
  1583. * @param clickable 图标是否可以点击
  1584. * @param lay 图层名
  1585. */
  1586. function addEwrAttr(jsonStr,clickable,lay){
  1587. for(var key in jsonStr){
  1588. var lev = jsonStr[key]["level"] ;
  1589. jsonStr[key] = addJsonAttribute(jsonStr[key],"clickable",clickable);
  1590. jsonStr[key] = addJsonAttribute(jsonStr[key],"layerName",lay);
  1591. jsonStr[key] = addJsonAttribute(jsonStr[key],"icon",level[lev]);
  1592. }
  1593. return jsonStr ;
  1594. }
  1595. /**
  1596. * json格式添加属性
  1597. * @param jsonStr
  1598. */
  1599. function addJsonAttribute(jsonStr,key,value){
  1600. $(jsonStr).attr(key,value) ;
  1601. return jsonStr ;
  1602. };
  1603. /**
  1604. * @param 取消显示应急资源图层
  1605. * @version 1.0
  1606. * @Date 2015-09-26
  1607. */
  1608. function closeemergencyresource()
  1609. {
  1610. $("#erToolWin").hide();
  1611. delLayer(lay1) ;
  1612. delLayer(lay2) ;
  1613. delLayer(lay3) ;
  1614. delLayer(lay4) ;
  1615. delLayer(lay5) ;
  1616. // delLayer(lay6) ;
  1617. addLayer(lay3,5,21,1) ;
  1618. delShapes(lay3) ;
  1619. delLayer("pref1") ;
  1620. delLayer("pref2") ;
  1621. delLayer("pref3") ;
  1622. delLayer("prov1") ;
  1623. delLayer("prov2") ;
  1624. delLayer("prov3") ;
  1625. removeEvent("onShapeDrawnCompleted") ;
  1626. removeEvent("onMarkerClicked") ;
  1627. removeEvent("onMapExtentChanged") ;
  1628. removeEvent("onGetPointEvent") ;
  1629. };
  1630. function removeEvent(eventName){
  1631. wg.removeEvent(eventName) ;
  1632. }
  1633. /**
  1634. * 单击打开应急资源投入查询面板
  1635. */
  1636. function resourceInvestment()
  1637. {
  1638. quilayoutpages.resourceInvestment() ;
  1639. // frmcontent.window.ewErShow() ;
  1640. // quilayoutpages.resourceInvestment() ;
  1641. // frmcontent.window.investmentShow() ;
  1642. };
  1643. /**
  1644. * 单击打开设备列表图标事件
  1645. */
  1646. function listFun()
  1647. {
  1648. quilayoutpages.listFun() ;
  1649. };
  1650. /**
  1651. * 单击打开绘图工具栏图标事件
  1652. */
  1653. function toolFun()
  1654. {
  1655. quilayoutpages.toolFun() ;
  1656. };
  1657. /**
  1658. * @param 打开应急预警与响应图例
  1659. * @version 1.0
  1660. * @Date 2015-10-13
  1661. */
  1662. //function openlegend()
  1663. //{
  1664. // EmergencyearlywarningandresponseLegend(RightMenuId);
  1665. //}
  1666. ///**
  1667. // * @param 打开展示应急预警与响应图例的html界面
  1668. // * @version 1.0
  1669. // * @Date 2015-10-13
  1670. // */
  1671. //function EmergencyearlywarningandresponseLegend(rightid)
  1672. //{
  1673. // var path =pathCon+"Legend.html?"+rightid;
  1674. // var obj = { posX: 400, posY: 100, sizeWidth: 222, sizeHeight: 166, content: path, iconPosition: "right" };
  1675. // wg.openFloatWindow(obj);
  1676. //};
  1677. ///**
  1678. // * @param 线路覆冰中添加线路点击事件
  1679. // * @version 1.0
  1680. // * @Date 2015-10-12
  1681. // */
  1682. //function addLineiceEvent()
  1683. //{
  1684. // wg.addEvent('onPSRClicked',callPsrID);
  1685. //};
  1686. ///**
  1687. // * @param 取消设备点击事件
  1688. // * @version 1.0
  1689. // * @Date 2015-10-12
  1690. // */
  1691. //function closeLineiceEvent()
  1692. //{
  1693. // wg.removeEvent('onPSRClicked');
  1694. //};
  1695. ///**
  1696. // *@param 获取覆冰线路,得到ID,根据ID弹出信息框
  1697. // */
  1698. //function callPsrID(e)
  1699. //{
  1700. // for(var key in e)
  1701. // {
  1702. // if(key == 'psrID')
  1703. // {
  1704. // var psrid = e[key];
  1705. // for(var key in ice_lineNArrs)
  1706. // {
  1707. // if(ice_lineNArrs[key]==psrid)
  1708. // {
  1709. // var path =pathCon+"LineIceInfo.html";
  1710. // var obj = { posX: 400, posY: 100, sizeWidth: 320, sizeHeight: 168, content: path, iconPosition: "right" };
  1711. // wg.openFloatWindow(obj);
  1712. // }
  1713. // }
  1714. // }
  1715. // }
  1716. //};
  1717. /**
  1718. * 添加一组坐标生成折线
  1719. * @param erPath
  1720. */
  1721. function addResourcePath(erPath){
  1722. for(var transfer in erPath){
  1723. wg.addPolyLine(erPath[transfer].layerName,erPath[transfer].points,erPath[transfer].lineStyle,erPath[transfer].title);
  1724. };
  1725. } ;
  1726. /**
  1727. * 应急资源的圆形标注 因为是用添加圆形方法画的标注,所以此标注会随着地图的放大缩小而改变,所以设置了它的显示级别为13到15
  1728. * @param erFlag: 一组资源标注信息json格式,x、y坐标以及三个标注的数量信息,顺序分别是:本地、外地和缺口
  1729. * @param level: 网省地县标识,0为网省级 1为地市级
  1730. * @param crad: 圆形半径
  1731. * @param bs: 圆与圆的差距
  1732. */
  1733. function drawResource(erFlag,level,crad,bs)
  1734. {
  1735. var c1,c2,c3 = "";
  1736. if(level==0){//网省级
  1737. c1 = "prov1" ;
  1738. c2 = "prov2" ;
  1739. c3 = "prov3" ;
  1740. addLayer(c1,4,8,1);
  1741. addLayer(c2,4,8,1);
  1742. addLayer(c3,4,8,1);
  1743. } else { //地市级
  1744. c1 = "pref1" ;
  1745. c2 = "pref2" ;
  1746. c3 = "pref3" ;
  1747. addLayer(c1,7,14,1);
  1748. addLayer(c2,7,14,1);
  1749. addLayer(c3,7,14,1);
  1750. }
  1751. var circelStyleNative = circelStyle([128,128,128,0],1,1,[93,152,226,255]) ;
  1752. var circelStyleOther = circelStyle([128,128,128,0],1,1,[129,158,67,255]) ;
  1753. var circelStyleInsufficiency = circelStyle([128,128,128,0],1,1,[255,5,5,255]);
  1754. var extraData = {} ;
  1755. for(var key in erFlag){
  1756. var ex = erFlag[key].x;
  1757. var ey = erFlag[key].y;
  1758. var rad = crad ;
  1759. //本地投入资源标注圆
  1760. var objc1 = {points:{x:ex,y:ey},radius:rad};
  1761. extraData = {"unit":erFlag[key]["unit"],"startDate":erFlag[key]["startDate"],"endDate":erFlag[key]["endDate"],"type":erFlag[key]["type"],"level":"Native"} ;
  1762. wg.addCircle(c1,objc1,circelStyleNative,"extraData");
  1763. ex -= 0.0008 * bs ;
  1764. ey += 0.001 * bs ;
  1765. var objt1 = {points:{ x:ex,y:ey}};
  1766. var textStyle1 = {"strokeColor":[255,255,255,0],text:erFlag[key].native,fontSize:15,fillColor:[0,0,0,255]};
  1767. wg.addText(c1,objt1,textStyle1,"备注");
  1768. //外地投入资源标注圆
  1769. ey += 0.0007 * bs ;
  1770. ex += 0.001 * bs ;
  1771. rad += 200 * bs ;
  1772. var objc2 = {points:{x:ex,y:ey},radius:rad};
  1773. extraData = {"unit":erFlag[key]["unit"],"startDate":erFlag[key]["startDate"],"endDate":erFlag[key]["endDate"],"type":erFlag[key]["type"],"level":"Other"} ;
  1774. wg.addCircle(c2,objc2,circelStyleOther,extraData);
  1775. ey += 0.006 * bs ;
  1776. ex -= 0.001 * bs ;
  1777. var objt2 = {points:{x:ex,y:ey}};
  1778. textStyle1 = {"strokeColor":[255,255,255,0],text:erFlag[key].other,fontSize:15,fillColor:[0,0,0,255]};
  1779. wg.addText(c2,objt2,textStyle1,"备注");
  1780. //缺口资源标注圆
  1781. ey -= 0.0044 * bs ;
  1782. ex += 0.001 * bs ;
  1783. rad += 200 * bs ;
  1784. var objc3 = {points:{x:ex,y:ey},radius:rad};
  1785. wg.addCircle(c3,objc3,circelStyleInsufficiency);
  1786. ey += 0.008 * bs ;
  1787. ex -= 0.001 * bs ;
  1788. var objt3 = {points:{x:ex,y:ey}};
  1789. textStyle1 = {"strokeColor":[255,255,255,0],text:erFlag[key].insufficiency,fontSize:15,fillColor:[0,0,0,255]};
  1790. wg.addText(c3,objt3,textStyle1,"备注");
  1791. };
  1792. // wg.addEvent("onShapeClicked",clickByRa);
  1793. };
  1794. //function clickByRa(e){
  1795. // var s = "";
  1796. // for(var key in e){
  1797. //
  1798. // s+=key+":"+e[key];
  1799. // alert(key + " : " + e[key]) ;
  1800. //
  1801. // }
  1802. // alert(s);
  1803. //}
  1804. /**
  1805. * 通过参数返回要添加的圆形的style
  1806. * @param sColor:边的颜色 如:[255,255,255,0]
  1807. * @param sWeight:线条宽度或者多边形边线宽度 number
  1808. * @param op:填充透明度0-1
  1809. * @param fColor:填充颜色 如:[255, 165, 0, 255]
  1810. * @returns {___anonymous7663_7736}
  1811. */
  1812. function circelStyle(sColor,sWeight,op,fColor)
  1813. {
  1814. var circelStyle = {"strokeColor": sColor,"strokeWeight":sWeight,opacity:op,fillColor:fColor};
  1815. return circelStyle ;
  1816. };
  1817. /**
  1818. * 启动折线
  1819. */
  1820. function openDrawPolylineTool() {
  1821. wg.openDrawPolylineTool(lay2,lineStyle);
  1822. };
  1823. //启动图形完成事件
  1824. //function dropaddEvent(){
  1825. // wg.addEvent("onShapeDrawnCompleted",callBack);
  1826. //}
  1827. //function callBack(e){
  1828. // var s = "";
  1829. // for(var key in e){
  1830. // if(key == "geoID"){
  1831. // var menuArr = [{ "Key": "3","Name": "测试"},{ "Key": "1","Name": "基本操作","SubMenus": [ { "Key": "1-1","Name": "全图" } ]},{ "Key": "2","Name": "test","SubMenus": [ { "Key": "2-1","Name": "test" } ]}];
  1832. // var funArr = [{"key":"1-1",fun:"fullExt()"},{"key":"3",fun:"test()"}];
  1833. // wg.addContextMenu(lay2,menuArr,funArr);
  1834. // }
  1835. // s+= key+":"+e[key]+" ";
  1836. // }
  1837. // alert(s);
  1838. //}
  1839. /**
  1840. * 启动多边形
  1841. */
  1842. function openDrawPolygonTool() {
  1843. wg.openDrawPolygonTool(lay2,lineStyle);
  1844. };
  1845. /**
  1846. * 启动矩形
  1847. */
  1848. function openDrawRectangleTool(){
  1849. wg.openDrawRectangleTool(lay2,lineStyle);
  1850. } ;
  1851. /**
  1852. * 启动圆形
  1853. */
  1854. function openDrawCircleTool(){
  1855. wg.openDrawCircleTool(lay2,lineStyle);
  1856. };
  1857. /**
  1858. * 自定义图形的右键编辑菜单
  1859. */
  1860. function editUserDefined(){
  1861. wg.openEditorTool();
  1862. };
  1863. /**
  1864. * 添加自定义标注
  1865. */
  1866. var flag = false;
  1867. var teamId = null ;
  1868. var describeinfo = null ;
  1869. function addMarkerToUserDefined(f){
  1870. if(f=='but6'){
  1871. userInfo = resolveUrl() ;
  1872. var url = "toolTeam.jsp?fd_id=" + userInfo["dept_id"] ;
  1873. var lonlat = showModalDialog(url,window,"scroll:yes;status:no;dialogWidth:400px;dialogHeight:270px") ;
  1874. if(lonlat=="undefined"||lonlat==null||lonlat==""){
  1875. addMarkerToUserDefined(f) ;
  1876. }
  1877. teamId = lonlat.split(",")[0] ;
  1878. describeinfo = lonlat.split(",")[1] ;
  1879. var descri = lonlat.split(",")[2] ;
  1880. if(descri){
  1881. describeinfo += "(" + descri + ")" ;
  1882. }
  1883. icon = path + "/nwyj/images/cockpit/er_group.png" ;//队伍
  1884. } else if(f=='but7'){
  1885. describeinfo = "地点" ;
  1886. icon = path + "/nwyj/images/cockpit/er_adslabel.png" ;//地点
  1887. } else if(f=='but8'){
  1888. var url = "/nwyj/page/cockpit/dialog/emergencySupplies.jsp" ;
  1889. describeinfo = showModalDialog(url,window,"scroll:yes;status:no;dialogWidth:400px;dialogHeight:270px") ;
  1890. icon = path + "/nwyj/images/cockpit/er_goods.png" ;//物资
  1891. } else if(f=='but9'){
  1892. describeinfo = "起点" ;
  1893. icon = path + "/nwyj/images/cockpit/ads_start.png" ;//起点
  1894. // icon = path + "/nwyj/images/cockpit/11.gif" ;//起点
  1895. } else if(f=='but10'){
  1896. describeinfo = "终点" ;
  1897. icon = path + "/nwyj/images/cockpit/er_destination.png" ;//终点
  1898. };
  1899. if(!flag){
  1900. wg.addEvent("onGetPointEvent",callBackAddMarker);
  1901. flag = true;
  1902. };
  1903. wg.startGetPoint();
  1904. }
  1905. /**
  1906. * 打开网面对话框
  1907. * @param url
  1908. * @param params
  1909. * @returns
  1910. */
  1911. function openDialog(url,params){
  1912. return showModalDialog(url,window, params);
  1913. }
  1914. /**
  1915. * 添加自定义图标的回调事件
  1916. * @param e鼠标点击获得的地图坐标点
  1917. */
  1918. function callBackAddMarker(e){
  1919. var obj = {layerName:lay2,posX:e.x,posY:e.y,icon:icon,clickable:true};
  1920. wg.addMarker(obj);
  1921. var iconName = icon.split("/") ;
  1922. addMarkerXY(iconName[iconName.length-1],e.x,e.y,teamId,describeinfo) ;
  1923. } ;
  1924. function addMarkerXY(iconName,x,y,teamId,describeinfo){
  1925. switch (iconName){
  1926. case "er_group.png" : //队伍
  1927. teamArr.push("TEAM") ;
  1928. var value = {} ;
  1929. if(describeinfo){
  1930. value = "[{\"LONGITUDE\":" + x + ",\"LATITUDE\":" + y + ",\"NUM\":0,\"TEAMID\":\"" + teamId + "\",\"DESCRIBEINFO\":\"" + describeinfo + "\"}]" ;
  1931. } else {
  1932. value = "[{\"LONGITUDE\":" + x + ",\"LATITUDE\":" + y + ",\"NUM\":0,\"TEAMID\":\"" + teamId + "\"}]" ;
  1933. }
  1934. teamXYArr.push(value) ;
  1935. break;
  1936. case "er_adslabel.png" : //地点
  1937. siteArr.push("SITE") ;
  1938. var value = "[{\"LONGITUDE\":" + x + ",\"LATITUDE\":" + y + ",\"NUM\":0,\"DESCRIBEINFO\":\"" + describeinfo + "\"}]" ;
  1939. siteXYArr.push(value) ;
  1940. break ;
  1941. case "er_goods.png" : //物资
  1942. vehicleArr.push("VEHICLE") ;
  1943. var value = "[{\"LONGITUDE\":" + x + ",\"LATITUDE\":" + y + ",\"NUM\":0,\"DESCRIBEINFO\":\"" + describeinfo + "\"}]" ;
  1944. vehicleXYArr.push(value) ;
  1945. break ;
  1946. case "ads_start.png" : //起点
  1947. originArr.push("ORIGIN") ;
  1948. var value = "[{\"LONGITUDE\":" + x + ",\"LATITUDE\":" + y + ",\"NUM\":0,\"DESCRIBEINFO\":\"" + describeinfo + "\"}]" ;
  1949. originXYArr.push(value) ;
  1950. break ;
  1951. case "er_destination.png" : //终点
  1952. destinationArr.push("DESTINATION") ;
  1953. var value = "[{\"LONGITUDE\":" + x + ",\"LATITUDE\":" + y + ",\"NUM\":0,\"DESCRIBEINFO\":\"" + describeinfo + "\"}]" ;
  1954. destinationXYArr.push(value) ;
  1955. break ;
  1956. }
  1957. } ;
  1958. /**
  1959. * 应急资源图层根据所选择的队伍进行定位
  1960. */
  1961. var afterRes = null ;
  1962. var tempLay = null ;
  1963. function locationPosition(){
  1964. var inciId = $("#teamInci").attr("relValue") ;
  1965. var teamId = $("#teamByInci").attr("relValue") ;
  1966. var params = { inci : inciId, teamid : teamId } ;
  1967. delLayer(lay4);
  1968. delLayer(lay5);
  1969. tracing = -1 ;
  1970. var url = "/nwyj/ws/cockpit/CockpitService/queryYJTameMarkerInfo" ;
  1971. var res = getJsonData(url,params) ;
  1972. var point = [] ;
  1973. point = point.concat(poinXY(res,"posX","posY")) ;
  1974. zoomToCoordList(point) ;
  1975. res = addErAttr(res,er_groupIcon,true,lay4) ;
  1976. addResourceIco(res);//添加图标
  1977. afterRes = res ;
  1978. tempLay = lay4 ;
  1979. calBackMarker() ;
  1980. } ;
  1981. var i = 0 ;
  1982. /**
  1983. * 设置标签闪动5次
  1984. */
  1985. function calBackMarker(){
  1986. i++ ;
  1987. setTimeout(function del(){
  1988. if(i%2==0){
  1989. markerids = addResourceIco(afterRes);//添加图标
  1990. } else {
  1991. delLayer(tempLay);
  1992. } ;
  1993. },500) ;
  1994. if(i<8){
  1995. setTimeout("calBackMarker()",500) ;
  1996. } else {
  1997. i = 0 ;
  1998. return ;
  1999. } ;
  2000. } ;
  2001. /**
  2002. * 轨迹描绘/向当前时间以后的数据进行描绘
  2003. * 先删除当前的路径及marker点,然后再重新生成路径及添加Marker点
  2004. */
  2005. var ps = {} ;
  2006. var tracing = 0 ;
  2007. function tracingMachine(){
  2008. /*var url = "/nwyj/ws/cockpit/CockpitService/queryTameLine" ;
  2009. var res = getJsonData(url,params) ;
  2010. wg.removeAllMarkers(lay4);
  2011. icon = path + "/nwyj/images/cockpit/er_group.png" ;
  2012. for(var key in res){
  2013. tracing(res[key],null,er_startIcon,icon,lay4,lineStyle3) ;
  2014. }*/
  2015. var inciId = $("#teamInci").attr("relValue") ;
  2016. var teamId = $("#teamByInci").attr("relValue") ;
  2017. var params = { inci : inciId, teamid : teamId } ;
  2018. delLayer(lay4);
  2019. delLayer(lay5);
  2020. addLayer(lay4,5,21,1) ;//添加自定义图标图层(应急队伍图层)
  2021. addLayer(lay5,5,21,1) ;//添加自定义图标图层(应急队伍图层)
  2022. var url = "/nwyj/ws/cockpit/CockpitService/queryYJTameMarkerInfo" ;
  2023. var res = getJsonData(url,params) ;
  2024. var point = [] ;
  2025. point = point.concat(poinXY(res,"posX","posY")) ;
  2026. zoomToCoordList(point) ;
  2027. var tres = addErAttr(res,er_groupIcon,true,lay4) ;
  2028. var pres = addErAttr(res,er_adsIcon,true,lay5) ;
  2029. addResourceIco(tres);//添加图标
  2030. addResourceIco(pres);//添加图标
  2031. afterRes = tres ;
  2032. tempLay = lay4 ;
  2033. ps = params ;
  2034. tracing = 0 ;
  2035. calBackMarkerPaint() ;
  2036. } ;
  2037. function calBackMarkerPaint(){
  2038. tracing++ ;
  2039. /* setTimeout(function del(){*/
  2040. if(tracing % 2 == 0){
  2041. markerids = addResourceIco(afterRes);//添加图标
  2042. } else {
  2043. delLayer(tempLay);
  2044. } ;
  2045. if(tracing % 5 == 0){
  2046. var url = "/nwyj/ws/cockpit/CockpitService/queryYJTameMarkerInfo" ;
  2047. var res = getJsonData(url,ps) ;
  2048. var point = [] ;
  2049. point = point.concat(poinXY(res,"posX","posY")) ;
  2050. res = addErAttr(res,er_groupIcon,true,lay4) ;
  2051. var after_x = afterRes[0]["posX"] ;
  2052. var after_y = afterRes[0]["posY"] ;
  2053. afterRes = res ;
  2054. if(!(after_x == afterRes[0]["posX"] && after_y == afterRes[0]["posY"])){
  2055. var points_team = {"points":[{"x":after_x,"y":after_y},{"x":afterRes[0]["posX"],"y":afterRes[0]["posY"]}]} ;
  2056. wg.addPolyLine(lay5,points_team,lineStyle4) ;
  2057. }
  2058. }
  2059. /* },1000) ;*/
  2060. if(tracing != 0){
  2061. setTimeout("calBackMarkerPaint()",1000) ;
  2062. } else {
  2063. return ;
  2064. } ;
  2065. } ;
  2066. ///**
  2067. // * 描绘轨迹用时间轮询方法(quartz),没有后台,所以先不写了
  2068. // * 先删除当前的路径及marker点,然后再重新生成路径及添加Marker点
  2069. // */
  2070. //function tracingMachine(params){
  2071. //
  2072. // var url = "/nwyj/ws/cockpit/CockpitService/queryTameLine" ;
  2073. // var res = getJsonData(url,params) ;
  2074. // wg.removeAllMarkers(lay4);
  2075. // icon = path + "/nwyj/images/cockpit/er_group.png" ;
  2076. // for(var key in res){
  2077. // tracing(res[key],null,er_startIcon,icon,lay4,lineStyle3) ;
  2078. // }
  2079. //} ;
  2080. /**
  2081. * 历史轨迹回放
  2082. */
  2083. function roadHistory(params){
  2084. var url = "/nwyj/ws/cockpit/CockpitService/queryTameLine" ;
  2085. var res = getJsonData(url,params) ;
  2086. delLayer(lay4);
  2087. delLayer(lay5);
  2088. url = "/nwyj/ws/cockpit/CockpitService/queryYJTameMarkerInfo" ;
  2089. $(resStart).attr("sort","ASC") ;
  2090. var resStart = getJsonData(url,params) ;
  2091. for(var key in res){
  2092. var markerId = addAdsIcon(res[key]["points"][0]["x"],res[key]["points"][0]["y"],res[key]["teamId"],resStart,lay4) ;
  2093. tracingHistory(res[key],markerId, er_adsIcon,er_groupIcon,lay4,lineStyle3) ;
  2094. } ;
  2095. } ;
  2096. function addAdsIcon(x,y,teamId,resStart,layTrac){
  2097. var markerId = "" ;
  2098. for(var key in resStart){
  2099. if(resStart[key]["extraData"]["teamid"] == teamId){
  2100. var tem = {layerName:layTrac,posX:x,posY:y,icon:er_groupIcon,clikable:true,"title":resStart[key]["title"]} ;
  2101. markerId = wg.addMarker(tem) ;
  2102. if(x == resStart[key]["posX"] && y == resStart[key]["posY"]){
  2103. //1.判断是不是起点,如果是起点则添加起点图标
  2104. var obj = {layerName:layTrac,posX:x,posY:y,icon:er_startIcon,clickable:true} ;
  2105. wg.addMarker(obj) ;
  2106. } else {
  2107. //1.判断是不是起点,如果不是起点则添加地址图标
  2108. var obj = {layerName:layTrac,posX:x,posY:y,icon:er_adsIcon,clickable:true} ;
  2109. wg.addMarker(obj) ;
  2110. }
  2111. }
  2112. }
  2113. return markerId ;
  2114. }
  2115. /**
  2116. * 线路跳闸与变电站停运图层初始化
  2117. */
  2118. function Linetrippingandsubstation(lineOParams, lineNParams, soOParams, soNParams){
  2119. var url ="/nwyj/ws/cockpit/CockpitService/queryLineTrip";
  2120. wg.setZoomAndCenter(gdX,gdY,13) ;//定位至指定坐标并设置缩放等级
  2121. if(lineOParams){
  2122. var lineOArrs = getArrData(url,lineOParams) ;//已恢复线路查询
  2123. if(lineOArrs != ""){
  2124. lineNotRecovered(lineOArrs,'#0F0') ;//高亮变电站和线路设备,线路已恢复
  2125. } else {
  2126. alert("没有发现线路已恢复数据!") ;
  2127. }
  2128. }
  2129. if(lineNParams){
  2130. var lineNArrs = getArrData(url,lineNParams) ;//未恢复线路查询
  2131. if(lineNArrs != ""){
  2132. lineNotRecovered(lineNArrs,'#00F') ;//高亮变电站和线路设备,线路未恢复
  2133. } else {
  2134. alert("没有发现线路未恢复数据!") ;
  2135. }
  2136. }
  2137. //此处为判断变电站查询条件
  2138. /*if(soOParams){
  2139. var soOArrs = getArrData(url,soOParams) ;//已恢复线路查询
  2140. if(soOArrs){
  2141. lineNotRecovered(soOArrs,'#0F0') ;//高亮变电站和线路设备,线路已恢复
  2142. } else {
  2143. alert("没有发现变电站已恢复数据!") ;
  2144. }
  2145. }
  2146. if(soNParams){
  2147. var soNArrs = getArrData(url,soNParams) ;//未恢复线路查询
  2148. if(soNArrs){
  2149. lineNotRecovered(soNArrs,'#00F') ;//高亮变电站和线路设备,线路未恢复
  2150. } else {
  2151. alert("没有发现变电站未恢复数据!") ;
  2152. }
  2153. }*/
  2154. /*lineNotRecovered(stNArrs,'#00F') ;//变电站未恢复
  2155. lineNotRecovered(stYArrs,'#0F0') ;//变电站已恢复
  2156. */
  2157. /*equis = [] ;
  2158. equis = equis.concat(stNArrs) ;
  2159. equis = equis.concat(stYArrs) ;*/
  2160. //右键菜单暂时未实现
  2161. /*addRightMenu("220kV变电站",menuArr,funArr) ;
  2162. addRightMenu("110kV变电站",menuArr,funArr) ;*/
  2163. lineTrippingAddEvent();//添加设备单击事件
  2164. linetrppingaddButEvent() ;//注册添加按钮事件
  2165. };
  2166. /**
  2167. * 得到设备id请求(返回数据为字符串并封闭为数组用)
  2168. */
  2169. function getArrData(url,params){
  2170. var newData = [] ;
  2171. $.ajax({
  2172. async:false,
  2173. url : url,
  2174. type : 'post',
  2175. timeout : 0,
  2176. data : params,
  2177. dataType : 'text',
  2178. success : function(data) {
  2179. newData = data.split(",") ;
  2180. return newData ;
  2181. },
  2182. error : function(e) {
  2183. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  2184. }
  2185. });
  2186. return newData ;
  2187. };
  2188. /**
  2189. * axaj请求(返回字符串数据)
  2190. */
  2191. function getStrData(url,params){
  2192. var str = "" ;
  2193. $.ajax({
  2194. async:false,
  2195. url : url,
  2196. type : 'post',
  2197. timeout : 0,
  2198. data : params,
  2199. dataType : 'text',
  2200. success : function(data) {
  2201. str = data ;
  2202. },
  2203. error : function(e) {
  2204. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  2205. }
  2206. });
  2207. return str ;
  2208. };
  2209. /**
  2210. * 得到json格式请求
  2211. */
  2212. function getJsonData(url,params){
  2213. var result={} ;
  2214. $.ajax({
  2215. async:false,
  2216. url : url,
  2217. type : 'post',
  2218. timeout : 60000,
  2219. data : params,
  2220. dataType : 'json',
  2221. success : function(data) {
  2222. result = data ;
  2223. return data ;
  2224. },
  2225. error : function(e) {
  2226. $.messager.alert('系统提示信息error', '访问服务失败!', 'error');
  2227. }
  2228. });
  2229. return result ;
  2230. };
  2231. /**
  2232. * 改变设备颜色
  2233. * @param arrs
  2234. * @param color
  2235. */
  2236. function lineNotRecovered(arrs,color){
  2237. wg.addHighlightPSR(arrs,color);
  2238. };
  2239. ////添加设备右键菜单
  2240. ///**
  2241. // * 添加设备右键菜单
  2242. // */
  2243. //function addRightMenu(lay,menuArr,funArr){
  2244. // wg.addContextMenu(lay,menuArr,funArr);
  2245. //} ;
  2246. //
  2247. //
  2248. ////查看负荷曲线图
  2249. //function showLoadPattern()
  2250. //{
  2251. // addMB();
  2252. // MBclickfunction();
  2253. // var pathTex = pathCon + "lt_loadCurve.html" ;
  2254. // openFloatWindow(725,310,pathTex) ;
  2255. //} ;
  2256. //
  2257. ////查看变电站视频
  2258. //function showSubstationVideo()
  2259. //{
  2260. // addMB();
  2261. // MBclickfunction();
  2262. // var pathTex = pathCon + "lt_video.html" ;
  2263. // openFloatWindow(450,350,pathTex) ;
  2264. //} ;
  2265. //
  2266. ////查看受影响的变电站、线路
  2267. //function showImpactEquipment()
  2268. //{
  2269. // addMB();
  2270. // MBclickfunction();
  2271. //} ;
  2272. function LayerLegend()
  2273. {
  2274. if ((window.location.href).indexOf('?') > -1)
  2275. {
  2276. //得到右键菜单的ID
  2277. var fid = (window.location.href).split('?')[1];
  2278. //定义图片的路径
  2279. var imgPath = $("#LayerLegend");
  2280. imgPath.src="/nwyj/images/cockpit/"+fid+".png";
  2281. }
  2282. }
  2283. /**
  2284. * 线路跳闸与变电站停运单击设备事件
  2285. */
  2286. function lineTrippingAddEvent(){
  2287. wg.addEvent('onPSRClicked',lineTrippingAddEventcall);
  2288. } ;
  2289. function lineTrippingAddEventcall(e){
  2290. for(var key in e){
  2291. if(key == "psrID"){
  2292. pID = e[key];
  2293. for(var psr in equis){
  2294. if(pID == equis[psr]){
  2295. addCustomButton(buttonInfo,150,30,100,20) ;
  2296. } ;
  2297. } ;
  2298. } ;
  2299. } ;
  2300. } ;
  2301. /**
  2302. * 添加按钮
  2303. * @param buttonInfo 按钮组
  2304. * @param width 按钮宽
  2305. * @param height 按钮高
  2306. */
  2307. function addCustomButton(buttonInfo,width,height,x,y){
  2308. var buttonArr = [];
  2309. for(var i=0;i<buttonInfo.length;i++){
  2310. var obj = {
  2311. key:buttonInfo[i].key,
  2312. x:x,
  2313. y:y+i*30,
  2314. width:width,
  2315. height:height,
  2316. context:buttonInfo[i].value,
  2317. icon:buttonInfo[i].icon
  2318. };
  2319. buttonArr.push(obj);
  2320. }
  2321. wg.addButtonGroup(buttonArr);
  2322. };
  2323. /**
  2324. * 注册事件
  2325. */
  2326. function linetrppingaddButEvent(){
  2327. wg.addEvent("onButtonClickedEvent",linetrppingcallBackLt);
  2328. };
  2329. function linetrppingcallBackLt(e){
  2330. if(e == "slp"){
  2331. removeCustomButton() ;
  2332. showLoadPattern() ;
  2333. } else if(e == 'ssv'){
  2334. removeCustomButton() ;
  2335. showSubstationVideo() ;
  2336. } else if(e == "sie"){
  2337. removeCustomButton() ;
  2338. showImpactEquipment() ;
  2339. };
  2340. } ;
  2341. /**
  2342. * 移除所有添加的按钮
  2343. */
  2344. function removeCustomButton(){
  2345. wg.removeButtonGroup();
  2346. };
  2347. /**
  2348. * index页面改变大小时刷新表格数据页码数
  2349. * @param pageSize
  2350. */
  2351. function refresh(pageHeight){
  2352. var quilayoutpages =new QUIlayoutpage();
  2353. quilayoutpages.refresh(pageHeight) ;
  2354. };
  2355. //设置设备过滤显示
  2356. function filterPSRDisplay(){
  2357. wg.filterPSRDisplay('1000357000000006300');
  2358. }
  2359. /**
  2360. * 清除所有过渡显示
  2361. */
  2362. function filterRemoveAll(){
  2363. wg.filterRemoveAll();
  2364. };
  2365. /**
  2366. * 启动图形完成事件
  2367. */
  2368. function openDarwAddEvent(){
  2369. wg.addEvent("onShapeDrawnCompleted",openDarwCallBack);
  2370. }
  2371. /**
  2372. * 启动图形完成回调事件
  2373. */
  2374. function openDarwCallBack(e){
  2375. // alert(e["geometryType"]) ;//得到图形类型 线:1 多边形:2 圆:3 矩形: 4
  2376. var num = 0 ;
  2377. var value = "[" ;
  2378. for(var point in e["geoData"]["points"] ){
  2379. if(e["geoData"]["radius"]){
  2380. value += "{\"LONGITUDE\":" + e["geoData"]["points"][point]["x"] + ",\"LATITUDE\":" + e["geoData"]["points"][point]["y"] + ",\"NUM\":" + num + ",\"RADIUS\":" + e["geoData"]["radius"] + "},";
  2381. } else {
  2382. value += "{\"LONGITUDE\":" + e["geoData"]["points"][point]["x"] + ",\"LATITUDE\":" + e["geoData"]["points"][point]["y"] + ",\"NUM\":" + num + "},";
  2383. }
  2384. num ++ ;
  2385. } ;
  2386. value = value.substring(0, value.length-1) ;
  2387. value += "]" ;
  2388. if(e["geometryType"]==1){ //折线
  2389. lineArr.push("LINE") ;
  2390. lineXYArr.push(value) ;
  2391. // linePoints.push(e["geoData"]["points"]) ;
  2392. } ;
  2393. if(e["geometryType"]==2){ //多边形
  2394. polygonArr.push("POLYGON") ;
  2395. polygonXYArr.push(value) ;
  2396. // polygonPoints.push(e["geoData"]["points"]) ;
  2397. } ;
  2398. if(e["geometryType"]==3){ //圆形
  2399. circleArr.push("CIRCLE") ;
  2400. circleXYArr.push(value) ;
  2401. // circlePoints.push(e["geoData"]["points"]) ;
  2402. } ;
  2403. if(e["geometryType"]==4){ //矩形
  2404. var valueGeo = "[{\"LONGITUDE\":" + e["geoData"]["points"][0]["x"] + ",\"LATITUDE\":" + e["geoData"]["points"][1]["y"] + ",\"NUM\":0},";
  2405. valueGeo += "{\"LONGITUDE\":" + e["geoData"]["points"][1]["x"] + ",\"LATITUDE\":" + e["geoData"]["points"][1]["y"] + ",\"NUM\":1},";
  2406. valueGeo += "{\"LONGITUDE\":" + e["geoData"]["points"][1]["x"] + ",\"LATITUDE\":" + e["geoData"]["points"][0]["y"] + ",\"NUM\":2},";
  2407. valueGeo += "{\"LONGITUDE\":" + e["geoData"]["points"][0]["x"] + ",\"LATITUDE\":" + e["geoData"]["points"][0]["y"] + ",\"NUM\":3}]";
  2408. rectangleArr.push("RECTANGLE") ;
  2409. rectangleXYArr.push(valueGeo) ;
  2410. // rectanglePoints.push(e["geoData"]["points"]) ;
  2411. } ;
  2412. } ;
  2413. /**
  2414. * 校验事件名称是否存在
  2415. */
  2416. /*function verifyIncidentName(){
  2417. var url ="/nwyj/ws/cockpit/CockpitService/verifyIncidentName" ; //标记
  2418. var params = {Condi:$("#eve").val()} ;
  2419. var result = getArrData(url,params) ;
  2420. //alert(result) ;
  2421. if(result==1) $("#sev").text("该事件名称已经存在!");
  2422. if(result==0){
  2423. $("#sev").text("可以添加!") ;
  2424. $("#saveDrawBut").removeAttr("disabled") ;
  2425. }
  2426. } ;*/
  2427. //以图层的形式整体保存,因为没有MarkerID,所以不能进行单独删除
  2428. /*var tempByUserDraw ;
  2429. function saveDrawByUser(inicId){
  2430. tempByUserDraw = wg.saveGraphToData(lay2) ;
  2431. var aa = JSON.stringify(tempByUserDraw) ;
  2432. alert(aa) ;
  2433. var url = "/nwyj/ws/cockpit/CockpitService/createDrawByUser" ;
  2434. var params = {inicId:inicId,info:aa} ;
  2435. var res = getStrData(url,params) ;
  2436. alert(res) ;
  2437. }
  2438. function importDrawByUser(){
  2439. var url = "/nwyj/ws/cockpit/CockpitService/importDrawByUser" ;
  2440. var aa = getJsonData(url,null) ;
  2441. alert(aa);
  2442. wg.openGraphFromData(lay1,aa) ;
  2443. }*/
  2444. /**
  2445. * 保存自定义图形按钮事件
  2446. */
  2447. function saveDraw(inciResult){
  2448. if(lineArr.length != 0 || polygonArr.length != 0 || circleArr != 0 || rectangleArr != 0 || originArr != 0 ||
  2449. siteArr != 0 || destinationArr != 0 || vehicleArr != 0 || teamArr != 0){
  2450. // var inciResult = saveIncident() ;
  2451. // drawTypeIds
  2452. // var a = drawTypeIds.join(",") ;
  2453. if(lineArr.length != 0){
  2454. var lineResult = saveType(inciResult,lineArr) ;
  2455. var lineXYResultJson = saveXY(lineResult,lineXYArr) ;//保存折线类坐标
  2456. drawTypeIds = drawTypeIds.concat(lineResult) ;
  2457. lineArr = [] ;
  2458. lineXYArr = [] ;
  2459. // trunDrawLine(lineResult) ;
  2460. }
  2461. if(polygonArr.length != 0){
  2462. var polygonResult = saveType(inciResult,polygonArr) ;
  2463. var polygonXYResultJson = saveXY(polygonResult,polygonXYArr) ;//保存多边形类坐标
  2464. drawTypeIds = drawTypeIds.concat(polygonResult) ;
  2465. polygonArr = [] ;
  2466. polygonXYArr = [] ;
  2467. }
  2468. if(circleArr.length != 0){
  2469. var circleResult = saveType(inciResult,circleArr) ;
  2470. var circleXYResultJson = saveXY(circleResult,circleXYArr) ;//保存圆形类坐标
  2471. // for(var key in circleXYResultJson){alert(circleXYResultJson[key]); }
  2472. drawTypeIds = drawTypeIds.concat(circleResult) ;
  2473. circleArr = [] ;
  2474. circleXYArr = [] ;
  2475. }
  2476. if(rectangleArr.length != 0){
  2477. var rectangleResult = saveType(inciResult,rectangleArr) ;
  2478. var rectangleXYResultJson = saveXY(rectangleResult,rectangleXYArr) ;//保存矩形类坐标
  2479. drawTypeIds = drawTypeIds.concat(rectangleResult) ;
  2480. rectangleArr = [] ;
  2481. rectangleXYArr = [] ;
  2482. }
  2483. if(originArr.length != 0){
  2484. var rectangleResult = saveType(inciResult,originArr) ;
  2485. var rectangleXYResultJson = saveXY(rectangleResult,originXYArr) ;//保存起点类坐标
  2486. drawTypeIds = drawTypeIds.concat(rectangleResult) ;
  2487. originArr = [] ;
  2488. originXYArr = [] ;
  2489. }
  2490. if(siteArr.length != 0){
  2491. var siteResult = saveType(inciResult,siteArr) ;
  2492. var siteXYResult = saveXY(siteResult,siteXYArr) ;//保存地点类坐标
  2493. drawTypeIds = drawTypeIds.concat(siteResult) ;
  2494. siteArr = [] ;
  2495. siteXYArr = [] ;
  2496. }
  2497. if(destinationArr.length != 0){
  2498. var destinationResult = saveType(inciResult,destinationArr) ;
  2499. var destinationXYResultJson = saveXY(destinationResult,destinationXYArr) ;//保存终点类坐标
  2500. drawTypeIds = drawTypeIds.concat(destinationResult) ;
  2501. destinationArr = [] ;
  2502. destinationXYArr = [] ;
  2503. }
  2504. if(vehicleArr.length != 0){
  2505. var vehicleResult = saveType(inciResult,vehicleArr) ;
  2506. var vehicleXYResult = saveXY(vehicleResult,vehicleXYArr) ;//保存车辆类坐标
  2507. drawTypeIds = drawTypeIds.concat(vehicleResult) ;
  2508. vehicleArr = [] ;
  2509. vehicleXYArr = [] ;
  2510. }
  2511. if(teamArr.length != 0){
  2512. var teamResult = saveType(inciResult,teamArr) ;
  2513. var teamXYResult = saveXY(teamResult,teamXYArr) ;//保存队伍类坐标
  2514. drawTypeIds = drawTypeIds.concat(teamResult) ;
  2515. teamArr = [] ;
  2516. teamXYArr = [] ;
  2517. } ;
  2518. } else {
  2519. alert("没有数据可以保存!") ;
  2520. } ;
  2521. } ;
  2522. /**
  2523. * 保存事件
  2524. */
  2525. function saveIncident(){
  2526. var url ="/nwyj/ws/cockpit/CockpitService/addIncidentName" ;
  2527. var params = {Condi:$("#eve").val()} ;
  2528. return getArrData(url,params) ;//得到事件ID
  2529. } ;
  2530. /**
  2531. * 保存参数信息
  2532. * @param inciResult 事件ID
  2533. * @returns {Array} 返回FD_ID
  2534. */
  2535. function saveType(inciResult,drowArr){
  2536. var par = "[" ;
  2537. for(var key in drowArr){
  2538. par += '{"INNECTID":"' + inciResult +'","DROWTYPE":"'+drowArr[key]+'","USER_ID":"' + userInfoByTop["user_id"] + '"},';
  2539. } ;
  2540. par = par.substring(0, par.length-1) ;
  2541. par += "]" ;
  2542. url ="/nwyj/ws/cockpit/CockpitService/addDrawType" ;//批量添加自定义线形图到参数信息存储表
  2543. params = { DATA : par } ;
  2544. // $.post(url,params,function(data){
  2545. // return data ;
  2546. // }, "text") ;
  2547. return getArrData(url,params) ;//得到线型FD_ID
  2548. } ;
  2549. /**
  2550. * 保存图形的坐标点
  2551. * @param lineResult
  2552. * @returns {Array}
  2553. */
  2554. function saveXY(lineResult, xyArr){
  2555. var jsonStr = "[" ;
  2556. var exchangeStr = "" ;
  2557. for(var i = 0 ; i < lineResult.length ; i++){//根据得到到图型FD_ID保存线形坐标数据
  2558. var exchangeJson = JSON.parse(xyArr[i]) ;
  2559. for(var sk in exchangeJson){
  2560. exchangeJson[sk] = addJsonAttribute(exchangeJson[sk],"FIGUREID",lineResult[i]);
  2561. exchangeStr = JSON.stringify(exchangeJson[sk]) ;
  2562. jsonStr += exchangeStr ;
  2563. jsonStr += "," ;
  2564. } ;
  2565. } ;
  2566. jsonStr = jsonStr.substring(0, jsonStr.length - 1) ;
  2567. jsonStr += "]" ;
  2568. url ="/nwyj/ws/cockpit/CockpitService/addDrawXY" ;//批量添加自定义线形图到参数信息存储表
  2569. params = { DATA : jsonStr } ;
  2570. return getArrData(url,params) ;
  2571. // getArrData(url,params) ;
  2572. // alert("保存完成!开始转换...") ;
  2573. // url ="/nwyj/ws/cockpit/CockpitService/getDrawPoints" ;//将批量添加自定义线形图转换为添加类型
  2574. // params = {ids:lineResult.join(",")} ;
  2575. //
  2576. // return getJsonData(url, params) ;
  2577. // $.post(url,params,function(data){
  2578. // return data ;
  2579. //}, "text") ;
  2580. } ;
  2581. //清除用户自定义图形
  2582. function clearDrawUserDefined(){
  2583. if(drawTypeIds.length != 0){
  2584. var url = "/nwyj/ws/cockpit/CockpitService/delDrawUserDefined" ;//批量删除用户自定义绘制图形
  2585. var params = drawTypeIds.join(",") ;
  2586. $.post(url,params,function(data){
  2587. if(data){
  2588. wg.removeAllShapes(lay2) ;
  2589. alert("保存后删除成功") ;
  2590. }
  2591. },"text") ;
  2592. drawTypeIds = [] ;
  2593. } else {
  2594. wg.removeAllShapes(lay2) ;
  2595. clearDrawByUserArr() ;
  2596. alert("未保存图形删除成功") ;
  2597. }
  2598. }
  2599. function clearDrawByUserArr(){
  2600. lineArr = [] ; //存储线类型数组
  2601. polygonArr = [] ; //存储多边形类型数组
  2602. circleArr = [] ; //存储圆类型
  2603. rectangleArr = [] ;//矩形数组
  2604. originArr = [] ;//起点数组
  2605. siteArr = [] ;//地点
  2606. destinationArr = [] ;//终点
  2607. vehicleArr = [] ;//车辆
  2608. teamArr = [] ;//人员
  2609. lineXYArr = [] ; //存储线类型数组坐标
  2610. polygonXYArr = [] ; //存储多边形类型数组坐标
  2611. circleXYArr = [] ; //存储圆类型坐标
  2612. rectangleXYArr = [] ;//矩形数组坐标
  2613. originXYArr = [] ;//起点数组坐标
  2614. siteXYArr = [] ;//地点坐标
  2615. destinationXYArr = [] ;//终点坐标
  2616. vehicleXYArr = [] ;//车辆坐标
  2617. teamXYArr = [] ;//人员坐标
  2618. drawTypeIds = [] ;
  2619. };
  2620. //按类型查询用户自定义图形信息
  2621. function searchDrawByUserInfo(inicId){
  2622. isDelDrawLay(inicId) ;
  2623. var params = {} ;
  2624. var res = {} ;
  2625. var url = "/nwyj/ws/cockpit/CockpitService/queryDrawByUser" ;
  2626. params = {"inicId":inicId,"type":"LINE","userId":userInfoByTop["user_id"]} ;//线
  2627. res = getJsonData(url,params) ;
  2628. if(res){
  2629. addUserDrawByLine(res) ;
  2630. }
  2631. params = {"inicId":inicId,"type":"POLYGON","userId":userInfoByTop["user_id"]} ;//多边形
  2632. res = getJsonData(url,params) ;
  2633. if(res){
  2634. addUserDrawByPolygon(res) ;
  2635. }
  2636. params = {"inicId":inicId,"type":"CIRCLE","userId":userInfoByTop["user_id"]} ;//圆形
  2637. res = getJsonData(url,params) ;
  2638. if(res){
  2639. addUserDrawByCircle(res) ;
  2640. }
  2641. params = {"inicId":inicId,"type":"RECTANGLE","userId":userInfoByTop["user_id"]} ;//矩形
  2642. res = getJsonData(url,params) ;
  2643. if(res){
  2644. addUserDrawByPolygon(res) ;
  2645. }
  2646. url = "/nwyj/ws/cockpit/CockpitService/queryDrawByUserMarker" ;
  2647. params = {"inicId":inicId,"type":"SITE","userId":userInfoByTop["user_id"]} ;//地点
  2648. res = getJsonData(url,params) ;
  2649. if(res){
  2650. res = addErAttr(res,er_adsIcon,true,lay3) ;
  2651. var objKV = addUserDrawByIcon(res) ;
  2652. addRightDraw(objKV) ;
  2653. }
  2654. params = {"inicId":inicId,"type":"ORIGIN","userId":userInfoByTop["user_id"]} ;//起点
  2655. res = getJsonData(url,params) ;
  2656. if(res){
  2657. res = addErAttr(res,er_startIcon,false,lay3) ;
  2658. addResourceIco(res) ;
  2659. }
  2660. params = {"inicId":inicId,"type":"DESTINATION","userId":userInfoByTop["user_id"]} ;//终点
  2661. res = getJsonData(url,params) ;
  2662. if(res){
  2663. res = addErAttr(res,er_destIcon,false,lay3) ;
  2664. addResourceIco(res) ;
  2665. }
  2666. params = {"inicId":inicId,"type":"TEAM","userId":userInfoByTop["user_id"]} ;//队伍
  2667. res = getJsonData(url,params) ;
  2668. if(res){
  2669. res = addErAttr(res,er_groupIcon,true,lay3) ;
  2670. addResourceIco(res) ;
  2671. }
  2672. params = {"inicId":inicId,"type":"VEHICLE","userId":userInfoByTop["user_id"]} ;//物资
  2673. res = getJsonData(url,params) ;
  2674. if(res){
  2675. res = addErAttr(res,er_GoodsIcon,true,lay3) ;
  2676. addResourceIco(res) ;
  2677. }
  2678. // addRightClick() ;
  2679. }
  2680. function isDelDrawLay(inicId){
  2681. if(lineArr.length != 0 || polygonArr.length != 0 || circleArr != 0 || rectangleArr != 0 || originArr != 0 ||
  2682. siteArr != 0 || destinationArr != 0 || vehicleArr != 0 || teamArr != 0){
  2683. if(confirm("有未保存的图形,单击确定保存后再查看")){
  2684. saveDraw(inicId) ;
  2685. delDrawLay() ;
  2686. } else {
  2687. delDrawLay() ;
  2688. }
  2689. } else {
  2690. delDrawLay() ;
  2691. }
  2692. }
  2693. function delDrawLay(){
  2694. addLayer(lay3,5,21,1) ;
  2695. addLayer(lay2,5,21,1) ;
  2696. clearlay(lay3) ;
  2697. clearlay(lay2) ;
  2698. addLayer(lay3,5,21,1) ;
  2699. }
  2700. /**
  2701. * 添加手绘折线
  2702. * @param drawLineResArr
  2703. */
  2704. function addUserDrawByLine(drawResArr){
  2705. var pointDraw = [] ;
  2706. for(var key in drawResArr){
  2707. pointDraw.push({"layerName":lay3,"points":{"points":drawResArr[key]["points"]},"lineStyle":lineStyle1,"extraData":drawResArr[key]["drawId"]}) ;
  2708. }
  2709. var objKV = addLineByUserDraw(pointDraw) ;
  2710. addRightDraw(objKV) ;
  2711. }
  2712. /**
  2713. * 添加手绘多边形
  2714. * @param drawLineResArr
  2715. */
  2716. function addUserDrawByPolygon(drawResArr){
  2717. var pointDraw = [] ;
  2718. for(var key in drawResArr){
  2719. pointDraw.push({"layerName":lay3,"points":{"points":drawResArr[key]["points"]},"lineStyle":lineStyle1,"extraData":drawResArr[key]["drawId"]}) ;
  2720. }
  2721. var objKV = addPolygonByUserDraw(pointDraw) ;
  2722. addRightDraw(objKV) ;
  2723. }
  2724. /**
  2725. * 添加手绘圆形
  2726. * @param drawResArr
  2727. */
  2728. function addUserDrawByCircle(drawResArr){
  2729. var pointDraw = [] ;
  2730. for(var key in drawResArr){
  2731. pointDraw.push({"layerName":lay3,"points":{"points":drawResArr[key]["points"],"radius":drawResArr[key]["radius"]},"lineStyle":lineStyle1,"extraData":drawResArr[key]["drawId"]}) ;
  2732. }
  2733. var objKV = addCircleByUserDraw(pointDraw) ;
  2734. addRightDraw(objKV) ;
  2735. }
  2736. ///**
  2737. // * 添加用户自定义图标
  2738. // * @param drawResArr
  2739. // */
  2740. //function addUserIcon(drawResArr){
  2741. // var drawKV = {} ;
  2742. // for(var key in drawResArr){
  2743. // wg.addMarker(drawResArr[key]) ;
  2744. // };
  2745. // return iconIds ;
  2746. //}
  2747. /**
  2748. * 得到手绘图形的参数信息
  2749. * @param lay 图层名
  2750. * @param drawTypeResArr 坐标信息参数
  2751. * @param ls 线样式
  2752. * @returns 添加样式数组
  2753. */
  2754. function getPoint(tempLay,drawTypeResArr,ls){
  2755. var pointDraw = [] ;
  2756. for(var key in drawTypeResArr){
  2757. pointDraw.push({"layerName":tempLay,"points":{"points":drawTypeResArr[key]["points"]},"lineStyle":ls}) ;
  2758. }
  2759. return pointDraw ;
  2760. }
  2761. /**
  2762. * 批量添加多边形,返回ID数组
  2763. * @param polygonArr
  2764. */
  2765. function addPolygon(polygonArr){
  2766. var polygonObj = [] ;
  2767. for(var transfer in polygonArr){
  2768. polygonObj.push(wg.addPolygon(polygonArr[transfer]["layerName"],polygonArr[transfer]["points"],polygonArr[transfer]["lineStyle"],polygonArr[transfer]["title"])) ;
  2769. };
  2770. return polygonObj ;
  2771. }
  2772. /**
  2773. * 添加圆,返回ID数组
  2774. * @param circleArr
  2775. * @returns {Array}
  2776. */
  2777. function addCircle(circleArr){
  2778. var polygonObj = [] ;
  2779. for(var transfer in circleArr){
  2780. var obj = {
  2781. points:{x:circleArr[transfer]["points"]["points"][0]["x"], y:circleArr[transfer]["points"]["points"][0]["y"]},
  2782. radius:circleArr[transfer]["points"]["radius"]
  2783. } ;
  2784. polygonObj.push(wg.addCircle(circleArr[transfer]["layerName"],obj,circleArr[transfer]["lineStyle"])) ;
  2785. };
  2786. return polygonObj ;
  2787. }
  2788. /**
  2789. * 添加用户自定义圆返回ID与FD_ID健值对
  2790. * @param circleArr
  2791. * @returns {___anonymous64930_64931}
  2792. */
  2793. function addCircleByUserDraw(circleArr){
  2794. var drawKV = {} ;
  2795. for(var transfer in circleArr){
  2796. var obj = {
  2797. points:{x:circleArr[transfer]["points"]["points"][0]["x"], y:circleArr[transfer]["points"]["points"][0]["y"]},
  2798. radius:circleArr[transfer]["points"]["radius"]
  2799. } ;
  2800. var circleId = wg.addCircle(circleArr[transfer]["layerName"],obj,circleArr[transfer]["lineStyle"],circleArr[transfer]["extraData"]) ;
  2801. drawKV = addJsonAttribute(drawKV,circleId,circleArr[transfer]["extraData"]);
  2802. };
  2803. return drawKV ;
  2804. }
  2805. /**
  2806. * 批量添加多边形,返回ID与FD_ID健值对
  2807. * @param polygonArr
  2808. */
  2809. function addPolygonByUserDraw(polygonArr){
  2810. var drawKV = {} ;
  2811. for(var transfer in polygonArr){
  2812. var pId = wg.addPolygon(polygonArr[transfer]["layerName"],polygonArr[transfer]["points"],polygonArr[transfer]["lineStyle"],polygonArr[transfer]["extraData"]) ;
  2813. drawKV = addJsonAttribute(drawKV,pId,polygonArr[transfer]["extraData"]);
  2814. };
  2815. return drawKV ;
  2816. }
  2817. /**
  2818. * 批量添加折线,返回ID与FD_ID健值对
  2819. * @param polygonArr
  2820. */
  2821. function addLineByUserDraw(polygonArr){
  2822. var drawKV = {} ;
  2823. for(var transfer in polygonArr){
  2824. var pId = wg.addPolyLine(polygonArr[transfer]["layerName"],polygonArr[transfer]["points"],polygonArr[transfer]["lineStyle"],polygonArr[transfer]["extraData"]) ;
  2825. drawKV = addJsonAttribute(drawKV,pId,polygonArr[transfer]["extraData"]);
  2826. };
  2827. return drawKV ;
  2828. }
  2829. /**
  2830. * 批量添加图标,返回ID与FD_ID健值对
  2831. * @param
  2832. */
  2833. function addUserDrawByIcon(polygonArr){
  2834. var drawKV = {} ;
  2835. for(var transfer in polygonArr){
  2836. var pId = wg.addMarker(polygonArr[transfer]) ;
  2837. drawKV = addJsonAttribute(drawKV,pId,polygonArr[transfer]["extraData"]["inciId"]);
  2838. };
  2839. return drawKV ;
  2840. } ;
  2841. //=========================================================================================================================
  2842. function trunDrawLine(ids){
  2843. var url ="/nwyj/ws/cockpit/CockpitService/getDrawPoints" ;//批量添加自定义线形图到参数信息存储表
  2844. var params = "" ;
  2845. for(var key in ids){
  2846. params += ids[key] + "," ;
  2847. }
  2848. if(params.length > 1)
  2849. params = params.substring(0, params.length-1) ;
  2850. var params = { "ids" : params } ;
  2851. return getJsonData(url,params) ;
  2852. // var pathA = {} ;
  2853. // var pathB = {} ;
  2854. //
  2855. //
  2856. // var trunErpathLine = [{"layerName":lay1,"points":pathA,"lineStyle":lineStyle2,"title":"路径A"},
  2857. // {"layerName":lay1,"points":pathB,"lineStyle":lineStyle2,"title":"路径B"}] ;
  2858. // addResourcePath(erpathA) ;//显示路径
  2859. }
  2860. //=========================================================================================================================
  2861. /**
  2862. * 应急预警与响应查询事件
  2863. */
  2864. function searchEwer(paramsEw,paramsEr,changeGridEw,changeGridEr){
  2865. closeEmergencyearlywarningandresponse();
  2866. var pointPre = [] ;
  2867. // Emergencyearlywarningandresponse(paramsEw,paramsEr) ;
  2868. //应急预警查询
  2869. var url ="/nwyj/ws/cockpit/CockpitService/getEwMarker";
  2870. pointPre = pointPre.concat(searchMarkerToEwer(url,paramsEw,true,ewer_lay2)) ;
  2871. //应急响应查询(地市级)
  2872. url ="/nwyj/ws/cockpit/CockpitService/getErMarker";
  2873. pointPre = pointPre.concat(searchMarkerToEwer(url,paramsEr,true,ewer_lay2)) ;
  2874. if(pointPre.length != 0){
  2875. zoomToCoordList(pointPre) ;
  2876. } else {
  2877. // alert("没有相关数据") ;
  2878. ai.setMes(320, 186, 200, 500, "系统提示", "没有相关数据");
  2879. ai.createAlert();
  2880. }
  2881. addEMMarkerEvent();
  2882. page_0.window.searchEw(changeGridEw) ;
  2883. page_1.window.searchEr(changeGridEr) ;
  2884. } ;
  2885. /**
  2886. * 线路跳闸与变电站停运查询事件
  2887. */
  2888. function searchLtSo(lttParams, ltfParams, sotParams, sofParams,gridParams,lostParams){
  2889. HighlightPSRs();
  2890. removeCustomButton();
  2891. Linetrippingandsubstation(lttParams, ltfParams, sotParams, sofParams) ;
  2892. page_0.window.searchLt(gridParams) ;
  2893. page_2.window.searchLost(lostParams) ;
  2894. } ;
  2895. /**
  2896. * 应急资源标注查询
  2897. * @param params
  2898. */
  2899. function searchErCount(params){
  2900. closeemergencyresource();
  2901. var erUnitID = $("#unitIdByEr").attr("relValue") ;
  2902. var erTypeID = $("#erTypeID").val();
  2903. var beginTime = $("#beginTimeByEr").attr("value") ;
  2904. var endTime = $("#endTimeByEr").attr("value") ;
  2905. if(beginTime != "" && endTime == "")
  2906. endTime = getNowFormatDate(allGetServerTime()) ;
  2907. if(beginTime == "" && endTime != ""){
  2908. alert("请选择开始时间") ;
  2909. }
  2910. if(beginTime == "" && endTime == ""){
  2911. var date = allGetServerTime() ;
  2912. beginTime = getThreeMonthsAgo(getNowFormatDate(date)) ;
  2913. endTime = getNowFormatDate(allGetServerTime()) ;
  2914. }
  2915. if(!erUnitID){
  2916. erUnitID = deptId ;
  2917. }
  2918. var params = {classid : erTypeID, unitId : erUnitID, startDate : beginTime, endDate : endTime} ;
  2919. var url ="/nwyj/ws/cockpit/CockpitService/queryErMarker" ;
  2920. erFlagPref = getJsonData(url,params) ;
  2921. if(erFlagPref){
  2922. erFlagProv = {} ;
  2923. var posXArr = [] ;
  2924. var posYArr = [] ;
  2925. for(var key in erFlagPref){
  2926. posXArr.push(erFlagPref[key]["x"]) ;
  2927. posYArr.push(erFlagPref[key]["y"]) ;
  2928. }
  2929. var radiu = zoomToExtent(posXArr,posYArr) ;
  2930. var rad = getErRadius(radiu) ;
  2931. drawResource(erFlagPref,1,rad["ra"],rad["ds"]) ;//####
  2932. wg.addEvent("onMapExtentChanged",mapChanged);
  2933. // drawResource(res,1,600,1) ;//####
  2934. } else {
  2935. // alert("没有相关数据") ;
  2936. ai.setMes(320, 186, 200, 500, "系统提示", "没有相关数据");
  2937. ai.createAlert();
  2938. } ;
  2939. } ;
  2940. /**
  2941. * 定位到指定区域
  2942. * @param posXArr X坐标数组
  2943. * @param posYArr Y坐标数组
  2944. * @returns 地图当前缩放等级
  2945. */
  2946. function zoomToExtent(posXArr,posYArr){
  2947. var maxX = Math.max.apply(Math,posXArr) + 0.5;
  2948. var minX = Math.min.apply(Math,posXArr) - 0.5;
  2949. var maxY = Math.max.apply(Math,posYArr) + 0.5;
  2950. var minY = Math.min.apply(Math,posYArr) - 0.5;
  2951. wg.zoomToExtent(minX,minY,maxX,maxY) ;
  2952. return wg.getCurrentZoomLevel() ;
  2953. }
  2954. /**
  2955. * 应急资源标各级显示半径
  2956. * @param zoomLevel
  2957. * @returns
  2958. */
  2959. function getErRadius(zoomLevel){
  2960. var zl = Math.floor(zoomLevel) ;
  2961. var raiusDs = {5 :{ra:90000,ds:170}, 6 :{ra:40000,ds:80}, 7 :{ra:30000,ds:60},
  2962. 8 :{ra:12000,ds:25} , 9 :{ra:6000,ds:11} , 10:{ra:3000,ds:6} ,
  2963. 11:{ra:1500 ,ds:2.7}, 12:{ra:1000,ds:1.7}, 13:{ra:500,ds:0.9} ,
  2964. 14:{ra:300 ,ds:0.5}, 15:{ra:200 ,ds:0.3}, 16:{ra:90,ds:0.15} ,
  2965. 17:{ra:60 ,ds:0.1}} ;
  2966. return raiusDs[zl] ;
  2967. }
  2968. /*$(function(){
  2969. // var lazyheight = 0;
  2970. //获取数据
  2971. function showload(){
  2972. alert("KKKKKKKKKKK") ;
  2973. lazyheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
  2974. if ($(document).height()-100 <= lazyheight) {
  2975. alert("xxx");
  2976. }
  2977. }
  2978. //showload();
  2979. //绑定事件
  2980. $(window).bind("scroll", function(){
  2981. //当滚动条滚动时
  2982. showload();
  2983. });
  2984. }) ;*/
  2985. /**
  2986. * 得到日期类型时间yyyy-mm-dd hh:mm:ss
  2987. * @returns {String}
  2988. */
  2989. function getNowFormatDate(date){
  2990. var month = date.getMonth() + 1 ;
  2991. if(month<10)
  2992. month = "0" + month ;
  2993. var day = date.getDate() ;
  2994. if(day<10)
  2995. day = "0" + day ;
  2996. var hours = date.getHours() ;
  2997. if(hours<10)
  2998. hours = "0" + hours ;
  2999. var minutes = date.getMinutes() ;
  3000. if(minutes<10)
  3001. minutes = "0" + minutes ;
  3002. var seonds = date.getSeconds() ;
  3003. if(seonds<10)
  3004. seonds = "0" + seonds ;
  3005. return date.getFullYear() + "-" + month + "-" + day + " " +
  3006. hours + ":" + minutes + ":" + seonds ;
  3007. } ;
  3008. /**
  3009. * 得到3个月前的日期类型时间yyyy-mm-dd hh:mm:ss
  3010. * @returns {String}
  3011. */
  3012. function getThreeMonthsAgo(date){
  3013. var now = new Date(date.replace(/\-/g,"/"));
  3014. var tmya =new Date( now.setMonth(now.getMonth() - 3));
  3015. return getNowFormatDate(tmya) ;
  3016. } ;
  3017. /**
  3018. * 得到部门下的省级或地级部门
  3019. * @returns
  3020. */
  3021. function getSubDept(userDeptID){
  3022. var url ="/nwyj/ws/cockpit/CockpitService/querySubDept";
  3023. // var params = { unitId:'1' } ;
  3024. var params = { unitId:userDeptID } ;
  3025. return getJsonData(url,params) ;
  3026. }
  3027. //===========================================================================================================================
  3028. function addRightDraw(objKV){
  3029. var menuArra = [{ "Key": "1","Name": "隐藏"},
  3030. // { "Key": "1","Name": "隐藏","SubMenus": [ { "Key": "1-1","Name": "全图" } ]},
  3031. { "Key": "2","Name": "删除"}];
  3032. var funArra ;
  3033. for(var key in objKV){
  3034. // alert("key:" + key + " value:" + objKV[key]) ;
  3035. funArra = [{"key":"1",fun:"hideDraw(\"" + key + "\")"},{"key":"2",fun:"delDraw(\"" + objKV[key] + "\",\"" + key + "\")"}] ;
  3036. wg.addContextMenu(lay3,menuArra,funArra,key);
  3037. }
  3038. }
  3039. function hideDraw(drawId){
  3040. setTimeout(function hideShape(){
  3041. removeShape(drawId) ;
  3042. },10) ;
  3043. }
  3044. function delDraw(fd_id, drawId){
  3045. setTimeout(function delShape(){
  3046. var url ="/nwyj/ws/cockpit/CockpitService/delDrawUserDefined";
  3047. var res = getStrData(url,fd_id) ;
  3048. if(res=="true"){
  3049. removeShape(drawId) ;
  3050. }
  3051. },10) ;
  3052. }
  3053. function removeShape(drawId){
  3054. wg.removeShape(drawId) ;
  3055. }
  3056. //单击
  3057. function clickUserDraw(e){
  3058. wg.removeShape(e["shapeID"]) ;
  3059. }
  3060. //=========================================================== SearchToewer ====================================================
  3061. var deptId = "" ;
  3062. $(function(){
  3063. var userInfo=top.conditionJson;
  3064. var yjIncidentUrl = "/nwyj/ws/cockpit/CockpitService/queryYjIncident" ;
  3065. $.post(yjIncidentUrl,function(data){
  3066. $("#erewInci").data("data", data) ;
  3067. $("#erewInci").render() ;
  3068. $("#teamInci").data("data", data) ;
  3069. $("#teamInci").attr("selectedValue",data["treeNodes"]["0"]["id"]);
  3070. $("#teamInci").render() ;
  3071. changeTameSelect(data["treeNodes"]["0"]["id"]) ;
  3072. }, "json") ;
  3073. var deptUrl="/nwyj/ws/orgInDeptService/OrgInDeptService/getDeptRootById";
  3074. $("#unitId").attr('params','{"id":"' + userInfo["dept_id"] + '"}');
  3075. //异步加载请求地址
  3076. $("#unitId").attr('url',deptUrl);
  3077. $.post(deptUrl, {"deptId" : userInfo["dept_id"]}, function(data) {
  3078. for(var key in data["treeNodes"]){
  3079. deptId += data["treeNodes"][key]["id"] + "," ;
  3080. }
  3081. deptId = deptId.substring(0, deptId.length-1) ;
  3082. $("#unitId").data("data", data);
  3083. $("#unitId").render();
  3084. $("#unitIdByEr").data("data", data);
  3085. $("#unitIdByEr").render();
  3086. }, "json");
  3087. }) ;
  3088. /**
  3089. * 应急预警与响应查询面板
  3090. */
  3091. function searchEwerClick(){
  3092. var conditionEw = " 1=1 and IS_DEL='0' and is_alert = '0' and is_send = '5' " ;
  3093. var conditionEr = " 1=1 and IS_DEL='0' and is_alert = '1' and is_send = '5' " ;
  3094. var temp = "" ;
  3095. var unitId = $("#unitId").attr("relValue") ;
  3096. var incidentType = $("#erewInci").attr("relText") ;
  3097. var incidentLevel = $("#incidentLevel").attr("relValue") ;
  3098. var beginTime = $("#beginTime").attr("value") ;
  3099. var endTime = $("#endTime").attr("value") ;
  3100. if(unitId){
  3101. temp = getOneSqlWhere("RELEASE_UNIT",unitId) ;
  3102. conditionEw += temp ;
  3103. conditionEr += temp ;
  3104. } else {
  3105. unitId = deptId ;
  3106. }
  3107. if(incidentType == "请选择"){
  3108. incidentType = "" ;
  3109. } else {
  3110. temp = getOneSqlWhereLike("EARLY_WARNING_NAME",incidentType) ;
  3111. conditionEw += temp ;
  3112. conditionEr += temp ;
  3113. }
  3114. if(beginTime == "" && endTime != ""){
  3115. alert("请选择开始时间!") ;
  3116. return ;
  3117. }
  3118. if(beginTime != "" && endTime == ""){
  3119. endTime = getNowFormatDate(allGetServerTime()) ;
  3120. }
  3121. if(beginTime != "" && endTime != ""){
  3122. temp = " and RELEASE_RELIEVE_DATE BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  3123. conditionEw += temp ;
  3124. conditionEr += temp ;
  3125. }
  3126. var ewLevel = '';
  3127. var erLevel = '';
  3128. if(incidentLevel==1){
  3129. ewLevel = '35' ;
  3130. erLevel = '29' ;
  3131. } else if (incidentLevel==2){
  3132. ewLevel = '36' ;
  3133. erLevel = '30' ;
  3134. } else if (incidentLevel==3){
  3135. ewLevel = '37' ;
  3136. erLevel = '31' ;
  3137. } else if (incidentLevel==4){
  3138. ewLevel = '38' ;
  3139. erLevel = '32' ;
  3140. }
  3141. if(incidentLevel != ""){
  3142. temp = getOneSqlWhere("CURRENT_EW_LEVEL",ewLevel) ;
  3143. conditionEw += temp ;
  3144. temp = getOneSqlWhere("CURRENT_ER_LEVEL",erLevel) ;
  3145. conditionEr += temp ;
  3146. }
  3147. var paramsEw = {
  3148. RELEASE_UNIT : unitId,//单位
  3149. BM_EMC_WarningName : incidentType,//事件类型
  3150. LEVEL : ewLevel,//级别
  3151. BEGINTIME : beginTime,//开始时间
  3152. ENDTIME : endTime //截止时间
  3153. } ;
  3154. var paramsEr = {
  3155. RELEASE_UNIT : unitId,//单位
  3156. BM_EMC_WarningName : incidentType,//事件类型
  3157. LEVEL : erLevel,//级别
  3158. BEGINTIME : beginTime,//开始时间
  3159. ENDTIME : endTime //截止时间
  3160. } ;
  3161. var changeGridEw = { "listId" : '365', "condition" : conditionEw };
  3162. var changeGridEr = { "listId" : '365', "condition" : conditionEr };
  3163. searchEwer(paramsEw,paramsEr,changeGridEw,changeGridEr);
  3164. // window.parent.window.searchEwer(paramsEw,paramsEr,changeGridEw,changeGridEr) ;
  3165. } ;
  3166. var dateSkin="blue";
  3167. function initComplete(){
  3168. //绑定应急事件下拉框change事件
  3169. $("#teamInci").bind("change",function(){
  3170. changeTameSelect($(this).attr("relValue")) ;
  3171. }) ;
  3172. //获取当前主题风格,用于设置日期控件的皮肤
  3173. try {
  3174. dateSkin=themeColor;
  3175. }catch(e){}
  3176. //自定义点击触发日期控件
  3177. document.getElementById('beginTime').onfocus=function(){
  3178. var endtimeTf=$dp.$('endTime');
  3179. WdatePicker({
  3180. skin:dateSkin,onpicked:function(){endtimeTf.focus();},maxDate:'#F{$dp.$D(\'endTime\')}'
  3181. });
  3182. } ;
  3183. document.getElementById('endTime').onfocus=function(){
  3184. //这里设置了最大日期为当前日期,如果不需要则把maxDate:'%y-%M-%d'去掉
  3185. WdatePicker({skin:dateSkin,minDate:'#F{$dp.$D(\'beginTime\')}'});
  3186. };
  3187. document.getElementById('beginTimeByEr').onfocus=function(){
  3188. var endtimeTf=$dp.$('endTimeByEr');
  3189. WdatePicker({
  3190. skin:dateSkin,onpicked:function(){endtimeTf.focus();},maxDate:'#F{$dp.$D(\'endTimeByEr\')}'
  3191. });
  3192. } ;
  3193. document.getElementById('endTimeByEr').onfocus=function(){
  3194. //这里设置了最大日期为当前日期,如果不需要则把maxDate:'%y-%M-%d'去掉
  3195. WdatePicker({skin:dateSkin,minDate:'#F{$dp.$D(\'beginTimeByEr\')}'});
  3196. };
  3197. } ;
  3198. ///**
  3199. // * 得到日期类型时间yyyy-mm-dd hh:mm:ss
  3200. // * @returns {String}
  3201. // */
  3202. //function getNowFormatDate(){
  3203. // var date = allGetServerTime() ;
  3204. //
  3205. // return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " +
  3206. // date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() ;
  3207. //} ;
  3208. ///**
  3209. // * 得到日期类型时间yyyy-mm-dd hh:mm:ss
  3210. // * @returns {String}
  3211. // */
  3212. //function getNowFormatDate(date){
  3213. // var month = date.getMonth() + 1 ;
  3214. // if(month<10)
  3215. // month = "0" + month ;
  3216. //
  3217. // var day = date.getDate() ;
  3218. // if(day<10)
  3219. // day = "0" + day ;
  3220. // var hours = date.getHours() ;
  3221. // if(hours<10)
  3222. // hours = "0" + hours ;
  3223. // var minutes = date.getMinutes() ;
  3224. // if(minutes<10)
  3225. // minutes = "0" + minutes ;
  3226. // var seonds = date.getSeconds() ;
  3227. // if(seonds<10)
  3228. // seonds = "0" + seonds ;
  3229. //
  3230. // return date.getFullYear() + "-" + month + "-" + day + " " +
  3231. // hours + ":" + minutes + ":" + seonds ;
  3232. //} ;
  3233. /**
  3234. * 得到单个sql精确查询条件
  3235. * @param colum
  3236. * @param value
  3237. * @return
  3238. */
  3239. function getOneSqlWhere(colum, value){
  3240. var valueArr = value.split(",") ;
  3241. var result = " and (" ;
  3242. for(var i = 0 ; i < valueArr.length ; i++){
  3243. result += ( colum + " = '" + valueArr[i] + "' or ") ;
  3244. }
  3245. result = result.substring(0, result.length - 3) ;
  3246. result += ")" ;
  3247. return result ;
  3248. } ;
  3249. /**
  3250. * 得到单个sql模糊查询条件
  3251. * @param colum
  3252. * @param value
  3253. * @return
  3254. */
  3255. function getOneSqlWhereLike(colum,value){
  3256. var valueArr = value.split(",") ;
  3257. var result = " and (" ;
  3258. for(var i = 0 ; i < valueArr.length ; i++){
  3259. result += ( colum + " like '%" + valueArr[i] + "%' or ") ;
  3260. }
  3261. result = result.substring(0, result.length-3) ;
  3262. result += ")" ;
  3263. return result ;
  3264. } ;
  3265. //============================================================= SearchToewer.js END ===============================================
  3266. //============================================================= Er_drawTool.js Start ==============================================
  3267. $(function(){
  3268. var yjIncidentUrl = "/nwyj/ws/cockpit/CockpitService/queryYjIncidentByRadio" ;
  3269. $.post(yjIncidentUrl,function(data){
  3270. $("#inic").data("data", data) ;
  3271. $("#inic").attr("selectedValue",data["list"]["0"]["value"]);
  3272. $("#inic").render() ;
  3273. }, "json") ;
  3274. });
  3275. /**
  3276. * 保存
  3277. * @returns
  3278. */
  3279. function erSave(){
  3280. var inicID = $("#inic").attr("relValue") ;
  3281. if(!inicID){
  3282. alert("请选择事件名称") ;
  3283. } else {
  3284. saveDraw(inicID) ;
  3285. // window.parent.window.saveDraw(inicID) ;//分类存储
  3286. // window.parent.window.saveDrawByUser(inicID) ;//以图层整体进行存储
  3287. // window.parent.window.importDrawByUser(inicID) ;//导入图层
  3288. } ;
  3289. } ;
  3290. /**
  3291. * 根据事件查看用户自定义图形
  3292. */
  3293. function showDraw(){
  3294. var inicID = $("#inic").attr("relValue") ;
  3295. if(!inicID){
  3296. alert("请选择事件名称") ;
  3297. } else {
  3298. var inicID = $("#inic").attr("relValue") ;
  3299. searchDrawByUserInfo(inicID) ;
  3300. // window.parent.window.searchDrawByUserInfo(inicID) ;
  3301. }
  3302. }
  3303. //============================================================= Er_drawTool.js END ================================================
  3304. //============================================================= SearchToteam.js Start =============================================
  3305. $(function(){
  3306. //轨迹回放
  3307. $("#roadHistory").click(function(){
  3308. var inciId = $("#teamInci").attr("relValue") ;
  3309. var teamId = $("#teamByInci").attr("relValue") ;
  3310. var beginTime = $("#beginTime").attr("value") ;
  3311. var endTime = $("#endTime").attr("value") ;
  3312. if(beginTime != "" && endTime == "")
  3313. endTime = getNowFormatDate() ;
  3314. if(beginTime == "" && endTime != ""){
  3315. alert("请选择开始时间") ;
  3316. } else {
  3317. if(beginTime == "" && endTime == ""){
  3318. beginTime = getNowFormatDate(allGetServerTime());
  3319. beginTime = getThreeMonthsAgo(beginTime) ;
  3320. endTime = getNowFormatDate(allGetServerTime()) ;
  3321. var params = { inci : inciId, teamid : teamId, beginTime : beginTime, endTime : endTime } ;
  3322. // window.parent.window.roadHistory(params) ;
  3323. roadHistory(params) ;
  3324. } else {
  3325. var params = { inci : inciId, teamid : teamId, beginTime : beginTime, endTime : endTime } ;
  3326. // window.parent.window.roadHistory(params) ;
  3327. roadHistory(params) ;
  3328. }
  3329. }
  3330. });
  3331. }) ;
  3332. function searchErTeam(){
  3333. var inci = $("#teamInci").attr("relValue") ;
  3334. window.parent.window.searchErTeam(inci) ;
  3335. } ;
  3336. /**
  3337. * 针对事件下拉复选框改变应急队伍选择框
  3338. */
  3339. function changeTameSelect(inciIds){
  3340. var tameUrl = "/nwyj/ws/cockpit/CockpitService/queryTeamByInci" ;
  3341. // var tameUrl = "/nwyj/ws/cockpit/CockpitService/queryYjIncidentByRadio" ;
  3342. var params = { teaminciId:inciIds } ;
  3343. $.post(tameUrl,params,function(data){
  3344. if(data){
  3345. $("#teamByInci").data("data", data) ;
  3346. $("#teamByInci").render() ;
  3347. } else {
  3348. $("#teamByInci").data("data", data) ;
  3349. $("#teamByInci").render() ;
  3350. }
  3351. },"json") ;
  3352. }
  3353. /**
  3354. * @author jyf
  3355. * @version 1.0
  3356. * @Date 2015-09-23
  3357. * @param 经纬度坐标转换为墨卡托投影下的坐标
  3358. */
  3359. function lonlat2mercator(x1,y1,x2,y2){
  3360. var lonlat = [x1,y1,x2,y2];
  3361. var Mx1 = lonlat[0] *20037508.34/180;
  3362. var My1 = Math.log(Math.tan((90+lonlat[1])*Math.PI/360))/(Math.PI/180);
  3363. My1 = My1 *20037508.34/180;
  3364. var Mx2 = lonlat[2] *20037508.34/180;
  3365. var My2 = Math.log(Math.tan((90+lonlat[3])*Math.PI/360))/(Math.PI/180);
  3366. My2 = My2 *20037508.34/180;
  3367. MercatorX1=Mx1;
  3368. MercatorY1=My1;
  3369. MercatorX2=Mx2;
  3370. MercatorY2=My2;
  3371. };
  3372. /**
  3373. * @author jyf
  3374. * @version 1.0
  3375. * @Date 2015-09-23
  3376. * @param 计算转换为墨卡托投影下两点之间的距离
  3377. */
  3378. function scalcRegan(x1,y1,x2,y2)
  3379. {
  3380. var lat = [x1, y1];
  3381. var lng = [x2, y2];
  3382. MercatorRange=(Math.sqrt((lat[0]-lng[0])*(lat[0]-lng[0])+(lat[1]-lng[1])*(lat[1]-lng[1])))/1000;
  3383. };