map.js 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490
  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 StatusStore=null,ConfirmStore=null,AlarmStore=null,showAlarm=null;
  22. var firstDraw = false;
  23. var storeTime = 60000;
  24. var centerLng = 121.475644;
  25. var currentLng = 121.475644;
  26. var centerLat = 31.1857;
  27. var currentLat = 31.1857;
  28. var rotation = 0;
  29. var alarm_show_window=null;
  30. var show_alarm_list;
  31. var V_LOGINNAME='',V_PASSWORD='';
  32. var viewAlarmType,pieAlarmType,statusType;
  33. var listSync=true;
  34. var synctime = 0;
  35. var company_code = '';
  36. var start=0;
  37. var end = 360;
  38. var targetZoom = 20;
  39. Ext.define('Alarm',{
  40. extend: 'Ext.data.Model',
  41. fields: [
  42. { header: '告警内容', name: 'data', width:80 },
  43. { header: '报告时间', name: 'time', width:150},
  44. { header: '单位', name: 'company', width:200 },
  45. { header: '详细信息', name: 'name',width:400 },
  46. { header: '状态', name: 'clzt', width:60 }
  47. ]
  48. });
  49. var showBuilding = function(idx) {
  50. $("#fp_backbtn").css("display","block");
  51. var company_code = idx.target.getExtData().company_code;
  52. for(var i=0;i<StatusStore.length;i++){
  53. if(StatusStore[i].company_code==company_code){
  54. $("#search_company").val(StatusStore[i].company_name);
  55. $("#company_code").val(company_code);
  56. $("#saerch_company_list").html('');
  57. getCurrentData2();
  58. break;
  59. }
  60. }
  61. }
  62. var btn_over = function() {
  63. $("#fp_backbtn").css("background-image","url("+baseUrl +"/res/img/back_on.png)");
  64. }
  65. var btn_out = function() {
  66. $("#fp_backbtn").css("background-image","url("+baseUrl +"/res/img/back.png)");
  67. }
  68. var back_all = function() {
  69. $("#fp_backbtn").css("display","none");
  70. clear_search();
  71. }
  72. var showVideo = function(idx){
  73. var company_code = idx.target.getExtData().company_code;
  74. location.href = baseUrl + 'view/videoCam/index.jsp?theme='+theme+'&company_code='+company_code;
  75. }
  76. var showInformation = function(idx) {
  77. var company_code = idx.target.getExtData().company_code;
  78. for(var i=0;i<StatusStore.length;i++){
  79. if(StatusStore[i].company_code==company_code){
  80. var iconurl = StatusStore[i].fire_alarm?(baseUrl+'res/img/icons/01.png')
  81. :(StatusStore[i].water_alarm?(baseUrl+'res/img/icons/02.png')
  82. :(StatusStore[i].other_alarm?(baseUrl+'res/img/icons/03.png'):(baseUrl+'res/img/icons/00.png')));
  83. $("#company_code").val(company_code);
  84. Ext.create('Ext.window.Window', {
  85. title: StatusStore[i].company_name,
  86. icon:iconurl,
  87. width: 460,
  88. bodyPadding: 10,
  89. modal:true,
  90. items: [{
  91. xtype: 'textfield',
  92. fieldLabel:'单位名称',
  93. width:300,
  94. value:StatusStore[i].company_name
  95. },{
  96. xtype: 'textfield',
  97. fieldLabel:'单位地址',
  98. width:430,
  99. value:StatusStore[i].fulladdress
  100. },{
  101. xtype: 'textfield',
  102. fieldLabel:'单位属性',
  103. width:240,
  104. value:StatusStore[i].xmlx
  105. },
  106. Ext.create('Ext.panel.Panel',{
  107. layout:{
  108. type:'table',
  109. columns:3
  110. },
  111. defaults:{
  112. bodyStyle:'margin:0px;padding:0px;background:rgba(0,0,0,0);'
  113. },
  114. items:[{
  115. html:'火警系统告警:',
  116. width:120
  117. },{
  118. html:StatusStore[i].fire_alarm?'未处理':'已处理',
  119. width:200
  120. },{
  121. html:'<button>查看</button>'
  122. },{
  123. html:'水系统告警:',
  124. width:120
  125. },{
  126. html:StatusStore[i].water_alarm?'未处理':'已处理',
  127. width:200
  128. },{
  129. html:'<button>查看</button>'
  130. },{
  131. html:'RTU告警:',
  132. width:120
  133. },{
  134. html:StatusStore[i].other_alarm?'未处理':'已处理',
  135. width:200
  136. },{
  137. html:'<button>查看</button>'
  138. }]
  139. })
  140. ],
  141. buttons:[{
  142. text: '查询',
  143. iconCls: 'ok_btn',
  144. handler: function() {
  145. show_alarm_list();
  146. this.up('window').hide();
  147. }
  148. },{
  149. text: '关闭',
  150. iconCls: 'cancel_btn',
  151. handler: function() {
  152. this.up('window').hide();
  153. }
  154. }],
  155. closeAction: 'hide'
  156. }).show();
  157. break;
  158. }
  159. }
  160. }
  161. var draw_confirm = function(){
  162. }
  163. var body_resize = function() {
  164. if($(document).innerWidth()<1800){
  165. $("#saerch_company_list").css('top','120px');
  166. $("#bar5").css('top','90px');
  167. }else{
  168. $("#saerch_company_list").css('top','80px');
  169. $("#bar5").css('top','50px');
  170. }
  171. $("#alarm_wrapper_table").css('left',(($(document).innerWidth()-800)/2)+'px');
  172. $("#mask_l").css('height',$(document).innerHeight()+'px');
  173. $("#mask_r").css('height',$(document).innerHeight()+'px');
  174. }
  175. var drawCompany = function(){
  176. if(StatusStore.length>0){
  177. if(firstDraw)
  178. map.clearMap();
  179. else{
  180. map.setZoomAndCenter(11,[centerLng,centerLat]);
  181. map.setFitView();
  182. }
  183. var current_device_id='';
  184. var device_count=0;
  185. var fire_device_count=0;
  186. var water_device_count=0;
  187. var rtu_device_count=0;
  188. var other_device_count=0;
  189. var fire_device_out=0;
  190. var water_device_out=0;
  191. var rtu_device_out=0;
  192. var other_device_out=0;
  193. var fire_device_alarm=0;
  194. var water_device_alarm=0;
  195. var rtu_device_alarm=0;
  196. var other_device_alarm=0;
  197. var fire_device_normal=0;
  198. var water_device_normal=0;
  199. var rtu_device_normal=0;
  200. var other_device_normal=0;
  201. var total_normal=0;
  202. var mark_array = new Array();
  203. if(StatusStore.length==1){
  204. $("#search_company").val(StatusStore[0].company_name);
  205. }
  206. for(var i=0;i<StatusStore.length;i++){
  207. var iconurl = (StatusStore[i].fire_alarm&&(viewAlarmType.substring(1,2)=='1'))?(baseUrl+'res/img/icons/01.gif')
  208. :((StatusStore[i].efire_alarm&&(viewAlarmType.substring(2,3)=='1'))?(baseUrl+'res/img/icons/01.png')
  209. :((StatusStore[i].water_alarm&&(viewAlarmType.substring(3,4)=='1'))?(baseUrl+'res/img/icons/02.png')
  210. :((StatusStore[i].other_alarm&&(viewAlarmType.substring(6,7)=='1'))?(baseUrl+'res/img/icons/03.png')
  211. :(baseUrl+'res/img/icons/00.png'))));
  212. currentLat = StatusStore[i].lat;
  213. currentLng = StatusStore[i].lng;
  214. var markers= new AMap.Marker({
  215. icon:iconurl,
  216. position: new AMap.LngLat(StatusStore[i].lng,StatusStore[i].lat),
  217. title:StatusStore[i].company_name,
  218. extData:{
  219. icontype:'company',
  220. company_code:StatusStore[i].company_code
  221. },
  222. offset: new AMap.Pixel(-12, -12),
  223. draggable:true,
  224. raiseOnDrag:true,
  225. autoRotation:true,
  226. label:StatusStore[i].company_name
  227. });
  228. if((StatusStore[i].lng>100)&&(StatusStore[i].lng<130)&&(StatusStore[i].lat>29)&&(StatusStore[i].lat<37))
  229. mark_array.push(markers);
  230. AMap.event.addListener(markers,'click',showBuilding,this);
  231. markers.setMap(map);
  232. if(StatusStore.length==1){
  233. if(StatusStore[i].company_code=='10122'){
  234. var markers= new AMap.Marker({
  235. icon:baseUrl+'res/img/icons/video.png',
  236. position: new AMap.LngLat(StatusStore[i].lng,StatusStore[i].lat),
  237. title:StatusStore[i].company_name,
  238. extData:{
  239. icontype:'camvideo',
  240. company_code:StatusStore[i].company_code
  241. },
  242. offset: new AMap.Pixel(-12, -48),
  243. draggable:true,
  244. raiseOnDrag:true,
  245. autoRotation:true,
  246. label:StatusStore[i].company_name+'.摄像机'
  247. });
  248. AMap.event.addListener(markers,'click',showVideo,this);
  249. markers.setMap(map);
  250. mark_array.push(markers);
  251. }
  252. }
  253. }
  254. // var persent = Number(((total_normal*100)/device_count).toString().match(/^\d+(?:\.\d{0,2})?/));
  255. var themecolor = ((theme=='')||(theme=='access'))?'#ffffff':'#000000';
  256. for(var i=0;i<ConfirmStore.length;i++){
  257. if(ConfirmStore[i].id=='fire_info'){
  258. draw_cycle_icon2('fire_confirm','火灾系统报告'
  259. ,'处理比率:',ConfirmStore[i].alarm,ConfirmStore[i].alarmConfirm,themecolor);
  260. draw_cycle_icon('fire_alarm','火灾设备'
  261. ,ConfirmStore[i].device,0,ConfirmStore[i].outConfirm,ConfirmStore[i].out-ConfirmStore[i].outConfirm,themecolor);
  262. }
  263. else if(ConfirmStore[i].id=='water_info'){
  264. draw_cycle_icon2('water_confirm','水系统报告'
  265. ,'处理比率:',ConfirmStore[i].alarm,ConfirmStore[i].alarmConfirm,themecolor);
  266. draw_cycle_icon('water_alarm','水系统设备'
  267. ,ConfirmStore[i].device,0,ConfirmStore[i].outConfirm,ConfirmStore[i].out-ConfirmStore[i].outConfirm,themecolor);
  268. }
  269. else if(ConfirmStore[i].id=='rtu_info'){
  270. draw_cycle_icon2('rtu_confirm','RTU报告'
  271. ,'处理比率:',ConfirmStore[i].alarm,ConfirmStore[i].alarmConfirm,themecolor);
  272. draw_cycle_icon('rtu_alarm','RTU设备'
  273. ,ConfirmStore[i].device,0,ConfirmStore[i].outConfirm,ConfirmStore[i].out-ConfirmStore[i].outConfirm,themecolor);
  274. }
  275. else if(ConfirmStore[i].id=='efire_info'){
  276. draw_cycle_icon2('efire_confirm','电气火灾报告'
  277. ,'处理比率:',ConfirmStore[i].alarm,ConfirmStore[i].alarmConfirm,themecolor);
  278. draw_cycle_icon('efire_alarm','电气火灾设备'
  279. ,ConfirmStore[i].device,0,ConfirmStore[i].outConfirm,ConfirmStore[i].out-ConfirmStore[i].outConfirm,themecolor);
  280. }
  281. }
  282. if(AlarmStore.length>0)
  283. $("#alarm_wrapper").html("["+AlarmStore[0].time+"] "+AlarmStore[0].data+" "+AlarmStore[0].company+" "+AlarmStore[0].name);
  284. if(!firstDraw)
  285. map.setFitView(mark_array,true,[20,20,20,20],22);
  286. firstDraw = true;
  287. rotation = 0;
  288. map.setRotation(rotation);
  289. if(StatusStore.length==1){
  290. map.setZoom(20);
  291. map.setPitch(60);
  292. map.setCenter([currentLng,currentLat]);
  293. }else{
  294. mapzoom = map.getZoom();
  295. map.setPitch(45);
  296. }
  297. }
  298. }
  299. var changeMapView = function(type){
  300. $("#viewAlarmType").val(type);
  301. viewAlarmType = type;
  302. draw_all();
  303. }
  304. var changeAlarmView = function(type){
  305. $("#pieAlarmType").val(type);
  306. pieAlarmType = type;
  307. draw_all();
  308. }
  309. var changeStatusView = function(type){
  310. $("#statusType").val(type);
  311. statusType = type;
  312. draw_all();
  313. }
  314. var createStatusPieTable = function(p,pheight,id,fun){
  315. var div = document.createElement('div');
  316. div.style.width = '276px';
  317. div.style.heigh = '136px';
  318. div.style.margin = '10px';
  319. div.style.padding = '4px 0px 0px 16px';
  320. div.style.position = 'absolution';
  321. div.style.left = '0px';
  322. div.style.top = pheight+'px';
  323. div.style.cursor = 'pointer';
  324. div.onclick = fun;
  325. div.style.background = 'url(../res/img/pie_background2.png) no-repeat';
  326. p.appendChild(div);
  327. var table = document.createElement('table');
  328. table.border='0';
  329. table.onclick = fun;
  330. table.style.margin = '4px 0px 0px 0px';
  331. table.style.border = '0px solid #000;';
  332. table.style.width = '260px';
  333. table.style.height = '120px';
  334. div.appendChild(table);
  335. var trr = document.createElement('tr');
  336. table.appendChild(trr);
  337. var td99 = document.createElement('td');
  338. trr.appendChild(td99);
  339. var table7 = document.createElement('table');
  340. td99.appendChild(table7);
  341. var trtitle = document.createElement('tr');
  342. table7.appendChild(trtitle);
  343. var th = document.createElement('th');
  344. th.style.border='0px solid #000';
  345. th.style.textAlign='left';
  346. th.style.fontSize='16px';
  347. th.style.fontWeight='bold';
  348. th.style.overflow='hidden';
  349. th.style.color='#ffffff';
  350. trtitle.appendChild(th);
  351. var tr = document.createElement('tr');
  352. tr.border='0';
  353. tr.style.border='0px solid #000';
  354. tr.style.height='20px';
  355. table7.appendChild(tr);
  356. var td2 = document.createElement('td');
  357. trr.appendChild(td2);
  358. var table2 = document.createElement('table');
  359. table2.style.color = '#dcdcdc';
  360. table2.style.fontSize='12px';
  361. table2.style.fontFamily = '"微软雅黑", Microsoft YaHei';
  362. td2.appendChild(table2);
  363. var div_title = document.createElement('div');
  364. div_title.id = id+'_label_title';
  365. th.appendChild(div_title);
  366. var tr2 = document.createElement('tr');
  367. tr2.border='0';
  368. tr2.style.border='0px solid #000';
  369. // tr2.style.height='40px';
  370. table2.appendChild(tr2);
  371. var td5 = document.createElement('td');
  372. td5.style.border='0px solid #000';
  373. td5.style.width='104px';
  374. td5.style.height='104px';
  375. tr.appendChild(td5);
  376. var div_pie2 = document.createElement('div');
  377. div_pie2.id = id+'_pie';
  378. div_pie2.style.width='104px';
  379. div_pie2.style.height='104px';
  380. td5.appendChild(div_pie2);
  381. var td22 = document.createElement('td');
  382. tr2.appendChild(td22);
  383. var table3 = document.createElement('table');
  384. table3.style.color = '#dcdcdc';
  385. table3.style.fontSize='12px';
  386. table3.style.width = '156px';
  387. table3.style.fontFamily = '"微软雅黑", Microsoft YaHei';
  388. td22.appendChild(table3);
  389. var tr5 = document.createElement('tr');
  390. table3.appendChild(tr5);
  391. var td4 = document.createElement('td');
  392. td4.style.border='0px solid #000';
  393. td4.style.width='50px';
  394. td4.style.paddingTop = '12px';
  395. td4.style.height = '26px';
  396. td4.style.textAlign = 'left';
  397. td4.style.height ='24px';
  398. td4.innerHTML='设备数量',
  399. tr5.appendChild(td4);
  400. var td6 =document.createElement('td');
  401. td6.style.border='0px solid #000';
  402. td6.style.width='90px';
  403. td6.style.paddingTop = '0px';
  404. td6.style.textAlign = 'left';
  405. td6.id = id+'_label_text_0';
  406. td6.style.color='#ffffff';
  407. td6.style.fontSize='24px';
  408. // td6.style.fontWeight = 'bold';
  409. tr5.appendChild(td6);
  410. var tr3 = document.createElement('tr');
  411. tr3.border='0';
  412. tr3.style.border='0px solid #000';
  413. table3.appendChild(tr3);
  414. var tr33 = document.createElement('tr');
  415. table3.appendChild(tr33);
  416. var td7 = document.createElement('td');
  417. td7.style.border='0px solid #000';
  418. td7.style.width='50px';
  419. td7.style.paddingTop = '12px';
  420. td7.style.height = '26px';
  421. td7.style.textAlign = 'left';
  422. td7.innerHTML='已处理',
  423. tr33.appendChild(td7);
  424. var td8 =document.createElement('td');
  425. td8.style.border='0px solid #000';
  426. td8.style.width='90px';
  427. td8.style.paddingTop = '0px';
  428. td8.style.textAlign = 'left';
  429. td8.id = id+'_label_text_2';
  430. td8.style.color='#31e9ff';
  431. td8.style.fontSize='24px';
  432. tr33.appendChild(td8);
  433. td8.innerHTML='0';
  434. var tr4 = document.createElement('tr');
  435. table3.appendChild(tr4);
  436. var td9 = document.createElement('td');
  437. td9.style.border='0px solid #000';
  438. td9.style.width='50px';
  439. td9.style.height='26px';
  440. td9.style.paddingTop = '12px';
  441. td9.style.textAlign = 'left';
  442. td9.innerHTML='待处理',
  443. tr4.appendChild(td9);
  444. var td10 =document.createElement('td');
  445. td10.style.border='0px solid #000';
  446. td10.style.width='90px';
  447. td10.style.paddingTop = '0px';
  448. td10.style.textAlign = 'left';
  449. td10.id = id+'_label_text_3';
  450. td10.style.color='#f66167';
  451. td10.style.fontSize='24px';
  452. // td10.style.fontWeight = 'bold';
  453. tr4.appendChild(td10);
  454. td10.innerHTML='0';
  455. pheight += 156;
  456. p.style.height=pheight+'px';
  457. }
  458. var createAlarmPieTable = function(p,pheight,id1,id2,fun){
  459. var div = document.createElement('div');
  460. div.style.width = '276px';
  461. div.style.heigh = '136px';
  462. div.style.margin = '10px';
  463. div.style.padding = '8px 0px 8px 16px';
  464. div.style.position = 'absolution';
  465. div.style.left = '0px';
  466. div.style.top = pheight+'px';
  467. div.style.cursor = 'pointer';
  468. div.onclick = fun;
  469. div.style.background = 'url(../res/img/pie_background2.png) no-repeat';
  470. p.appendChild(div);
  471. var table = document.createElement('table');
  472. table.border='0';
  473. table.style.border = '0px solid #000;';
  474. table.style.width = '260px';
  475. table.style.height = '120px';
  476. table.style.overflow = 'hidden';
  477. div.appendChild(table);
  478. var tr = document.createElement('tr');
  479. tr.border='0';
  480. tr.style.border='0px solid #000';
  481. tr.style.height='20px';
  482. table.appendChild(tr);
  483. var td2 = document.createElement('td');
  484. tr.appendChild(td2);
  485. var table2 = document.createElement('table');
  486. table2.style.color = '#dcdcdc';
  487. table2.style.fontSize='12px';
  488. table2.style.fontFamily = '"微软雅黑", Microsoft YaHei';
  489. td2.appendChild(table2);
  490. var trr = document.createElement('tr');
  491. table2.appendChild(trr);
  492. var th = document.createElement('th');
  493. th.style.border='0px solid #000';
  494. th.style.textAlign='left';
  495. th.style.fontSize='16px';
  496. th.style.fontWeight='bold';
  497. th.style.overflow='hidden';
  498. th.style.color='#ffffff';
  499. th.colSpan='2';
  500. trr.appendChild(th);
  501. var div_title = document.createElement('div');
  502. div_title.id = id2+'_label_title';
  503. th.appendChild(div_title);
  504. var tr2 = document.createElement('tr');
  505. tr2.border='0';
  506. tr2.style.border='0px solid #000';
  507. // tr2.style.height='40px';
  508. table2.appendChild(tr2);
  509. var td4 = document.createElement('td');
  510. td4.style.border='1px solid rgba(0,0,0,0)';
  511. td4.style.width='50px';
  512. td4.style.height = '50px';
  513. td4.style.paddingTop = '38px';
  514. td4.style.textAlign = 'left';
  515. td4.innerHTML='总数',
  516. tr2.appendChild(td4);
  517. var td6 =document.createElement('td');
  518. td6.style.border='1px solid rgba(0,0,0,0)';
  519. td6.style.paddingTop='26px';
  520. td6.style.width='90px';
  521. // td6.style.verticalAlign = 'bottom';
  522. td6.style.textAlign = 'left';
  523. td6.id = id2+'_label_text_0';
  524. td6.style.color='#31e9ff';
  525. td6.style.fontSize='24px';
  526. // td6.style.fontWeight = 'bold';
  527. tr2.appendChild(td6);
  528. var tr3 = document.createElement('tr');
  529. tr3.border='0';
  530. tr3.style.border='0px solid #000';
  531. // tr3.style.height='40px';
  532. table2.appendChild(tr3);
  533. var td41 = document.createElement('td');
  534. td41.style.border='1px solid rgba(0,0,0,0)';
  535. td41.style.width='50px';
  536. td41.style.height = '24px';
  537. td41.style.paddingTop = '12px';
  538. td41.style.textAlign = 'left';
  539. td41.innerHTML='待处理',
  540. tr3.appendChild(td41);
  541. var td61 =document.createElement('td');
  542. td61.style.border='1px solid rgba(0,0,0,0)';
  543. td61.style.width='90px';
  544. td61.style.paddingTop = '0px';
  545. td61.style.textAlign = 'left';
  546. td61.id = id2+'_label_text_1';
  547. td61.style.color='#f66167';
  548. td61.style.fontSize='24px';
  549. // td61.style.fontWeight = 'bold';
  550. tr3.appendChild(td61);
  551. var tr4 = document.createElement('tr');
  552. table2.appendChild(tr4);
  553. var td5 = document.createElement('td');
  554. td5.style.border='0px solid #000';
  555. td5.style.width='120px';
  556. td5.style.height='120px';
  557. td5.rowspan = '2';
  558. tr.appendChild(td5);
  559. var div_pie2 = document.createElement('div');
  560. div_pie2.id = id2+'_pie';
  561. div_pie2.style.width='120px';
  562. div_pie2.style.height='120px';
  563. td5.appendChild(div_pie2);
  564. pheight += 156;
  565. p.style.height=pheight+'px';
  566. }
  567. var draw_all = function(){
  568. myMask.hide();
  569. var alarm_pie_bar = document.getElementById('alarm_pie_bar');
  570. var device_pie_bar = document.getElementById('device_pie_bar');
  571. var alarmBarHeight = 0;
  572. var deviceBarHeight = 0;
  573. alarm_pie_bar.innerHTML='';
  574. device_pie_bar.innerHTML='';
  575. alarm_pie_bar.style.height = alarmBarHeight+'px';
  576. alarm_pie_bar.style.width = '296px';
  577. device_pie_bar.style.height = deviceBarHeight+'px';
  578. device_pie_bar.style.width = '296px';
  579. if(pieAlarmType.substring(1,2)=='1'){//火灾监控告警
  580. createAlarmPieTable(alarm_pie_bar,alarmBarHeight,'fire_alarm2','fire_confirm',show_all_fireAlarm);
  581. alarmBarHeight += 156;
  582. }
  583. if(pieAlarmType.substring(2,3)=='1'){//电气火灾监控告警
  584. createAlarmPieTable(alarm_pie_bar,alarmBarHeight,'efire_alarm2','efire_confirm',show_all_efireAlarm);
  585. alarmBarHeight += 156;
  586. }
  587. if(pieAlarmType.substring(3,4)=='1'){//水系统监控告警
  588. createAlarmPieTable(alarm_pie_bar,alarmBarHeight,'water_alarm2','water_confirm',show_all_waterAlarm);
  589. alarmBarHeight += 156;
  590. }
  591. if(pieAlarmType.substring(4,5)=='1'){//通道监控告警
  592. createAlarmPieTable(alarm_pie_bar,alarmBarHeight,'access_alarm2','access_confirm',show_all_accessAlarm);
  593. alarmBarHeight += 156;
  594. }
  595. if(pieAlarmType.substring(5,6)=='1'){//消防电源监控告警
  596. createAlarmPieTable(alarm_pie_bar,alarmBarHeight,'power_alarm2','power_confirm',show_all_powerAlarm);
  597. alarmBarHeight += 156;
  598. }
  599. if(pieAlarmType.substring(6,7)=='1'){//rtu监控告警
  600. createAlarmPieTable(alarm_pie_bar,alarmBarHeight,'rtu_alarm2','rtu_confirm',show_all_rtuAlarm);
  601. alarmBarHeight += 156;
  602. }
  603. if(pieAlarmType.substring(7,8)=='1'){//烟感监控告警
  604. createAlarmPieTable(alarm_pie_bar,alarmBarHeight,'smoke_alarm2','smoke_confirm',show_all_smokeAlarm);
  605. alarmBarHeight += 156;
  606. }
  607. if(statusType.substring(1,2)=='1'){//火灾监控设备
  608. createStatusPieTable(device_pie_bar,deviceBarHeight,'fire_alarm',show_all_fireDevice);
  609. deviceBarHeight += 156;
  610. }
  611. if(statusType.substring(2,3)=='1'){//电气火灾监控设备
  612. createStatusPieTable(device_pie_bar,deviceBarHeight,'efire_alarm',show_all_efireDevice);
  613. deviceBarHeight += 156;
  614. }
  615. if(statusType.substring(3,4)=='1'){//水系统监控设备
  616. createStatusPieTable(device_pie_bar,deviceBarHeight,'water_alarm',show_all_waterDevice);
  617. deviceBarHeight += 156;
  618. }
  619. if(statusType.substring(4,5)=='1'){//通道监控设备
  620. createStatusPieTable(device_pie_bar,deviceBarHeight,'access_alarm',show_all_accessDevice);
  621. deviceBarHeight += 156;
  622. }
  623. if(statusType.substring(5,6)=='1'){//消防用电监控设备
  624. createStatusPieTable(device_pie_bar,deviceBarHeight,'power_alarm',show_all_powerDevice);
  625. deviceBarHeight += 156;
  626. }
  627. if(statusType.substring(6,7)=='1'){//RTU监控设备
  628. createStatusPieTable(device_pie_bar,deviceBarHeight,'rtu_alarm',show_all_rtuDevice);
  629. deviceBarHeight += 156;
  630. }
  631. if(statusType.substring(7,8)=='1'){//烟感监控设备
  632. createStatusPieTable(device_pie_bar,deviceBarHeight,'smoke_alarm',show_all_smokeDevice);
  633. deviceBarHeight += 156;
  634. }
  635. drawCompany();
  636. // draw_confirm();
  637. }
  638. var show_all_smokeAlarm = function(){
  639. }
  640. var show_all_smokeDevice = function(){
  641. }
  642. var clear_search = function(){
  643. $("#fp_backbtn").css("display","none");
  644. $("#company_code",window.parent.document).val('');
  645. firstDraw = true;
  646. if($("#search_company").val().length>0){
  647. $("#search_company").val('');
  648. $("#company_code").val('');
  649. $("#saerch_company_list").html('');
  650. map.setZoom(mapzoom);
  651. map.setCenter([121.475644, 31.1857]);
  652. getCurrentData2();
  653. }
  654. }
  655. var update_companyList = function(){
  656. map.setZoom(mapzoom);
  657. $("#saerch_company_list").html('');
  658. if($("#search_company").val().length>0){
  659. var query = new Object();
  660. // query.V_LOGINNAME = V_LOGINNAME;
  661. // query.V_PASSWORD = V_PASSWORD;
  662. query.V_COMPANY_NAME = $("#search_company").val();
  663. $.ajax({
  664. type:'POST',
  665. url:baseUrl+"/iot/company/getList",
  666. data:{
  667. queryJson : Ext.JSON.encode(query),
  668. sort :"[{property:'V_COMPANY_NAME',direction:'ASC'}]"
  669. },
  670. success:function(result){
  671. var json = eval('(' + result + ')');
  672. if(json.action=='getCompanyList'){
  673. var list = json.RESULT;
  674. if(list.length>0){
  675. var saerch_company_list = document.getElementById('saerch_company_list');
  676. var table = document.createElement('table');
  677. table.border='0';
  678. table.style.width='300px';
  679. table.style.border='0px solid #000';
  680. saerch_company_list.appendChild(table);
  681. for(var i=0;i<list.length;i++){
  682. var tr = document.createElement('tr');
  683. tr.style.border='0px solid #000';
  684. table.appendChild(tr);
  685. var td = document.createElement('td');
  686. td.id='company_code_list_'+list[i].V_COMPANY_CODE;
  687. td.company_code=list[i].V_COMPANY_CODE;
  688. td.style.border='1px solid rgba(255,255,255,0.0)';
  689. td.style.background = 'rgba(255,255,255,0.3)';
  690. td.style.fontSize = '14px';
  691. td.style.cursor = "pointer";
  692. td.innerHTML=list[i].V_COMPANY_NAME;
  693. tr.appendChild(td);
  694. $("#company_code_list_"+list[i].V_COMPANY_CODE).mouseover(function(){
  695. $(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"});
  696. });
  697. $("#company_code_list_"+list[i].V_COMPANY_CODE).mouseout(function(){
  698. $(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"});
  699. });
  700. $("#company_code_list_"+list[i].V_COMPANY_CODE).click(function(e){
  701. var id = e.target.company_code;
  702. var name = e.target.innerHTML;
  703. $("#search_company").val(name);
  704. $("#company_code").val(id);
  705. $("#saerch_company_list").html('');
  706. $("#fp_backbtn").css("display","block");
  707. getCurrentData2();
  708. });
  709. }
  710. }
  711. }
  712. }
  713. });
  714. }
  715. }
  716. var getCurrentData2 = function(){
  717. myMask = new Ext.LoadMask(Ext.getBody(), {
  718. msg: '查询中,请稍后!',
  719. cls:'toplevel',
  720. removeMask: true //完成后移除
  721. });
  722. myMask.show();
  723. synctime = (new Date()).getTime();
  724. $("#alarm_wrapper").html('Loading......');
  725. var query = new Object();
  726. query.V_LOGINNAME = V_LOGINNAME;
  727. query.V_PASSWORD = V_PASSWORD;
  728. query.QUERY_FROM = 'FRONTPAGE';
  729. query.COMMSTATUS = "NO";
  730. query.V_COMMAND = 'FRONTPAGE';
  731. // query.point_code = '0';
  732. // query.clzt = '0';
  733. if($("#company_code").val().length>0)
  734. query.company_code = $("#company_code").val();
  735. var qurl = baseUrl+'/cgi-bin/WebAction.cgi';
  736. // if((baseUrl.indexOf('localhost')>=0)||(baseUrl.indexOf('127.0.0.1')>=0))
  737. qurl = 'https://fire.usky.cn:8443/YtIoT/cgi-bin/WebAction.cgi';
  738. // ConfirmStore=null;
  739. // StatusStore=null;
  740. $("#FireAlarmWinmdow").attr("src",'fireAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):''));
  741. $("#FireAlarmWinmdow").attr("style",'width:100%;height:100%;');
  742. $("#FireAlarmWinmdow").attr("frameborder",'0');
  743. $("#WaterAlarmWinmdow").attr("src",'waterAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):''));
  744. $("#WaterAlarmWinmdow").attr("style",'width:100%;height:100%;');
  745. $("#WaterAlarmWinmdow").attr("frameborder",'0');
  746. $("#RtuAlarmWinmdow").attr("src",'rtuAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):''));
  747. $("#RtuAlarmWinmdow").attr("style",'width:100%;height:100%;');
  748. $("#RtuAlarmWinmdow").attr("frameborder",'0');
  749. $.ajax({
  750. type:'POST',
  751. url: qurl,
  752. data: {
  753. queryJson : Ext.JSON.encode(query)
  754. },
  755. success: function(result){
  756. var json = eval('(' + result + ')');
  757. if(json.action=='getSyncStatusVListByCompany'){
  758. if(json.check=='true'){
  759. StatusStore = json.RESULT;
  760. centerLng = json.avelng;
  761. centerLat = json.avelat;
  762. ConfirmStore = json.confirm_status;
  763. AlarmStore = json.ALARM_LIST;
  764. draw_all();
  765. if((StatusStore.length==1)&&($("#company_code").val().length>0)){
  766. var fireAlarm = false;
  767. var waterAlarm = false;
  768. var rtuAlarm = false;
  769. if(ConfirmStore.length>0){
  770. for(var i=0;i<ConfirmStore.length;i++){
  771. if(ConfirmStore[i].id=='fire_info'){
  772. if(ConfirmStore[i].alarmConfirm<ConfirmStore[i].alarm)
  773. fireAlarm = true;
  774. }else if(ConfirmStore[i].id=='water_info'){
  775. if(ConfirmStore[i].alarmConfirm<ConfirmStore[i].alarm)
  776. waterAlarm = true;
  777. }else if(ConfirmStore[i].id=='rtu_info'){
  778. if(ConfirmStore[i].alarmConfirm<ConfirmStore[i].alarm)
  779. rtuAlarm = true;
  780. }
  781. }
  782. }
  783. var iconurl = StatusStore[0].fire_alarm?(baseUrl+'res/img/icons/01.png')
  784. :(StatusStore[0].water_alarm?(baseUrl+'res/img/icons/02.png')
  785. :(StatusStore[0].other_alarm?(baseUrl+'res/img/icons/03.png'):(baseUrl+'res/img/icons/00.png')));
  786. Ext.create('Ext.window.Window', {
  787. title: StatusStore[0].company_name,
  788. icon:iconurl,
  789. width: 460,
  790. bodyPadding: 10,
  791. modal:true,
  792. items: [{
  793. layout:'column',
  794. items:[{
  795. xtype: 'textfield',
  796. columnWidth:.95,
  797. fieldLabel:'单位名称',
  798. width:300,
  799. disabled:true,
  800. disabledCls:'x-item-disabled-new',
  801. background: 'rgba(0,0,0,0)',
  802. value:StatusStore[0].company_name
  803. },{
  804. }]
  805. },{
  806. layout:'column',
  807. items:[{
  808. xtype: 'textfield',
  809. columnWidth:.95,
  810. fieldLabel:'单位地址',
  811. disabled:true,
  812. disabledCls:'x-item-disabled-new',
  813. width:430,
  814. value:StatusStore[0].fulladdress
  815. },{
  816. }]
  817. },{
  818. layout:'column',
  819. items:[{
  820. xtype: 'textfield',
  821. columnWidth:.46,
  822. fieldLabel:'单位属性',
  823. disabled:true,
  824. disabledCls:'x-item-disabled-new',
  825. width:240,
  826. value:StatusStore[0].xmlx
  827. },{}]
  828. },{
  829. layout:'column',
  830. items:[{
  831. columnWidth:.46,
  832. xtype: 'textfield',
  833. fieldLabel:'火警系统报告',
  834. disabled:true,
  835. disabledCls:'x-item-disabled-new',
  836. width:200,
  837. value:fireAlarm?'待处理':'已处理',
  838. fieldStyle:fireAlarm?'color:#f66167':'color:#000000'
  839. },{
  840. columnWidth:.20
  841. },{
  842. xtype:'button',
  843. text:'查看',
  844. handler:function(){
  845. show_all_fireAlarm();
  846. }
  847. }]
  848. },{
  849. layout:'column',
  850. items:[{
  851. xtype: 'textfield',
  852. columnWidth:.46,
  853. fieldLabel:'水系统报告',
  854. disabled:true,
  855. disabledCls:'x-item-disabled-new',
  856. width:200,
  857. value:waterAlarm?'待处理':'已处理',
  858. fieldStyle:waterAlarm?'color:#f66167':'color:#000000'
  859. },{
  860. columnWidth:.20
  861. },{
  862. xtype:'button',
  863. text:'查看',
  864. handler:function(){
  865. show_all_waterAlarm();
  866. }
  867. }]
  868. },{
  869. layout:'column',
  870. items:[{
  871. columnWidth:.46,
  872. xtype: 'textfield',
  873. fieldLabel:'RTU报告',
  874. disabled:true,
  875. disabledCls:'x-item-disabled-new',
  876. width:200,
  877. value:rtuAlarm?'待处理':'已处理',
  878. fieldStyle:rtuAlarm?'color:#f66167':'color:#000000'
  879. },{
  880. columnWidth:.20
  881. },{
  882. xtype:'button',
  883. text:'查看',
  884. handler:function(){
  885. show_all_rtuAlarm();
  886. }
  887. }]
  888. },{
  889. layout:'column',
  890. items:[{
  891. columnWidth:.50,
  892. xtype: 'textfield',
  893. fieldLabel:'联系人',
  894. disabled:true,
  895. disabledCls:'x-item-disabled-new',
  896. width:240,
  897. value:StatusStore[0].username
  898. }]
  899. },{
  900. layout:'column',
  901. style:{
  902. backgroundColor: 'rgba(0,0,0,0)',
  903. border: '0px solid #000000'
  904. },
  905. items:[{
  906. columnWidth:.80,
  907. xtype: 'textfield',
  908. fieldLabel:'联系电话',
  909. disabled:true,
  910. disabledCls:'x-item-disabled-new',
  911. width:400,
  912. value:StatusStore[0].phone
  913. }]
  914. }],
  915. buttons:[{
  916. text: '查询',
  917. iconCls: 'ok_btn',
  918. handler: function() {
  919. show_alarm_list();
  920. this.up('window').hide();
  921. }
  922. },{
  923. text: '关闭',
  924. iconCls: 'cancel_btn',
  925. handler: function() {
  926. this.up('window').hide();
  927. }
  928. }],
  929. closeAction: 'hide'
  930. }).show();
  931. try{
  932. map.setCenter([StatusStore[0].lng,StatusStore[0].lat]);
  933. }catch(e){}
  934. map.setZoom(20);
  935. }
  936. }else{
  937. Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function(){
  938. window.parent.document.location=baseUrl;
  939. });
  940. }
  941. }
  942. myMask.hide();
  943. }
  944. });
  945. }
  946. var getCurrentData = function(){
  947. if(((new Date()).getTime()-synctime)<storeTime)
  948. return;
  949. $("#fp_backbtn").css("display","none");
  950. synctime = (new Date()).getTime();
  951. var query = new Object();
  952. query.V_LOGINNAME = V_LOGINNAME;
  953. query.V_PASSWORD = V_PASSWORD;
  954. query.QUERY_FROM = 'FRONTPAGE';
  955. query.V_COMMAND = 'FRONTPAGE';
  956. query.COMMSTATUS = "NO";
  957. // query.point_code = '0';
  958. // query.clzt = '0';
  959. if($("#company_code").val().length>0)
  960. query.company_code = $("#company_code").val();
  961. // ConfirmStore=null;
  962. // StatusStore=null;
  963. var qurl = baseUrl+'/cgi-bin/WebAction.cgi';
  964. // if((baseUrl.indexOf('localhost')>=0)||(baseUrl.indexOf('127.0.0.1')>=0))
  965. qurl = 'https://fire.usky.cn:8443/YtIoT/cgi-bin/WebAction.cgi';
  966. $.ajax({
  967. type:'POST',
  968. url: qurl,
  969. data: {
  970. queryJson : Ext.JSON.encode(query)
  971. },
  972. success: function(result){
  973. var json = eval('(' + result + ')');
  974. if(json.action=='getSyncStatusVListByCompany'){
  975. if(json.check=='true'){
  976. StatusStore = json.RESULT;
  977. centerLng = json.avelng;
  978. centerLat = json.avelat;
  979. ConfirmStore = json.confirm_status;
  980. AlarmStore = json.ALARM_LIST;
  981. if(StatusStore.length==1){
  982. $("#company_code").val(StatusStore[0].company_code);
  983. $("#company_code",window.parent.document).val(StatusStore[0].company_code);
  984. }
  985. // if(ConfirmStore!=null){
  986. draw_all();
  987. // }
  988. }else{
  989. Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function(){
  990. window.parent.document.location=baseUrl;
  991. });
  992. }
  993. }
  994. myMask.hide();
  995. }
  996. });
  997. setTimeout(getCurrentData,storeTime);
  998. }
  999. var mapRotation = function(){
  1000. if((ConfirmStore!=null)&&(StatusStore.length==1)){
  1001. // start += 20;
  1002. // if(start>360)
  1003. // start -=360;
  1004. // draw_confirm();
  1005. rotation = (rotation-1);
  1006. if(rotation<0)
  1007. rotation = 359;
  1008. map.setRotation(rotation);
  1009. }
  1010. setTimeout(mapRotation,2000);
  1011. }
  1012. var renderIcons = function () {
  1013. if (!this.series[0].icon) {
  1014. this.series[0].icon = this.renderer.path(['M', -8, 0, 'L', 8, 0, 'M', 0, -8, 'L', 8, 0, 0, 8])
  1015. .attr({
  1016. 'stroke': '#303030',
  1017. 'stroke-linecap': 'round',
  1018. 'stroke-linejoin': 'round',
  1019. 'stroke-width': 2,
  1020. 'zIndex': 10
  1021. })
  1022. .add(this.series[2].group);
  1023. }
  1024. this.series[0].icon.translate(
  1025. this.chartWidth / 2 - 10,
  1026. this.plotHeight / 2 - this.series[0].points[0].shapeArgs.innerR -
  1027. (this.series[0].points[0].shapeArgs.r - this.series[0].points[0].shapeArgs.innerR) / 2
  1028. );
  1029. if (!this.series[1].icon) {
  1030. this.series[1].icon = this.renderer.path(
  1031. ['M', -8, 0, 'L', 8, 0, 'M', 0, -8, 'L', 8, 0, 0, 8,
  1032. 'M', 8, -8, 'L', 16, 0, 8, 8]
  1033. )
  1034. .attr({
  1035. 'stroke': '#ffffff',
  1036. 'stroke-linecap': 'round',
  1037. 'stroke-linejoin': 'round',
  1038. 'stroke-width': 2,
  1039. 'zIndex': 10
  1040. })
  1041. .add(this.series[2].group);
  1042. }
  1043. this.series[1].icon.translate(
  1044. this.chartWidth / 2 - 10,
  1045. this.plotHeight / 2 - this.series[1].points[0].shapeArgs.innerR -
  1046. (this.series[1].points[0].shapeArgs.r - this.series[1].points[0].shapeArgs.innerR) / 2
  1047. );
  1048. if (!this.series[2].icon) {
  1049. this.series[2].icon = this.renderer.path(['M', 0, 8, 'L', 0, -8, 'M', -8, 0, 'L', 0, -8, 8, 0])
  1050. .attr({
  1051. 'stroke': '#303030',
  1052. 'stroke-linecap': 'round',
  1053. 'stroke-linejoin': 'round',
  1054. 'stroke-width': 2,
  1055. 'zIndex': 10
  1056. })
  1057. .add(this.series[2].group);
  1058. }
  1059. this.series[2].icon.translate(
  1060. this.chartWidth / 2 - 10,
  1061. this.plotHeight / 2 - this.series[2].points[0].shapeArgs.innerR -
  1062. (this.series[2].points[0].shapeArgs.r - this.series[2].points[0].shapeArgs.innerR) / 2
  1063. );
  1064. }
  1065. var draw_cycle_icon2 = function(Id, title, name, total, num, themecolor){
  1066. var mColor= '#34abf5';//[ '#DDDF0D','#f66167', '#34abf5']
  1067. var percent = 100;
  1068. if(total>0)
  1069. percent = Number(((num*100)/total).toString().match(/^\d+(?:\.\d{0,2})?/));
  1070. if(percent<60)
  1071. mColor = '#f66167';
  1072. else if(percent<80)
  1073. mColor = '#DDDF0D';
  1074. var label_id_title = Id+'_label_title';
  1075. var label_id_text = Id+'_label_text';
  1076. var icon_id = Id+'_pie';
  1077. if((document.getElementById(icon_id)==null)
  1078. ||(document.getElementById(icon_id)=='undefined'))
  1079. return;
  1080. if(title.length>0)
  1081. document.getElementById(label_id_title).innerHTML=title;
  1082. document.getElementById(label_id_text+'_0').innerHTML=total;
  1083. document.getElementById(label_id_text+'_1').innerHTML=total-num;
  1084. Highcharts.getOptions().colors = Highcharts.map(['#f66167','#34abf5', '#DDDF0D'], function (color) {
  1085. return {
  1086. radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
  1087. stops: [
  1088. [0, color],
  1089. [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
  1090. ]
  1091. };
  1092. });
  1093. Highcharts.chart(icon_id,{
  1094. chart: {
  1095. type: 'solidgauge',
  1096. height: '100%',
  1097. backgroundColor: 'rgba(0,0,0,0)',
  1098. animation: false
  1099. },
  1100. title:{
  1101. text:percent+'%<br/>处置率',
  1102. floating:true,
  1103. y:46,
  1104. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  1105. },
  1106. exporting: {
  1107. enabled: false
  1108. },
  1109. credits: {
  1110. enabled: false
  1111. },
  1112. tooltip: {
  1113. enabled: false
  1114. },
  1115. pane: {
  1116. startAngle: start,
  1117. background: [{
  1118. outerRadius: '110%',
  1119. innerRadius: '60%',
  1120. backgroundColor: 'rgba(0,0,0,0)',
  1121. borderWidth: 0
  1122. }]
  1123. },
  1124. yAxis: {
  1125. min: 0,
  1126. max: 100,
  1127. lineWidth: 0,
  1128. tickPositions: []
  1129. },
  1130. plotOptions: {
  1131. solidgauge: {
  1132. dataLabels: {
  1133. enabled: false
  1134. },
  1135. linecap: 'square',
  1136. stickyTracking: false,
  1137. rounded: false,
  1138. warp: false
  1139. },
  1140. series:{
  1141. animation: false
  1142. }
  1143. },
  1144. series:[{
  1145. name:name,
  1146. data:[{
  1147. color: (Highcharts.theme && Highcharts.theme.contrastTextColor),
  1148. radius: '110%',
  1149. innerRadius: '70%',
  1150. y: 100
  1151. },{
  1152. color: (Highcharts.theme && Highcharts.theme.contrastTextColor),
  1153. radius: '110%',
  1154. innerRadius: '70%',
  1155. y: percent
  1156. }]
  1157. }]
  1158. });
  1159. if((theme=='access')||(theme=='')){
  1160. $('#'+label_id_title).addClass('shadow_black');
  1161. $('#'+label_id_text).addClass('shadow_black');
  1162. $('#'+icon_id).addClass('shadow_black');
  1163. }else{
  1164. $('#'+label_id_title).addClass('shadow_white');
  1165. $('#'+label_id_text).addClass('shadow_white');
  1166. $('#'+icon_id).addClass('shadow_white');
  1167. }
  1168. }
  1169. var draw_cycle_icon = function(Id, title, num1, num2, num3, num4, themecolor){
  1170. var mColor= '#34abf5';//[ '#DDDF0D','#f66167', '#34abf5']
  1171. var label_id_title = Id+'_label_title';
  1172. var label_id_text = Id+'_label_text';
  1173. var icon_id = Id+'_pie';
  1174. var percent = 100;
  1175. if((num3+num4)>0)
  1176. percent = Number(((num3*100)/(num3+num4)).toString().match(/^\d+(?:\.\d{0,2})?/));
  1177. if((document.getElementById(icon_id)==null)
  1178. ||(document.getElementById(icon_id)=='undefined'))
  1179. return;
  1180. if(title.length>0)
  1181. document.getElementById(label_id_title).innerHTML=title;
  1182. document.getElementById(label_id_text+'_0').innerHTML=num1;
  1183. // document.getElementById(label_id_text+'_1').innerHTML=num2;
  1184. document.getElementById(label_id_text+'_2').innerHTML=num3;
  1185. document.getElementById(label_id_text+'_3').innerHTML=num4;
  1186. // var percent = Number(((num3*100)/(num3+num4)).toString().match(/^\d+(?:\.\d{0,2})?/));
  1187. Highcharts.setOptions({
  1188. lang: {
  1189. thousandsSep: ','
  1190. }
  1191. });
  1192. Highcharts.getOptions().colors = Highcharts.map(['#f66167','#34abf5', '#DDDF0D'], function (color) {
  1193. // Highcharts.getOptions().colors = Highcharts.map(['#DDDF0D','#f66167','#34abf5', '#DDDF0D','#34abf5'], function (color) {
  1194. return {
  1195. radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
  1196. stops: [
  1197. [0, color],
  1198. [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
  1199. ]
  1200. };
  1201. });
  1202. Highcharts.chart(icon_id,{
  1203. chart: {
  1204. type: 'solidgauge',
  1205. height: '100%',
  1206. backgroundColor: 'rgba(0,0,0,0)',
  1207. animation: false
  1208. },
  1209. title:{
  1210. text:percent+'%<br/>处置率',
  1211. floating:true,
  1212. y:37,
  1213. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  1214. },
  1215. exporting: {
  1216. enabled: false
  1217. },
  1218. credits: {
  1219. enabled: false
  1220. },
  1221. tooltip: {
  1222. enabled: false,
  1223. borderWidth: 0,
  1224. backgroundColor: 'none',
  1225. shadow: false,
  1226. style: {
  1227. fontSize: '12px'
  1228. },
  1229. pointFormat: '<span style="border:2px solid #27c5ff; background:rgba(255,255,255,0.3); color:#ffffff; font-size:14px; font-weight:bold;">{point.name}:{point.showv}%</span>'
  1230. },
  1231. pane: {
  1232. startAngle: start,
  1233. background: [{
  1234. outerRadius: '110%',
  1235. innerRadius: '60%',
  1236. backgroundColor: 'rgba(0,0,0,0)',
  1237. borderWidth: 0
  1238. }]
  1239. },
  1240. yAxis: {
  1241. min: 0,
  1242. max: 100,
  1243. lineWidth: 0,
  1244. tickPositions: []
  1245. },
  1246. plotOptions: {
  1247. solidgauge: {
  1248. dataLabels: {
  1249. enabled: false
  1250. },
  1251. linecap: 'square',
  1252. stickyTracking: false,
  1253. rounded: false,
  1254. warp: false
  1255. },
  1256. series:{
  1257. animation: false
  1258. }
  1259. },
  1260. series:[{
  1261. name:title,
  1262. data:[{
  1263. name: '未处理',
  1264. showv: Number(((num4*100)/(num3+num4)).toString().match(/^\d+(?:\.\d{0,2})?/)),
  1265. color: (Highcharts.theme && Highcharts.theme.contrastTextColor),
  1266. radius: '115%',
  1267. innerRadius: '70%',
  1268. y: 100
  1269. },{
  1270. name:'已处理',
  1271. showv:percent,
  1272. color: (Highcharts.theme && Highcharts.theme.contrastTextColor),
  1273. radius: '115%',
  1274. innerRadius: '70%',
  1275. y: percent
  1276. }]
  1277. }]
  1278. });
  1279. if((theme=='access')||(theme=='')){
  1280. $('#'+label_id_title).addClass('shadow_black');
  1281. $('#'+label_id_text).addClass('shadow_black');
  1282. $('#'+icon_id).addClass('shadow_black');
  1283. }else{
  1284. $('#'+label_id_title).addClass('shadow_white');
  1285. $('#'+label_id_text).addClass('shadow_white');
  1286. $('#'+icon_id).addClass('shadow_white');
  1287. }
  1288. }
  1289. var show_all_fireAlarm = function(){
  1290. if($("#company_code").val().length>0)
  1291. location.href = baseUrl + 'view/fireAlarm/subFireAlarm.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1292. else
  1293. location.href = baseUrl + 'view/fireAlarm/subFireAlarm.jsp?theme='+theme;
  1294. }
  1295. var show_all_waterAlarm = function(){
  1296. if($("#company_code").val().length>0)
  1297. location.href = baseUrl + 'view/waterAlarm/subWaterAlarm.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1298. else
  1299. location.href = baseUrl + 'view/waterAlarm/subWaterAlarm.jsp?theme='+theme;
  1300. }
  1301. var show_all_rtuAlarm = function(){
  1302. if($("#company_code").val().length>0)
  1303. location.href = baseUrl + 'view/rtuAlarm/subRtuAlarm.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1304. else
  1305. location.href = baseUrl + 'view/rtuAlarm/subRtuAlarm.jsp?theme='+theme;
  1306. }
  1307. var show_all_fireDevice = function(){
  1308. if($("#company_code").val().length>0)
  1309. location.href = baseUrl + 'view/fireAlarm/FireDeviceIndex.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1310. else
  1311. location.href = baseUrl + 'view/fireAlarm/FireDeviceIndex.jsp?theme='+theme;
  1312. }
  1313. var show_all_efireDevice = function () {
  1314. if($("#company_code").val().length>0)
  1315. location.href = baseUrl + 'view/efireAlarm/eFireDeviceIndex.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1316. else
  1317. location.href = baseUrl + 'view/efireAlarm/eFireDeviceIndex.jsp?theme='+theme;
  1318. }
  1319. var show_all_efireAlarm = function () {
  1320. if($("#company_code").val().length>0)
  1321. location.href = baseUrl + 'view/efireAlarm/subeFireAlarm.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1322. else
  1323. location.href = baseUrl + 'view/efireAlarm/subeFireAlarm.jsp?theme='+theme;
  1324. }
  1325. var show_all_waterDevice = function(){
  1326. if($("#company_code").val().length>0)
  1327. location.href = baseUrl + 'view/waterAlarm/WaterDeviceIndex.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1328. else
  1329. location.href = baseUrl + 'view/waterAlarm/WaterDeviceIndex.jsp?theme='+theme;
  1330. }
  1331. var show_all_rtuDevice = function(){
  1332. if($("#company_code").val().length>0)
  1333. location.href = baseUrl + 'view/rtuAlarm/RtuDeviceIndex.jsp?theme='+theme+'&company_code='+($("#company_code").val());
  1334. else
  1335. location.href = baseUrl + 'view/rtuAlarm/RtuDeviceIndex.jsp?theme='+theme;
  1336. }
  1337. Ext.onReady(function(){
  1338. baseUrl = $("#basePath").val();
  1339. theme = $("#theme").val();
  1340. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  1341. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  1342. V_LOGINNAME = $("#V_LOGINNAME").val();
  1343. V_PASSWORD = $("#V_PASSWORD").val();
  1344. viewAlarmType = $("#viewAlarmType").val();
  1345. pieAlarmType = $("#pieAlarmType").val();
  1346. statusType = $("#statusType").val();
  1347. company_code = $("#company_code").val();
  1348. mapStyle = (theme=='default')?'normal':(theme=='gray')?'amap://styles/light':'amap://styles/659dc6c4753dc6e87c65c8a874c02133';
  1349. // if((V_LOGINNAME=='dfmz')||(V_LOGINNAME=='ytkj'))
  1350. location.href = baseUrl+'view/frontpage/map.jsp';
  1351. return;
  1352. $("#alarm_wrapper_table").css('left',(($(document).innerWidth()-800)/2)+'px');
  1353. if((theme=='access')||(theme==''))
  1354. $('#alarm_wrapper').addClass('shadow_black');
  1355. else
  1356. $('#alarm_wrapper').addClass('shadow_white');
  1357. var tab = Ext.create('Ext.tab.Panel',{
  1358. items:[{
  1359. title:'火警系统报告',
  1360. html:'<iframe id="FireAlarmWinmdow" name="FireAlarmWinmdow" src="fireAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):'')+'" style="width:100%;height:100%;" frameborder="0"></iframe>'
  1361. },{
  1362. title:'水系统报告',
  1363. html:'<iframe id="WaterAlarmWinmdow" name="WaterAlarmWinmdow" src="waterAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):'')+'" style="width:100%;height:100%;" frameborder="0"></iframe>'
  1364. },{
  1365. title:'RTU报告',
  1366. html:'<iframe id="RtuAlarmWinmdow" name="RtuAlarmWinmdow" src="rtuAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):'')+'" style="width:100%;height:100%;" frameborder="0"></iframe>'
  1367. }],
  1368. listeners:{
  1369. click:{
  1370. element: 'el', //bind to the underlying el property on the panel
  1371. fn: function(){
  1372. $("#FireAlarmWinmdow").attr("src",'fireAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):''));
  1373. $("#FireAlarmWinmdow").attr("style",'width:100%;height:100%;');
  1374. $("#FireAlarmWinmdow").attr("frameborder",'0');
  1375. $("#WaterAlarmWinmdow").attr("src",'waterAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):''));
  1376. $("#WaterAlarmWinmdow").attr("style",'width:100%;height:100%;');
  1377. $("#WaterAlarmWinmdow").attr("frameborder",'0');
  1378. $("#RtuAlarmWinmdow").attr("src",'rtuAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):''));
  1379. $("#RtuAlarmWinmdow").attr("style",'width:100%;height:100%;');
  1380. $("#RtuAlarmWinmdow").attr("frameborder",'0');
  1381. }
  1382. }
  1383. }
  1384. });
  1385. myMask = new Ext.LoadMask(Ext.getBody(), {
  1386. msg: '查询中,请稍后!',
  1387. cls:'toplevel',
  1388. removeMask: true //完成后移除
  1389. });
  1390. show_alarm_list = function(){
  1391. if(alarm_show_window==null)
  1392. alarm_show_window = Ext.create('Ext.window.Window', {
  1393. title: '最新报警事件记录',
  1394. id:'alarm_show_window',
  1395. height: 640,
  1396. width: 800,
  1397. layout: 'fit',
  1398. items:tab,
  1399. modal:true,
  1400. closable:true,
  1401. closeAction: 'hide'
  1402. }).show();
  1403. else{
  1404. alarm_show_window.show();
  1405. }
  1406. $("#FireAlarmWinmdow").attr("src",'fireAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):''));
  1407. $("#FireAlarmWinmdow").attr("style",'width:100%;height:100%;');
  1408. $("#FireAlarmWinmdow").attr("frameborder",'0');
  1409. $("#WaterAlarmWinmdow").attr("src",'waterAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):''));
  1410. $("#WaterAlarmWinmdow").attr("style",'width:100%;height:100%;');
  1411. $("#WaterAlarmWinmdow").attr("frameborder",'0');
  1412. $("#RtuAlarmWinmdow").attr("src",'rtuAlarm/window.jsp?theme='+theme+(($("#company_code").val().length>0)?('&company_code='+($("#company_code").val())):''));
  1413. $("#RtuAlarmWinmdow").attr("style",'width:100%;height:100%;');
  1414. $("#RtuAlarmWinmdow").attr("frameborder",'0');
  1415. }
  1416. map = new AMap.Map('container', {
  1417. mapStyle: mapStyle, //样式URL
  1418. viewMode: '3D',
  1419. turboMode: false,
  1420. resizeEnable: true,
  1421. zoom: mapzoom,
  1422. center: [121.475644, 31.1857],
  1423. features:['bg', 'road', 'building'],
  1424. pitch: 45,
  1425. forceVector: true
  1426. });
  1427. myMask.show();
  1428. getCurrentData();
  1429. // mapRotation();
  1430. $("#search_company").on('input',function(){
  1431. update_companyList();
  1432. });
  1433. $(window).resize(function(){
  1434. body_resize();
  1435. });
  1436. body_resize();
  1437. });