efireOption.js 38 KB

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