liftOption.js 39 KB

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