waterBattery.js 33 KB

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