waterDevice.js 36 KB

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