map.js.bak.ypxy20200819 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680
  1. /**
  2. * map.js
  3. */
  4. Ext.Loader.setConfig({
  5. enabled: true
  6. });
  7. Ext.Loader.setPath('Ext.ux', '../../res/extjs/examples/ux');
  8. Ext.require([
  9. 'Ext.grid.*',
  10. 'Ext.data.*',
  11. 'Ext.ux.RowExpander',
  12. 'Ext.selection.CheckboxModel'
  13. ]);
  14. var sm = Ext.create('Ext.selection.CheckboxModel');
  15. var myMask;
  16. var baseUrl = "";
  17. var theme = "";
  18. var mapStyle = "";
  19. var map;
  20. var mapzoom = 11;
  21. var company_cur = 0;
  22. var StatusStore=null,AlarmStore=null;
  23. var firstDraw = true;
  24. var storeTime = 60000;
  25. var centerLng = 121.475644;
  26. var currentLng = 121.475644;
  27. var centerLat = 31.1857;
  28. var currentLat = 31.1857;
  29. var rotation = 0;
  30. var alarm_show_window=null;
  31. var show_alarm_list;
  32. var show_list_cur=0
  33. var V_LOGINNAME='',V_PASSWORD='';
  34. var listSync=true;
  35. var synctime = 0;
  36. var company_code = '';
  37. var start=0;
  38. var end = 360;
  39. var targetZoom = 20;
  40. var maxHeight = 10000;
  41. var maxWidth = 10000;
  42. var SearchList = null;
  43. var markers = [];
  44. var current_company_code="";
  45. var LabelShow = false;
  46. var MapShow = false;
  47. var last_move;
  48. var wsUri = "wss://iot.usky.cn:55120";
  49. var websocket = null;
  50. var win1_config={
  51. title:'<table border=0><tr><td style="width:100px;overflow:hidden">火灾监控</td><td id="win1-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-12" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-11"></span></td></tr></table>',
  52. titleColor:'#ffffff',
  53. titleIconColor:'#ffffff',
  54. titleBackgroundColor:'rgba(0,0,0,0.1)',
  55. backgroundColor: 'rgba(23,21,57,0.2)',
  56. backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
  57. border: '1px solid rgba(0,123,255,0.3)',
  58. borderRadius:'10px',
  59. position:'absolute',
  60. width:320,
  61. height:120,
  62. top:100,
  63. left:50,
  64. zIndex:200,
  65. bodyText:'<div id="win1" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_1" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_fireAlarm()"></td></tr><tr><td id="data_label_11" class="data_bar_total_label" style="width:80px;" onclick="show_all_fireAlarm()">报告总数</td><td id="data_number_11" class="data_bar_total_number" style="width:100px;" onclick="show_all_fireAlarm()"></td></tr><tr><td id="data_label_12" class="data_bar_alarm_label" onclick="show_all_fireAlarm()">待处理</td><td id="data_number_12" class="data_bar_alarm_number" onclick="show_all_fireAlarm()"></td></tr></table></div>'
  66. }
  67. var win2_config={
  68. title:'<table border=0><tr><td style="width:100px;overflow:hidden">电气火灾监控</td><td id="win2-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-22" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-21"></span></td></tr></table>',
  69. titleColor:'#ffffff',
  70. titleIconColor:'#ffffff',
  71. titleBackgroundColor:'rgba(0,0,0,0.1)',
  72. backgroundColor: 'rgba(23,21,57,0.2)',
  73. backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
  74. border: '1px solid rgba(0,123,255,0.3)',
  75. borderRadius:'10px',
  76. position:'absolute',
  77. width:320,
  78. height:120,
  79. top:260,
  80. left:50,
  81. zIndex:260,
  82. bodyText:'<div id="win2" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_2" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_efireAlarm()"></td></tr><tr><td id="data_label_21" class="data_bar_total_label" style="width:80px;" onclick="show_all_efireAlarm()">报告总数</td><td id="data_number_21" class="data_bar_total_number" style="width:100px;" onclick="show_all_efireAlarm()"></td></tr><tr><td id="data_label_22" class="data_bar_alarm_label" onclick="show_all_efireAlarm()">待处理</td><td id="data_number_22" class="data_bar_alarm_number" onclick="show_all_efireAlarm()"></td></tr></table></div>'
  83. }
  84. var win3_config={
  85. title:'<table border=0><tr><td style="width:100px;overflow:hidden">水系统监控</td><td id="win3-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-32" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-31"></span></td></tr></table>',
  86. titleColor:'#ffffff',
  87. titleIconColor:'#ffffff',
  88. titleBackgroundColor:'rgba(0,0,0,0.1)',
  89. backgroundColor: 'rgba(23,21,57,0.2)',
  90. backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
  91. border: '1px solid rgba(0,123,255,0.3)',
  92. borderRadius:'10px',
  93. position:'absolute',
  94. width:320,
  95. height:120,
  96. top:420,
  97. left:50,
  98. zIndex:260,
  99. bodyText:'<div id="win3" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_3" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_waterAlarm()"></td></tr><tr><td id="data_label_31" class="data_bar_total_label" style="width:80px;" onclick="show_all_waterAlarm()">报告总数</td><td id="data_number_31" class="data_bar_total_number" style="width:100px;" onclick="show_all_waterAlarm()"></td></tr><tr><td id="data_label_32" class="data_bar_alarm_label" onclick="show_all_waterAlarm()">待处理</td><td id="data_number_32" class="data_bar_alarm_number" onclick="show_all_waterAlarm()"></td></tr></table></div>'
  100. }
  101. var win4_config={
  102. title:'<table border=0><tr><td style="width:100px;overflow:hidden">RTU监控</td><td id="win4-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-42" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-41"></span></td></tr></table>',
  103. titleColor:'#ffffff',
  104. titleIconColor:'#ffffff',
  105. titleBackgroundColor:'rgba(0,0,0,0.1)',
  106. backgroundColor: 'rgba(23,21,57,0.2)',
  107. backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
  108. border: '1px solid rgba(0,123,255,0.3)',
  109. borderRadius:'10px',
  110. position:'absolute',
  111. width:320,
  112. height:120,
  113. top:580,
  114. left:50,
  115. zIndex:260,
  116. bodyText:'<div id="win4" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_4" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_rtuAlarm()"></td></tr><tr><td id="data_label_41" class="data_bar_total_label" style="width:80px;" onclick="show_all_rtuAlarm()">报告总数</td><td id="data_number_41" class="data_bar_total_number" style="width:100px;" onclick="show_all_rtuAlarm()"></td></tr><tr><td id="data_label_42" class="data_bar_alarm_label" onclick="show_all_rtuAlarm()">待处理</td><td id="data_number_42" class="data_bar_alarm_number" onclick="show_all_rtuAlarm()"></td></tr></table></div>'
  117. }
  118. var dev1_config={
  119. title:'<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">火灾监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev1_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev1-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev1-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
  120. titleColor:'#ffffff',
  121. titleIconColor:'#ffffff',
  122. titleBackgroundColor:'rgba(0,0,0,0.1)',
  123. backgroundColor: 'rgba(23,21,57,0.2)',
  124. backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
  125. border: '1px solid rgba(0,123,255,0.3)',
  126. borderRadius:'10px',
  127. position:'absolute',
  128. width:320,
  129. height:100,
  130. top:219,
  131. left:50,
  132. zIndex:200,
  133. floding:'true',
  134. bodyText:'<div id="dev1" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px"><tr><td>已处理:</td><td id="device_count_num_12" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_13" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_14" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_fireDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_14" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
  135. }
  136. var dev2_config={
  137. title:'<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">电气火灾监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev2_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev2-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev2-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
  138. titleColor:'#ffffff',
  139. titleIconColor:'#ffffff',
  140. titleBackgroundColor:'rgba(0,0,0,0.1)',
  141. backgroundColor: 'rgba(23,21,57,0.2)',
  142. backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
  143. border: '1px solid rgba(0,123,255,0.3)',
  144. borderRadius:'10px',
  145. position:'absolute',
  146. width:320,
  147. height:100,
  148. top:379,
  149. left:50,
  150. zIndex:200,
  151. floding:'true',
  152. bodyText:'<div id="dev2" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px"><tr><td>已处理:</td><td id="device_count_num_22" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_23" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_24" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_efireDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_24" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
  153. }
  154. var dev3_config={
  155. title:'<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">水系统监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev3_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev3-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev3-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
  156. titleColor:'#ffffff',
  157. titleIconColor:'#ffffff',
  158. titleBackgroundColor:'rgba(0,0,0,0.1)',
  159. backgroundColor: 'rgba(23,21,57,0.2)',
  160. backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
  161. border: '1px solid rgba(0,123,255,0.3)',
  162. borderRadius:'10px',
  163. position:'absolute',
  164. width:320,
  165. height:100,
  166. top:539,
  167. left:50,
  168. zIndex:200,
  169. floding:'true',
  170. bodyText:'<div id="dev3" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px"><tr><td>已处理:</td><td id="device_count_num_32" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_33" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_34" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_waterDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_34" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
  171. }
  172. var dev4_config={
  173. title:'<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">RTU监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev4_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev4-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev4-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
  174. titleColor:'#ffffff',
  175. titleIconColor:'#ffffff',
  176. titleBackgroundColor:'rgba(0,0,0,0.1)',
  177. backgroundColor: 'rgba(23,21,57,0.2)',
  178. backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
  179. border: '1px solid rgba(0,123,255,0.3)',
  180. borderRadius:'10px',
  181. position:'absolute',
  182. width:320,
  183. height:100,
  184. top:699,
  185. left:50,
  186. zIndex:200,
  187. floding:'true',
  188. bodyText:'<div id="dev4" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px;"><tr><td>已处理:</td><td id="device_count_num_42" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_43" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_44" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_rtuDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_44" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
  189. }
  190. var alarm_alert_config={
  191. title:'<table border=0 style="width:320px;"><tr><td id="rt_alarm_alert_icon" style="width:24px;height:24px;"></td><td><span id="rt_alarm_alert_title" style="text-align:right;margin-left:10px;font-widght:bold;color:#31e9ff;overflow:hidden;"></span></td><td style="width:32px;color:#ffffff;cursor:pointer;text-align:left;" onclick="close_alert()"><div style="width:16px;height:16px;background-image:url(../../res/img/common/close-tmp.gif)"></div></td></tr></table>',
  192. titleColor:'#ffffff',
  193. titleIconColor:'#ffffff',
  194. titleBackgroundColor:'rgba(0,0,0,0.1)',
  195. backgroundColor: 'rgba(23,21,57,0.2)',
  196. backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
  197. border: '1px solid #31e9ff',
  198. borderRadius:'10px',
  199. position:'absolute',
  200. width:320,
  201. height:120,
  202. bottom:-100,
  203. right:95,
  204. zIndex:990,
  205. bodyText:'<div><table border="0" style="border:0px solid #31e9ff;margin:5px;font-size:9px;color:#ffffff"><tr><td colspan=2 style="height:20px;"><div id="alarm_time" style="margin-top:3px;"></div><div id="alarm_company" style="margin-top:3px;"></div><div id="alarm_device" style="margin-top:3px;"></div></td></tr></table></div>'
  206. }
  207. var close_alert = function(){
  208. removeDIV("rt_alarm_alert");
  209. }
  210. var initWebSocket = function() {
  211. try{
  212. if(typeof MozWebSocket == 'function')
  213. WebSocket =MozWebSocket;
  214. if( websocket && websocket.readyState == 1)
  215. websocket.close();
  216. websocket = new WebSocket(wsUri);
  217. websocket.onopen = function(evt){
  218. var json = {};
  219. json.agentid = $("#V_LOGINNAME").val();
  220. console.log("Connected.");
  221. (function(){})()
  222. websocket.send(JSON.stringify(json));
  223. };
  224. websocket.onclose = function(evt){
  225. console.log("DisConnected.");
  226. (function(){})()
  227. initWebSocket();
  228. };
  229. websocket.onmessage = function(evt){
  230. console.log("Received:",evt.data);
  231. var jData = eval('(' + evt.data + ')');
  232. if(jData.dwtype!=undefined){
  233. if(document.getElementById('rt_alarm_alert')!=undefined)
  234. removeDIV('rt_alarm_alert');
  235. var alarm_alert= new UNote();
  236. alarm_alert.create("rt_alarm_alert","container",alarm_alert_config);
  237. var Icon = document.createElement('img');
  238. Icon.width='32';
  239. Icon.height='32';
  240. Icon.src="../../res/img/icons/alarm_tab_04.gif"
  241. if(jData.detype==1){
  242. Icon.src="../../res/img/icons/alarm_tab_01.gif"
  243. }else if(jData.dwtype==2){
  244. Icon.src="../../res/img/icons/alarm_tab_03.gif"
  245. }else if(jData.dwtype==6){
  246. Icon.src="../../res/img/icons/alarm_tab_04.gif"
  247. }else if(jData.dwtype==7){
  248. Icon.src="../../res/img/icons/alarm_tab_02.gif"
  249. }else if(jData.dwtype==16){
  250. Icon.src="../../res/img/icons/alarm_tab_05.gif"
  251. }
  252. document.getElementById("rt_alarm_alert_icon").innerHTML="";
  253. document.getElementById("rt_alarm_alert_icon").appendChild(Icon);
  254. document.getElementById("rt_alarm_alert_title").innerHTML=jData.evtname;
  255. document.getElementById("alarm_time").innerHTML=jData.time;
  256. document.getElementById("alarm_company").innerHTML=jData.company;
  257. document.getElementById("alarm_device").innerHTML=jData.devicename;
  258. alarm_alert.show();
  259. $("#rt_alarm_alert").animate({
  260. bottom:'0px'
  261. });
  262. }
  263. };
  264. websocket.onerror = function(evt){
  265. console.log("Error:",evt.data);
  266. (function(){})()
  267. };
  268. }catch(exception){
  269. console.log("Exception:",exception);
  270. (function(){})()
  271. }
  272. }
  273. var toDecimal = function(x) {
  274. var f = parseFloat(x);
  275. if (isNaN(f)) {
  276. return;
  277. }
  278. f = Math.round(x*100)/100;
  279. return f;
  280. }
  281. var bigger_mouseover = function(){
  282. $("#map_btn_bigger").removeClass('map_btn_bigger_off');
  283. $("#map_btn_bigger").addClass('map_btn_bigger_on');
  284. }
  285. var bigger_mouseout = function(){
  286. $("#map_btn_bigger").removeClass('map_btn_bigger_on');
  287. $("#map_btn_bigger").addClass('map_btn_bigger_off');
  288. }
  289. var bigger_click = function(){
  290. map.zoomIn( );
  291. }
  292. var smaller_mouseover = function(){
  293. $("#map_btn_smaller").removeClass('map_btn_smaller_off');
  294. $("#map_btn_smaller").addClass('map_btn_smaller_on');
  295. }
  296. var smaller_mouseout = function(){
  297. $("#map_btn_smaller").removeClass('map_btn_smaller_on');
  298. $("#map_btn_smaller").addClass('map_btn_smaller_off');
  299. }
  300. var smaller_click = function(){
  301. map.zoomOut( );
  302. }
  303. var shower_mouseover = function(){
  304. if(!LabelShow){
  305. $("#map_btn_showlaebl").removeClass('map_btn_showlaebl_off');
  306. $("#map_btn_showlaebl").addClass('map_btn_showlaebl_on');
  307. }
  308. }
  309. var shower_mouseout = function(){
  310. if(!LabelShow){
  311. $("#map_btn_showlaebl").removeClass('map_btn_showlaebl_on');
  312. $("#map_btn_showlaebl").addClass('map_btn_showlaebl_off');
  313. }
  314. }
  315. var shower_click = function(){
  316. LabelShow = !LabelShow;
  317. if(LabelShow){
  318. $("#map_btn_showlaebl").removeClass('map_btn_showlaebl_on');
  319. $("#map_btn_showlaebl").addClass('map_btn_hidelabel');
  320. $(".info").removeClass('hiden');
  321. $(".info").addClass('shown');
  322. }else{
  323. $("#map_btn_showlaebl").removeClass('map_btn_hidelabel');
  324. $("#map_btn_showlaebl").addClass('map_btn_showlaebl_on');
  325. $(".info").removeClass('shown');
  326. $(".info").addClass('hiden');
  327. }
  328. }
  329. var left_mouseover = function(){
  330. $("#map_btn_left").removeClass('map_btn_left_off');
  331. $("#map_btn_left").addClass('map_btn_left_on');
  332. }
  333. var left_mouseout = function(){
  334. $("#map_btn_left").removeClass('map_btn_left_on');
  335. $("#map_btn_left").addClass('map_btn_left_off');
  336. }
  337. var left_click = function(){
  338. rotation = map.getRotation();
  339. rotation -= 5;
  340. if(rotation<0)
  341. rotation = 360 + rotation;
  342. map.setRotation(rotation);
  343. draw_all();
  344. }
  345. var right_mouseover = function(){
  346. $("#map_btn_right").removeClass('map_btn_right_off');
  347. $("#map_btn_right").addClass('map_btn_right_on');
  348. }
  349. var right_mouseout = function(){
  350. $("#map_btn_right").removeClass('map_btn_right_on');
  351. $("#map_btn_right").addClass('map_btn_right_off');
  352. }
  353. var right_click = function(){
  354. rotation = map.getRotation();
  355. rotation += 5;
  356. if(rotation>360)
  357. rotation = rotation-360;
  358. map.setRotation(rotation);
  359. draw_all();
  360. }
  361. var higher_mouseover = function(){
  362. $("#map_btn_high").removeClass('map_btn_high_off');
  363. $("#map_btn_high").addClass('map_btn_high_on');
  364. }
  365. var higher_mouseout = function(){
  366. $("#map_btn_high").removeClass('map_btn_high_on');
  367. $("#map_btn_high").addClass('map_btn_high_off');
  368. }
  369. var higher_click = function(){
  370. var pitch = map.getPitch();
  371. pitch -= 5;
  372. if(pitch<0)
  373. pitch = 0;
  374. map.setPitch(pitch);
  375. }
  376. var lower_mouseover = function(){
  377. $("#map_btn_low").removeClass('map_btn_low_off');
  378. $("#map_btn_low").addClass('map_btn_low_on');
  379. }
  380. var lower_mouseout = function(){
  381. $("#map_btn_low").removeClass('map_btn_low_on');
  382. $("#map_btn_low").addClass('map_btn_low_off');
  383. }
  384. var lower_click = function(){
  385. var pitch = map.getPitch();
  386. pitch += 5;
  387. if(pitch>83)
  388. pitch = 83;
  389. map.setPitch(pitch);
  390. }
  391. var clear_search = function(){
  392. SearchList = null
  393. show_list_cur = 0;
  394. $("#fp_backbtn").css("display","none");
  395. firstDraw = true;
  396. if($("#search_company").val().length>0){
  397. $("#search_company").val('');
  398. $("#company_code").val('');
  399. $("#saerch_company_list").html('');
  400. }
  401. if((!LabelShow)&&(StatusStore.length>0)){
  402. for(var i=0;i<StatusStore.length;i++){
  403. $("#label_"+StatusStore[i].company_code).css('display','none');
  404. }
  405. }
  406. }
  407. var update_companyList = function(){
  408. $("#saerch_company_list").html('');
  409. SearchList = null
  410. show_list_cur = 0;
  411. if($("#search_company").val().length>0){
  412. var query = new Object();
  413. query.V_LOGINNAME = V_LOGINNAME;
  414. query.V_PASSWORD = V_PASSWORD;
  415. query.V_COMPANY_NAME = $("#search_company").val();
  416. $.ajax({
  417. type:'POST',
  418. url:baseUrl+"/iot/company/getList",
  419. data:{
  420. queryJson : Ext.JSON.encode(query),
  421. sort :"[{property:'V_COMPANY_NAME',direction:'ASC'}]"
  422. },
  423. success:function(result){
  424. var json = eval('(' + result + ')');
  425. if(json.action=='getCompanyList'){
  426. var list = json.RESULT;
  427. if(list.length>0){
  428. SearchList = list;
  429. var saerch_company_list = document.getElementById('saerch_company_list');
  430. var table = document.createElement('table');
  431. table.border='0';
  432. table.style.width='300px';
  433. table.style.border='0px solid #000';
  434. saerch_company_list.appendChild(table);
  435. for(var i=0;i<list.length;i++){
  436. var tr = document.createElement('tr');
  437. tr.style.border='0px solid #000';
  438. table.appendChild(tr);
  439. var td = document.createElement('td');
  440. td.id='company_code_list_'+list[i].V_COMPANY_CODE;
  441. td.company_code=list[i].V_COMPANY_CODE;
  442. td.style.border='1px solid rgba(255,255,255,0.0)';
  443. td.style.background = 'rgba(255,255,255,0.3)';
  444. td.style.fontSize = '14px';
  445. td.style.cursor = "pointer";
  446. td.innerHTML=list[i].V_COMPANY_NAME;
  447. tr.appendChild(td);
  448. $("#company_code_list_"+list[i].V_COMPANY_CODE).mouseover(function(){
  449. $(this).css({"border": "1px solid rgba(64,85,98,0.7)", "background": "rgba(64,85,98,0.7)", "color":"#ffff00", "cursor":"pointer","font-size":"14px"});
  450. $("#label_"+this.company_code).css('display','block');
  451. show_list_cur = i+1;
  452. });
  453. $("#company_code_list_"+list[i].V_COMPANY_CODE).mouseout(function(){
  454. $(this).css({"border": "1px solid rgba(255,255,255,0.0)", "background": "rgba(255,255,255,0.3)", "color":"#ffffff", "cursor":"pointer","font-size":"14px"});
  455. if(!LabelShow)
  456. $("#label_"+this.company_code).css('display','none');
  457. });
  458. $("#company_code_list_"+list[i].V_COMPANY_CODE).click(function(e){
  459. showBuilding(this.company_code);
  460. });
  461. }
  462. }
  463. }
  464. }
  465. });
  466. }
  467. }
  468. var key_fun = function(event){
  469. var x = (navigator.appname=="Netscape")?event.which:window.event.keyCode;
  470. if(x==38){
  471. if(SearchList!=null){
  472. if((show_list_cur>0)&&(show_list_cur<=SearchList.length)){
  473. show_list_cur--;
  474. for(var i=0;i<SearchList.length;i++){
  475. $("#company_code_list_"+SearchList[i].V_COMPANY_CODE).css({"border": "1px solid rgba(255,255,255,0.0)", "background": "rgba(255,255,255,0.3)", "color":"#ffffff", "cursor":"pointer","font-size":"14px"});
  476. var div = document.getElementById("label_"+SearchList[i].V_COMPANY_CODE);
  477. if(!LabelShow){
  478. if(div!=undefined)
  479. div.style.display='none';
  480. }
  481. if(i==(show_list_cur-1)){
  482. $("#company_code_list_"+SearchList[i].V_COMPANY_CODE).css({"border": "1px solid rgba(64,85,98,0.7)", "background": "rgba(64,85,98,0.7)", "color":"#ffff00", "cursor":"pointer","font-size":"14px"});
  483. if(div!=undefined)
  484. div.style.display='block';
  485. }
  486. }
  487. }
  488. }
  489. }else if(x==40){
  490. if(SearchList!=null){
  491. if((show_list_cur>=0)&&(show_list_cur<SearchList.length)){
  492. show_list_cur++;
  493. for(var i=0;i<SearchList.length;i++){
  494. $("#company_code_list_"+SearchList[i].V_COMPANY_CODE).css({"border": "1px solid rgba(255,255,255,0.0)", "background": "rgba(255,255,255,0.3)", "color":"#ffffff", "cursor":"pointer","font-size":"14px"});
  495. var div = document.getElementById("label_"+SearchList[i].V_COMPANY_CODE);
  496. if(!LabelShow){
  497. if(div!=undefined)
  498. div.style.display='none';
  499. }
  500. if(i==(show_list_cur-1)){
  501. $("#company_code_list_"+SearchList[i].V_COMPANY_CODE).css({"border": "1px solid rgba(64,85,98,0.7)", "background": "rgba(64,85,98,0.7)", "color":"#ffff00", "cursor":"pointer","font-size":"14px"});
  502. if(div!=undefined)
  503. div.style.display='block';
  504. }
  505. }
  506. }
  507. }
  508. }else if(x==13){
  509. if(SearchList!=null){
  510. if((show_list_cur>=0)&&(show_list_cur<=SearchList.length)){
  511. showBuilding(SearchList[show_list_cur-1].V_COMPANY_CODE);
  512. }
  513. }
  514. }else if(x==27){
  515. clear_search();
  516. }
  517. }
  518. var chk_lat = function(lat){
  519. if(lat<30)
  520. return false;
  521. if(lat>32)
  522. return false;
  523. return true;
  524. }
  525. var chk_lng = function(lng){
  526. if(lng<110)
  527. return false;
  528. if(lng>135)
  529. return false;
  530. return true;
  531. }
  532. var showBuilding = function(company_code){
  533. if((StatusStore!=null)&&(StatusStore.length>0)){
  534. for(var i=0;i<StatusStore.length;i++){
  535. if(StatusStore[i].company_code==company_code){
  536. map.setCenter(new AMap.LngLat(StatusStore[i].lng,StatusStore[i].lat,true));
  537. map.setPitch(83);
  538. map.setZoom(18);
  539. $("#data_number_11").html(StatusStore[i].d1a);
  540. $("#data_number_12").html(StatusStore[i].d1a-StatusStore[i].d1ac);
  541. $("#data_number_21").html(StatusStore[i].d7a);
  542. $("#data_number_22").html(StatusStore[i].d7a-StatusStore[i].d7ac);
  543. $("#data_number_31").html(StatusStore[i].d2a);
  544. $("#data_number_32").html(StatusStore[i].d2a-StatusStore[i].d2ac);
  545. $("#data_number_41").html(StatusStore[i].d6a);
  546. $("#data_number_42").html(StatusStore[i].d6a-StatusStore[i].d6ac);
  547. draw_pie('data_pie_1',StatusStore[i].d1a,StatusStore[i].d1ac);
  548. draw_pie('data_pie_2',StatusStore[i].d7a,StatusStore[i].d7ac);
  549. draw_pie('data_pie_3',StatusStore[i].d2a,StatusStore[i].d2ac);
  550. draw_pie('data_pie_4',StatusStore[i].d6a,StatusStore[i].d6ac);
  551. $("#device_count_num_11").html(StatusStore[i].d1);
  552. $("#device_count_num_12").html(StatusStore[i].d1oc);
  553. $("#device_count_num_13").html(StatusStore[i].d1o-StatusStore[i].d1oc);
  554. if(StatusStore[i].d1o==0)
  555. $("#device_count_num_14").html('100%');
  556. else
  557. $("#device_count_num_14").html(toDecimal(StatusStore[i].d1oc*100/StatusStore[i].d1o)+'%');
  558. $("#device_count_num_21").html(StatusStore[i].d7);
  559. $("#device_count_num_22").html(StatusStore[i].d7oc);
  560. $("#device_count_num_23").html(StatusStore[i].d7o-StatusStore[i].d7oc);
  561. if(StatusStore[i].d7o==0)
  562. $("#device_count_num_24").html('100%');
  563. else
  564. $("#device_count_num_24").html(toDecimal(StatusStore[i].d7oc*100/StatusStore[i].d7o)+'%');
  565. $("#device_count_num_31").html(StatusStore[i].d2);
  566. $("#device_count_num_32").html(StatusStore[i].d2oc);
  567. $("#device_count_num_33").html(StatusStore[i].d2o-StatusStore[i].d2oc);
  568. if(StatusStore[i].d2o==0)
  569. $("#device_count_num_34").html('100%');
  570. else
  571. $("#device_count_num_34").html(toDecimal(StatusStore[i].d2oc*100/StatusStore[i].d2o)+'%');
  572. $("#device_count_num_41").html(StatusStore[i].d6);
  573. $("#device_count_num_42").html(StatusStore[i].d6oc);
  574. $("#device_count_num_43").html(StatusStore[i].d6o-StatusStore[i].d6oc);
  575. if(StatusStore[i].d6o==0)
  576. $("#device_count_num_44").html('100%');
  577. else
  578. $("#device_count_num_44").html(toDecimal(StatusStore[i].d6oc*100/StatusStore[i].d6o)+'%');
  579. if(StatusStore[i].d1o!=0){
  580. $("#device_confirm_14").css('width',(280*StatusStore[i].d1oc/StatusStore[i].d1o)+'px');
  581. }else
  582. $("#device_confirm_14").css('width','280px');
  583. if(StatusStore[i].d7o!=0)
  584. $("#device_confirm_24").css('width',(280*StatusStore[i].d7oc/StatusStore[i].d7o)+'px');
  585. else
  586. $("#device_confirm_24").css('width','280px');
  587. if(StatusStore[i].d2o!=0)
  588. $("#device_confirm_34").css('width',(280*StatusStore[i].d2oc/StatusStore[i].d2o)+'px');
  589. else
  590. $("#device_confirm_34").css('width','280px');
  591. if(StatusStore[i].d6o!=0)
  592. $("#device_confirm_44").css('width',(280*StatusStore[i].d6oc/StatusStore[i].d6o)+'px');
  593. else
  594. $("#device_confirm_44").css('width','280px');
  595. $("#label_"+company_code).css('display','block');
  596. break;
  597. }
  598. }
  599. }
  600. }
  601. var clear_detail_info = function(){
  602. var d0=0, d0o=0, d0oc=0, d0a=0, d0ac=0;
  603. var d1=0, d1o=0, d1oc=0, d1a=0, d1ac=0;
  604. var d2=0, d2o=0, d2oc=0, d2a=0, d2ac=0;
  605. var d6=0, d6o=0, d6oc=0, d6a=0, d6ac=0;
  606. var d7=0, d7o=0, d7oc=0, d7a=0, d7ac=0;
  607. var detail_info = document.getElementById('detail_info');
  608. var parent = document.getElementById('container');
  609. if(detail_info!=undefined){
  610. parent.removeChild(detail_info);
  611. current_company_code="";
  612. for(var i=0;i<StatusStore.length;i++){
  613. var obj = StatusStore[i];
  614. d1 += obj.d1;
  615. d1o += obj.d1o;
  616. d1a += obj.d1a;
  617. d1oc+= obj.d1oc;
  618. d1ac+= obj.d1ac;
  619. d2 += obj.d2;
  620. d2o += obj.d2o;
  621. d2a += obj.d2a;
  622. d2oc+= obj.d2oc;
  623. d2ac+= obj.d2ac;
  624. d6 += obj.d6;
  625. d6o += obj.d6o;
  626. d6a += obj.d6a;
  627. d6oc+= obj.d6oc;
  628. d6ac+= obj.d6ac;
  629. d7 += obj.d7;
  630. d7o += obj.d7o;
  631. d7a += obj.d7a;
  632. d7oc+= obj.d7oc;
  633. d7ac+= obj.d7ac;
  634. }
  635. $("#data_number_11").html(d1a);
  636. $("#data_number_12").html(d1a-d1ac);
  637. $("#data_number_21").html(d7a);
  638. $("#data_number_22").html(d7a-d7ac);
  639. $("#data_number_31").html(d2a);
  640. $("#data_number_32").html(d2a-d2ac);
  641. $("#data_number_41").html(d6a);
  642. $("#data_number_42").html(d6a-d6ac);
  643. draw_pie('data_pie_1',d1a,d1ac);
  644. draw_pie('data_pie_2',d7a,d7ac);
  645. draw_pie('data_pie_3',d2a,d2ac);
  646. draw_pie('data_pie_4',d6a,d6ac);
  647. $("#device_count_num_11").html(d1);
  648. $("#device_count_num_12").html(d1oc);
  649. $("#device_count_num_13").html(d1o-d1oc);
  650. if(d1o==0)
  651. $("#device_count_num_14").html('100%');
  652. else
  653. $("#device_count_num_14").html(toDecimal(d1oc*100/d1o)+'%');
  654. $("#device_count_num_21").html(d7);
  655. $("#device_count_num_22").html(d7oc);
  656. $("#device_count_num_23").html(d7o-d7oc);
  657. if(d7o==0)
  658. $("#device_count_num_24").html('100%');
  659. else
  660. $("#device_count_num_24").html(toDecimal(d7oc*100/d7o)+'%');
  661. $("#device_count_num_31").html(d2);
  662. $("#device_count_num_32").html(d2oc);
  663. $("#device_count_num_33").html(d2o-d2oc);
  664. if(d2o==0)
  665. $("#device_count_num_34").html('100%');
  666. else
  667. $("#device_count_num_34").html(toDecimal(d2oc*100/d2o)+'%');
  668. $("#device_count_num_41").html(d6);
  669. $("#device_count_num_42").html(d6oc);
  670. $("#device_count_num_43").html(d6o-d6oc);
  671. if(d6o==0)
  672. $("#device_count_num_44").html('100%');
  673. else
  674. $("#device_count_num_44").html(toDecimal(d6oc*100/d6o)+'%');
  675. if(d1o!=0){
  676. $("#device_confirm_14").css('width',(280*d1oc/d1o)+'px');
  677. }else
  678. $("#device_confirm_14").css('width','280px');
  679. if(d7o!=0)
  680. $("#device_confirm_24").css('width',(280*d7oc/d7o)+'px');
  681. else
  682. $("#device_confirm_24").css('width','280px');
  683. if(d2o!=0)
  684. $("#device_confirm_34").css('width',(280*d2oc/d2o)+'px');
  685. else
  686. $("#device_confirm_34").css('width','280px');
  687. if(d6o!=0)
  688. $("#device_confirm_44").css('width',(280*d6oc/d6o)+'px');
  689. else
  690. $("#device_confirm_44").css('width','280px');
  691. $(".alarm_tab_area").remove();
  692. if((AlarmStore!=null)&&(AlarmStore.length>0)){
  693. var parent = document.getElementById('container');
  694. AlarmStore.sort(alarmSortByTime);
  695. var area = document.createElement('div');
  696. area.id= 'alarm_tab_area';
  697. area.setAttribute('class','alarm_tab_area');
  698. parent.appendChild(area);
  699. for(var i=0;i<AlarmStore.length;i++){
  700. if(i>=6)
  701. break;
  702. var tab = document.createElement('div');
  703. tab.id = 'alarm_tab_'+(i+1);
  704. tab.setAttribute('class','alarm_tab');
  705. tab.setAttribute('onclick',(AlarmStore[i].dwtype==1)?'show_all_fireAlarm()':
  706. (AlarmStore[i].dwtype==2)?'show_all_waterAlarm()':
  707. (AlarmStore[i].dwtype==5)?'show_all_waterAlarm()':
  708. (AlarmStore[i].dwtype==6)?'show_all_rtuAlarm()':
  709. (AlarmStore[i].dwtype==7)?'show_all_efireAlarm()':'#');
  710. tab.style.top=(120*i)+'px';
  711. if(($(document).innerHeight()-205)>(120*(i+1)))
  712. $('#alarm_tab_area').css('height',($(document).innerHeight()-205)+'px');
  713. else
  714. $('#alarm_tab_area').css('height',($(document).innerHeight()-205)+'px');
  715. area.appendChild(tab);
  716. var title = document.createElement('div');
  717. title.id = 'alarm_tab_title_'+(i+1);
  718. title.setAttribute('class','alarm_tab_title');
  719. title.innerHTML=(AlarmStore[i].dwtype==1)?'火警监测报告':
  720. (AlarmStore[i].dwtype==2)?'水系统监测报告':
  721. (AlarmStore[i].dwtype==5)?'水系统监测报告':
  722. (AlarmStore[i].dwtype==6)?'RTU监测报告':
  723. (AlarmStore[i].dwtype==7)?'电气火灾监测报告':'其他报告';
  724. tab.appendChild(title);
  725. var time_label = document.createElement('div');
  726. time_label.id = 'alarm_tab_time_'+(i+1);
  727. time_label.setAttribute('class','alarm_tab_time');
  728. time_label.innerHTML=AlarmStore[i].time;
  729. tab.appendChild(time_label);
  730. var data = document.createElement('div');
  731. data.id = "alarm_tab_data_"+(i+1);
  732. data.setAttribute('class','alarm_tab_data');
  733. data.innerHTML=AlarmStore[i].company_name+' '+AlarmStore[i].data;
  734. tab.appendChild(data);
  735. var icon = document.createElement('img');
  736. icon.setAttribute('class','alarm_tab_icon');
  737. icon.height = '66';
  738. icon.width = '66';
  739. icon.src = baseUrl+'res/img/icons/'+((AlarmStore[i].dwtype==1)?'alarm_tab_01.gif'
  740. :(AlarmStore[i].dwtype==2)?'alarm_tab_03.gif'
  741. :(AlarmStore[i].dwtype==5)?'alarm_tab_03.gif'
  742. :(AlarmStore[i].dwtype==6)?'alarm_tab_04.gif'
  743. :(AlarmStore[i].dwtype==7)?'alarm_tab_02.gif':'alarm_tab_04.gif');
  744. // var icon = document.createElement('div');
  745. // icon.id = "alarm_tab_icon_"+(i+1);
  746. // icon.setAttribute('class',(AlarmStore[i].dwtype==1)?'alarm_tab_icon alarm_icon_01':
  747. // (AlarmStore[i].dwtype==2)?'alarm_tab_icon alarm_icon_03':
  748. // (AlarmStore[i].dwtype==5)?'alarm_tab_icon alarm_icon_03':
  749. // (AlarmStore[i].dwtype==6)?'alarm_tab_icon alarm_icon_04':
  750. // (AlarmStore[i].dwtype==7)?'alarm_tab_icon alarm_icon_02':'alarm_tab_icon alarm_icon_04');
  751. tab.appendChild(icon);
  752. }
  753. }
  754. }
  755. }
  756. var showInfo = function(e){
  757. var pixel = e.pixel;
  758. var company_code = e.target.getExtData().company_code;
  759. var detail_info;
  760. var parent = document.getElementById('container')
  761. for(var i=0;i<StatusStore.length;i++){
  762. if(StatusStore[i].company_code==company_code){
  763. if(current_company_code==company_code)
  764. return;
  765. clear_detail_info();
  766. current_company_code=company_code;
  767. var qobj = new Object();
  768. qobj.V_LOGINNAME = $("#V_LOGINNAME").val();
  769. qobj.V_PASSWORD = $("#V_PASSWORD").val();
  770. qobj.V_COMPANYID = company_code;
  771. qobj.I_COMMAND = 4;
  772. var qdata = "queryJson="+JSON.stringify(qobj);
  773. var qurl = 'https://iot.usky.cn/YtIoT/cgi-bin/WebAction2.cgi';
  774. $.ajax({
  775. type:'POST',
  776. url: qurl,
  777. data: qdata,
  778. success:function(result){
  779. var json = eval('(' + result + ')');
  780. if(json.action=='getAlarmList'){
  781. $(".alarm_tab_area").remove();
  782. if((json.ALARM==undefined)||(json.ALARM.length==0))
  783. return;
  784. var parent = document.getElementById('container');
  785. json.ALARM.sort(alarmSortByTime);
  786. var area = document.createElement('div');
  787. area.id= 'alarm_tab_area';
  788. area.setAttribute('class','alarm_tab_area');
  789. parent.appendChild(area);
  790. for(var i=0;i<json.ALARM.length;i++){
  791. if(i>=6)
  792. break;
  793. var tab = document.createElement('div');
  794. tab.id = 'alarm_tab_'+(i+1);
  795. tab.setAttribute('class','alarm_tab');
  796. tab.setAttribute('onclick',(json.ALARM[i].dwtype==1)?'show_all_fireAlarm()':
  797. (AlarmStore[i].dwtype==2)?'show_all_waterAlarm()':
  798. (AlarmStore[i].dwtype==5)?'show_all_waterAlarm()':
  799. (AlarmStore[i].dwtype==6)?'show_all_rtuAlarm()':
  800. (AlarmStore[i].dwtype==7)?'show_all_efireAlarm()':'#');
  801. tab.style.top=(120*i)+'px';
  802. if(($(document).innerHeight()-205)>(120*(i+1)))
  803. $('#alarm_tab_area').css('height',($(document).innerHeight()-205)+'px');
  804. else
  805. $('#alarm_tab_area').css('height',($(document).innerHeight()-205)+'px');
  806. area.appendChild(tab);
  807. var title = document.createElement('div');
  808. title.id = 'alarm_tab_title_'+(i+1);
  809. title.setAttribute('class','alarm_tab_title');
  810. title.innerHTML=(json.ALARM[i].dwtype==1)?'火警监测报告':
  811. (json.ALARM[i].dwtype==2)?'水系统监测报告':
  812. (json.ALARM[i].dwtype==5)?'水系统监测报告':
  813. (json.ALARM[i].dwtype==6)?'RTU监测报告':
  814. (json.ALARM[i].dwtype==7)?'电气火灾监测报告':'其他报告';
  815. tab.appendChild(title);
  816. var time_label = document.createElement('div');
  817. time_label.id = 'alarm_tab_time_'+(i+1);
  818. time_label.setAttribute('class','alarm_tab_time');
  819. time_label.innerHTML=json.ALARM[i].time;
  820. tab.appendChild(time_label);
  821. var data = document.createElement('div');
  822. data.id = "alarm_tab_data_"+(i+1);
  823. data.setAttribute('class','alarm_tab_data');
  824. data.innerHTML=json.ALARM[i].company_name+' '+json.ALARM[i].data;
  825. tab.appendChild(data);
  826. var icon = document.createElement('img');
  827. icon.setAttribute('class','alarm_tab_icon');
  828. icon.height = '66';
  829. icon.width = '66';
  830. icon.src = baseUrl+'res/img/icons/'+((json.ALARM[i].dwtype==1)?'alarm_tab_01.gif'
  831. :(json.ALARM[i].dwtype==2)?'alarm_tab_03.gif'
  832. :(json.ALARM[i].dwtype==5)?'alarm_tab_03.gif'
  833. :(json.ALARM[i].dwtype==6)?'alarm_tab_04.gif'
  834. :(json.ALARM[i].dwtype==7)?'alarm_tab_02.gif':'alarm_tab_04.gif');
  835. tab.appendChild(icon);
  836. }
  837. }
  838. }
  839. });
  840. detail_info = document.createElement('div');
  841. detail_info.id = 'detail_info';
  842. detail_info.style.position='absolute';
  843. detail_info.style.top=(pixel.getY()-270)+'px';
  844. detail_info.style.left=(pixel.getX()-101)+'px';
  845. detail_info.style.width='203px';
  846. detail_info.style.height='270px';
  847. detail_info.style.backgroundImage='url(../../res/img/icons/detail_info.png)';
  848. detail_info.style.zIndex='500';
  849. detail_info.onmouseleave=clear_detail_info;
  850. parent.appendChild(detail_info);
  851. var info_title = document.createElement('div');
  852. info_title.id='info_title';
  853. info_title.setAttribute('class','info_title');
  854. info_title.innerHTML='<div style="display:inline-block;vertical-align:middle;align-self:center;">'+StatusStore[i].company_name+'</div>';
  855. detail_info.appendChild(info_title);
  856. var info_body0 = document.createElement('div');
  857. info_body0.id = 'info_body0';
  858. info_body0.setAttribute('class','info_body0');
  859. info_body0.innerHTML='地址:'+StatusStore[i].address;
  860. detail_info.appendChild(info_body0);
  861. var info_body1 = document.createElement('div');
  862. info_body1.id = 'info_body1';
  863. info_body1.setAttribute('class','info_body1');
  864. info_body1.innerHTML='联系人:'+StatusStore[i].username;
  865. detail_info.appendChild(info_body1);
  866. var info_body2 = document.createElement('div');
  867. info_body2.id = 'info_body2';
  868. info_body2.setAttribute('class','info_body2');
  869. info_body2.innerHTML='联系电话:'+StatusStore[i].phone;
  870. detail_info.appendChild(info_body2);
  871. var info_btn = document.createElement('div');
  872. info_btn.id = 'info_btn';
  873. info_btn.setAttribute('class','info_btn');
  874. info_btn.innerHTML='查看详情';
  875. info_btn.company_code=company_code;
  876. info_btn.onclick=function(e){
  877. var event = e;
  878. location.href = baseUrl+'view/frontpage/company.jsp?company_code='+event.currentTarget.company_code;
  879. }
  880. detail_info.appendChild(info_btn);
  881. // var info_btn1 = document.createElement('div');
  882. // info_btn1.id = 'info_btn1';
  883. // info_btn1.setAttribute('class','info_btn');
  884. // info_btn1.innerHTML='历史数据';
  885. // info_btn1.company_code=company_code;
  886. // info_btn1.onclick=function(e){
  887. // var event = e;
  888. // location.href = baseUrl+'view/frontpage/company.jsp?company_code='+event.currentTarget.company_code;
  889. // }
  890. // detail_info.appendChild(info_btn1);
  891. $("#data_number_11").html(StatusStore[i].d1a);
  892. $("#data_number_12").html(StatusStore[i].d1a-StatusStore[i].d1ac);
  893. $("#data_number_21").html(StatusStore[i].d7a);
  894. $("#data_number_22").html(StatusStore[i].d7a-StatusStore[i].d7ac);
  895. $("#data_number_31").html(StatusStore[i].d2a);
  896. $("#data_number_32").html(StatusStore[i].d2a-StatusStore[i].d2ac);
  897. $("#data_number_41").html(StatusStore[i].d6a);
  898. $("#data_number_42").html(StatusStore[i].d6a-StatusStore[i].d6ac);
  899. draw_pie('data_pie_1',StatusStore[i].d1a,StatusStore[i].d1ac);
  900. draw_pie('data_pie_2',StatusStore[i].d7a,StatusStore[i].d7ac);
  901. draw_pie('data_pie_3',StatusStore[i].d2a,StatusStore[i].d2ac);
  902. draw_pie('data_pie_4',StatusStore[i].d6a,StatusStore[i].d6ac);
  903. $("#dev1_count").html(StatusStore[i].d1);
  904. $("#device_count_num_12").html(StatusStore[i].d1oc);
  905. $("#dev1-label-hidden").html(StatusStore[i].d1o-StatusStore[i].d1oc);
  906. $("#device_count_num_13").html(StatusStore[i].d1o-StatusStore[i].d1oc);
  907. if(StatusStore[i].d1o==0)
  908. $("#device_count_num_14").html('100%');
  909. else
  910. $("#device_count_num_14").html(toDecimal(StatusStore[i].d1oc*100/StatusStore[i].d1o)+'%');
  911. $("#dev2_count").html(StatusStore[i].d7);
  912. $("#device_count_num_22").html(StatusStore[i].d7oc);
  913. $("#dev2-label-hidden").html(StatusStore[i].d7o-StatusStore[i].d7oc);
  914. $("#device_count_num_23").html(StatusStore[i].d7o-StatusStore[i].d7oc);
  915. if(StatusStore[i].d7o==0)
  916. $("#device_count_num_24").html('100%');
  917. else
  918. $("#device_count_num_24").html(toDecimal(StatusStore[i].d7oc*100/StatusStore[i].d7o)+'%');
  919. $("#dev3_count").html(StatusStore[i].d2);
  920. $("#device_count_num_32").html(StatusStore[i].d2oc);
  921. $("#dev3-label-hidden").html(StatusStore[i].d2o-StatusStore[i].d2oc);
  922. $("#device_count_num_33").html(StatusStore[i].d2o-StatusStore[i].d2oc);
  923. if(StatusStore[i].d2o==0)
  924. $("#device_count_num_34").html('100%');
  925. else
  926. $("#device_count_num_34").html(toDecimal(StatusStore[i].d2oc*100/StatusStore[i].d2o)+'%');
  927. $("#dev4_count").html(StatusStore[i].d6);
  928. $("#device_count_num_42").html(StatusStore[i].d6oc);
  929. $("#dev4-label-hidden").html(StatusStore[i].d6o-StatusStore[i].d6oc);
  930. $("#device_count_num_43").html(StatusStore[i].d6o-StatusStore[i].d6oc);
  931. if(StatusStore[i].d6o==0)
  932. $("#device_count_num_44").html('100%');
  933. else
  934. $("#device_count_num_44").html(toDecimal(StatusStore[i].d6oc*100/StatusStore[i].d6o)+'%');
  935. if(StatusStore[i].d1o!=0){
  936. $("#device_confirm_14").css('width',(300*StatusStore[i].d1oc/StatusStore[i].d1o)+'px');
  937. }else
  938. $("#device_confirm_14").css('width','300px');
  939. if(StatusStore[i].d7o!=0)
  940. $("#device_confirm_24").css('width',(300*StatusStore[i].d7oc/StatusStore[i].d7o)+'px');
  941. else
  942. $("#device_confirm_24").css('width','300px');
  943. if(StatusStore[i].d2o!=0)
  944. $("#device_confirm_34").css('width',(300*StatusStore[i].d2oc/StatusStore[i].d2o)+'px');
  945. else
  946. $("#device_confirm_34").css('width','300px');
  947. if(StatusStore[i].d6o!=0)
  948. $("#device_confirm_44").css('width',(300*StatusStore[i].d6oc/StatusStore[i].d6o)+'px');
  949. else
  950. $("#device_confirm_44").css('width','300px');
  951. $(".alarm_tab_area").remove();
  952. // if((AlarmStore!=null)&&(AlarmStore.length>0)){
  953. // var parent = document.getElementById('container');
  954. // AlarmStore.sort(alarmSortByTime);
  955. // var area = document.createElement('div');
  956. // area.id= 'alarm_tab_area';
  957. // area.setAttribute('class','alarm_tab_area');
  958. // parent.appendChild(area);
  959. // for(var i=0;i<AlarmStore.length;i++){
  960. // if(i>=6)
  961. // break;
  962. // var tab = document.createElement('div');
  963. // tab.id = 'alarm_tab_'+(i+1);
  964. // tab.setAttribute('class','alarm_tab');
  965. // tab.setAttribute('onclick',(AlarmStore[i].dwtype==1)?'show_all_fireAlarm()':
  966. // (AlarmStore[i].dwtype==2)?'show_all_waterAlarm()':
  967. // (AlarmStore[i].dwtype==5)?'show_all_waterAlarm()':
  968. // (AlarmStore[i].dwtype==6)?'show_all_rtuAlarm()':
  969. // (AlarmStore[i].dwtype==7)?'show_all_efireAlarm()':'#');
  970. // tab.style.top=(120*i)+'px';
  971. // if(($(document).innerHeight()-205)>(120*(i+1)))
  972. // $('#alarm_tab_area').css('height',($(document).innerHeight()-205)+'px');
  973. // else
  974. // $('#alarm_tab_area').css('height',($(document).innerHeight()-205)+'px');
  975. // area.appendChild(tab);
  976. // var title = document.createElement('div');
  977. // title.id = 'alarm_tab_title_'+(i+1);
  978. // title.setAttribute('class','alarm_tab_title');
  979. // title.innerHTML=(AlarmStore[i].dwtype==1)?'火警监测报告':
  980. // (AlarmStore[i].dwtype==2)?'水系统监测报告':
  981. // (AlarmStore[i].dwtype==5)?'水系统监测报告':
  982. // (AlarmStore[i].dwtype==6)?'RTU监测报告':
  983. // (AlarmStore[i].dwtype==7)?'电气火灾监测报告':'其他报告';
  984. // tab.appendChild(title);
  985. // var time_label = document.createElement('div');
  986. // time_label.id = 'alarm_tab_time_'+(i+1);
  987. // time_label.setAttribute('class','alarm_tab_time');
  988. // time_label.innerHTML=AlarmStore[i].time;
  989. // tab.appendChild(time_label);
  990. // var data = document.createElement('div');
  991. // data.id = "alarm_tab_data_"+(i+1);
  992. // data.setAttribute('class','alarm_tab_data');
  993. // data.innerHTML=AlarmStore[i].company_name+' '+AlarmStore[i].data;
  994. // tab.appendChild(data);
  995. // var icon = document.createElement('img');
  996. // icon.setAttribute('class','alarm_tab_icon');
  997. // icon.height = '66';
  998. // icon.width = '66';
  999. // icon.src = baseUrl+'res/img/icons/'+((AlarmStore[i].dwtype==1)?'alarm_tab_01.gif'
  1000. // :(AlarmStore[i].dwtype==2)?'alarm_tab_03.gif'
  1001. // :(AlarmStore[i].dwtype==5)?'alarm_tab_03.gif'
  1002. // :(AlarmStore[i].dwtype==6)?'alarm_tab_04.gif'
  1003. // :(AlarmStore[i].dwtype==7)?'alarm_tab_02.gif':'alarm_tab_04.gif')+'?t='+(new Date());
  1004. // tab.appendChild(icon);
  1005. // }
  1006. // }
  1007. break;
  1008. }
  1009. }
  1010. }
  1011. var markerSortByRotation = function(a,b){
  1012. if((rotation<=45)||(rotation>=315))
  1013. return b.lat-a.lat;
  1014. else if((rotation>45)&&(rotation<=135))
  1015. return a.lng - b.lng;
  1016. else if((rotation>135)&&(rotation<=270))
  1017. return a.lat-b.lat;
  1018. else
  1019. return b.lng-a.lng;
  1020. }
  1021. var alarmSortByTime = function(a,b){
  1022. var time_a = Date.parse(a.time);
  1023. var time_b = Date.parse(b.time);
  1024. return time_b-time_a;
  1025. }
  1026. var draw_pie = function(id, total, num){
  1027. var mColor= '#34abf5';
  1028. var percent = 100;
  1029. if(total>0)
  1030. percent = Number(((num*100)/total).toString().match(/^\d+(?:\.\d{0,2})?/));
  1031. if(percent<60)
  1032. mColor = '#f66167';
  1033. else if(percent<80)
  1034. mColor = '#DDDF0D';
  1035. if(id=='data_pie_1'){
  1036. $("#title-label-11").css({
  1037. color:mColor
  1038. }).html(percent+'%');
  1039. $("#title-label-12").html(total);
  1040. }else if(id=='data_pie_2'){
  1041. $("#title-label-21").css({
  1042. color:mColor
  1043. }).html(percent+'%');
  1044. $("#title-label-22").html(total);
  1045. }else if(id=='data_pie_3'){
  1046. $("#title-label-31").css({
  1047. color:mColor
  1048. }).html(percent+'%');
  1049. $("#title-label-32").html(total);
  1050. }else if(id=='data_pie_4'){
  1051. $("#title-label-41").css({
  1052. color:mColor
  1053. }).html(percent+'%');
  1054. $("#title-label-42").html(total);
  1055. }
  1056. Highcharts.getOptions().colors = Highcharts.map(['#f66167','#34abf5', '#DDDF0D'], function (color) {
  1057. return {
  1058. radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
  1059. stops: [
  1060. [0, color],
  1061. [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
  1062. ]
  1063. };
  1064. });
  1065. Highcharts.chart(id,{
  1066. chart: {
  1067. type: 'pie',
  1068. backgroundColor: 'rgba(0,0,0,0)',
  1069. height:'100%',
  1070. options3d: {
  1071. enabled: true,
  1072. alpha: 45,
  1073. beta: 0
  1074. }
  1075. },
  1076. title: {
  1077. text: '处置率:'+percent+'%',
  1078. floating:true,
  1079. y:85,
  1080. style:{fontSize:'12px',color:'#ffffff'}
  1081. },
  1082. exporting: {
  1083. enabled: false
  1084. },
  1085. credits: {
  1086. enabled: false
  1087. },
  1088. tooltip: {
  1089. // enabled: false
  1090. pointFormat: '{point.percentage:.2f}%'
  1091. },
  1092. plotOptions: {
  1093. pie: {
  1094. allowPointSelect: true,
  1095. cursor: 'pointer',
  1096. depth: 15,
  1097. dataLabels: {
  1098. enabled: false,
  1099. format: '{point.name}'
  1100. }
  1101. }
  1102. },
  1103. series: [{
  1104. type: 'pie',
  1105. name: '处置率',
  1106. startAngle:90,
  1107. data: [{
  1108. name:'待处理',
  1109. y:100-percent,
  1110. sliced: true,
  1111. selected: true
  1112. },
  1113. ['已处理', percent]
  1114. ]
  1115. }]
  1116. });
  1117. }
  1118. var draw_all = function(){
  1119. if(company_cur>0)
  1120. return;
  1121. var d0=0, d0o=0, d0oc=0, d0a=0, d0ac=0;
  1122. var d1=0, d1o=0, d1oc=0, d1a=0, d1ac=0;
  1123. var d2=0, d2o=0, d2oc=0, d2a=0, d2ac=0;
  1124. var d6=0, d6o=0, d6oc=0, d6a=0, d6ac=0;
  1125. var d7=0, d7o=0, d7oc=0, d7a=0, d7ac=0;
  1126. var totalLat=0, totalLng=0, latngCount=0;
  1127. // map.clearMap();
  1128. clear_detail_info();
  1129. markers = [];
  1130. var zoom = map.getZoom();
  1131. var iconWidth = 28;
  1132. var iconHeight = 28;
  1133. if((StatusStore!=null)&&(StatusStore.length>0)){
  1134. rotation = map.getRotation();
  1135. StatusStore.sort(markerSortByRotation);
  1136. for(var i=0;i<StatusStore.length;i++){
  1137. var obj = StatusStore[i];
  1138. var iconurl = baseUrl+'res/img/icons/building.png';
  1139. if((obj.d0a!=obj.d0ac)
  1140. ||(obj.d0o!=obj.d0oc)
  1141. ||(obj.d1a!=obj.d1ac)
  1142. ||(obj.d1o!=obj.d1oc)
  1143. ||(obj.d2a!=obj.d2ac)
  1144. ||(obj.d2o!=obj.d2oc)
  1145. ||(obj.d6a!=obj.d6ac)
  1146. ||(obj.d6o!=obj.d6oc)
  1147. ||(obj.d7a!=obj.d7ac)
  1148. ||(obj.d7o!=obj.d7oc))
  1149. iconurl = baseUrl+'res/img/icons/building_alarm.png';
  1150. d1 += obj.d1;
  1151. d1o += obj.d1o;
  1152. d1a += obj.d1a;
  1153. d1oc+= obj.d1oc;
  1154. d1ac+= obj.d1ac;
  1155. d2 += obj.d2;
  1156. d2o += obj.d2o;
  1157. d2a += obj.d2a;
  1158. d2oc+= obj.d2oc;
  1159. d2ac+= obj.d2ac;
  1160. d6 += obj.d6;
  1161. d6o += obj.d6o;
  1162. d6a += obj.d6a;
  1163. d6oc+= obj.d6oc;
  1164. d6ac+= obj.d6ac;
  1165. d7 += obj.d7;
  1166. d7o += obj.d7o;
  1167. d7a += obj.d7a;
  1168. d7oc+= obj.d7oc;
  1169. d7ac+= obj.d7ac;
  1170. if((obj.lat>30)&&(obj.lat<33)&&(obj.lng>120)&&(obj.lng<125)){
  1171. totalLng += obj.lng;
  1172. totalLat += obj.lat;
  1173. latngCount++;
  1174. var marker= new AMap.Marker({
  1175. icon:new AMap.Icon({
  1176. size:new AMap.Size(iconWidth,iconHeight),
  1177. image:iconurl,
  1178. imageSize:new AMap.Size(iconWidth,iconHeight)
  1179. }),
  1180. position: new AMap.LngLat(obj.lng,obj.lat),
  1181. extData:{
  1182. icontype:'company',
  1183. company_code:obj.company_code
  1184. },
  1185. offset: new AMap.Pixel(-(iconWidth/2), -(iconHeight/2)),
  1186. draggable:false,
  1187. raiseOnDrag:false,
  1188. autoRotation:false,
  1189. label:{
  1190. offset: new AMap.Pixel(-iconWidth-5,-(iconHeight/2)-10),
  1191. content:"<div id='label_"+obj.company_code+"' class='info "+(LabelShow?'shown':'hiden')+"'>"+obj.company_name+"</div>",
  1192. direction: 'right'
  1193. }
  1194. });
  1195. AMap.event.addListener(marker,'click',showBuilding,this);
  1196. AMap.event.addListener(marker,'mouseover',showInfo,this);
  1197. if(!MapShow){
  1198. marker.setMap(map);
  1199. markers.push(marker);
  1200. }
  1201. }
  1202. }
  1203. var sts = [{
  1204. url: baseUrl+'res/img/icons/icon_juhe_grade1.png',
  1205. size: new AMap.Size(40, 40),
  1206. offset: new AMap.Pixel(-16, -16)
  1207. }, {
  1208. url: baseUrl+'res/img/icons/icon_juhe_grade2.png',
  1209. size: new AMap.Size(40, 40),
  1210. offset: new AMap.Pixel(-16, -16)
  1211. }, {
  1212. url: baseUrl+'res/img/icons/icon_juhe_grade3.png',
  1213. size: new AMap.Size(40, 40),
  1214. offset: new AMap.Pixel(-18, -18)
  1215. }];
  1216. if(!MapShow){
  1217. MapShow=true;
  1218. // map.plugin(["AMap.MarkerClusterer"],function(){
  1219. // cluster = new AMap.MarkerClusterer(map, markers, {
  1220. // styles: sts,
  1221. // gridSize: 80,
  1222. // maxZoom:14
  1223. //// minClusterSize:3
  1224. //// renderClusterMarker:_renderClusterMarker
  1225. // });
  1226. // });
  1227. }
  1228. if((latngCount>0)&&(firstDraw)){
  1229. map.setCenter(new AMap.LngLat(totalLng/latngCount,totalLat/latngCount,true));
  1230. map.setFitView();
  1231. firstDraw = false;
  1232. }
  1233. $("#data_number_11").html(d1a);
  1234. $("#data_number_12").html(d1a-d1ac);
  1235. $("#data_number_21").html(d7a);
  1236. $("#data_number_22").html(d7a-d7ac);
  1237. $("#data_number_31").html(d2a);
  1238. $("#data_number_32").html(d2a-d2ac);
  1239. $("#data_number_41").html(d6a);
  1240. $("#data_number_42").html(d6a-d6ac);
  1241. draw_pie('data_pie_1',d1a,d1ac);
  1242. draw_pie('data_pie_2',d7a,d7ac);
  1243. draw_pie('data_pie_3',d2a,d2ac);
  1244. draw_pie('data_pie_4',d6a,d6ac);
  1245. $("#dev1_count").html(d1);
  1246. $("#device_count_num_12").html(d1oc);
  1247. $("#dev1-label-hidden").html(d1o-d1oc);
  1248. $("#device_count_num_13").html(d1o-d1oc);
  1249. if(d1o==0)
  1250. $("#device_count_num_14").html('100%');
  1251. else
  1252. $("#device_count_num_14").html(toDecimal(d1oc*100/d1o)+'%');
  1253. $("#dev2_count").html(d7);
  1254. $("#device_count_num_22").html(d7oc);
  1255. $("#dev2-label-hidden").html(d7o-d7oc);
  1256. $("#device_count_num_23").html(d7o-d7oc);
  1257. if(d7o==0)
  1258. $("#device_count_num_24").html('100%');
  1259. else
  1260. $("#device_count_num_24").html(toDecimal(d7oc*100/d7o)+'%');
  1261. $("#dev3_count").html(d2);
  1262. $("#device_count_num_32").html(d2oc);
  1263. $("#dev3-label-hidden").html(d2o-d2oc);
  1264. $("#device_count_num_33").html(d2o-d2oc);
  1265. if(d2o==0)
  1266. $("#device_count_num_34").html('100%');
  1267. else
  1268. $("#device_count_num_34").html(toDecimal(d2oc*100/d2o)+'%');
  1269. $("#dev4_count").html(d6);
  1270. $("#device_count_num_42").html(d6oc);
  1271. $("#dev4-label-hidden").html(d6o-d6oc);
  1272. $("#device_count_num_43").html(d6o-d6oc);
  1273. if(d6o==0)
  1274. $("#device_count_num_44").html('100%');
  1275. else
  1276. $("#device_count_num_44").html(toDecimal(d6oc*100/d6o)+'%');
  1277. if(d1o!=0){
  1278. $("#device_confirm_14").css('width',(300*d1oc/d1o)+'px');
  1279. }else
  1280. $("#device_confirm_14").css('width','300px');
  1281. if(d7o!=0)
  1282. $("#device_confirm_24").css('width',(300*d7oc/d7o)+'px');
  1283. else
  1284. $("#device_confirm_24").css('width','300px');
  1285. if(d2o!=0)
  1286. $("#device_confirm_34").css('width',(300*d2oc/d2o)+'px');
  1287. else
  1288. $("#device_confirm_34").css('width','300px');
  1289. if(d6o!=0)
  1290. $("#device_confirm_44").css('width',(300*d6oc/d6o)+'px');
  1291. else
  1292. $("#device_confirm_44").css('width','300px');
  1293. }
  1294. $(".alarm_tab_area").remove();
  1295. if((AlarmStore!=null)&&(AlarmStore.length>0)){
  1296. var parent = document.getElementById('container');
  1297. AlarmStore.sort(alarmSortByTime);
  1298. var area = document.createElement('div');
  1299. area.id= 'alarm_tab_area';
  1300. area.setAttribute('class','alarm_tab_area');
  1301. parent.appendChild(area);
  1302. for(var i=0;i<AlarmStore.length;i++){
  1303. if(i>=6)
  1304. break;
  1305. var tab = document.createElement('div');
  1306. tab.id = 'alarm_tab_'+(i+1);
  1307. tab.setAttribute('class','alarm_tab');
  1308. tab.setAttribute('onclick',(AlarmStore[i].dwtype==1)?'show_all_fireAlarm()':
  1309. (AlarmStore[i].dwtype==2)?'show_all_waterAlarm()':
  1310. (AlarmStore[i].dwtype==5)?'show_all_waterAlarm()':
  1311. (AlarmStore[i].dwtype==6)?'show_all_rtuAlarm()':
  1312. (AlarmStore[i].dwtype==7)?'show_all_efireAlarm()':'#');
  1313. tab.style.top=(120*i)+'px';
  1314. if(($(document).innerHeight()-205)>(120*(i+1)))
  1315. $('#alarm_tab_area').css('height',($(document).innerHeight()-205)+'px');
  1316. else
  1317. $('#alarm_tab_area').css('height',($(document).innerHeight()-205)+'px');
  1318. area.appendChild(tab);
  1319. var title = document.createElement('div');
  1320. title.id = 'alarm_tab_title_'+(i+1);
  1321. title.setAttribute('class','alarm_tab_title');
  1322. title.innerHTML=(AlarmStore[i].dwtype==1)?'火警监测报告':
  1323. (AlarmStore[i].dwtype==2)?'水系统监测报告':
  1324. (AlarmStore[i].dwtype==5)?'水系统监测报告':
  1325. (AlarmStore[i].dwtype==6)?'RTU监测报告':
  1326. (AlarmStore[i].dwtype==7)?'电气火灾监测报告':'其他报告';
  1327. tab.appendChild(title);
  1328. var time_label = document.createElement('div');
  1329. time_label.id = 'alarm_tab_time_'+(i+1);
  1330. time_label.setAttribute('class','alarm_tab_time');
  1331. time_label.innerHTML=AlarmStore[i].time;
  1332. tab.appendChild(time_label);
  1333. var data = document.createElement('div');
  1334. data.id = "alarm_tab_data_"+(i+1);
  1335. data.setAttribute('class','alarm_tab_data');
  1336. data.innerHTML=AlarmStore[i].company_name+' '+AlarmStore[i].data;
  1337. tab.appendChild(data);
  1338. var icon = document.createElement('img');
  1339. icon.setAttribute('class','alarm_tab_icon');
  1340. icon.height = '66';
  1341. icon.width = '66';
  1342. icon.src = baseUrl+'res/img/icons/'+((AlarmStore[i].dwtype==1)?'alarm_tab_01.gif'
  1343. :(AlarmStore[i].dwtype==2)?'alarm_tab_03.gif'
  1344. :(AlarmStore[i].dwtype==5)?'alarm_tab_03.gif'
  1345. :(AlarmStore[i].dwtype==6)?'alarm_tab_04.gif'
  1346. :(AlarmStore[i].dwtype==7)?'alarm_tab_02.gif':'alarm_tab_04.gif')+'?t='+(new Date());
  1347. tab.appendChild(icon);
  1348. }
  1349. }
  1350. }
  1351. var getCurrentData = function(){
  1352. if(((new Date()).getTime()-synctime)<storeTime)
  1353. return;
  1354. $("#fp_backbtn").css("display","none");
  1355. synctime = (new Date()).getTime();
  1356. var query = new Object();
  1357. query.V_LOGINNAME = V_LOGINNAME;
  1358. query.V_PASSWORD = V_PASSWORD;
  1359. query.V_COMMAND = 'FRONTPAGE';
  1360. query.COMMSTATUS = "NO";
  1361. if($("#company_code").val().length>0)
  1362. query.company_code = $("#company_code").val();
  1363. var qdata = JSON.stringify(query);
  1364. var qurl = baseUrl+'/cgi-bin/WebAction.cgi';
  1365. if((baseUrl.indexOf('localhost')>=0)||(baseUrl.indexOf('127.0.0.1')>=0))
  1366. qurl = 'http://47.103.74.123:8080/YtIoT/cgi-bin/WebAction.cgi';
  1367. $.ajax({
  1368. type:'POST',
  1369. url: qurl,
  1370. data: qdata,
  1371. success: function(result){
  1372. if((result==undefined)||(result.length==0)){
  1373. Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function(){
  1374. window.parent.document.location=baseUrl;
  1375. });
  1376. }else{
  1377. var json = eval('(' + result + ')');
  1378. if(json.check=='false'){
  1379. Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function(){
  1380. window.parent.document.location=baseUrl;
  1381. });
  1382. }
  1383. if(json.action=='getFrontpageQuery'){
  1384. if(json.check=='true'){
  1385. if(json.LIST!=undefined)
  1386. StatusStore = json.LIST;
  1387. if(json.ALARM!=undefined)
  1388. AlarmStore = json.ALARM;
  1389. draw_all();
  1390. }
  1391. }
  1392. }
  1393. myMask.hide();
  1394. }
  1395. });
  1396. setTimeout(getCurrentData,storeTime);
  1397. }
  1398. var chk_company_cur = function(idx){
  1399. var nrow=0;
  1400. while(1){
  1401. idx++;
  1402. if(idx>=StatusStore.length)
  1403. idx = 0;
  1404. var obj = StatusStore[idx];
  1405. if((obj.lat>30)&&(obj.lat<33)&&(obj.lng>120)&&(obj.lng<125))
  1406. return idx;
  1407. nrow++;
  1408. if(nrow>=StatusStore.length)
  1409. return -1;
  1410. }
  1411. }
  1412. var show_cur_comany = function(){
  1413. var current_t = Date.parse(new Date());
  1414. if((current_t-last_move)>30000){
  1415. last_move = current_t;
  1416. if((StatusStore!=null)&&(StatusStore.length>0)){
  1417. company_cur = chk_company_cur(company_cur);
  1418. if(company_cur>=0){
  1419. var obj = StatusStore[company_cur];
  1420. showBuilding(obj.company_code);
  1421. LabelShow = false;
  1422. shower_click();
  1423. }
  1424. }
  1425. }
  1426. setTimeout(show_cur_comany,5000);
  1427. }
  1428. var body_resize = function() {
  1429. $("#mask_l").css('height',$(window).innerHeight()+'px');
  1430. $("#mask_r").css('height',$(window).innerHeight()+'px');
  1431. $("#mask_b").css('top',($(window).innerHeight()-100)+'px');
  1432. $("#mask_b").css('width',$(window).innerWidth()+'px');
  1433. $("#mask_t").css('width',$(window).innerWidth()+'px');
  1434. $("#map_header").css('left',($(window).innerWidth()-740)/2+'px');
  1435. $("#map_header").css('height','82px');
  1436. $("#container").css('width',$(window).innerWidth()+'px');
  1437. $("#container").css('height',$(window).innerHeight()+'px');
  1438. var area_height = $(window).innerHeight()-129;
  1439. $("#data_bar_area").css('height',area_height+'px');
  1440. $("#alarm_tab_area").css('height',($(window).innerHeight()-205)+'px');
  1441. draw_all();
  1442. }
  1443. var show_all_fireAlarm = function(){
  1444. if($("#V_LOGINNAME").val()=='guest')
  1445. return;
  1446. parent.window.keep_menu();
  1447. if($("#company_code").val()!=undefined)
  1448. location.href = baseUrl + 'view/fireAlarm/subFireAlarm.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1449. else
  1450. location.href = baseUrl + 'view/fireAlarm/subFireAlarm.jsp?theme='+theme;
  1451. }
  1452. var show_all_waterAlarm = function(){
  1453. if($("#V_LOGINNAME").val()=='guest')
  1454. return;
  1455. parent.window.keep_menu();
  1456. if($("#company_code").val()!=undefined)
  1457. location.href = baseUrl + 'view/waterAlarm/subWaterAlarm.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1458. else
  1459. location.href = baseUrl + 'view/waterAlarm/subWaterAlarm.jsp?theme='+theme;
  1460. }
  1461. var show_all_rtuAlarm = function(){
  1462. if($("#V_LOGINNAME").val()=='guest')
  1463. return;
  1464. parent.window.keep_menu();
  1465. if($("#company_code").val()!=undefined)
  1466. location.href = baseUrl + 'view/rtuAlarm/subRtuAlarm.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1467. else
  1468. location.href = baseUrl + 'view/rtuAlarm/subRtuAlarm.jsp?theme='+theme;
  1469. }
  1470. var show_all_efireAlarm = function () {
  1471. if($("#V_LOGINNAME").val()=='guest')
  1472. return;
  1473. parent.window.keep_menu();
  1474. if($("#company_code").val()!=undefined)
  1475. location.href = baseUrl + 'view/efireAlarm/subeFireAlarm.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1476. else
  1477. location.href = baseUrl + 'view/efireAlarm/subeFireAlarm.jsp?theme='+theme;
  1478. }
  1479. var show_all_fireDevice = function(){
  1480. if($("#V_LOGINNAME").val()=='guest')
  1481. return;
  1482. parent.window.keep_menu();
  1483. if($("#company_code").val()!=undefined)
  1484. location.href = baseUrl + 'view/fireAlarm/FireDeviceIndex.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1485. else
  1486. location.href = baseUrl + 'view/fireAlarm/FireDeviceIndex.jsp?theme='+theme;
  1487. }
  1488. var show_all_efireDevice = function () {
  1489. if($("#V_LOGINNAME").val()=='guest')
  1490. return;
  1491. parent.window.keep_menu();
  1492. if($("#company_code").val()!=undefined)
  1493. location.href = baseUrl + 'view/efireAlarm/eFireDeviceIndex.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1494. else
  1495. location.href = baseUrl + 'view/efireAlarm/eFireDeviceIndex.jsp?theme='+theme;
  1496. }
  1497. var show_all_waterDevice = function(){
  1498. if($("#V_LOGINNAME").val()=='guest')
  1499. return;
  1500. parent.window.keep_menu();
  1501. if($("#company_code").val()!=undefined)
  1502. location.href = baseUrl + 'view/waterAlarm/WaterDeviceIndex.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1503. else
  1504. location.href = baseUrl + 'view/waterAlarm/WaterDeviceIndex.jsp?theme='+theme;
  1505. }
  1506. var show_all_rtuDevice = function(){
  1507. if($("#V_LOGINNAME").val()=='guest')
  1508. return;
  1509. parent.window.keep_menu();
  1510. if($("#company_code").val()!=undefined)
  1511. location.href = baseUrl + 'view/rtuAlarm/RtuDeviceIndex.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1512. else
  1513. location.href = baseUrl + 'view/rtuAlarm/RtuDeviceIndex.jsp?theme='+theme;
  1514. }
  1515. Ext.onReady(function(){
  1516. parent.window.hiding_menu();
  1517. maxHeight = document.documentElement.clientHeight;
  1518. maxWidth = document.documentElement.clientWidth;
  1519. if(($("#V_LOGINNAME").val().length==0)||($("#V_LOGINNAME").val()=='null')||($("#V_LOGINNAME").val()==null))
  1520. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  1521. else
  1522. sessionStorage.setItem('V_LOGINNAME',$("#V_LOGINNAME").val());
  1523. if(($("#V_PASSWORD").val().length==0)||($("#V_PASSWORD").val()=='null')||($("#V_PASSWORD").val()==null))
  1524. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  1525. else
  1526. sessionStorage.setItem('V_PASSWORD',$("#V_PASSWORD").val());
  1527. baseUrl = $("#basePath").val();
  1528. theme = $("#theme").val();
  1529. V_LOGINNAME = $("#V_LOGINNAME").val();
  1530. V_PASSWORD = $("#V_PASSWORD").val();
  1531. viewAlarmType = $("#viewAlarmType").val();
  1532. pieAlarmType = $("#pieAlarmType").val();
  1533. statusType = $("#statusType").val();
  1534. company_code = $("#company_code").val();
  1535. mapStyle = (theme=='default')?'normal':(theme=='gray')?'amap://styles/light':'amap://styles/659dc6c4753dc6e87c65c8a874c02133';
  1536. // mapStyle = (theme=='default')?'normal':(theme=='gray')?'amap://styles/light':'amap://styles/dark';
  1537. $("#alarm_wrapper_table").css('left',(($(document).innerWidth()-800)/2)+'px');
  1538. if((theme=='access')||(theme==''))
  1539. $('#alarm_wrapper').addClass('shadow_black');
  1540. else
  1541. $('#alarm_wrapper').addClass('shadow_white');
  1542. last_move = Date.parse(new Date());
  1543. company_cur = -1;
  1544. myMask = new Ext.LoadMask(Ext.getBody(), {
  1545. msg: '查询中,请稍后!',
  1546. cls:'toplevel',
  1547. removeMask: true //完成后移除
  1548. });
  1549. map = new AMap.Map('container', {
  1550. mapStyle: mapStyle, //样式URL
  1551. viewMode: '3D',
  1552. turboMode: false,
  1553. resizeEnable: true,
  1554. zoom: mapzoom,
  1555. center: [121.475644, 31.1857],
  1556. features:['bg', 'road', 'building'],
  1557. pitch: 45,
  1558. forceVector: true
  1559. });
  1560. map.on('zoomend',function(e){
  1561. draw_all();
  1562. });
  1563. map.on('movestart',function(e){
  1564. clear_detail_info();
  1565. });
  1566. map.on('mousemove',function(e){
  1567. if(company_cur<0)
  1568. return;
  1569. last_move = Date.parse(new Date());
  1570. company_cur=-1;
  1571. firstDraw = true;
  1572. map.setPitch(45);
  1573. draw_all();
  1574. LabelShow = true;
  1575. shower_click();
  1576. shower_mouseout();
  1577. });
  1578. map.on('complete',function(e){
  1579. getCurrentData();
  1580. });
  1581. $("#search_company").on('input',function(){
  1582. update_companyList();
  1583. });
  1584. myMask.show();
  1585. var win1 = new UWindow();
  1586. win1.create('win1','container',win1_config);
  1587. win1.show();
  1588. var win2 = new UWindow();
  1589. win2.create('win2','container',win2_config);
  1590. win2.show();
  1591. var win3 = new UWindow();
  1592. win3.create('win3','container',win3_config);
  1593. win3.show();
  1594. var win4 = new UWindow();
  1595. win4.create('win4','container',win4_config);
  1596. win4.show();
  1597. var dev1 = new UWindow();
  1598. dev1.create('dev1','container',dev1_config);
  1599. dev1.show();
  1600. var dev2 = new UWindow();
  1601. dev2.create('dev2','container',dev2_config);
  1602. dev2.show();
  1603. var dev3 = new UWindow();
  1604. dev3.create('dev3','container',dev3_config);
  1605. dev3.show();
  1606. var dev4 = new UWindow();
  1607. dev4.create('dev4','container',dev4_config);
  1608. dev4.show();
  1609. window.onresize=function(){
  1610. body_resize();
  1611. };
  1612. body_resize();
  1613. // initWebSocket();
  1614. });