waterOption.js 38 KB

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