map.js.bak 65 KB

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