waterDevice.js 37 KB

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