fireOption.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  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. listeners: {
  679. //添加日期选择事件
  680. "select": function (time) {
  681. var start = Ext.getCmp('ff_start_data').getValue()
  682. var end = Ext.getCmp('ff_end_data').getValue()
  683. if(start === null || start === ""){
  684. Ext.Msg.alert('操作失败', '请选择开始时间后再次选择!' , function(btn,txt){
  685. Ext.getCmp('ff_end_data').setValue('');
  686. });
  687. }else{
  688. if((end.valueOf() - start.valueOf()) < 0){
  689. Ext.Msg.alert('操作失败', '开始日期不能选择在结束日期后!' , function(btn,txt){
  690. Ext.getCmp('ff_end_data').setValue('');
  691. });
  692. }
  693. }
  694. },
  695. }
  696. },{
  697. xtype:'combo',
  698. fieldLabel:'处理状态',
  699. id: 'ff_clzt',
  700. name: 'ff_clzt',
  701. displayField : 'name',
  702. valueField : 'abbr',
  703. editable : false,
  704. width:330,
  705. store:ClztStory
  706. }],
  707. buttons: [{
  708. text: '筛选',
  709. iconCls:'ok_btn',
  710. handler: function() {
  711. var form = this.up('form').getForm();
  712. if (form.isValid()) {
  713. var query = new Object();
  714. // var tmp = Ext.getCmp('ff_company_code');
  715. if(Ext.getCmp('ff_company_code').getValue()){
  716. query.company_code = Ext.getCmp('ff_company_code').getValue();
  717. $("#company_code").val(query.company_code);
  718. company_code = query.company_code;
  719. $("#FirePiePanel_title_string").html(Ext.getCmp('ff_company_code').getRawValue( )+'.火警报告列表');
  720. }else{
  721. $("#company_code").val('');
  722. $("#FirePiePanel_title_string").html('火警报告列表');
  723. company_code = null;
  724. }
  725. if(Ext.getCmp('ff_clzt').getValue()){
  726. query.clzt = Ext.getCmp('ff_clzt').getValue();
  727. $("#clzt").val(query.clzt);
  728. }else{
  729. $("#clzt").val('');
  730. }
  731. if(Ext.getCmp('ff_start_data').getValue()){
  732. query.time_start = Ext.getCmp('ff_start_data').getValue();
  733. 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();
  734. $("#time_start").val(datetime);
  735. }else{
  736. $("#time_start").val('');
  737. }
  738. if(Ext.getCmp('ff_end_data').getValue()){
  739. query.time_end = Ext.getCmp('ff_end_data').getValue();
  740. 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();
  741. $("#time_end").val(datetime1);
  742. }else{
  743. $("#time_end").val('');
  744. }
  745. // query.clzt = Ext.getCmp('ff_clzt').getValue()==null?"":Ext.getCmp('ff_clzt').getValue();
  746. // query.time_start = Ext.getCmp('ff_start_data').getValue()==null?"":Ext.getCmp('ff_start_data').getValue();
  747. // query.time_end = Ext.getCmp('ff_end_data').getValue()==null?"":Ext.getCmp('ff_end_data').getValue();
  748. // query.V_LOGINNAME = V_LOGINNAME;
  749. // query.V_PASSWORD = V_PASSWORD;
  750. query.COMMSTATUS = 'NO';
  751. var jsonstr = Ext.JSON.encode(query);
  752. myStore.getProxy().extraParams = {
  753. queryJson : jsonstr
  754. };
  755. Ext.getCmp('VFireOptionListPageToolbar').moveFirst();
  756. Ext.getCmp('ff_company_code').setValue('');
  757. Ext.getCmp('ff_clzt').setValue('');
  758. Ext.getCmp('ff_start_data').setValue('');
  759. Ext.getCmp('ff_end_data').setValue('');
  760. Ext.getCmp('VFireOptionFilterWin').hide();
  761. // getCurrentData();
  762. }
  763. }
  764. },{
  765. text: '关闭',
  766. iconCls: 'cancel_btn',
  767. handler: function() {
  768. Ext.getCmp('VFireOptionFilterWin').hide();
  769. }
  770. }]
  771. });
  772. var filterwin = function() {
  773. Ext.create('Ext.window.Window',{
  774. id: 'VFireOptionFilterWin',
  775. title: '火警报告筛选',
  776. height: 210,
  777. width: 400,
  778. layout: 'fit',
  779. items: FilterForm,
  780. closable:false,
  781. modal:true,
  782. closeAction: 'hide'
  783. }).show();
  784. CompanyStory.reload();
  785. }
  786. var radiogroup = new Ext.create('Ext.form.RadioGroup',{
  787. fieldLabel:'误报',
  788. id:'uf_r_clwb',
  789. width:300,
  790. items:[{
  791. name:'uf_r_clwb',
  792. inputValue:'1',
  793. boxLabel:'是'
  794. },{
  795. name:'uf_r_clwb',
  796. inputValue:'0',
  797. boxLabel:'否',
  798. checked:true
  799. }]
  800. });
  801. var radiogroup2 = new Ext.create('Ext.form.RadioGroup',{
  802. fieldLabel:'处理范围',
  803. id:'uf_r_clfw',
  804. width:300,
  805. items:[{
  806. name:'uf_r_clfw',
  807. inputValue:'1',
  808. boxLabel:'批量'
  809. },{
  810. name:'uf_r_clfw',
  811. inputValue:'0',
  812. boxLabel:'单一',
  813. checked:true
  814. }]
  815. });
  816. var clear_modify_form = function(){
  817. Ext.getCmp('uf_company_name').setValue('');
  818. Ext.getCmp('uf_name').setValue('');
  819. Ext.getCmp('uf_device_code').setValue('');
  820. Ext.getCmp('uf_id').setValue('');
  821. Ext.getCmp('uf_status').setValue('');
  822. Ext.getCmp('uf_fullname').setValue('');
  823. Ext.getCmp('uf_data2').setValue('');
  824. Ext.getCmp('uf_data4').setValue('');
  825. Ext.getCmp('uf_clwb').setValue('');
  826. Ext.getCmp('uf_clr').setValue('');
  827. Ext.getCmp('uf_clsj').setValue('');
  828. Ext.getCmp('uf_clnr').setValue('');
  829. }
  830. var fireInfoForm = Ext.create('Ext.form.Panel', {
  831. id: 'fireInfoForm',
  832. labelWidth: 55,
  833. url: baseUrl+'iot/alarm/view/updateHj',
  834. defaultType: 'textfield',
  835. bodyPadding: 15,
  836. items: [{
  837. fieldLabel:'单位名称',
  838. id: 'uf_company_name',
  839. name: 'uf_company_name',
  840. anchor:'90%'
  841. },{
  842. fieldLabel:'监控设备',
  843. id:'uf_name',
  844. name:'uf_name',
  845. anchor:'100%'
  846. },{
  847. fieldLabel:'设备编号',
  848. id:'uf_device_code',
  849. name:'uf_device_code',
  850. hidden: true
  851. },{
  852. fieldLabel:'记录编号',
  853. id:'uf_id',
  854. name:'uf_id',
  855. hidden: true
  856. },{
  857. fieldLabel:'设备编号',
  858. id:'uf_status',
  859. name:'uf_status',
  860. hidden: true
  861. },{
  862. fieldLabel:'设备信息',
  863. id:'uf_data4',
  864. name:'uf_data4',
  865. hidden: true
  866. },{
  867. fieldLabel:'故障信息',
  868. id:'uf_data2',
  869. name:'uf_data2',
  870. hidden: true
  871. },{
  872. fieldLabel:'报告信息',
  873. id: 'uf_fullname',
  874. name:'uf_fullname',
  875. xtype: 'textareafield',
  876. maxLength: 250,
  877. cols:4,
  878. anchor:'100%'
  879. },{
  880. fieldLabel:'误报',
  881. id: 'uf_clwb',
  882. name:'uf_clwb',
  883. maxLength: 200,
  884. anchor:'65%'
  885. },radiogroup,radiogroup2,{
  886. fieldLabel:'处理人',
  887. id: 'uf_clr',
  888. name:'uf_clr',
  889. maxLength: 120,
  890. anchor:'65%'
  891. },{
  892. fieldLabel:'处理时间',
  893. id: 'uf_clsj',
  894. name:'uf_clsj',
  895. maxLength: 200,
  896. anchor:'80%'
  897. },{
  898. fieldLabel:'处理内容',
  899. id: 'uf_clnr',
  900. name:'uf_clnr',
  901. xtype: 'textareafield',
  902. maxLength: 250,
  903. cols:4,
  904. anchor:'100%'
  905. },{
  906. id:'fm_queryJson',
  907. name:'queryJson',
  908. hidden:true
  909. }],
  910. buttons: [{
  911. text: '处理',
  912. id:'confirmBtn',
  913. iconCls:'ok_btn',
  914. handler: function() {
  915. var form = this.up('form').getForm();
  916. if (form.isValid()) {
  917. var queryJson = new Object();
  918. // queryJson.V_LOGINNAME = V_LOGINNAME;
  919. // queryJson.V_PASSWORD = V_PASSWORD;
  920. queryJson.id = Ext.getCmp('uf_id').getValue();
  921. queryJson.status = Ext.getCmp('uf_status').getValue();
  922. queryJson.name = Ext.getCmp('uf_name').getValue();
  923. queryJson.data4 = Ext.getCmp('uf_data4').getValue();
  924. queryJson.data2 = Ext.getCmp('uf_data2').getValue();
  925. queryJson.device_code = Ext.getCmp('uf_device_code').getValue();
  926. queryJson.confirmAll = Ext.getCmp('uf_r_clfw').getChecked()[0].boxLabel=='单一'?'0':'1';
  927. queryJson.clwb = Ext.getCmp('uf_r_clwb').getChecked()[0].boxLabel=='否'?'0':'1';
  928. queryJson.clnr = Ext.getCmp('uf_clnr').getValue();
  929. var jsonstr = Ext.JSON.encode(queryJson);
  930. Ext.getCmp('fm_queryJson').setValue(jsonstr);
  931. form.submit({
  932. method:'post',
  933. success: function(form, action) {
  934. Ext.Msg.alert('操作成功', '已确认'+action.result.activerow+'条记录', function(btn,txt){
  935. clear_modify_form();
  936. myStore.reload();
  937. // getCurrentData();
  938. });
  939. },
  940. failure: function(form, action) {
  941. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  942. clear_modify_form();
  943. myStore.reload();
  944. // getCurrentData();
  945. });
  946. }
  947. });
  948. this.up('window').close();
  949. }
  950. }
  951. },{
  952. text: '关闭',
  953. iconCls: 'cancel_btn',
  954. handler: function() {
  955. this.up('window').close();
  956. }
  957. }]
  958. });
  959. var vFileInfoWin = Ext.create('Ext.window.Window',{
  960. id:'VFileInfoWin',
  961. title:'详细信息: <span id="VInfoWin_Title"></span>',
  962. width:400,
  963. layout:'fit',
  964. closable:false,
  965. modal:true,
  966. closeAction:'hide',
  967. items:fireInfoForm
  968. });
  969. var showFireInfoWin = function(record){
  970. vFileInfoWin.show();
  971. $("#VInfoWin_Title").html(record.get('data'));
  972. Ext.getCmp('uf_company_name').setValue(record.get('company_name'));
  973. Ext.getCmp('uf_name').setValue(record.get('name'));
  974. Ext.getCmp('uf_device_code').setValue(record.get('device_code'));
  975. Ext.getCmp('uf_fullname').setValue(record.get('fullname'));
  976. Ext.getCmp('uf_clr').setValue(record.get('clr_name'));
  977. Ext.getCmp('uf_clsj').setValue(record.get('clsj'));
  978. Ext.getCmp('uf_clnr').setValue(record.get('clnr'));
  979. Ext.getCmp('uf_id').setValue(record.get('id'));
  980. Ext.getCmp('uf_clwb').setValue(record.get('clwb')=='1'?'误报':'告警');
  981. Ext.getCmp('uf_status').setValue(record.get('status'));
  982. Ext.getCmp('uf_data4').setValue(record.get('data4'));
  983. Ext.getCmp('uf_data2').setValue(record.get('data2'));
  984. if(record.get('clzt')=='已处理'){
  985. Ext.getCmp('uf_clwb').setVisible(true);
  986. Ext.getCmp('uf_r_clwb').setVisible(false);
  987. Ext.getCmp('uf_r_clfw').setVisible(false);
  988. Ext.getCmp('confirmBtn').setVisible(false);
  989. Ext.getCmp('uf_clr').setVisible(true);
  990. Ext.getCmp('uf_clsj').setVisible(true);
  991. }else{
  992. Ext.getCmp('uf_clwb').setVisible(false);
  993. Ext.getCmp('uf_r_clwb').setVisible(true);
  994. Ext.getCmp('uf_r_clfw').setVisible(true);
  995. Ext.getCmp('confirmBtn').setVisible(true);
  996. Ext.getCmp('uf_clr').setVisible(false);
  997. Ext.getCmp('uf_clsj').setVisible(false);
  998. }
  999. }
  1000. var FireOptionPanel = Ext.create('Ext.grid.Panel', {
  1001. // title: '火警报告列表',
  1002. header :{
  1003. height:0,
  1004. border:'0px solid #000000'
  1005. },
  1006. titleCollapse:true,
  1007. id: 'VFireOptionListPanel',
  1008. region:'center',
  1009. store: myStore,
  1010. // selModel: sm,
  1011. columns: [
  1012. { header: 'id', dataIndex:'id',hidden:true, menuDisabled:true},
  1013. { header: '故障信息', dataIndex:'data2',hidden:true, menuDisabled:true},
  1014. { header: '设备编号', dataIndex:'device_code',hidden:true, menuDisabled:true},
  1015. { header: '设备信息', dataIndex:'data4',hidden:true, menuDisabled:true},
  1016. { header: '序号', dataIndex: 'orderIdx',width:50, menuDisabled:true },
  1017. { header: '单位名称', dataIndex: 'company_name',width:240, menuDisabled:true },
  1018. { header: '报告时间', dataIndex: 'time', width:160, menuDisabled:true },
  1019. { header: '报告数据', dataIndex: 'data', width:140, menuDisabled:true },
  1020. { header: '报告内容', dataIndex: 'fullname', width:900,minWidth:400, maxWidth:1600,menuDisabled:true },
  1021. { header: '处理状态', dataIndex: 'clzt', width:100, menuDisabled:true },
  1022. { header: '处理人', dataIndex: 'clr_name',width:150, menuDisabled:true },
  1023. { header: '处理时间', dataIndex: 'clsj', width:160, menuDisabled:true }
  1024. ],
  1025. columnLines: true,
  1026. height: maxHeight,
  1027. width: '100%',
  1028. tbar: new Ext.create('Ext.toolbar.Toolbar',{
  1029. items:[{
  1030. html:'<span id="FirePiePanel_title_string" style="color:#ffffff;background-color:rgba(0,0,0,0)">火警报告列表</span>'
  1031. },'->',{
  1032. xtype: 'button',
  1033. iconCls:'back_btn',
  1034. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">返回</span>',
  1035. listeners: {
  1036. click: function(){
  1037. location.href=baseUrl+'view/frontpage/map.jsp?&theme='+theme+'&company_code='+company_code;
  1038. }
  1039. }
  1040. },'-',
  1041. {
  1042. xtype: 'button',
  1043. iconCls:'filter_btn',
  1044. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">筛选</span>',
  1045. listeners: {
  1046. click: filterwin
  1047. }
  1048. },'-',
  1049. {
  1050. xtype: 'button',
  1051. iconCls:'filter_btn',
  1052. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">导出</span>',
  1053. listeners: {
  1054. click: exportbtn_click
  1055. }
  1056. },'-']
  1057. }),
  1058. bbar: new Ext.PagingToolbar({
  1059. store: myStore,
  1060. id:'VFireOptionListPageToolbar',
  1061. displayInfo: true,
  1062. pageSize: countPerPage,
  1063. prependButtons: true,
  1064. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  1065. emptyMsg : "没有记录",
  1066. firstText: '第一页',
  1067. prevText: '前一页',
  1068. nextText: '后一页',
  1069. lastText: '最后一页',
  1070. refreshText: '刷新'
  1071. }),
  1072. frame: true,
  1073. border:false,
  1074. iconCls: 'icon-grid',
  1075. listeners:{
  1076. 'celldblclick' : function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts){
  1077. showFireInfoWin(record);
  1078. }
  1079. }
  1080. });
  1081. var piebar = Ext.create('Ext.panel.Panel',{
  1082. id:'FirePiePanel',
  1083. width:'100%',
  1084. height:498,
  1085. region:'north',
  1086. layout:'border',
  1087. defaults:{
  1088. border:false
  1089. },
  1090. 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>'
  1091. });
  1092. pieMask = new Ext.LoadMask(piebar,{msg:"Loading..."});
  1093. new Ext.create('Ext.panel.Panel',{
  1094. width:'100%',
  1095. id: 'FireAlarmPanel',
  1096. layout:'border',
  1097. items:[
  1098. piebar,FireOptionPanel
  1099. ],
  1100. renderTo: Ext.getBody()
  1101. });
  1102. myStore.reload();
  1103. $(window).resize(function(){
  1104. body_resize();
  1105. });
  1106. body_resize();
  1107. });