rtuDevice.js 36 KB

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