hiddenDanger.js 36 KB

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