fireOption.js 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
  1. /**
  2. *
  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 StatusStore;
  15. var baseUrl;
  16. var centerLng;
  17. var centerLat;
  18. var company_code;
  19. var theme;
  20. var ConfirmStore
  21. var pieWidth;
  22. var showAlarm=null;
  23. var pieMask;
  24. var V_LOGINNAME='',V_PASSWORD='';
  25. var maxHeight = 10000;
  26. var maxWidth = 10000;
  27. var companyName = null;
  28. var sm = Ext.create('Ext.selection.CheckboxModel');
  29. Ext.define('VFireOption',{
  30. extend: 'Ext.data.Model',
  31. fields: [
  32. { name:'id', type:'int'},
  33. { name:'orderIdx', type:'int'},
  34. { name:'device_code', type:'string' },
  35. { name:'company_code', type:'string' },
  36. { name:'company_name', type:'string' },
  37. { name:'fullname', type:'string' },
  38. { name:'time', type:'string' },
  39. { name:'name', type:'string' },
  40. { name:'status', type:'string' },
  41. { name:'data', type:'string' },
  42. { name:'data2', type:'string' },
  43. { name:'data4', type:'string' },
  44. { name:'clzt', type:'string' },
  45. { name:'clr_name', type:'string' },
  46. { name:'clsj', type:'string' },
  47. { name:'clnr', type:'string'},
  48. { name:'clwb', type:'string'}
  49. ]
  50. });
  51. Ext.define('CompanyComboStore',{
  52. extend:'Ext.data.Model',
  53. fields: [
  54. {name:'owner_name', type:'string'},
  55. {name:'owner_id',type:'string'}
  56. ]
  57. });
  58. var drawDevices = function(){
  59. // alert('get device info');
  60. if(StatusStore.length>0){
  61. var current_device_id='';
  62. var device_count=0;
  63. var fire_device_count=0;
  64. var water_device_count=0;
  65. var rtu_device_count=0;
  66. var other_device_count=0;
  67. var fire_device_out=0;
  68. var water_device_out=0;
  69. var rtu_device_out=0;
  70. var other_device_out=0;
  71. var fire_device_alarm=0;
  72. var water_device_alarm=0;
  73. var rtu_device_alarm=0;
  74. var other_device_alarm=0;
  75. var fire_device_normal=0;
  76. var water_device_normal=0;
  77. var rtu_device_normal=0;
  78. var other_device_normal=0;
  79. var total_normal=0;
  80. var mark_array = new Array();
  81. for(var i=0;i<StatusStore.length;i++){
  82. if((StatusStore[i].point_list!=null)
  83. &&(StatusStore[i].point_list!=undefined)
  84. &&(StatusStore[i].point_list.length>0)){
  85. for(var j=0;j<StatusStore[i].point_list.length;j++){
  86. if(StatusStore[i].point_list[j].device_id!=current_device_id){
  87. current_device_id=StatusStore[i].point_list[j].device_id;
  88. device_count++;
  89. if((StatusStore[i].point_list[j].dwtype=='1')
  90. ||(StatusStore[i].point_list[j].dwtype==1))
  91. fire_device_count++;
  92. else if((StatusStore[i].point_list[j].dwtype=='2')
  93. ||(StatusStore[i].point_list[j].dwtype==2))
  94. water_device_count++;
  95. else if((StatusStore[i].point_list[j].dwtype=='3')
  96. ||(StatusStore[i].point_list[j].dwtype==3))
  97. other_device_count++;
  98. else if((StatusStore[i].point_list[j].dwtype=='4')
  99. ||(StatusStore[i].point_list[j].dwtype==4))
  100. water_device_count++;
  101. else if((StatusStore[i].point_list[j].dwtype=='5')
  102. ||(StatusStore[i].point_list[j].dwtype==5))
  103. water_device_count++;
  104. else if((StatusStore[i].point_list[j].dwtype=='6')
  105. ||(StatusStore[i].point_list[j].dwtype==6))
  106. rtu_device_count++;
  107. else
  108. other_device_count++;
  109. }
  110. if((StatusStore[i].point_list[j].point_code=='0')
  111. ||(StatusStore[i].point_list[j].point_code==0)){
  112. if((StatusStore[i].point_list[j].point_data!='0')
  113. &&(StatusStore[i].point_list[j].point_data!=0)){
  114. if((StatusStore[i].point_list[j].dwtype=='1')
  115. ||(StatusStore[i].point_list[j].dwtype==1))
  116. fire_device_alarm++;
  117. else if((StatusStore[i].point_list[j].dwtype=='2')
  118. ||(StatusStore[i].point_list[j].dwtype==2)){
  119. if((StatusStore[i].point_list[j].point_data=='4')
  120. ||(StatusStore[i].point_list[j].point_data==4))
  121. water_device_out++;
  122. else
  123. water_device_alarm++;
  124. }
  125. else if((StatusStore[i].point_list[j].dwtype=='3')
  126. ||(StatusStore[i].point_list[j].dwtype==3))
  127. other_device_out++;
  128. else if((StatusStore[i].point_list[j].dwtype=='4')
  129. ||(StatusStore[i].point_list[j].dwtype==4))
  130. if((StatusStore[i].point_list[j].point_data=='4')
  131. ||(StatusStore[i].point_list[j].point_data==4))
  132. water_device_out++;
  133. else
  134. water_device_alarm++;
  135. else if((StatusStore[i].point_list[j].dwtype=='5')
  136. ||(StatusStore[i].point_list[j].dwtype==5))
  137. if((StatusStore[i].point_list[j].point_data=='4')
  138. ||(StatusStore[i].point_list[j].point_data==4))
  139. water_device_out++;
  140. else
  141. water_device_alarm++;
  142. else if((StatusStore[i].point_list[j].dwtype=='6')
  143. ||(StatusStore[i].point_list[j].dwtype==6))
  144. rtu_device_out++;
  145. else
  146. other_device_out++;
  147. }
  148. }
  149. }
  150. }
  151. }
  152. fire_device_normal = fire_device_count-fire_device_out-fire_device_alarm;
  153. water_device_normal = water_device_count-water_device_out-water_device_alarm;
  154. rtu_device_normal = rtu_device_count-rtu_device_out-rtu_device_alarm;
  155. other_device_normal = other_device_count-other_device_out-other_device_alarm;
  156. total_normal = fire_device_normal+water_device_normal+rtu_device_normal+other_device_normal;
  157. var themecolor = ((theme=='')||(theme=='access'))?'#ffffff':'#000000';
  158. draw_cycle_icon('firePie1','设备在线<br/> <br/>监控总数:<span style="color:#DDDF0D;text-shadow: 1px 1px 2px #888, 0 0 0 #000">'+fire_device_count+'</span><br/>在线总数:<span style="color:#34abf5;text-shadow: 1px 1px 2px #888, 0 0 0 #000">'+(fire_device_count-fire_device_out)+'</span><br/>离线线总数:<span style="color:#DF5353;text-shadow: 1px 1px 2px #888, 0 0 0 #000">'+fire_device_out+'<br/>在线率:',fire_device_count,(fire_device_count-fire_device_out),themecolor);
  159. draw_cycle_icon('firePie2','状态正常<br/> <br/>在线总数:<span style="color:#DDDF0D;text-shadow: 1px 1px 2px #888, 0 0 0 #000">'+(fire_device_count-fire_device_out)+'</span><br/>正常总数:<span style="color:#34abf5;text-shadow: 1px 1px 2px #888, 0 0 0 #000">'+fire_device_normal+'</span><br/>告警总数:<span style="color:#DF5353;text-shadow: 1px 1px 2px #888, 0 0 0 #000">'+fire_device_alarm+'<br/>正常率:',(fire_device_count-fire_device_out),fire_device_normal,themecolor);
  160. }
  161. }
  162. var draw_confirm = function(){
  163. if(companyName!=null)
  164. $("#FirePiePanel_title_string").html(companyName+'.火警报告列表');
  165. else
  166. $("#FirePiePanel_title_string").html('火警报告列表');
  167. var themecolor = ((theme=='')||(theme=='access'))?'#ffffff':'#000000';
  168. for(var i=0;i<ConfirmStore.length;i++){
  169. if(ConfirmStore[i].id=='fire_alarm'){
  170. var mColor= '#34abf5';//[ '#DDDF0D','#f66167', '#34abf5']
  171. var percent = 100;
  172. if(ConfirmStore[i].count>0)
  173. percent = Number(((ConfirmStore[i].sum*100)/ConfirmStore[i].count).toString().match(/^\d+(?:\.\d{0,2})?/));
  174. if(percent<60)
  175. mColor = '#f66167';
  176. else if(percent<80)
  177. mColor = '#DDDF0D';
  178. $("#operation_num_1").html(ConfirmStore[i].count);
  179. $("#operation_num_2").html(ConfirmStore[i].sum);
  180. $("#operation_num_3").html(ConfirmStore[i].count-ConfirmStore[i].sum);
  181. $("#operation_num_4").html(percent);
  182. // draw_cycle_icon('firePie3','告警处理情况<br/>告警总数:<span style="color:#DDDF0D;text-shadow: 1px 1px 2px #888, 0 0 0 #000">'+ConfirmStore[i].count+'</span><br/>已处理:<span style="color:#34abf5;text-shadow: 1px 1px 2px #888, 0 0 0 #000">'+ConfirmStore[i].sum+'</span><br/>未处理:<span style="color:#DF5353;text-shadow: 1px 1px 2px #888, 0 0 0 #000">'+(ConfirmStore[i].count-ConfirmStore[i].sum)+'</span><br/>处理率:',ConfirmStore[i].count,ConfirmStore[i].sum,themecolor);
  183. Highcharts.getOptions().colors = Highcharts.map(['#DDDF0D',mColor], function (color) {
  184. return {
  185. radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
  186. stops: [
  187. [0, color],
  188. [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
  189. ]
  190. };
  191. });
  192. Highcharts.chart('operation_pie',{
  193. chart: {
  194. type: 'solidgauge',
  195. height: '100%',
  196. backgroundColor: 'rgba(0,0,0,0)',
  197. animation: false
  198. },
  199. title:{
  200. text:percent+'%',
  201. floating:true,
  202. y:90,
  203. style:{fontSize:'16px',color:themecolor,fontWeight:'bold'}
  204. },
  205. exporting: {
  206. enabled: false
  207. },
  208. credits: {
  209. enabled: false
  210. },
  211. tooltip: {
  212. enabled: false
  213. },
  214. pane: {
  215. startAngle: 0,
  216. background: [{
  217. outerRadius: '110%',
  218. innerRadius: '55%',
  219. backgroundColor: 'rgba(0,0,0,0)',
  220. borderWidth: 0
  221. }]
  222. },
  223. yAxis: {
  224. min: 0,
  225. max: 100,
  226. lineWidth: 0,
  227. tickPositions: []
  228. },
  229. plotOptions: {
  230. solidgauge: {
  231. dataLabels: {
  232. enabled: false
  233. },
  234. linecap: 'square',
  235. stickyTracking: false,
  236. rounded: false,
  237. warp: false
  238. },
  239. series:{
  240. animation: false
  241. }
  242. },
  243. series:[{
  244. name:name,
  245. data:[{
  246. color: 'rgba(0,0,0,0.3)',
  247. radius: '110%',
  248. innerRadius: '60%',
  249. y: 100
  250. },{
  251. color: (Highcharts.theme && Highcharts.theme.contrastTextColor),
  252. radius: '110%',
  253. innerRadius: '60%',
  254. y: percent
  255. }]
  256. }]
  257. });
  258. Highcharts.getOptions().colors = Highcharts.map(['#f66167', '#34abf5'], function (color) {
  259. return {
  260. linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
  261. stops: [
  262. [0, color],
  263. [1, Highcharts.Color(color).setOpacity(0).get('rgb')] // darken
  264. ]
  265. };
  266. });
  267. Highcharts.chart('operation_area',{
  268. chart:{
  269. type:'area',
  270. // zoomType: 'x',
  271. backgroundColor: 'rgba(0,0,0,0)'
  272. },
  273. color:['#f66167', '#34abf5'],
  274. title:{
  275. text:(companyName!=null)?companyName+'.火警监控告警处理情况跟踪':'火警监控告警处理情况跟踪',
  276. float:true,
  277. style:{fontSize:'14px',color:themecolor,fontWeight:'bold'},
  278. enabled:false
  279. },
  280. legend:{
  281. // enabled:false,
  282. floating:true,
  283. x:410,
  284. y:-210,
  285. itemStyle:{fontSize:'12px',color:themecolor,fontWeight:'bold'}
  286. },
  287. // colors:['#f66167', '#34abf5'],
  288. exporting: {
  289. enabled: false
  290. },
  291. credits: {
  292. enabled: false
  293. },
  294. xAxis:{
  295. categories:ConfirmStore[i].day_list,
  296. tickmarkPlacement:'on',
  297. gridLineWidth:0,
  298. labels:{
  299. enabled:false,
  300. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  301. },
  302. title:{
  303. enabled:false
  304. }
  305. },
  306. yAxis:{
  307. title:{
  308. enabled:false,
  309. text:'次',
  310. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  311. },
  312. gridLineWidth:1,
  313. gridLineColor:'rgba(0,0,0,0.2)',
  314. labels:{
  315. // enabled:false,
  316. formatter:this.value,
  317. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  318. }
  319. },
  320. plotOptions:{
  321. area:{
  322. stackiung:'normal',
  323. // fillOpacity:0.1,
  324. // lineColor:'#666666',
  325. // lineWidth:1,
  326. marker:{
  327. lineWidth:0,
  328. enabled:false,
  329. radius:0
  330. // lineColor:'#666666'
  331. }
  332. }
  333. },
  334. series:[
  335. {
  336. name:'告警次数',
  337. data:ConfirmStore[i].count_list,
  338. lineWidth:1,
  339. lineColor:'#f66167',
  340. fillColor: {
  341. linearGradient: {
  342. x1: 0,
  343. y1: 0,
  344. x2: 0,
  345. y2: 1
  346. },
  347. stops: [
  348. [0, '#f66167'],
  349. [1, Highcharts.Color('#f66167').setOpacity(0.3).get('rgba')]
  350. ]
  351. }
  352. },{
  353. name:'处理次数',
  354. data:ConfirmStore[i].sum_list,
  355. lineWidth:1,
  356. lineColor:'#34abf5',
  357. fillColor: {
  358. linearGradient: {
  359. x1: 0,
  360. y1: 0,
  361. x2: 0,
  362. y2: 1
  363. },
  364. stops: [
  365. [0, '#34abf5'],
  366. [1, Highcharts.Color('#34abf5').setOpacity(0.3).get('rgba')]
  367. ]
  368. },
  369. }
  370. ]
  371. });
  372. }
  373. }
  374. }
  375. var draw_cycle_icon = function(icon_id,name, total, num, themecolor){
  376. var mColor= '#34abf5';//[ '#DDDF0D','#f66167', '#34abf5']
  377. var percent = 100;
  378. if(total>0)
  379. percent = Number(((num*100)/total).toString().match(/^\d+(?:\.\d{0,2})?/));
  380. if(percent<60)
  381. mColor = '#f66167';
  382. else if(percent<80)
  383. mColor = '#DDDF0D';
  384. $("#"+icon_id+"Title").html('<br/><br/>'+name+percent+'%');
  385. Highcharts.getOptions().colors = Highcharts.map([ '#000000',mColor, mColor], function (color) {
  386. return {
  387. radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
  388. stops: [
  389. [0, color],
  390. [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
  391. ]
  392. };
  393. });
  394. Highcharts.chart(icon_id,{
  395. chart: {
  396. type: 'solidgauge',
  397. height: '85%',
  398. backgroundColor: 'rgba(0,0,0,0)',
  399. reflow:true,
  400. marginTop:0
  401. },
  402. title:{
  403. text:percent+'%',
  404. floating:true,
  405. y:(pieWidth*2/5),
  406. style:{fontSize:'21px',color:themecolor,fontWeight:'bold'}
  407. },
  408. exporting: {
  409. enabled: false
  410. },
  411. credits: {
  412. enabled: false
  413. },
  414. tooltip: {
  415. enabled: false
  416. },
  417. pane: {
  418. startAngle: -90,
  419. endAngle: 270,
  420. background: [{
  421. outerRadius: '90%',
  422. innerRadius: '60%',
  423. backgroundColor: 'rgba(0,0,0,0)',
  424. borderWidth: 0
  425. }]
  426. },
  427. yAxis: {
  428. min: 0,
  429. max: 100,
  430. lineWidth: 0,
  431. tickPositions: []
  432. },
  433. plotOptions: {
  434. solidgauge: {
  435. dataLabels: {
  436. enabled: false
  437. },
  438. linecap: 'square',
  439. stickyTracking: false,
  440. rounded: false,
  441. warp: false
  442. }
  443. },
  444. series:[{
  445. name:'',
  446. data:[{
  447. color: Highcharts.Color(mColor)
  448. .setOpacity(0.2)
  449. .get(),
  450. radius: '110%',
  451. innerRadius: '80%',
  452. y: 100
  453. },{
  454. color: (Highcharts.theme && Highcharts.theme.contrastTextColor) ,
  455. radius: '110%',
  456. innerRadius: '80%',
  457. y: percent
  458. },{
  459. color: (Highcharts.theme && Highcharts.theme.contrastTextColor) ,
  460. radius: '60%',
  461. innerRadius: '0%',
  462. y: 100
  463. }]
  464. }]
  465. });
  466. if((theme=='access')||(theme=='')){
  467. $('#'+icon_id).addClass('shadow_black');
  468. }else{
  469. $('#'+icon_id).addClass('shadow_white');
  470. }
  471. }
  472. var getCurrentData = function(){
  473. var query = new Object();
  474. // query.V_LOGINNAME = V_LOGINNAME;
  475. // query.V_PASSWORD = V_PASSWORD;
  476. query.dwtype='1';
  477. query.COMMSTATUS = 'NO';
  478. if((company_code!=null)&&(company_code!='null')&&(company_code.length>0))
  479. query.company_code = company_code;
  480. pieMask.show();
  481. $.ajax({
  482. type:'POST',
  483. url: baseUrl+"iot/alarm/view/getConfirmStatusByDays",
  484. data: {
  485. queryJson : Ext.JSON.encode(query)
  486. },
  487. success: function(result){
  488. var json = eval('(' + result + ')');
  489. if(json.action=='getConfirmStatusByDays'){
  490. if(json.check=='true'){
  491. ConfirmStore = json.RESULT;
  492. if(json.company_name!=null)
  493. companyName = json.company_name;
  494. else
  495. companyName = null;
  496. draw_confirm();
  497. }else{
  498. Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function(){
  499. window.parent.frames.return_login();
  500. });
  501. }
  502. }
  503. pieMask.hide();
  504. }
  505. });
  506. }
  507. var body_resize = function(){
  508. maxHeight = document.documentElement.clientHeight;
  509. maxWidth = document.documentElement.clientWidth;
  510. Ext.getCmp('FireAlarmPanel').setHeight(maxHeight);
  511. Ext.getCmp('FireAlarmPanel').setWidth(maxWidth);
  512. }
  513. function exportbtn_click(){
  514. V_LOGINNAME = $("#V_LOGINNAME").val();
  515. company_code = document.getElementById('company_code').value;
  516. clzt = document.getElementById('clzt').value;
  517. time_start = document.getElementById('time_start').value;
  518. time_end = document.getElementById('time_end').value;
  519. var fields = '';
  520. var array = ['id','company_name','device_code','name','data2','clr','clnr','clwb','clzt','time','clsj'];
  521. var name = ['编号','公司名称','设备编号','设备名称','报警类型','处理人','处理内容','是否误报','处理状态','报警时间','处理时间'];
  522. for(var i=0;i<11;i++){
  523. if(i>0)
  524. fields += ',';
  525. fields += '{id:"'+array[i]+'",title:"'+name[i]+'",shown:"'+true+'"}';
  526. }
  527. var query = new Object();
  528. // query.V_LOGINNAME = V_LOGINNAME;
  529. query.company_code = company_code;
  530. query.clzt = clzt;
  531. query.time_start = time_start;
  532. query.time_end = time_end;
  533. query.COMMSTATUS = 'NO';
  534. query.EXPORT_FILE = '火系统告警数据列表';
  535. query.fields = '['+fields+']';
  536. $.ajax({
  537. type:'POST',
  538. url: baseUrl+"iot/excel/view/fireAlarmExcel",
  539. data: {
  540. queryJson : Ext.JSON.encode(query)
  541. },
  542. success: function(result){
  543. var json = eval('(' + result + ')');
  544. if(json.action=='dormExport'){
  545. ConfirmStore = json.RESULT;
  546. var elemIF = document.createElement("iframe");
  547. elemIF.src = baseUrl+json.filename;
  548. elemIF.style.display = "none";
  549. document.body.appendChild(elemIF);
  550. }
  551. }
  552. });
  553. }
  554. Ext.onReady(function(){
  555. baseUrl = document.getElementById('basePath').value;
  556. theme = document.getElementById('theme').value;
  557. company_code = document.getElementById('company_code').value;
  558. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  559. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  560. V_LOGINNAME = $("#V_LOGINNAME").val();
  561. V_PASSWORD = $("#V_PASSWORD").val();
  562. var currentWidth = document.documentElement.clientWidth;
  563. pieWidth = currentWidth/7;
  564. var chkIcon = '<img src="'+baseUrl+'res/img/common/check.gif"/>'
  565. var unchkIcon = '<img src="'+baseUrl+'res/img/common/uncheck.gif"/>'
  566. var countPerPage = 20;
  567. var chkBoolean = function(flag) {
  568. if(flag)
  569. return chkIcon;
  570. return unchkIcon;
  571. }
  572. var queryJson = new Object();
  573. // queryJson.V_LOGINNAME = V_LOGINNAME;
  574. // queryJson.V_PASSWORD = V_PASSWORD;
  575. queryJson.COMMSTATUS = 'NO';
  576. if((company_code!=null)&&(company_code!='null')&&(company_code.length>0))
  577. queryJson.company_code = company_code;
  578. var myStore = Ext.create('Ext.data.Store', {
  579. model: 'VFireOption',
  580. pageSize: countPerPage,
  581. proxy: {
  582. type: 'ajax',
  583. actionMethods: {
  584. create : 'POST',
  585. read : 'POST', // by default GET
  586. update : 'POST',
  587. destroy: 'POST'
  588. },
  589. url: baseUrl+'iot/alarm/view/getHJList',
  590. reader: {
  591. type: 'json',
  592. root: 'RESULT',
  593. totalProperty: 'totalCount'
  594. },
  595. extraParams:{
  596. queryJson:Ext.JSON.encode(queryJson)
  597. }
  598. },
  599. sorters:[{
  600. property:'time',
  601. direction:'DESC'
  602. }],
  603. remoteSort: true
  604. });
  605. myStore.on("load",function(myStore){
  606. getCurrentData();
  607. // alert(myStore.find('RESULT'));
  608. //do something
  609. });
  610. myStore.each(function(record){
  611. alert(record.get('RESULT'))
  612. });
  613. var CompanyStory = Ext.create('Ext.data.Store',{
  614. model: 'CompanyComboStore',
  615. proxy: {
  616. type: 'ajax',
  617. actionMethods: {
  618. create : 'POST',
  619. read : 'POST', // by default GET
  620. update : 'POST',
  621. destroy: 'POST'
  622. },
  623. url: baseUrl+'iot/company/view/getNameList',
  624. reader: {
  625. type: 'json',
  626. root: 'RESULT',
  627. totalProperty: 'totalCount'
  628. },
  629. extraParams:{
  630. queryJson:Ext.JSON.encode(queryJson)
  631. }
  632. }
  633. });
  634. var ClztStory = Ext.create('Ext.data.Store',{
  635. fields:['abbr','name'],
  636. data:[
  637. {'abbr':'0','name':'未处理'},
  638. {'abbr':'1','name':'已处理'}
  639. ]
  640. });
  641. var FilterForm = Ext.create('Ext.form.Panel', {
  642. id: 'VFireOptionFilterForm',
  643. labelWidth: 55,
  644. defaultType: 'textfield',
  645. bodyPadding: 15,
  646. items: [{
  647. xtype:'combo',
  648. fieldLabel:'单位名称',
  649. id: 'ff_company_code',
  650. name:'ff_company_code',
  651. displayField : 'owner_name',
  652. valueField : 'owner_id',
  653. editable : false,
  654. width:330,
  655. store:CompanyStory
  656. },{
  657. xtype:'datefield',
  658. fieldLabel:"开始日期",
  659. minValue:'07/07/2017',
  660. minText:"当前日期选择应大于当天日期",
  661. format:"Y-m-d",
  662. columnWidth:0.5,
  663. id: 'ff_start_data',
  664. name:"ff_start_data",
  665. editable:false,//只读约束
  666. width:330
  667. },{
  668. xtype:'datefield',
  669. fieldLabel:"结束日期",
  670. minValue:'07/07/2017',
  671. minText:"当前日期选择应大于当天日期",
  672. format:"Y-m-d",
  673. columnWidth:0.5,
  674. id: 'ff_end_data',
  675. name:"ff_end_data",
  676. editable:false,//只读约束
  677. width:330
  678. },{
  679. xtype:'combo',
  680. fieldLabel:'处理状态',
  681. id: 'ff_clzt',
  682. name: 'ff_clzt',
  683. displayField : 'name',
  684. valueField : 'abbr',
  685. editable : false,
  686. width:330,
  687. store:ClztStory
  688. }],
  689. buttons: [{
  690. text: '筛选',
  691. iconCls:'ok_btn',
  692. handler: function() {
  693. var form = this.up('form').getForm();
  694. if (form.isValid()) {
  695. var query = new Object();
  696. // var tmp = Ext.getCmp('ff_company_code');
  697. if(Ext.getCmp('ff_company_code').getValue()){
  698. query.company_code = Ext.getCmp('ff_company_code').getValue();
  699. $("#company_code").val(query.company_code);
  700. company_code = query.company_code;
  701. $("#FirePiePanel_title_string").html(Ext.getCmp('ff_company_code').getRawValue( )+'.火警报告列表');
  702. }else{
  703. $("#company_code").val('');
  704. $("#FirePiePanel_title_string").html('火警报告列表');
  705. company_code = null;
  706. }
  707. if(Ext.getCmp('ff_clzt').getValue()){
  708. query.clzt = Ext.getCmp('ff_clzt').getValue();
  709. $("#clzt").val(query.clzt);
  710. }else{
  711. $("#clzt").val('');
  712. }
  713. if(Ext.getCmp('ff_start_data').getValue()){
  714. query.time_start = Ext.getCmp('ff_start_data').getValue();
  715. var datetime=query.time_start.getFullYear() + '-' + (query.time_start.getMonth() + 1) + '-' + query.time_start.getDate() + ' ' + query.time_start.getHours() + ':' + query.time_start.getMinutes() + ':' + query.time_start.getSeconds();
  716. $("#time_start").val(datetime);
  717. }else{
  718. $("#time_start").val('');
  719. }
  720. if(Ext.getCmp('ff_end_data').getValue()){
  721. query.time_end = Ext.getCmp('ff_end_data').getValue();
  722. var datetime1=query.time_end.getFullYear() + '-' + (query.time_end.getMonth() + 1) + '-' + query.time_end.getDate() + ' ' + query.time_end.getHours() + ':' + query.time_end.getMinutes() + ':' + query.time_end.getSeconds();
  723. $("#time_end").val(datetime1);
  724. }else{
  725. $("#time_end").val('');
  726. }
  727. // query.clzt = Ext.getCmp('ff_clzt').getValue()==null?"":Ext.getCmp('ff_clzt').getValue();
  728. // query.time_start = Ext.getCmp('ff_start_data').getValue()==null?"":Ext.getCmp('ff_start_data').getValue();
  729. // query.time_end = Ext.getCmp('ff_end_data').getValue()==null?"":Ext.getCmp('ff_end_data').getValue();
  730. // query.V_LOGINNAME = V_LOGINNAME;
  731. // query.V_PASSWORD = V_PASSWORD;
  732. query.COMMSTATUS = 'NO';
  733. var jsonstr = Ext.JSON.encode(query);
  734. myStore.getProxy().extraParams = {
  735. queryJson : jsonstr
  736. };
  737. Ext.getCmp('VFireOptionListPageToolbar').moveFirst();
  738. Ext.getCmp('ff_company_code').setValue('');
  739. Ext.getCmp('ff_clzt').setValue('');
  740. Ext.getCmp('VFireOptionFilterWin').hide();
  741. // getCurrentData();
  742. }
  743. }
  744. },{
  745. text: '关闭',
  746. iconCls: 'cancel_btn',
  747. handler: function() {
  748. Ext.getCmp('VFireOptionFilterWin').hide();
  749. }
  750. }]
  751. });
  752. var filterwin = function() {
  753. Ext.create('Ext.window.Window',{
  754. id: 'VFireOptionFilterWin',
  755. title: '火警报告筛选',
  756. height: 210,
  757. width: 400,
  758. layout: 'fit',
  759. items: FilterForm,
  760. closable:false,
  761. modal:true,
  762. closeAction: 'hide'
  763. }).show();
  764. CompanyStory.reload();
  765. }
  766. var radiogroup = new Ext.create('Ext.form.RadioGroup',{
  767. fieldLabel:'误报',
  768. id:'uf_r_clwb',
  769. width:300,
  770. items:[{
  771. name:'uf_r_clwb',
  772. inputValue:'1',
  773. boxLabel:'是'
  774. },{
  775. name:'uf_r_clwb',
  776. inputValue:'0',
  777. boxLabel:'否',
  778. checked:true
  779. }]
  780. });
  781. var radiogroup2 = new Ext.create('Ext.form.RadioGroup',{
  782. fieldLabel:'处理范围',
  783. id:'uf_r_clfw',
  784. width:300,
  785. items:[{
  786. name:'uf_r_clfw',
  787. inputValue:'1',
  788. boxLabel:'批量'
  789. },{
  790. name:'uf_r_clfw',
  791. inputValue:'0',
  792. boxLabel:'单一',
  793. checked:true
  794. }]
  795. });
  796. var clear_modify_form = function(){
  797. Ext.getCmp('uf_company_name').setValue('');
  798. Ext.getCmp('uf_name').setValue('');
  799. Ext.getCmp('uf_device_code').setValue('');
  800. Ext.getCmp('uf_id').setValue('');
  801. Ext.getCmp('uf_status').setValue('');
  802. Ext.getCmp('uf_fullname').setValue('');
  803. Ext.getCmp('uf_data2').setValue('');
  804. Ext.getCmp('uf_data4').setValue('');
  805. Ext.getCmp('uf_clwb').setValue('');
  806. Ext.getCmp('uf_clr').setValue('');
  807. Ext.getCmp('uf_clsj').setValue('');
  808. Ext.getCmp('uf_clnr').setValue('');
  809. }
  810. var fireInfoForm = Ext.create('Ext.form.Panel', {
  811. id: 'fireInfoForm',
  812. labelWidth: 55,
  813. url: baseUrl+'iot/alarm/view/updateHj',
  814. defaultType: 'textfield',
  815. bodyPadding: 15,
  816. items: [{
  817. fieldLabel:'单位名称',
  818. id: 'uf_company_name',
  819. name: 'uf_company_name',
  820. anchor:'90%'
  821. },{
  822. fieldLabel:'监控设备',
  823. id:'uf_name',
  824. name:'uf_name',
  825. anchor:'100%'
  826. },{
  827. fieldLabel:'设备编号',
  828. id:'uf_device_code',
  829. name:'uf_device_code',
  830. hidden: true
  831. },{
  832. fieldLabel:'记录编号',
  833. id:'uf_id',
  834. name:'uf_id',
  835. hidden: true
  836. },{
  837. fieldLabel:'设备编号',
  838. id:'uf_status',
  839. name:'uf_status',
  840. hidden: true
  841. },{
  842. fieldLabel:'设备信息',
  843. id:'uf_data4',
  844. name:'uf_data4',
  845. hidden: true
  846. },{
  847. fieldLabel:'故障信息',
  848. id:'uf_data2',
  849. name:'uf_data2',
  850. hidden: true
  851. },{
  852. fieldLabel:'报告信息',
  853. id: 'uf_fullname',
  854. name:'uf_fullname',
  855. xtype: 'textareafield',
  856. maxLength: 250,
  857. cols:4,
  858. anchor:'100%'
  859. },{
  860. fieldLabel:'误报',
  861. id: 'uf_clwb',
  862. name:'uf_clwb',
  863. maxLength: 200,
  864. anchor:'65%'
  865. },radiogroup,radiogroup2,{
  866. fieldLabel:'处理人',
  867. id: 'uf_clr',
  868. name:'uf_clr',
  869. maxLength: 120,
  870. anchor:'65%'
  871. },{
  872. fieldLabel:'处理时间',
  873. id: 'uf_clsj',
  874. name:'uf_clsj',
  875. maxLength: 200,
  876. anchor:'80%'
  877. },{
  878. fieldLabel:'处理内容',
  879. id: 'uf_clnr',
  880. name:'uf_clnr',
  881. xtype: 'textareafield',
  882. maxLength: 250,
  883. cols:4,
  884. anchor:'100%'
  885. },{
  886. id:'fm_queryJson',
  887. name:'queryJson',
  888. hidden:true
  889. }],
  890. buttons: [{
  891. text: '处理',
  892. id:'confirmBtn',
  893. iconCls:'ok_btn',
  894. handler: function() {
  895. var form = this.up('form').getForm();
  896. if (form.isValid()) {
  897. var queryJson = new Object();
  898. // queryJson.V_LOGINNAME = V_LOGINNAME;
  899. // queryJson.V_PASSWORD = V_PASSWORD;
  900. queryJson.id = Ext.getCmp('uf_id').getValue();
  901. queryJson.status = Ext.getCmp('uf_status').getValue();
  902. queryJson.name = Ext.getCmp('uf_name').getValue();
  903. queryJson.data4 = Ext.getCmp('uf_data4').getValue();
  904. queryJson.data2 = Ext.getCmp('uf_data2').getValue();
  905. queryJson.device_code = Ext.getCmp('uf_device_code').getValue();
  906. queryJson.confirmAll = Ext.getCmp('uf_r_clfw').getChecked()[0].boxLabel=='单一'?'0':'1';
  907. queryJson.clwb = Ext.getCmp('uf_r_clwb').getChecked()[0].boxLabel=='否'?'0':'1';
  908. queryJson.clnr = Ext.getCmp('uf_clnr').getValue();
  909. var jsonstr = Ext.JSON.encode(queryJson);
  910. Ext.getCmp('fm_queryJson').setValue(jsonstr);
  911. form.submit({
  912. method:'post',
  913. success: function(form, action) {
  914. Ext.Msg.alert('操作成功', '已确认'+action.result.activerow+'条记录', function(btn,txt){
  915. clear_modify_form();
  916. myStore.reload();
  917. // getCurrentData();
  918. });
  919. },
  920. failure: function(form, action) {
  921. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  922. clear_modify_form();
  923. myStore.reload();
  924. // getCurrentData();
  925. });
  926. }
  927. });
  928. this.up('window').close();
  929. }
  930. }
  931. },{
  932. text: '关闭',
  933. iconCls: 'cancel_btn',
  934. handler: function() {
  935. this.up('window').close();
  936. }
  937. }]
  938. });
  939. var vFileInfoWin = Ext.create('Ext.window.Window',{
  940. id:'VFileInfoWin',
  941. title:'详细信息: <span id="VInfoWin_Title"></span>',
  942. width:400,
  943. layout:'fit',
  944. closable:false,
  945. modal:true,
  946. closeAction:'hide',
  947. items:fireInfoForm
  948. });
  949. var showFireInfoWin = function(record){
  950. vFileInfoWin.show();
  951. $("#VInfoWin_Title").html(record.get('data'));
  952. Ext.getCmp('uf_company_name').setValue(record.get('company_name'));
  953. Ext.getCmp('uf_name').setValue(record.get('name'));
  954. Ext.getCmp('uf_device_code').setValue(record.get('device_code'));
  955. Ext.getCmp('uf_fullname').setValue(record.get('fullname'));
  956. Ext.getCmp('uf_clr').setValue(record.get('clr_name'));
  957. Ext.getCmp('uf_clsj').setValue(record.get('clsj'));
  958. Ext.getCmp('uf_clnr').setValue(record.get('clnr'));
  959. Ext.getCmp('uf_id').setValue(record.get('id'));
  960. Ext.getCmp('uf_clwb').setValue(record.get('clwb')=='1'?'误报':'告警');
  961. Ext.getCmp('uf_status').setValue(record.get('status'));
  962. Ext.getCmp('uf_data4').setValue(record.get('data4'));
  963. Ext.getCmp('uf_data2').setValue(record.get('data2'));
  964. if(record.get('clzt')=='已处理'){
  965. Ext.getCmp('uf_clwb').setVisible(true);
  966. Ext.getCmp('uf_r_clwb').setVisible(false);
  967. Ext.getCmp('uf_r_clfw').setVisible(false);
  968. Ext.getCmp('confirmBtn').setVisible(false);
  969. Ext.getCmp('uf_clr').setVisible(true);
  970. Ext.getCmp('uf_clsj').setVisible(true);
  971. }else{
  972. Ext.getCmp('uf_clwb').setVisible(false);
  973. Ext.getCmp('uf_r_clwb').setVisible(true);
  974. Ext.getCmp('uf_r_clfw').setVisible(true);
  975. Ext.getCmp('confirmBtn').setVisible(true);
  976. Ext.getCmp('uf_clr').setVisible(false);
  977. Ext.getCmp('uf_clsj').setVisible(false);
  978. }
  979. }
  980. var FireOptionPanel = Ext.create('Ext.grid.Panel', {
  981. // title: '火警报告列表',
  982. header :{
  983. height:0,
  984. border:'0px solid #000000'
  985. },
  986. titleCollapse:true,
  987. id: 'VFireOptionListPanel',
  988. region:'center',
  989. store: myStore,
  990. // selModel: sm,
  991. columns: [
  992. { header: 'id', dataIndex:'id',hidden:true, menuDisabled:true},
  993. { header: '故障信息', dataIndex:'data2',hidden:true, menuDisabled:true},
  994. { header: '设备编号', dataIndex:'device_code',hidden:true, menuDisabled:true},
  995. { header: '设备信息', dataIndex:'data4',hidden:true, menuDisabled:true},
  996. { header: '序号', dataIndex: 'orderIdx',width:50, menuDisabled:true },
  997. { header: '单位名称', dataIndex: 'company_name',width:240, menuDisabled:true },
  998. { header: '报告时间', dataIndex: 'time', width:160, menuDisabled:true },
  999. { header: '报告数据', dataIndex: 'data', width:140, menuDisabled:true },
  1000. { header: '报告内容', dataIndex: 'fullname', width:900,minWidth:400, maxWidth:1600,menuDisabled:true },
  1001. { header: '处理状态', dataIndex: 'clzt', width:100, menuDisabled:true },
  1002. { header: '处理人', dataIndex: 'clr_name',width:150, menuDisabled:true },
  1003. { header: '处理时间', dataIndex: 'clsj', width:160, menuDisabled:true }
  1004. ],
  1005. columnLines: true,
  1006. height: maxHeight,
  1007. width: '100%',
  1008. tbar: new Ext.create('Ext.toolbar.Toolbar',{
  1009. items:[{
  1010. html:'<span id="FirePiePanel_title_string" style="color:#ffffff;background-color:rgba(0,0,0,0)">火警报告列表</span>'
  1011. },'->',{
  1012. xtype: 'button',
  1013. iconCls:'back_btn',
  1014. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">返回</span>',
  1015. listeners: {
  1016. click: function(){
  1017. location.href=baseUrl+'view/frontpage/map.jsp?&theme='+theme+'&company_code='+company_code;
  1018. }
  1019. }
  1020. },'-',
  1021. {
  1022. xtype: 'button',
  1023. iconCls:'filter_btn',
  1024. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">筛选</span>',
  1025. listeners: {
  1026. click: filterwin
  1027. }
  1028. },'-',
  1029. {
  1030. xtype: 'button',
  1031. iconCls:'filter_btn',
  1032. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">导出</span>',
  1033. listeners: {
  1034. click: exportbtn_click
  1035. }
  1036. },'-']
  1037. }),
  1038. bbar: new Ext.PagingToolbar({
  1039. store: myStore,
  1040. id:'VFireOptionListPageToolbar',
  1041. displayInfo: true,
  1042. pageSize: countPerPage,
  1043. prependButtons: true,
  1044. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  1045. emptyMsg : "没有记录",
  1046. firstText: '第一页',
  1047. prevText: '前一页',
  1048. nextText: '后一页',
  1049. lastText: '最后一页',
  1050. refreshText: '刷新'
  1051. }),
  1052. frame: true,
  1053. border:false,
  1054. iconCls: 'icon-grid',
  1055. listeners:{
  1056. 'celldblclick' : function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts){
  1057. showFireInfoWin(record);
  1058. }
  1059. }
  1060. });
  1061. var piebar = Ext.create('Ext.panel.Panel',{
  1062. id:'FirePiePanel',
  1063. width:'100%',
  1064. height:498,
  1065. region:'north',
  1066. layout:'border',
  1067. defaults:{
  1068. border:false
  1069. },
  1070. html:'<div id="operation_body" class="operation_body"><div id="operation_dock_l" class="operation_dock_l"></div><div id="operation_dock_r" class="operation_dock_r"></div><img id="operation_title_icon" class="operation_title_icon" width="48" height="48" src="../../res/img/icons/1.gif"/><div id="operation_title_text" class="operation_title_text">火警监控告警处理情况</div><div id="operation_label_1" class="operation_label_1">总数</div><div id="operation_label_2" class="operation_label_2">已处理</div><div id="operation_label_3" class="operation_label_3">未处理</div><div id="operation_label_4" class="operation_label_4">处置率</div><div id="operation_num_1" class="operation_num_1"></div><div id="operation_num_2" class="operation_num_2"></div><div id="operation_num_3" class="operation_num_3"></div><div id="operation_num_4" class="operation_num_4"></div><div id="operation_pie_bg" class="operation_pie_bg"></div><div id="operation_pie" class="operation_pie"></div><div id="operation_pie_title" class="operation_pie_title">处置率</div><div id="operation_area_bg" class="operation_area_bg"></div><div id="operation_area" class="operation_area"></div></div>'
  1071. });
  1072. pieMask = new Ext.LoadMask(piebar,{msg:"Loading..."});
  1073. new Ext.create('Ext.panel.Panel',{
  1074. width:'100%',
  1075. id: 'FireAlarmPanel',
  1076. layout:'border',
  1077. items:[
  1078. piebar,FireOptionPanel
  1079. ],
  1080. renderTo: Ext.getBody()
  1081. });
  1082. myStore.reload();
  1083. $(window).resize(function(){
  1084. body_resize();
  1085. });
  1086. body_resize();
  1087. });