building.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  1. /**
  2. * Building.js
  3. * 建筑物界面
  4. * emial: hanzhengyi@chinausky.com
  5. * create: 2018-12-27
  6. */
  7. Ext.Loader.setConfig({
  8. enabled: true
  9. });
  10. Ext.Loader.setPath('Ext.ux', '../../res/extjs/examples/ux');
  11. Ext.require([
  12. 'Ext.grid.*',
  13. 'Ext.data.*',
  14. 'Ext.ux.RowExpander',
  15. 'Ext.selection.CheckboxModel'
  16. ]);
  17. var sm = Ext.create('Ext.selection.CheckboxModel');
  18. Ext.define('Building',{
  19. extend: 'Ext.data.Model',
  20. fields: [
  21. { name:'I_ORDER_IDX', type:'int' },
  22. { name:'UQ_BUILDING_ID', type:'string' },
  23. { name:'V_BUILDING_NAME', type:'string' },
  24. { name:'UQ_POINT_ID', type:'string' },
  25. { name:'UQ_COMPANY_ID', type:'string' },
  26. { name:'V_AREA_ID', type:'string' },
  27. { name:'V_ADDR_0', type:'string' },
  28. { name:'V_ADDR_1', type:'string' },
  29. { name:'V_ADDR_2', type:'string' },
  30. { name:'I_MIN_FLOOR', type:'int' },
  31. { name:'I_MAX_FLOOR', type:'int' },
  32. { name:'F_FLOOR_SPACE', type:'string' },
  33. { name:'F_TOTAL_SPACE', type:'string' },
  34. { name:'F_BUILDING_HEIGHT', type:'string' },
  35. { name:'I_VERSION', type:'int' },
  36. { name:'D_STORETIME', type:'string' }
  37. ]
  38. });
  39. Ext.onReady(function(){
  40. var baseUrl = document.getElementById('basePath').value;
  41. var theme = document.getElementById('theme').value;
  42. var chkIcon = '<img src="'+baseUrl+'res/img/common/check.gif"/>'
  43. var unchkIcon = '<img src="'+baseUrl+'res/img/common/uncheck.gif"/>'
  44. var countPerPage = 20;
  45. var maxHeight = 10000;
  46. var chkBoolean = function(flag) {
  47. if(flag)
  48. return chkIcon;
  49. return unchkIcon;
  50. }
  51. var clear_append_form = function (){
  52. Ext.getCmp('fa_V_BUILDING_NAME').setValue("");
  53. Ext.getCmp('fa_UQ_POINT_ID').setValue("");
  54. Ext.getCmp('fa_UQ_COMPANY_ID').setValue("");
  55. Ext.getCmp('fa_V_AREA_ID').setValue("");
  56. Ext.getCmp('fa_V_ADDR_0').setValue("");
  57. Ext.getCmp('fa_I_MIN_FLOOR').setValue("");
  58. //Ext.getCmp('fa_I_MAX_FLOOR').setValue("");
  59. Ext.getCmp('fa_I_MAX_FLOOR').setValue("");
  60. Ext.getCmp('fa_V_COMMENT').setValue("新增建筑物");
  61. Ext.getCmp('BuildingListPanel').getStore().reload();
  62. }
  63. var states2 = Ext.create('Ext.data.Store', {
  64. fields: ['status', 'name'],
  65. data : [
  66. {"status": "国家", "name":"国家"},
  67. {"status": "省、直辖市、自治区、特别行政区", "name":"省、直辖市、自治区、特别行政区"},
  68. {"status": "地区、市、自治州、盟", "name":"地区、市、自治州、盟"},
  69. {"status": "县、市辖区、县级市、旗", "name":"县、市辖区、县级市、旗"},
  70. ]
  71. });
  72. var myStore = Ext.create('Ext.data.Store', {
  73. model: 'Building',
  74. pageSize: countPerPage,
  75. proxy: {
  76. type: 'ajax',
  77. url: baseUrl+'iot/building/getList',
  78. reader: {
  79. type: 'json',
  80. root: 'RESULT',
  81. totalProperty: 'totalCount'
  82. }
  83. },
  84. remoteSort: true
  85. });
  86. // var combocitystoreA = new Ext.data.Store({
  87. // //设定读取的地址
  88. // proxy: new Ext.data.HttpProxy({ url: baseUrl+'iot/area/getProvince' }),
  89. // //设定读取的格式
  90. // reader: new Ext.data.JsonReader({
  91. // root: 'RESULT',
  92. // fields :[ 'V_AREA_ID', 'V_AREA_NAME' ]
  93. // })
  94. // });
  95. Ext.define('Province',{
  96. extend:'Ext.data.Model',
  97. fields: [
  98. {name:'V_AREA_NAME', type:'string'},
  99. {name:'V_AREA_ID',type:'string'}
  100. ]
  101. });
  102. Ext.define('City',{
  103. extend:'Ext.data.Model',
  104. fields: [
  105. {name:'V_AREA_NAME', type:'string'},
  106. {name:'V_AREA_ID',type:'string'}
  107. ]
  108. });
  109. Ext.define('Qu',{
  110. extend:'Ext.data.Model',
  111. fields: [
  112. {name:'V_AREA_NAME', type:'string'},
  113. {name:'V_AREA_ID',type:'string'}
  114. ]
  115. });
  116. var queryJson = new Object();
  117. var combocitystoreA = Ext.create('Ext.data.Store',{
  118. model: 'Province',
  119. proxy: {
  120. type: 'ajax',
  121. actionMethods: {
  122. create : 'POST',
  123. read : 'POST', // by default GET
  124. update : 'POST',
  125. destroy: 'POST'
  126. },
  127. url: baseUrl+'iot/area/getProvince',
  128. reader: {
  129. type: 'json',
  130. root: 'RESULT',
  131. totalProperty: 'totalCount'
  132. }
  133. // extraParams:{
  134. // queryJson:Ext.JSON.encode(queryJson)
  135. // }
  136. }
  137. });
  138. // combocitystoreA.reload();
  139. var CityStore = Ext.create('Ext.data.Store',{
  140. model: 'City',
  141. proxy: {
  142. type: 'ajax',
  143. actionMethods: {
  144. create : 'POST',
  145. read : 'POST', // by default GET
  146. update : 'POST',
  147. destroy: 'POST'
  148. },
  149. url: baseUrl+'iot/area/getCity',
  150. reader: {
  151. type: 'json',
  152. root: 'RESULT',
  153. totalProperty: 'totalCount'
  154. }
  155. }
  156. });
  157. var QuStore = Ext.create('Ext.data.Store',{
  158. model: 'Qu',
  159. proxy: {
  160. type: 'ajax',
  161. actionMethods: {
  162. create : 'POST',
  163. read : 'POST', // by default GET
  164. update : 'POST',
  165. destroy: 'POST'
  166. },
  167. url: baseUrl+'iot/area/getQu',
  168. reader: {
  169. type: 'json',
  170. root: 'RESULT',
  171. totalProperty: 'totalCount'
  172. }
  173. }
  174. });
  175. Ext.define('State', {
  176. extend: 'Ext.data.Model',
  177. fields: [
  178. {name:'V_AREA_NAME', type:'string'},
  179. {name:'V_AREA_ID',type:'string'}
  180. ]
  181. });
  182. //加载省数据源
  183. var store = Ext.create('Ext.data.Store', {
  184. model: 'State',
  185. proxy: {
  186. type: 'ajax',
  187. url: baseUrl+'iot/area/getProvince'
  188. },
  189. // autoLoad: true,
  190. remoteSort:true,
  191. reader: {
  192. type: 'json',
  193. root: 'RESULT',
  194. totalProperty: 'totalCount'
  195. }
  196. });
  197. //加载市数据源
  198. var store1 = Ext.create('Ext.data.Store', {
  199. model: 'State',
  200. proxy: {
  201. type: 'ajax',
  202. url: 'city.asp?act=shi&n='+new Date().getTime()+''
  203. },
  204. autoLoad: false,
  205. remoteSort:true
  206. });
  207. //加载区数据源
  208. var store2 = Ext.create('Ext.data.Store', {
  209. model: 'State',
  210. proxy: {
  211. type: 'ajax',
  212. url: 'city.asp?act=qu&n='+new Date().getTime()+''
  213. },
  214. autoLoad: false,
  215. remoteSort:true
  216. });
  217. var AppendForm = Ext.create('Ext.form.Panel', {
  218. id: 'BuildingAppendForm',
  219. labelWidth: 55,
  220. url: baseUrl+'iot/building/append',
  221. defaultType: 'textfield',
  222. bodyPadding: 15,
  223. items: [{
  224. fieldLabel:'建筑物名称',
  225. id: 'fa_V_BUILDING_NAME',
  226. name:'V_BUILDING_NAME',
  227. maxLength:20,
  228. maxLengthText:'长度不得超出{0}',
  229. anchor:'75%'
  230. },{
  231. fieldLabel:'坐标点位ID',
  232. id: 'fa_UQ_POINT_ID',
  233. name: 'UQ_POINT_ID',
  234. maxLength: 7,
  235. maxLengthText:'长度不得超出{0}',
  236. anchor:'50%'
  237. },{
  238. fieldLabel:'物业管理公司ID',
  239. id: 'fa_UQ_COMPANY_ID',
  240. name:'UQ_COMPANY_ID',
  241. maxLength: 12,
  242. maxLengthText:'长度不得超出{0}',
  243. anchor:'75%'
  244. },
  245. {
  246. xtype:"combo",
  247. name:'sheng',
  248. id : 'sheng',
  249. fieldLabel:'选择省',
  250. displayField:'V_AREA_NAME',
  251. valueField:'V_AREA_ID',
  252. store:combocitystoreA,
  253. triggerAction:'all',
  254. queryMode: 'remote',
  255. selectOnFocus:true,
  256. forceSelection: true,
  257. allowBlank:false,
  258. editable: false,
  259. emptyText:'请选择省',
  260. blankText : '请选择省',
  261. listeners:{
  262. select:function(combo, record,index){
  263. try{
  264. //userAdd = record.data.name;
  265. var parent=Ext.getCmp('shi');
  266. var parent1 = Ext.getCmp("fa_V_AREA_ID");
  267. parent.clearValue();
  268. parent1.clearValue();
  269. parent.store.load({params:{queryJson:this.value}});
  270. }
  271. catch(ex){
  272. Ext.MessageBox.alert("错误","数据加载失败。");
  273. }
  274. }
  275. }
  276. },{
  277. xtype:"combo",
  278. name:'shi',
  279. id : 'shi',
  280. fieldLabel:'选择市',
  281. displayField:'V_AREA_NAME',
  282. valueField:'V_AREA_ID',
  283. store:CityStore,
  284. triggerAction:'all',
  285. queryMode: 'local',
  286. selectOnFocus:true,
  287. forceSelection: true,
  288. allowBlank:false,
  289. editable: false,
  290. emptyText:'请选择市',
  291. blankText : '请选择市',
  292. listeners:{
  293. select:function(combo, record,index){
  294. try{
  295. //userAdd = record.data.name;
  296. var parent = Ext.getCmp("fa_V_AREA_ID");
  297. parent.clearValue();
  298. parent.store.load({params:{queryJson:this.value}});
  299. }
  300. catch(ex){
  301. Ext.MessageBox.alert("错误","数据加载失败。");
  302. }
  303. }
  304. }
  305. },
  306. {
  307. xtype:"combo",
  308. name:'V_AREA_ID',
  309. id : 'fa_V_AREA_ID',
  310. fieldLabel:'选择区',
  311. displayField:'V_AREA_NAME',
  312. valueField:'V_AREA_ID',
  313. store:QuStore,
  314. triggerAction:'all',
  315. queryMode: 'local',
  316. selectOnFocus:true,
  317. forceSelection: true,
  318. allowBlank:false,
  319. editable: false,
  320. emptyText:'请选择区',
  321. blankText : '请选择区',
  322. },
  323. {
  324. fieldLabel:'详细地址1',
  325. id: 'fa_V_ADDR_0',
  326. name:'V_ADDR_0',
  327. maxLength: 30,
  328. maxLengthText:'长度不得超出{0}',
  329. anchor:'75%'
  330. },{
  331. fieldLabel:'最低楼层',
  332. id: 'fa_I_MIN_FLOOR',
  333. name:'I_MIN_FLOOR',
  334. maxLength: 30,
  335. maxLengthText:'长度不得超出{0}',
  336. anchor:'75%'
  337. },{
  338. fieldLabel:'最高楼层',
  339. id: 'fa_I_MAX_FLOOR',
  340. name:'I_MAX_FLOOR',
  341. maxLength: 30,
  342. maxLengthText:'长度不得超出{0}',
  343. anchor:'75%'
  344. },{
  345. fieldLabel:'新增建筑物说明',
  346. id: 'fa_V_COMMENT',
  347. name:'V_COMMENT',
  348. xtype: 'textareafield',
  349. maxLength: 250,
  350. maxLengthText:'长度不得超出{0}',
  351. anchor:'100%',
  352. value:'新增建筑物'
  353. },{
  354. id:'fa_queryJson',
  355. name:'queryJson',
  356. hidden:true
  357. }],
  358. buttons: [{
  359. text: '提交',
  360. iconCls:'ok_btn',
  361. handler: function() {
  362. var form = this.up('form').getForm();
  363. if (form.isValid()) {
  364. var query = new Object();
  365. query.V_BUILDING_NAME = Ext.getCmp('fa_V_BUILDING_NAME').getValue();
  366. query.UQ_POINT_ID = Ext.getCmp('fa_UQ_POINT_ID').getValue();
  367. query.UQ_COMPANY_ID = Ext.getCmp('fa_UQ_COMPANY_ID').getValue();
  368. query.V_AREA_ID = Ext.getCmp('fa_V_AREA_ID').getValue();
  369. query.V_ADDR_0 = Ext.getCmp('fa_V_ADDR_0').getValue();
  370. query.I_MIN_FLOOR = Ext.getCmp('fa_I_MIN_FLOOR').getValue();
  371. query.I_MAX_FLOOR = Ext.getCmp('fa_I_MAX_FLOOR').getValue();
  372. // if(Ext.getCmp('fa_I_MAX_FLOOR').getValue()=='国家'){
  373. // query.I_MAX_FLOOR=0;
  374. // }
  375. // if(Ext.getCmp('fa_I_MAX_FLOOR').getValue()=='省、直辖市、自治区、特别行政区'){
  376. // query.I_MAX_FLOOR=1;
  377. // }
  378. // if(Ext.getCmp('fa_I_MAX_FLOOR').getValue()=='地区、市、自治州、盟'){
  379. // query.I_MAX_FLOOR=2;
  380. // }
  381. // if(Ext.getCmp('fa_I_MAX_FLOOR').getValue()=='县、市辖区、县级市、旗'){
  382. // query.I_MAX_FLOOR=3;
  383. // }
  384. query.V_COMMENT = Ext.getCmp('fa_V_COMMENT').getValue();
  385. query.UQ_ADMIN_ID = '00000000-000000-000000-000000';
  386. var jsonstr = Ext.JSON.encode(query);
  387. Ext.getCmp('fa_queryJson').setValue(jsonstr);
  388. form.submit({
  389. method:'post',
  390. success: function(form, action) {
  391. Ext.Msg.alert('操作成功', '新增建筑物已保存', function(btn,txt){
  392. clear_append_form();
  393. });
  394. },
  395. failure: function(form, action) {
  396. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  397. clear_append_form();
  398. });
  399. }
  400. });
  401. }
  402. }
  403. },{
  404. text: '关闭',
  405. iconCls: 'cancel_btn',
  406. handler: function() {
  407. this.up('window').hide();
  408. }
  409. }]
  410. });
  411. var appendwin = function(){
  412. Ext.create('Ext.window.Window', {
  413. title: '新增建筑物',
  414. height: 400,
  415. width: 400,
  416. layout: 'fit',
  417. items: AppendForm,
  418. closeAction: 'hide'
  419. }).show();
  420. // combocitystoreA.reload();
  421. }
  422. var clear_filter_form = function(){
  423. Ext.getCmp('ff_V_BUILDING_NAME').setValue("");
  424. Ext.getCmp('ff_UQ_COMPANY_ID').setValue("");
  425. Ext.getCmp('ff_V_AREA_ID').setValue("");
  426. Ext.getCmp('ff_V_ADDR_0').setValue("");
  427. // Ext.getCmp('ff_I_MAX_FLOOR').setValue(0);
  428. }
  429. var FilterForm = Ext.create('Ext.form.Panel', {
  430. id: 'BuildingFilterForm',
  431. labelWidth: 55,
  432. defaultType: 'textfield',
  433. bodyPadding: 15,
  434. items: [{
  435. fieldLabel:'建筑物名称',
  436. id: 'ff_V_BUILDING_NAME',
  437. name:'V_BUILDING_NAME',
  438. maxLength:20,
  439. maxLengthText:'长度不得超出{0}',
  440. anchor:'75%',
  441. value:document.getElementById('myAct').value
  442. },{
  443. fieldLabel:'物业管理公司ID',
  444. id: 'ff_UQ_COMPANY_ID',
  445. name: 'UQ_COMPANY_ID',
  446. maxLength: 7,
  447. maxLengthText:'长度不得超出{0}',
  448. anchor:'75%',
  449. value:document.getElementById('loginName').value
  450. },{
  451. fieldLabel:'行政区域ID',
  452. id: 'ff_V_AREA_ID',
  453. name: 'V_AREA_ID',
  454. maxLength: 30,
  455. maxLengthText:'长度不得超出{0}',
  456. anchor:'75%',
  457. value:document.getElementById('zipCode').value
  458. },{
  459. fieldLabel:'详细地址',
  460. id: 'ff_V_ADDR_0',
  461. name: 'V_ADDR_0',
  462. maxLength: 30,
  463. maxLengthText:'长度不得超出{0}',
  464. anchor:'75%',
  465. value:document.getElementById('mergerName').value
  466. },{
  467. id:'ff_queryJson',
  468. name:'queryJson',
  469. hidden:true
  470. }],
  471. buttons: [{
  472. text: '提交',
  473. iconCls:'ok_btn',
  474. handler: function() {
  475. var form = this.up('form').getForm();
  476. if (form.isValid()) {
  477. var query = new Object();
  478. if(Ext.getCmp('ff_V_BUILDING_NAME').getValue().length>0)
  479. query.V_BUILDING_NAME = Ext.getCmp('ff_V_BUILDING_NAME').getValue();
  480. if(Ext.getCmp('ff_UQ_COMPANY_ID').getValue().length>0)
  481. query.UQ_COMPANY_ID = Ext.getCmp('ff_UQ_COMPANY_ID').getValue();
  482. if(Ext.getCmp('ff_V_AREA_ID').getValue().length>0)
  483. query.V_AREA_ID = Ext.getCmp('ff_V_AREA_ID').getValue();
  484. if(Ext.getCmp('ff_V_ADDR_0').getValue().length>0)
  485. query.V_ADDR_0 = Ext.getCmp('ff_V_ADDR_0').getValue();
  486. // if(Ext.getCmp('ff_I_MAX_FLOOR').getValue().length>0)
  487. // if(Ext.getCmp('ff_I_MAX_FLOOR').getValue()=='国家'){
  488. // query.I_MAX_FLOOR=0;
  489. // }
  490. // if(Ext.getCmp('ff_I_MAX_FLOOR').getValue()=='省、直辖市、自治区、特别行政区'){
  491. // query.I_MAX_FLOOR=1;
  492. // }
  493. // if(Ext.getCmp('ff_I_MAX_FLOOR').getValue()=='地区、市、自治州、盟'){
  494. // query.I_MAX_FLOOR=2;
  495. // }
  496. // if(Ext.getCmp('ff_I_MAX_FLOOR').getValue()=='县、市辖区、县级市、旗'){
  497. // query.I_MAX_FLOOR=3;
  498. // }
  499. var jsonstr = Ext.JSON.encode(query);
  500. myStore.getProxy().extraParams = {
  501. queryJson : jsonstr
  502. };
  503. Ext.getCmp('BuildingListPageToolbar').moveFirst();
  504. Ext.getCmp('myAct').setValue(query.V_BUILDING_NAME);
  505. Ext.getCmp('loginName').setValue(query.UQ_COMPANY_ID);
  506. Ext.getCmp('zipCode').setValue(query.V_AREA_ID);
  507. Ext.getCmp('mergerName').setValue(query.V_ADDR_0);
  508. // Ext.getCmp('level').setValue(query.I_MAX_FLOOR);
  509. clear_filter_form();
  510. this.up('window').hide();
  511. }
  512. }
  513. },{
  514. text: '关闭',
  515. iconCls: 'cancel_btn',
  516. handler: function() {
  517. this.up('window').hide();
  518. }
  519. }]
  520. });
  521. var filterwin = function() {
  522. Ext.create('Ext.window.Window',{
  523. id: 'BuildingFilterWin',
  524. title: '建筑物筛选',
  525. height: 300,
  526. width: 400,
  527. layout: 'fit',
  528. items: FilterForm,
  529. closeAction: 'hide'
  530. }).show();
  531. }
  532. var clear_modify_form = function (){
  533. Ext.getCmp('fm_V_BUILDING_NAME').setValue("");
  534. Ext.getCmp('fm_UQ_COMPANY_ID').setValue("");
  535. Ext.getCmp('fm_V_AREA_ID').setValue("");
  536. Ext.getCmp('fm_V_ADDR_0').setValue("");
  537. Ext.getCmp('fm_I_MIN_FLOOR').setValue("");
  538. Ext.getCmp('fm_I_MAX_FLOOR').setValue(0);
  539. Ext.getCmp('fm_V_COMMENT').setValue("修改建筑物");
  540. Ext.getCmp('BuildingListPanel').getStore().reload();
  541. }
  542. var ModifyForm = Ext.create('Ext.form.Panel', {
  543. id: 'BuildingEditForm',
  544. labelWidth: 55,
  545. url: baseUrl+'iot/building/update',
  546. defaultType: 'textfield',
  547. bodyPadding: 15,
  548. items: [{
  549. fieldLabel:'建筑物名称',
  550. id: 'fm_V_BUILDING_NAME',
  551. name:'V_BUILDING_NAME',
  552. maxLength:20,
  553. maxLengthText:'长度不得超出{0}',
  554. anchor:'75%'
  555. },{
  556. fieldLabel:'物业管理公司ID',
  557. id: 'fm_UQ_COMPANY_ID',
  558. name:'UQ_COMPANY_ID',
  559. maxLength: 12,
  560. maxLengthText:'长度不得超出{0}',
  561. anchor:'75%'
  562. },{
  563. fieldLabel:'行政区域ID',
  564. id: 'fm_V_AREA_ID',
  565. name:'V_AREA_ID',
  566. maxLength: 30,
  567. maxLengthText:'长度不得超出{0}',
  568. anchor:'75%'
  569. },{
  570. fieldLabel:'详细地址',
  571. id: 'fm_V_ADDR_0',
  572. name:'V_ADDR_0',
  573. maxLength: 30,
  574. maxLengthText:'长度不得超出{0}',
  575. anchor:'75%'
  576. },{
  577. fieldLabel:'最低楼层',
  578. id: 'fm_I_MIN_FLOOR',
  579. name:'I_MIN_FLOOR',
  580. maxLength: 30,
  581. maxLengthText:'长度不得超出{0}',
  582. anchor:'75%'
  583. },{
  584. fieldLabel:'最高楼层',
  585. id: 'fm_I_MAX_FLOOR',
  586. name: 'I_MAX_FLOOR',
  587. maxLength: 7,
  588. maxLengthText:'长度不得超出{0}',
  589. anchor:'50%'
  590. },{
  591. fieldLabel:'修改建筑物说明',
  592. id: 'fm_V_COMMENT',
  593. name:'V_COMMENT',
  594. xtype: 'textareafield',
  595. maxLength: 250,
  596. maxLengthText:'长度不得超出{0}',
  597. anchor:'100%',
  598. value:'修改建筑物'
  599. },{
  600. id: 'fm_UQ_BUILDING_ID',
  601. name:'UQ_BUILDING_ID',
  602. hidden:true
  603. },{
  604. id:'fm_queryJson',
  605. name:'queryJson',
  606. hidden:true
  607. }],
  608. buttons: [{
  609. text: '修改',
  610. iconCls:'ok_btn',
  611. handler: function() {
  612. var form = this.up('form').getForm();
  613. if (form.isValid()) {
  614. var query = new Object();
  615. query.UQ_BUILDING_ID = Ext.getCmp('fm_UQ_BUILDING_ID').getValue();
  616. query.V_BUILDING_NAME = Ext.getCmp('fm_V_BUILDING_NAME').getValue();
  617. query.I_MAX_FLOOR = Ext.getCmp('fm_I_MAX_FLOOR').getValue();
  618. query.UQ_COMPANY_ID = Ext.getCmp('fm_UQ_COMPANY_ID').getValue();
  619. query.V_AREA_ID = Ext.getCmp('fm_V_AREA_ID').getValue();
  620. query.V_ADDR_0 = Ext.getCmp('fm_V_ADDR_0').getValue();
  621. query.I_MIN_FLOOR = Ext.getCmp('fm_I_MIN_FLOOR').getValue();
  622. // if(Ext.getCmp('fm_I_MAX_FLOOR').getValue()=='国家'){
  623. // query.I_MAX_FLOOR=0;
  624. // }
  625. // if(Ext.getCmp('fm_I_MAX_FLOOR').getValue()=='省、直辖市、自治区、特别行政区'){
  626. // query.I_MAX_FLOOR=1;
  627. // }
  628. // if(Ext.getCmp('fm_I_MAX_FLOOR').getValue()=='地区、市、自治州、盟'){
  629. // query.I_MAX_FLOOR=2;
  630. // }
  631. // if(Ext.getCmp('fm_I_MAX_FLOOR').getValue()=='县、市辖区、县级市、旗'){
  632. // query.I_MAX_FLOOR=3;
  633. // }
  634. query.V_COMMENT = Ext.getCmp('fm_V_COMMENT').getValue();
  635. query.UQ_ADMIN_ID = '00000000-000000-000000-000000';
  636. var jsonstr = Ext.JSON.encode(query);
  637. Ext.getCmp('fm_queryJson').setValue(jsonstr);
  638. form.submit({
  639. method:'post',
  640. success: function(form, action) {
  641. Ext.Msg.alert('操作成功', '建筑物已修改', function(btn,txt){
  642. clear_modify_form();
  643. });
  644. },
  645. failure: function(form, action) {
  646. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  647. clear_modify_form();
  648. });
  649. }
  650. });
  651. this.up('window').hide();
  652. }
  653. }
  654. },{
  655. text: '关闭',
  656. iconCls: 'cancel_btn',
  657. handler: function() {
  658. this.up('window').hide();
  659. }
  660. }]
  661. });
  662. var modifywin = function(){
  663. Ext.create('Ext.window.Window', {
  664. title: '修改建筑物',
  665. height: 400,
  666. width: 400,
  667. layout: 'fit',
  668. items: ModifyForm,
  669. closeAction: 'hide'
  670. }).show();
  671. }
  672. // var del_sm = function() {
  673. // if(sm.getCount()==1){
  674. // var selected = sm.getSelection( );
  675. // var query = new Object();
  676. // var list = new Array();
  677. // var o = new Object();
  678. // o.UQ_BUILDING_ID = selected[0].raw.UQ_BUILDING_ID;
  679. // list.push(o);
  680. // query.Building_LIST = list;
  681. // var jsonstr= Ext.JSON.encode(query);
  682. // Ext.MessageBox.confirm('注销建筑物','是否注销 '+selected[0].raw.V_BUILDING_NAME+' 建筑物?',function(btn){
  683. // if(btn=='yes'){
  684. //
  685. // Ext.Ajax.request( {
  686. // timeout : 3000000,
  687. // url: baseUrl+'iot/building/delete',
  688. // params : 'queryJson='+ jsonstr,
  689. // success: function(resp,opts){
  690. // myStore.reload();
  691. // }
  692. // });
  693. //
  694. // }
  695. // },this);
  696. // }else{
  697. // if(sm.getCount()>1){
  698. // var query = new Object();
  699. // var list = new Array();
  700. // for(var i=0;i<sm.getCount();i++){
  701. // var selected = sm.getSelection( );
  702. // var o = new Object();
  703. // o.UQ_BUILDING_ID = selected[i].raw.UQ_BUILDING_ID;
  704. // list.push(o);
  705. // }
  706. // query.Building_LIST = list;
  707. //
  708. // var jsonstr= Ext.JSON.encode(query);
  709. // Ext.MessageBox.confirm('注销建筑物','是否注销选中的'+sm.getCount()+' 个建筑物?',function(btn){
  710. // if(btn=='yes'){
  711. //
  712. // Ext.Ajax.request( {
  713. // timeout : 3000000,
  714. // url: baseUrl+'iot/building/delete',
  715. // params : 'queryJson='+ jsonstr,
  716. // success: function(resp,opts){
  717. // myStore.reload();
  718. // }
  719. // });
  720. //
  721. // }
  722. // },this);
  723. // }else{
  724. // Ext.Msg.alert('请先选择','至少选择一条记录,再点击注销');
  725. // }
  726. // }
  727. // }
  728. var chk_sm = function() {
  729. if(sm.getCount()==1){
  730. modifywin();
  731. var selected = sm.getSelection( );
  732. Ext.getCmp('fm_UQ_BUILDING_ID').setValue(selected[0].raw.UQ_BUILDING_ID);
  733. Ext.getCmp('fm_V_BUILDING_NAME').setValue(selected[0].raw.V_BUILDING_NAME);
  734. // Ext.getCmp('fm_UQ_POINT_ID').setValue(selected[0].raw.UQ_POINT_ID);
  735. Ext.getCmp('fm_UQ_COMPANY_ID').setValue(selected[0].raw.UQ_COMPANY_ID);
  736. Ext.getCmp('fm_V_AREA_ID').setValue(selected[0].raw.V_AREA_ID);
  737. Ext.getCmp('fm_V_ADDR_0').setValue(selected[0].raw.V_ADDR_0);
  738. Ext.getCmp('fm_I_MIN_FLOOR').setValue(selected[0].raw.I_MIN_FLOOR);
  739. Ext.getCmp('fm_I_MAX_FLOOR').setValue(selected[0].raw.I_MAX_FLOOR);
  740. }else{
  741. Ext.Msg.alert('请先选择','请先选择一条记录,再点击修改');
  742. }
  743. }
  744. Ext.create('Ext.grid.Panel', {
  745. title: '建筑物信息',
  746. id: 'BuildingListPanel',
  747. store: myStore,
  748. selModel: sm,
  749. columns: [
  750. { header: 'ID', dataIndex: 'UQ_BUILDING_ID',hidden:true, menuDisabled:true },
  751. { header: '序号', dataIndex: 'I_ORDER_IDX', width:40, menuDisabled:true },
  752. { header: '建筑物名称', dataIndex: 'V_BUILDING_NAME', width:100,align:'center', menuDisabled:true },
  753. { header: '物业管理公司ID', dataIndex: 'UQ_COMPANY_ID', width:100, align:'center', menuDisabled:true },
  754. { header: '行政区域ID', dataIndex: 'V_AREA_ID', width:100,align:'center', menuDisabled:true },
  755. { header: '最低楼层', dataIndex: 'I_MIN_FLOOR', width:100,align:'center', menuDisabled:true },
  756. { header: '最高楼层', dataIndex: 'I_MAX_FLOOR', width:100, align:'center', menuDisabled:true },
  757. { header: '详细地址', dataIndex: 'V_ADDR_0', width:100,align:'center', menuDisabled:true },
  758. { header: '保存时间', dataIndex: 'D_STORETIME',width:150, align:'center', menuDisabled:true },
  759. { header: '记录版本', dataIndex: 'I_VERSION', width:80, align:'center', menuDisabled:true },
  760. {
  761. xtype : 'actioncolumn',
  762. width:20,
  763. sortable:false,
  764. align:'center',
  765. menuDisabled:true,
  766. items:[{
  767. icon: '../../res/img/common/forum.gif',
  768. tooltip: '版本记录',
  769. handler: function(grid, rowIndex, colIndex) {
  770. var rec = grid.getStore().getAt(rowIndex);
  771. window.location = 'version.jsp?theme='+theme+'&buildingId='+rec.get('UQ_BUILDING_ID');
  772. }
  773. }]
  774. }
  775. ],
  776. columnLines: true,
  777. tbar: [
  778. {
  779. xtype: 'button',
  780. iconCls:'filter_btn',
  781. text: '筛选',
  782. listeners: {
  783. click: filterwin
  784. }
  785. },'-',
  786. {xtype: 'tbfill'},'-',
  787. {
  788. xtype: 'button',
  789. iconCls:'append_btn',
  790. text: '新增',
  791. listeners: {
  792. click: appendwin
  793. }
  794. },
  795. {
  796. xtype: 'button',
  797. iconCls:'modify_btn',
  798. text: '修改',
  799. listeners: {
  800. click: chk_sm
  801. }
  802. }
  803. ],
  804. height: maxHeight,
  805. width: '100%',
  806. bbar: new Ext.PagingToolbar({
  807. store: myStore,
  808. id:'BuildingListPageToolbar',
  809. displayInfo: true,
  810. pageSize: countPerPage,
  811. prependButtons: true,
  812. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  813. emptyMsg : "没有记录",
  814. firstText: '第一页',
  815. prevText: '前一页',
  816. nextText: '后一页',
  817. lastText: '最后一页',
  818. refreshText: '刷新'//,
  819. // doRefresh:function(start){
  820. // alert(start);
  821. // relushDataFunction(start); // 调用函数刷新数据
  822. // this.cursor = start; // 更新页签
  823. // }
  824. }),
  825. frame: true,
  826. border:false,
  827. iconCls: 'icon-grid',
  828. renderTo: Ext.getBody()
  829. });
  830. myStore.reload();
  831. maxHeight = document.documentElement.clientHeight;
  832. Ext.getCmp('BuildingListPanel').setHeight(maxHeight);
  833. });