liftDevice.js 37 KB

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