dataSearch.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  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 myStore=null;
  15. var StatusStore;
  16. var baseUrl;
  17. var centerLng;
  18. var centerLat;
  19. var company_code;
  20. var theme;
  21. var ConfirmStore
  22. var pieWidth;
  23. var pieMask;
  24. var myMask;
  25. var V_LOGINNAME='',V_PASSWORD='';
  26. var maxHeight = 10000;
  27. var maxWidth = 10000;
  28. var dwtype;
  29. var sm = Ext.create('Ext.selection.CheckboxModel');
  30. Ext.define('VDevices',{
  31. extend: 'Ext.data.Model',
  32. fields: [
  33. { name:'id', type:'int'},
  34. { name:'orderIdx', type:'int'},
  35. { name:'company', type:'string' },
  36. { name:'name', type:'string' },
  37. { name:'device_id', type:'string' },
  38. { name:'data_time', type:'string' },
  39. { name:'point_name', type:'string' },
  40. { name:'point_code', type:'string' },
  41. { name:'point_data', type:'string' },
  42. { name:'device_type', type:'string' },
  43. { name:'company_code', type:'string' },
  44. { name:'dwtype', type:'int' }
  45. ]
  46. });
  47. Ext.define('CompanyComboStore',{
  48. extend:'Ext.data.Model',
  49. fields: [
  50. {name:'owner_name', type:'string'},
  51. {name:'owner_id',type:'string'}
  52. ]
  53. });
  54. //var body_resize = function(){
  55. // maxHeight = document.documentElement.clientHeight;
  56. // maxWidth = document.documentElement.clientWidth;
  57. // Ext.getCmp('DeviceDataPanel').setHeight(maxHeight);
  58. // Ext.getCmp('DeviceDataPanel').setWidth(maxWidth);
  59. //}
  60. var draw_confirm = function(){
  61. // $("#WaterPiePanel_title_string").html(ConfirmStore[0].company+'.'+ConfirmStore[0].name+'.水系统监控设备电池电量情况');
  62. var data_0 = new Array();
  63. var data_1 = new Array();
  64. var data_2 = new Array();
  65. var d_time = new Array();
  66. var tmp_0 = null, tmp_1 = null, tmp_2 = null,tmp_t = null;
  67. var themecolor = ((theme=='')||(theme=='access'))?'#ffffff':'#000000';
  68. if(ConfirmStore==null)
  69. return;
  70. for(var i=0;i<ConfirmStore.length;i++){
  71. var rec = ConfirmStore[i];
  72. if(rec.point_code=='2'){
  73. tmp_0 = parseInt(rec.point_data);
  74. tmp_t = rec.data_time;
  75. data_0.push(tmp_0);
  76. d_time.push(tmp_t);
  77. $("#operation_num_1").html(data_0[0]);
  78. $("#operation_num_2").html(d_time[0]);
  79. }else if(rec.point_code=='3'){
  80. tmp_1 = parseInt(rec.point_data);
  81. tmp_t = rec.data_time;
  82. data_1.push(tmp_1);
  83. d_time.push(tmp_t);
  84. $("#operation_num_1").html(data_1[0]);
  85. $("#operation_num_2").html(d_time[0]);
  86. }else if(rec.point_code=='4'){
  87. // var tmp_2 = Ext.util.Format.number(num,'0.00');
  88. tmp_2 = parseFloat(rec.point_data);
  89. tmp_t = rec.data_time;
  90. data_2.push(tmp_2);
  91. d_time.push(tmp_t);
  92. $("#operation_num_1").html(data_2[0]);
  93. $("#operation_num_2").html(d_time[0]);
  94. }
  95. }
  96. if(rec.point_code=='2'){
  97. var max = data_0[0];
  98. for(var i = 1; i < data_0.length; i++) {
  99. var cur = data_0[i];
  100. cur >= max ? max = cur : null
  101. if(max == cur){
  102. time = d_time[i];
  103. }
  104. }
  105. $("#operation_num_3").html(max);
  106. $("#operation_num_4").html(time);
  107. }else if(rec.point_code=='3'){
  108. var max = data_1[0];
  109. for(var i = 1; i < data_1.length; i++) {
  110. var cur = data_1[i];
  111. cur >= max ? max = cur : null
  112. if(max == cur){
  113. time = d_time[i];
  114. }
  115. }
  116. $("#operation_num_3").html(max);
  117. $("#operation_num_4").html(time);
  118. }else if(rec.point_code=='4'){
  119. var max = data_2[0];
  120. for(var i = 1; i < data_2.length; i++) {
  121. var cur = data_2[i];
  122. cur >= max ? max = cur : null
  123. if(max == cur){
  124. time = d_time[i];
  125. }
  126. }
  127. $("#operation_num_3").html(max);
  128. $("#operation_num_4").html(time);
  129. }
  130. if(rec.point_code=='2'){
  131. var min = data_0[0];
  132. for(var i = 1; i < data_0.length; i++) {
  133. var cur = data_0[i];
  134. cur <= min ? min = cur : null
  135. if(min == cur){
  136. min_time = d_time[i];
  137. }
  138. }
  139. $("#operation_num_5").html(min);
  140. $("#operation_num_6").html(min_time);
  141. }else if(rec.point_code=='3'){
  142. var min = data_1[0];
  143. for(var i = 1; i < data_1.length; i++) {
  144. var cur = data_1[i];
  145. cur <= min ? min = cur : null
  146. if(min == cur){
  147. min_time = d_time[i];
  148. }
  149. }
  150. $("#operation_num_5").html(min);
  151. $("#operation_num_6").html(min_time);
  152. }else if(rec.point_code=='4'){
  153. var min = data_2[0];
  154. // var min_time = d_time[0]
  155. for(var i = 1; i < data_2.length; i++) {
  156. var cur = data_2[i];
  157. cur <= min ? min = cur : null
  158. if(min == cur){
  159. min_time = d_time[i];
  160. }
  161. }
  162. $("#operation_num_5").html(min);
  163. $("#operation_num_6").html(min_time);
  164. }
  165. // $("#operation_num_1").html(data_0[0]);
  166. // $("#operation_num_2").html(data_1[0]);
  167. // $("#operation_num_3").html(d_time[0]);
  168. var mColor1= '#34abf5';//[ '#DDDF0D','#f66167', '#34abf5']
  169. if(data_0[0]<60)
  170. mColor1 = '#f66167';
  171. else if(data_0[0]<80)
  172. mColor1 = '#DDDF0D';
  173. var mColor2= '#34abf5';//[ '#DDDF0D','#f66167', '#34abf5']
  174. if(data_1[0]<3)
  175. mColor2 = '#f66167';
  176. else if(data_1[0]<4)
  177. mColor2 = '#DDDF0D';
  178. Highcharts.getOptions().colors = Highcharts.map([mColor2,mColor2,mColor1,mColor1], function (color) {
  179. return {
  180. radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
  181. stops: [
  182. [0, color],
  183. [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
  184. ]
  185. };
  186. });
  187. if(rec.point_code=='2'){
  188. Highcharts.chart('operation_area',{
  189. chart:{
  190. type:'area',
  191. // zoomType: 'x',
  192. zoomType: 'xy',
  193. backgroundColor: 'rgba(0,0,0,0)'
  194. },
  195. // color:['#f66167', '#34abf5'],
  196. title:{
  197. // text:(companyName==null)?'水系统监控告警处理情况跟踪':companyName+'.水系统监控告警处理情况跟踪',
  198. text:'水系统近两周数据',
  199. float:true,
  200. style:{fontSize:'14px',color:themecolor,fontWeight:'bold'},
  201. enabled:false
  202. },
  203. legend:{
  204. // enabled:false,
  205. floating:true,
  206. x:410,
  207. y:-230,
  208. itemStyle:{fontSize:'12px',color:themecolor,fontWeight:'bold'}
  209. },
  210. exporting: {
  211. enabled: false
  212. },
  213. credits: {
  214. enabled: false
  215. },
  216. xAxis:[{
  217. categories:d_time,
  218. labels:{
  219. enabled:false
  220. },
  221. crosshair: true
  222. }],
  223. yAxis:[{
  224. title:{
  225. // text:'剩余电量',
  226. text:'',
  227. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  228. },
  229. gridLineColor:'rgba(0,0,0,0.2)',
  230. labels:{
  231. format:'{value} %',
  232. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  233. },
  234. max:max+max*0.3,
  235. min:0
  236. }],
  237. tooltip:{
  238. shared:true
  239. },
  240. plotOptions:{
  241. area:{
  242. stackiung:'normal',
  243. marker:{
  244. lineWidth:0,
  245. enabled:false,
  246. radius:0
  247. }
  248. }
  249. },
  250. series:[{
  251. name:'剩余电量',
  252. type: 'area',
  253. data:data_0,
  254. lineWidth:1,
  255. tooltip:{
  256. valueSuffix: ' %'
  257. },
  258. fillColor: {
  259. linearGradient: {
  260. x1: 0,
  261. y1: 0,
  262. x2: 0,
  263. y2: 1
  264. },
  265. stops: [
  266. [0, '#34abf5'],
  267. [1, Highcharts.Color('#34abf5').setOpacity(0.0).get('rgba')]
  268. ]
  269. }
  270. }
  271. ]
  272. });
  273. }else if(rec.point_code=='3'){
  274. Highcharts.chart('operation_area',{
  275. chart:{
  276. type:'area',
  277. // zoomType: 'x',
  278. zoomType: 'xy',
  279. backgroundColor: 'rgba(0,0,0,0)'
  280. },
  281. // color:['#f66167', '#34abf5'],
  282. title:{
  283. // text:(companyName==null)?'水系统监控告警处理情况跟踪':companyName+'.水系统监控告警处理情况跟踪',
  284. text:'水系统近两周数据',
  285. float:true,
  286. style:{fontSize:'14px',color:themecolor,fontWeight:'bold'},
  287. enabled:false
  288. },
  289. legend:{
  290. // enabled:false,
  291. floating:true,
  292. x:410,
  293. y:-230,
  294. itemStyle:{fontSize:'12px',color:themecolor,fontWeight:'bold'}
  295. },
  296. exporting: {
  297. enabled: false
  298. },
  299. credits: {
  300. enabled: false
  301. },
  302. xAxis:[{
  303. categories:d_time,
  304. labels:{
  305. enabled:false
  306. },
  307. crosshair: true
  308. }],
  309. yAxis:[{
  310. title:{
  311. text:'无线信号',
  312. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  313. },
  314. gridLineColor:'rgba(0,0,0,0.2)',
  315. labels:{
  316. format:'{value} ',
  317. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  318. },
  319. max:max+max*0.3,
  320. min:0,
  321. // opposite:true
  322. }],
  323. tooltip:{
  324. shared:true
  325. },
  326. plotOptions:{
  327. area:{
  328. stackiung:'normal',
  329. marker:{
  330. lineWidth:0,
  331. enabled:false,
  332. radius:0
  333. }
  334. }
  335. },
  336. series:[{
  337. name:'无线信号',
  338. type: 'area',
  339. // yAxis: 1,
  340. data:data_1,
  341. lineWidth:1,
  342. tooltip:{
  343. valueSuffix: ' '
  344. },
  345. fillColor: {
  346. linearGradient: {
  347. x1: 0,
  348. y1: 0,
  349. x2: 0,
  350. y2: 1
  351. },
  352. stops: [
  353. [0, '#34abf5'],
  354. [1, Highcharts.Color('#34abf5').setOpacity(0.0).get('rgba')]
  355. ]
  356. }
  357. }]
  358. });
  359. }else if(rec.point_code=='4'){
  360. Highcharts.chart('operation_area',{
  361. chart:{
  362. type:'area',
  363. // zoomType: 'x',
  364. zoomType: 'xy',
  365. backgroundColor: 'rgba(0,0,0,0)'
  366. },
  367. // color:['#f66167', '#34abf5'],
  368. title:{
  369. // text:(companyName==null)?'水系统监控告警处理情况跟踪':companyName+'.水系统监控告警处理情况跟踪',
  370. text:'水系统近两周数据',
  371. float:true,
  372. style:{fontSize:'14px',color:themecolor,fontWeight:'bold'},
  373. enabled:false
  374. },
  375. legend:{
  376. // enabled:false,
  377. floating:true,
  378. x:410,
  379. y:-230,
  380. itemStyle:{fontSize:'12px',color:themecolor,fontWeight:'bold'}
  381. },
  382. exporting: {
  383. enabled: false
  384. },
  385. credits: {
  386. enabled: false
  387. },
  388. xAxis:[{
  389. categories:d_time,
  390. labels:{
  391. enabled:false
  392. },
  393. crosshair: true
  394. }],
  395. yAxis:[{
  396. title:{
  397. text:'设备数据值',
  398. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  399. },
  400. gridLineColor:'rgba(0,0,0,0.2)',
  401. labels:{
  402. format:'{value} ',
  403. style:{fontSize:'10px',color:themecolor,fontWeight:'bold'}
  404. },
  405. max:max+max*0.3,
  406. min:0,
  407. // opposite:true
  408. }],
  409. tooltip:{
  410. shared:true
  411. },
  412. plotOptions:{
  413. area:{
  414. stackiung:'normal',
  415. marker:{
  416. lineWidth:0,
  417. enabled:false,
  418. radius:0
  419. }
  420. }
  421. },
  422. series:[{
  423. name:'设备数据值',
  424. type: 'area',
  425. // yAxis: 1,
  426. data:data_2,
  427. lineWidth:1,
  428. tooltip:{
  429. valueSuffix: ' '
  430. },
  431. fillColor: {
  432. linearGradient: {
  433. x1: 0,
  434. y1: 0,
  435. x2: 0,
  436. y2: 1
  437. },
  438. stops: [
  439. [0, '#34abf5'],
  440. [1, Highcharts.Color('#34abf5').setOpacity(0.0).get('rgba')]
  441. ]
  442. }
  443. }]
  444. });
  445. }
  446. }
  447. var show_datapie = function(record){
  448. if(myStore==null)
  449. return;
  450. var div = Ext.getCmp('VWaterOptionListPanel');
  451. var model = div.getSelectionModel();
  452. var record = model.getSelection()[0];
  453. var themecolor = ((theme=='')||(theme=='access'))?'#ffffff':'#000000';
  454. var nrow = myStore.getCount();
  455. var device_id = record.get('device_id');
  456. var point_code = record.get('point_code');
  457. for(var i=0;i<nrow;i++){
  458. if(myStore.getAt(i).get('device_id')==device_id){
  459. $("#operation_num_1").html('');
  460. $("#operation_num_2").html('');
  461. $("#operation_num_3").html('');
  462. $("#operation_pie").html('');
  463. $("#operation_area").html('');
  464. pieMask.show();
  465. var query = new Object();
  466. // query.V_LOGINNAME = V_LOGINNAME;
  467. // query.V_PASSWORD = V_PASSWORD;
  468. query.device_id = device_id;
  469. query.point_code = point_code;
  470. $.ajax({
  471. type:'POST',
  472. url: baseUrl+"iot/data/view/getSyncDataQList",
  473. data: {
  474. queryJson : Ext.JSON.encode(query)
  475. },
  476. success: function(result){
  477. var json = eval('(' + result + ')');
  478. if(json.action=='getSyncDataVList'){
  479. ConfirmStore = json.RESULT;
  480. draw_confirm();
  481. }
  482. pieMask.hide();
  483. }
  484. });
  485. break;
  486. }
  487. }
  488. // pieMask.hide();
  489. }
  490. var getCurrentData = function(){
  491. var div = Ext.getCmp('VWaterOptionListPanel');
  492. var model = div.getSelectionModel();
  493. var record = model.getSelection()[0];
  494. show_datapie(record);
  495. }
  496. var body_resize = function(){
  497. maxHeight = document.documentElement.clientHeight;
  498. maxWidth = document.documentElement.clientWidth;
  499. Ext.getCmp('WaterAlarmPanel').setHeight(maxHeight);
  500. Ext.getCmp('WaterAlarmPanel').setWidth(maxWidth);
  501. }
  502. function exportbtn_click(){
  503. if(myStore==null)
  504. return;
  505. var div = Ext.getCmp('VWaterOptionListPanel');
  506. var model = div.getSelectionModel();
  507. var record = model.getSelection()[0];
  508. var nrow = myStore.getCount();
  509. var fields = '';
  510. var device_id = record.get('device_id');
  511. var device_type = record.get('device_type');
  512. var point_code = record.get('point_code');
  513. var point_name = record.get('point_name');
  514. var array = ['id','device_id','name','point_code','point_data','company','data_time'];
  515. var name = ['编号','设备编号','设备名称','端口号','数据值','公司名称','添加时间'];
  516. for(var i=0;i<7;i++){
  517. if(i>0)
  518. fields += ',';
  519. fields += '{id:"'+array[i]+'",title:"'+name[i]+'",shown:"'+true+'"}';
  520. }
  521. var query = new Object();
  522. query.device_id = device_id;
  523. query.point_code = point_code;
  524. if(device_type=='水表'&& point_name=='水压/水位'){
  525. query.EXPORT_FILE = '水系统水压数据监控列表';
  526. }else if(device_type=='液位'&& point_name=='水压/水位'){
  527. query.EXPORT_FILE = '水系统水位数据监控列表';
  528. }else{
  529. query.EXPORT_FILE = '水系统'+point_name+'数据监控列表';
  530. }
  531. query.fields = '['+fields+']';
  532. $.ajax({
  533. type:'POST',
  534. url: baseUrl+"iot/excel/view/waterexportexl",
  535. data: {
  536. queryJson : Ext.JSON.encode(query)
  537. },
  538. success: function(result){
  539. var json = eval('(' + result + ')');
  540. if(json.action=='dormExport'){
  541. ConfirmStore = json.RESULT;
  542. var elemIF = document.createElement("iframe");
  543. elemIF.src = baseUrl+json.filename;
  544. elemIF.style.display = "none";
  545. document.body.appendChild(elemIF);
  546. }
  547. }
  548. });
  549. }
  550. Ext.onReady(function(){
  551. baseUrl = document.getElementById('basePath').value;
  552. theme = document.getElementById('theme').value;
  553. company_code = document.getElementById('company_code').value;
  554. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  555. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  556. V_LOGINNAME = $("#V_LOGINNAME").val();
  557. V_PASSWORD = $("#V_PASSWORD").val();
  558. var currentWidth = document.documentElement.clientWidth;
  559. pieWidth = currentWidth/7;
  560. var chkIcon = '<img src="'+baseUrl+'res/img/common/check.gif"/>'
  561. var unchkIcon = '<img src="'+baseUrl+'res/img/common/uncheck.gif"/>'
  562. var countPerPage = 20;
  563. var chkBoolean = function(flag) {
  564. if(flag)
  565. return chkIcon;
  566. return unchkIcon;
  567. }
  568. var queryJson = new Object();
  569. queryJson.V_LOGINNAME = V_LOGINNAME;
  570. // queryJson.V_PASSWORD = V_PASSWORD;
  571. queryJson.COMMSTATUS = 'NO';
  572. if((company_code!=null)&&(company_code!='null')&&(company_code.length>0))
  573. queryJson.company_code = company_code;
  574. myStore = Ext.create('Ext.data.Store', {
  575. model: 'VDevices',
  576. pageSize: countPerPage,
  577. proxy: {
  578. type: 'ajax',
  579. actionMethods: {
  580. create : 'POST',
  581. read : 'POST', // by default GET
  582. update : 'POST',
  583. destroy: 'POST'
  584. },
  585. url: baseUrl+'iot/data/view/getSyncwaterDataVList',
  586. reader: {
  587. type: 'json',
  588. root: 'RESULT',
  589. totalProperty: 'totalCount'
  590. },
  591. extraParams:{
  592. queryJson:Ext.JSON.encode(queryJson)
  593. }
  594. },
  595. sorters:[{
  596. property:'data_time',
  597. direction:'DESC'
  598. }],
  599. remoteSort: true
  600. });
  601. var CompanyStory = Ext.create('Ext.data.Store',{
  602. model: 'CompanyComboStore',
  603. proxy: {
  604. type: 'ajax',
  605. actionMethods: {
  606. create : 'POST',
  607. read : 'POST', // by default GET
  608. update : 'POST',
  609. destroy: 'POST'
  610. },
  611. url: baseUrl+'iot/company/view/getNameList',
  612. reader: {
  613. type: 'json',
  614. root: 'RESULT',
  615. totalProperty: 'totalCount'
  616. },
  617. extraParams:{
  618. queryJson:Ext.JSON.encode(queryJson)
  619. }
  620. }
  621. });
  622. var ClztStory = Ext.create('Ext.data.Store',{
  623. fields:['abbr','name'],
  624. data:[
  625. {'abbr':0,'name':'未处理'},
  626. {'abbr':1,'name':'已处理'}
  627. ]
  628. });
  629. var FilterForm = Ext.create('Ext.form.Panel', {
  630. id: 'VFireOptionFilterForm',
  631. labelWidth: 55,
  632. defaultType: 'textfield',
  633. bodyPadding: 15,
  634. items: [{
  635. xtype:'combo',
  636. fieldLabel:'单位名称',
  637. id: 'ff_company_code',
  638. name:'company_code',
  639. displayField : 'owner_name',
  640. valueField : 'owner_id',
  641. editable : false,
  642. width:330,
  643. store:CompanyStory
  644. },{
  645. xtype:'datefield',
  646. fieldLabel:"开始日期",
  647. minValue:'07/07/2017',
  648. minText:"当前日期选择应大于当天日期",
  649. format:"Y-m-d",
  650. columnWidth:0.5,
  651. id: 'ff_start_data',
  652. name:"ff_start_data",
  653. editable:false,//只读约束
  654. width:330
  655. },{
  656. xtype:'datefield',
  657. fieldLabel:"结束日期",
  658. minValue:'07/07/2017',
  659. minText:"当前日期选择应大于当天日期",
  660. format:"Y-m-d",
  661. columnWidth:0.5,
  662. id: 'ff_end_data',
  663. name:"ff_end_data",
  664. editable:false,//只读约束
  665. width:330,
  666. listeners: {
  667. //添加日期选择事件
  668. "select": function (time) {
  669. var start = Ext.getCmp('ff_start_data').getValue()
  670. var end = Ext.getCmp('ff_end_data').getValue()
  671. if(start === null || start === ""){
  672. Ext.Msg.alert('操作失败', '请选择开始时间后再次选择!' , function(btn,txt){
  673. Ext.getCmp('ff_end_data').setValue('');
  674. });
  675. }else{
  676. if((end.valueOf() - start.valueOf()) < 0){
  677. Ext.Msg.alert('操作失败', '开始日期不能选择在结束日期后!' , function(btn,txt){
  678. Ext.getCmp('ff_end_data').setValue('');
  679. });
  680. }
  681. }
  682. },
  683. }
  684. },{
  685. fieldLabel:'设备名称',
  686. id: 'ff_clzt',
  687. name: 'clzt',
  688. maxLength: 30,
  689. maxLengthText:'长度不得超出{0}',
  690. width:330
  691. }],
  692. buttons: [{
  693. text: '筛选',
  694. iconCls:'ok_btn',
  695. handler: function() {
  696. var form = this.up('form').getForm();
  697. if (form.isValid()) {
  698. var query = new Object();
  699. // var tmp = Ext.getCmp('ff_company_code');
  700. if(Ext.getCmp('ff_company_code').getValue()){
  701. query.company_code = Ext.getCmp('ff_company_code').getValue();
  702. $("#company_code").val(query.company_code);
  703. company_code = query.company_code;
  704. $("#FirePiePanel_title_string").html(Ext.getCmp('ff_company_code').getRawValue( )+'.监测设备列表');
  705. }else{
  706. $("#company_code").val('');
  707. $("#FirePiePanel_title_string").html('监测设备列表');
  708. company_code = null;
  709. }
  710. if(Ext.getCmp('ff_clzt').getValue()){
  711. query.name = Ext.getCmp('ff_clzt').getValue();
  712. $("#clzt").val(query.name);
  713. }else{
  714. $("#clzt").val('');
  715. }
  716. if(Ext.getCmp('ff_start_data').getValue()){
  717. query.time_start = Ext.getCmp('ff_start_data').getValue();
  718. 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();
  719. $("#time_start").val(datetime);
  720. }else{
  721. $("#time_start").val('');
  722. }
  723. if(Ext.getCmp('ff_end_data').getValue()){
  724. query.time_end = Ext.getCmp('ff_end_data').getValue();
  725. 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();
  726. $("#time_end").val(datetime1);
  727. }else{
  728. $("#time_end").val('');
  729. }
  730. // query.name = Ext.getCmp('ff_clzt').getValue()==null?"":Ext.getCmp('ff_clzt').getValue();
  731. // query.V_LOGINNAME = V_LOGINNAME;
  732. // query.V_PASSWORD = V_PASSWORD;
  733. query.COMMSTATUS = 'NO';
  734. var jsonstr = Ext.JSON.encode(query);
  735. myStore.getProxy().extraParams = {
  736. queryJson : jsonstr
  737. };
  738. Ext.getCmp('VFireOptionListPageToolbar').moveFirst();
  739. Ext.getCmp('ff_company_code').setValue('');
  740. Ext.getCmp('ff_start_data').setValue('');
  741. Ext.getCmp('ff_end_data').setValue('');
  742. Ext.getCmp('ff_clzt').setValue('');
  743. Ext.getCmp('VFireOptionFilterWin').hide();
  744. }
  745. }
  746. },{
  747. text: '关闭',
  748. iconCls: 'cancel_btn',
  749. handler: function() {
  750. Ext.getCmp('VFireOptionFilterWin').hide();
  751. }
  752. }]
  753. });
  754. var filterwin = function() {
  755. if(Ext.getCmp('VFireOptionFilterWin')==undefined){
  756. Ext.create('Ext.window.Window',{
  757. id: 'VFireOptionFilterWin',
  758. title: '监测设备筛选',
  759. height: 210,
  760. width: 400,
  761. layout: 'fit',
  762. items: FilterForm,
  763. closable:false,
  764. modal:true,
  765. closeAction: 'hide'
  766. }).show();
  767. }else
  768. Ext.getCmp('VFireOptionFilterWin').show();
  769. CompanyStory.reload();
  770. }
  771. var WaterOptionPanel = Ext.create('Ext.grid.Panel', {
  772. header :{
  773. height:0,
  774. border:'0px solid #000000'
  775. },
  776. titleCollapse:true,
  777. id: 'VWaterOptionListPanel',
  778. region:'center',
  779. store: myStore,
  780. columns: [
  781. { header: 'id', dataIndex:'id',hidden:true, menuDisabled:true},
  782. { header: '序号', dataIndex: 'orderIdx',width:50, menuDisabled:true },
  783. { header: '单位名称', dataIndex: 'company',width:240, menuDisabled:true },
  784. { header: '设备名称', dataIndex: 'name', width:240, menuDisabled:true },
  785. { header: '设备编号', dataIndex: 'device_id', width:240, menuDisabled:true },
  786. { header: '设备类型', dataIndex: 'device_type', width:240, menuDisabled:true },
  787. { header: '端口名称', dataIndex: 'point_name', width:230, menuDisabled:true },
  788. { header: '端口编号', dataIndex: 'point_code', width:100, menuDisabled:true },
  789. { header: '数据上传时间', dataIndex: 'data_time', width:560,minWidth:400, maxWidth:1600,menuDisabled:true }
  790. // { header: '处理状态', dataIndex: 'clzt', width:100, menuDisabled:true },
  791. // { header: '处理人', dataIndex: 'clr_name',width:150, menuDisabled:true },
  792. // { header: '处理时间', dataIndex: 'clsj', width:160, menuDisabled:true }
  793. ],
  794. columnLines: true,
  795. height: maxHeight,
  796. width: '100%',
  797. tbar: new Ext.create('Ext.toolbar.Toolbar',{
  798. items:[{
  799. html:'<span id="FirePiePanel_title_string" style="color:#ffffff;background-color:rgba(0,0,0,0)">监测设备列表</span>'
  800. },'->',{
  801. xtype: 'button',
  802. iconCls:'back_btn',
  803. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">返回</span>',
  804. listeners: {
  805. click: function(){
  806. location.href=baseUrl+'view/frontpage/map.jsp?&theme='+theme+'&company_code='+company_code;
  807. }
  808. }
  809. },'-',
  810. {
  811. xtype: 'button',
  812. iconCls:'filter_btn',
  813. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">筛选</span>',
  814. listeners: {
  815. click: filterwin
  816. }
  817. },'-',
  818. {
  819. xtype: 'button',
  820. iconCls:'filter_btn',
  821. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">导出</span>',
  822. listeners: {
  823. click: exportbtn_click
  824. }
  825. },'-']
  826. }),
  827. bbar: new Ext.PagingToolbar({
  828. store: myStore,
  829. id:'VFireOptionListPageToolbar',
  830. displayInfo: true,
  831. pageSize: countPerPage,
  832. prependButtons: true,
  833. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  834. emptyMsg : "没有记录",
  835. firstText: '第一页',
  836. prevText: '前一页',
  837. nextText: '后一页',
  838. lastText: '最后一页',
  839. refreshText: '刷新'
  840. }),
  841. frame: true,
  842. border:false,
  843. iconCls: 'icon-grid',
  844. listeners:{
  845. 'celldblclick' : function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts){
  846. show_datapie(record);
  847. }
  848. }
  849. });
  850. // myStore.reload();
  851. // getCurrentData();
  852. var piebar = Ext.create('Ext.panel.Panel',{
  853. id:'FirePiePanel',
  854. width:'100%',
  855. height:498,
  856. region:'north',
  857. layout:'border',
  858. defaults:{
  859. border:false
  860. },
  861. 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_11">最新数据</div><div id="operation_label_2" class="operation_label_12">最大数据</div><div id="operation_label_3" class="operation_label_13">最小数据</div><div id="operation_label_4" class="operation_label_14">时间</div><div id="operation_label_5" class="operation_label_15">时间</div><div id="operation_label_6" class="operation_label_16">时间</div><div id="operation_num_1" class="operation_num_11"></div><div id="operation_num_2" class="operation_num_12"></div><div id="operation_num_3" class="operation_num_13"></div><div id="operation_num_4" class="operation_num_14"></div><div id="operation_num_5" class="operation_num_15"></div><div id="operation_num_6" class="operation_num_16"></div><div id="operation_area_bg" class="operation_area_bg"></div><div id="operation_area" class="operation_area"></div></div>'
  862. });
  863. pieMask = new Ext.LoadMask(piebar,{msg:"Loading..."});
  864. myMask = new Ext.LoadMask(document.body,{msg:"Loading..."});
  865. new Ext.create('Ext.panel.Panel',{
  866. width:'100%',
  867. id: 'WaterAlarmPanel',
  868. layout:'border',
  869. items:[
  870. piebar,WaterOptionPanel
  871. ],
  872. renderTo: Ext.getBody()
  873. });
  874. pieMask.show();
  875. myStore.addListener('load',function(store,record,opts){
  876. pieMask.show();
  877. WaterOptionPanel.getSelectionModel().select(0,true);
  878. getCurrentData();
  879. });
  880. myStore.reload();
  881. $(window).resize(function(){
  882. body_resize();
  883. });
  884. body_resize();
  885. });