area.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. /**
  2. * Area.js
  3. * 行政区域划分界面
  4. * emial: hanzhengyi@chinausky.com
  5. * create: 2018-12-24
  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('Area',{
  19. extend: 'Ext.data.Model',
  20. fields: [
  21. { name:'I_ORDER_IDX', type:'int' },
  22. { name:'V_AREA_ID', type:'string' },
  23. { name:'V_AREA_NAME', type:'string' },
  24. { name:'V_PARENT_ID', type:'string' },
  25. { name:'E_LEVEL', type:'string' },
  26. { name:'V_CITYCODE', type:'string' },
  27. { name:'V_ZIPCODE', type:'string' },
  28. { name:'V_MERGERNAME', type:'string' },
  29. { name:'V_PINYIN', type:'string' },
  30. { name:'I_VERSION', type:'int' },
  31. { name:'D_STORETIME', type:'string' }
  32. ]
  33. });
  34. Ext.onReady(function(){
  35. var baseUrl = document.getElementById('basePath').value;
  36. var theme = document.getElementById('theme').value;
  37. var chkIcon = '<img src="'+baseUrl+'res/img/common/check.gif"/>'
  38. var unchkIcon = '<img src="'+baseUrl+'res/img/common/uncheck.gif"/>'
  39. var countPerPage = 20;
  40. var maxHeight = 10000;
  41. var chkBoolean = function(flag) {
  42. if(flag)
  43. return chkIcon;
  44. return unchkIcon;
  45. }
  46. var clear_append_form = function (){
  47. Ext.getCmp('fa_V_AREA_ID').setValue("");
  48. Ext.getCmp('fa_V_AREA_NAME').setValue("");
  49. Ext.getCmp('fa_V_PARENT_ID').setValue("");
  50. Ext.getCmp('fa_V_CITYCODE').setValue("");
  51. Ext.getCmp('fa_V_ZIPCODE').setValue("");
  52. Ext.getCmp('fa_V_MERGERNAME').setValue("");
  53. Ext.getCmp('fa_V_PINYIN').setValue("");
  54. Ext.getCmp('fa_V_AREA_SHORTNAME').setValue("");
  55. Ext.getCmp('fa_E_LEVEL').setValue(0);
  56. Ext.getCmp('fa_V_COMMENT').setValue("新增行政区域");
  57. Ext.getCmp('AreaListPanel').getStore().reload();
  58. }
  59. var states2 = Ext.create('Ext.data.Store', {
  60. fields: ['status', 'name'],
  61. data : [
  62. {"status": "国家", "name":"国家"},
  63. {"status": "省、直辖市、自治区、特别行政区", "name":"省、直辖市、自治区、特别行政区"},
  64. {"status": "地区、市、自治州、盟", "name":"地区、市、自治州、盟"},
  65. {"status": "县、市辖区、县级市、旗", "name":"县、市辖区、县级市、旗"},
  66. ]
  67. });
  68. var myStore = Ext.create('Ext.data.Store', {
  69. model: 'Area',
  70. pageSize: countPerPage,
  71. proxy: {
  72. type: 'ajax',
  73. url: baseUrl+'iot/area/getList',
  74. reader: {
  75. type: 'json',
  76. root: 'RESULT',
  77. totalProperty: 'totalCount'
  78. }
  79. },
  80. remoteSort: true
  81. });
  82. var AppendForm = Ext.create('Ext.form.Panel', {
  83. id: 'AreaAppendForm',
  84. labelWidth: 55,
  85. url: baseUrl+'iot/area/append',
  86. defaultType: 'textfield',
  87. bodyPadding: 15,
  88. items: [{
  89. fieldLabel:'行政区域ID',
  90. id: 'fa_V_AREA_ID',
  91. name: 'V_AREA_ID',
  92. maxLength: 8,
  93. maxLengthText:'长度不得超出{0}',
  94. anchor:'50%'
  95. },{
  96. fieldLabel:'行政区域名称',
  97. id: 'fa_V_AREA_NAME',
  98. name:'V_AREA_NAME',
  99. maxLength:20,
  100. maxLengthText:'长度不得超出{0}',
  101. anchor:'75%'
  102. },{
  103. fieldLabel:'上级行政区域ID',
  104. id: 'fa_V_PARENT_ID',
  105. name: 'V_PARENT_ID',
  106. maxLength: 7,
  107. maxLengthText:'长度不得超出{0}',
  108. anchor:'50%'
  109. },{
  110. fieldLabel:'电话区号',
  111. id: 'fa_V_CITYCODE',
  112. name:'V_CITYCODE',
  113. maxLength: 12,
  114. maxLengthText:'长度不得超出{0}',
  115. anchor:'75%'
  116. },{
  117. fieldLabel:'邮政编码',
  118. id: 'fa_V_ZIPCODE',
  119. name:'V_ZIPCODE',
  120. maxLength: 12,
  121. maxLengthText:'长度不得超出{0}',
  122. anchor:'75%'
  123. },{
  124. fieldLabel:'组合名称',
  125. id: 'fa_V_MERGERNAME',
  126. name:'V_MERGERNAME',
  127. maxLength: 30,
  128. maxLengthText:'长度不得超出{0}',
  129. anchor:'75%'
  130. },{
  131. fieldLabel:'拼音',
  132. id: 'fa_V_PINYIN',
  133. name:'V_PINYIN',
  134. maxLength: 30,
  135. maxLengthText:'长度不得超出{0}',
  136. anchor:'75%'
  137. },{
  138. fieldLabel:'行政区域简称',
  139. id: 'fa_V_AREA_SHORTNAME',
  140. name:'V_AREA_SHORTNAME',
  141. maxLength: 30,
  142. maxLengthText:'长度不得超出{0}',
  143. anchor:'75%'
  144. },{
  145. fieldLabel:'行政区域级别',
  146. id:'fa_E_LEVEL',
  147. name:'E_LEVEL',
  148. xtype:'combo',
  149. store:states2,
  150. displayField : 'name',
  151. valueField : 'status',
  152. editable : false,
  153. maxLength: 30,
  154. maxLengthText:'长度不得超出{0}',
  155. anchor:'75%'
  156. },{
  157. fieldLabel:'新增行政区域说明',
  158. id: 'fa_V_COMMENT',
  159. name:'V_COMMENT',
  160. xtype: 'textareafield',
  161. maxLength: 250,
  162. maxLengthText:'长度不得超出{0}',
  163. anchor:'100%',
  164. value:'新增行政区域'
  165. },{
  166. id:'fa_queryJson',
  167. name:'queryJson',
  168. hidden:true
  169. }],
  170. buttons: [{
  171. text: '提交',
  172. iconCls:'ok_btn',
  173. handler: function() {
  174. var form = this.up('form').getForm();
  175. if (form.isValid()) {
  176. var query = new Object();
  177. query.V_AREA_ID = Ext.getCmp('fa_V_AREA_ID').getValue();
  178. query.V_AREA_NAME = Ext.getCmp('fa_V_AREA_NAME').getValue();
  179. query.V_PARENT_ID = Ext.getCmp('fa_V_PARENT_ID').getValue();
  180. query.V_CITYCODE = Ext.getCmp('fa_V_CITYCODE').getValue();
  181. query.V_ZIPCODE = Ext.getCmp('fa_V_ZIPCODE').getValue();
  182. query.V_MERGERNAME = Ext.getCmp('fa_V_MERGERNAME').getValue();
  183. query.V_PINYIN = Ext.getCmp('fa_V_PINYIN').getValue();
  184. query.V_AREA_SHORTNAME = Ext.getCmp('fa_V_AREA_SHORTNAME').getValue();
  185. if(Ext.getCmp('fa_E_LEVEL').getValue()=='国家'){
  186. query.E_LEVEL=0;
  187. }
  188. if(Ext.getCmp('fa_E_LEVEL').getValue()=='省、直辖市、自治区、特别行政区'){
  189. query.E_LEVEL=1;
  190. }
  191. if(Ext.getCmp('fa_E_LEVEL').getValue()=='地区、市、自治州、盟'){
  192. query.E_LEVEL=2;
  193. }
  194. if(Ext.getCmp('fa_E_LEVEL').getValue()=='县、市辖区、县级市、旗'){
  195. query.E_LEVEL=3;
  196. }
  197. query.V_COMMENT = Ext.getCmp('fa_V_COMMENT').getValue();
  198. query.UQ_ADMIN_ID = '00000000-000000-000000-000000';
  199. var jsonstr = Ext.JSON.encode(query);
  200. Ext.getCmp('fa_queryJson').setValue(jsonstr);
  201. form.submit({
  202. method:'post',
  203. success: function(form, action) {
  204. Ext.Msg.alert('操作成功', '新增行政区域已保存', function(btn,txt){
  205. clear_append_form();
  206. });
  207. },
  208. failure: function(form, action) {
  209. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  210. clear_append_form();
  211. });
  212. }
  213. });
  214. }
  215. }
  216. },{
  217. text: '关闭',
  218. iconCls: 'cancel_btn',
  219. handler: function() {
  220. this.up('window').hide();
  221. }
  222. }]
  223. });
  224. var appendwin = function(){
  225. Ext.create('Ext.window.Window', {
  226. title: '新增行政区域',
  227. height: 400,
  228. width: 400,
  229. layout: 'fit',
  230. items: AppendForm,
  231. closeAction: 'hide'
  232. }).show();
  233. }
  234. var clear_filter_form = function(){
  235. Ext.getCmp('ff_V_AREA_NAME').setValue("");
  236. Ext.getCmp('ff_V_PARENT_ID').setValue("");
  237. Ext.getCmp('ff_V_ZIPCODE').setValue("");
  238. Ext.getCmp('ff_V_PINYIN').setValue("");
  239. Ext.getCmp('ff_E_LEVEL').setValue(0);
  240. }
  241. var states3 = Ext.create('Ext.data.Store', {
  242. fields: ['status', 'name'],
  243. data : [
  244. {"status": "8", "name":"不选"},
  245. {"status": "国家", "name":"国家"},
  246. {"status": "省、直辖市、自治区、特别行政区", "name":"省、直辖市、自治区、特别行政区"},
  247. {"status": "地区、市、自治州、盟", "name":"地区、市、自治州、盟"},
  248. {"status": "县、市辖区、县级市、旗", "name":"县、市辖区、县级市、旗"},
  249. ]
  250. });
  251. var FilterForm = Ext.create('Ext.form.Panel', {
  252. id: 'AreaFilterForm',
  253. labelWidth: 55,
  254. defaultType: 'textfield',
  255. bodyPadding: 15,
  256. items: [{
  257. fieldLabel:'行政区域名称',
  258. id: 'ff_V_AREA_NAME',
  259. name:'V_AREA_NAME',
  260. maxLength:20,
  261. maxLengthText:'长度不得超出{0}',
  262. anchor:'75%',
  263. value:document.getElementById('myAct').value
  264. },{
  265. fieldLabel:'上级区域ID',
  266. id: 'ff_V_PARENT_ID',
  267. name: 'V_PARENT_ID',
  268. maxLength: 7,
  269. maxLengthText:'长度不得超出{0}',
  270. anchor:'75%',
  271. value:document.getElementById('loginName').value
  272. },{
  273. fieldLabel:'邮政编码',
  274. id: 'ff_V_ZIPCODE',
  275. name: 'V_ZIPCODE',
  276. maxLength: 7,
  277. maxLengthText:'长度不得超出{0}',
  278. anchor:'75%',
  279. value:document.getElementById('zipCode').value
  280. },{
  281. fieldLabel:'拼音',
  282. id: 'ff_V_PINYIN',
  283. name: 'V_PINYIN',
  284. maxLength: 7,
  285. maxLengthText:'长度不得超出{0}',
  286. anchor:'75%',
  287. value:document.getElementById('mergerName').value
  288. },{
  289. fieldLabel:'行政区域级别',
  290. id:'ff_E_LEVEL',
  291. name:'E_LEVEL',
  292. xtype:'combo',
  293. store:states3,
  294. displayField : 'name',
  295. valueField : 'status',
  296. editable : false,
  297. maxLength: 30,
  298. maxLengthText:'长度不得超出{0}',
  299. anchor:'75%',
  300. value:document.getElementById('level').value
  301. },{
  302. id:'ff_queryJson',
  303. name:'queryJson',
  304. hidden:true
  305. }],
  306. buttons: [{
  307. text: '提交',
  308. iconCls:'ok_btn',
  309. handler: function() {
  310. var form = this.up('form').getForm();
  311. if (form.isValid()) {
  312. var query = new Object();
  313. if(Ext.getCmp('ff_V_AREA_NAME').getValue().length>0)
  314. query.V_AREA_NAME = Ext.getCmp('ff_V_AREA_NAME').getValue();
  315. if(Ext.getCmp('ff_V_PARENT_ID').getValue().length>0)
  316. query.V_PARENT_ID = Ext.getCmp('ff_V_PARENT_ID').getValue();
  317. if(Ext.getCmp('ff_V_ZIPCODE').getValue().length>0)
  318. query.V_ZIPCODE = Ext.getCmp('ff_V_ZIPCODE').getValue();
  319. if(Ext.getCmp('ff_V_PINYIN').getValue().length>0)
  320. query.V_PINYIN = Ext.getCmp('ff_V_PINYIN').getValue();
  321. if(Ext.getCmp('ff_E_LEVEL').getValue().length>0)
  322. if(Ext.getCmp('ff_E_LEVEL').getValue()=='国家'){
  323. query.E_LEVEL=0;
  324. }
  325. if(Ext.getCmp('ff_E_LEVEL').getValue()=='省、直辖市、自治区、特别行政区'){
  326. query.E_LEVEL=1;
  327. }
  328. if(Ext.getCmp('ff_E_LEVEL').getValue()=='地区、市、自治州、盟'){
  329. query.E_LEVEL=2;
  330. }
  331. if(Ext.getCmp('ff_E_LEVEL').getValue()=='县、市辖区、县级市、旗'){
  332. query.E_LEVEL=3;
  333. }
  334. var jsonstr = Ext.JSON.encode(query);
  335. myStore.getProxy().extraParams = {
  336. queryJson : jsonstr
  337. };
  338. Ext.getCmp('AreaListPageToolbar').moveFirst();
  339. Ext.getCmp('myAct').setValue(query.V_AREA_NAME);
  340. Ext.getCmp('loginName').setValue(query.V_PARENT_ID);
  341. Ext.getCmp('zipCode').setValue(query.V_ZIPCODE);
  342. Ext.getCmp('mergerName').setValue(query.V_PINYIN);
  343. Ext.getCmp('level').setValue(query.E_LEVEL);
  344. clear_filter_form();
  345. this.up('window').hide();
  346. }
  347. }
  348. },{
  349. text: '关闭',
  350. iconCls: 'cancel_btn',
  351. handler: function() {
  352. this.up('window').hide();
  353. }
  354. }]
  355. });
  356. var filterwin = function() {
  357. Ext.create('Ext.window.Window',{
  358. id: 'AreaFilterWin',
  359. title: '行政区域筛选',
  360. height: 300,
  361. width: 400,
  362. layout: 'fit',
  363. items: FilterForm,
  364. closeAction: 'hide'
  365. }).show();
  366. }
  367. var clear_modify_form = function (){
  368. Ext.getCmp('fm_V_AREA_NAME').setValue("");
  369. Ext.getCmp('fm_V_PARENT_ID').setValue("");
  370. Ext.getCmp('fm_V_CITYCODE').setValue("");
  371. Ext.getCmp('fm_V_ZIPCODE').setValue("");
  372. Ext.getCmp('fm_V_MERGERNAME').setValue("");
  373. Ext.getCmp('fm_V_PINYIN').setValue("");
  374. Ext.getCmp('fm_E_LEVEL').setValue(0);
  375. Ext.getCmp('fm_V_COMMENT').setValue("修改行政区域");
  376. Ext.getCmp('AreaListPanel').getStore().reload();
  377. }
  378. var ModifyForm = Ext.create('Ext.form.Panel', {
  379. id: 'AreaEditForm',
  380. labelWidth: 55,
  381. url: baseUrl+'iot/area/update',
  382. defaultType: 'textfield',
  383. bodyPadding: 15,
  384. items: [{
  385. fieldLabel:'行政区域名称',
  386. id: 'fm_V_AREA_NAME',
  387. name:'V_AREA_NAME',
  388. maxLength:20,
  389. maxLengthText:'长度不得超出{0}',
  390. anchor:'75%'
  391. },{
  392. fieldLabel:'上级行政区域ID',
  393. id: 'fm_V_PARENT_ID',
  394. name: 'V_PARENT_ID',
  395. maxLength: 7,
  396. maxLengthText:'长度不得超出{0}',
  397. anchor:'50%'
  398. },{
  399. fieldLabel:'电话区号',
  400. id: 'fm_V_CITYCODE',
  401. name:'V_CITYCODE',
  402. maxLength: 12,
  403. maxLengthText:'长度不得超出{0}',
  404. anchor:'75%'
  405. },{
  406. fieldLabel:'邮政编码',
  407. id: 'fm_V_ZIPCODE',
  408. name:'V_ZIPCODE',
  409. maxLength: 12,
  410. maxLengthText:'长度不得超出{0}',
  411. anchor:'75%'
  412. },{
  413. fieldLabel:'组合名称',
  414. id: 'fm_V_MERGERNAME',
  415. name:'V_MERGERNAME',
  416. maxLength: 30,
  417. maxLengthText:'长度不得超出{0}',
  418. anchor:'75%'
  419. },{
  420. fieldLabel:'拼音',
  421. id: 'fm_V_PINYIN',
  422. name:'V_PINYIN',
  423. maxLength: 30,
  424. maxLengthText:'长度不得超出{0}',
  425. anchor:'75%'
  426. },{
  427. fieldLabel:'行政区域级别',
  428. id:'fm_E_LEVEL',
  429. name:'E_LEVEL',
  430. xtype:'combo',
  431. store:states2,
  432. displayField : 'name',
  433. valueField : 'status',
  434. editable : false,
  435. maxLength: 30,
  436. maxLengthText:'长度不得超出{0}',
  437. anchor:'75%'
  438. },{
  439. fieldLabel:'修改行政区域说明',
  440. id: 'fm_V_COMMENT',
  441. name:'V_COMMENT',
  442. xtype: 'textareafield',
  443. maxLength: 250,
  444. maxLengthText:'长度不得超出{0}',
  445. anchor:'100%',
  446. value:'修改行政区域'
  447. },{
  448. id: 'fm_V_AREA_ID',
  449. name:'V_AREA_ID',
  450. hidden:true
  451. },{
  452. id:'fm_queryJson',
  453. name:'queryJson',
  454. hidden:true
  455. }],
  456. buttons: [{
  457. text: '修改',
  458. iconCls:'ok_btn',
  459. handler: function() {
  460. var form = this.up('form').getForm();
  461. if (form.isValid()) {
  462. var query = new Object();
  463. query.V_AREA_ID = Ext.getCmp('fm_V_AREA_ID').getValue();
  464. query.V_AREA_NAME = Ext.getCmp('fm_V_AREA_NAME').getValue();
  465. query.V_PARENT_ID = Ext.getCmp('fm_V_PARENT_ID').getValue();
  466. query.V_CITYCODE = Ext.getCmp('fm_V_CITYCODE').getValue();
  467. query.V_ZIPCODE = Ext.getCmp('fm_V_ZIPCODE').getValue();
  468. query.V_MERGERNAME = Ext.getCmp('fm_V_MERGERNAME').getValue();
  469. query.V_PINYIN = Ext.getCmp('fm_V_PINYIN').getValue();
  470. if(Ext.getCmp('fm_E_LEVEL').getValue()=='国家'){
  471. query.E_LEVEL=0;
  472. }
  473. if(Ext.getCmp('fm_E_LEVEL').getValue()=='省、直辖市、自治区、特别行政区'){
  474. query.E_LEVEL=1;
  475. }
  476. if(Ext.getCmp('fm_E_LEVEL').getValue()=='地区、市、自治州、盟'){
  477. query.E_LEVEL=2;
  478. }
  479. if(Ext.getCmp('fm_E_LEVEL').getValue()=='县、市辖区、县级市、旗'){
  480. query.E_LEVEL=3;
  481. }
  482. query.V_COMMENT = Ext.getCmp('fm_V_COMMENT').getValue();
  483. query.UQ_ADMIN_ID = '00000000-000000-000000-000000';
  484. var jsonstr = Ext.JSON.encode(query);
  485. Ext.getCmp('fm_queryJson').setValue(jsonstr);
  486. form.submit({
  487. method:'post',
  488. success: function(form, action) {
  489. Ext.Msg.alert('操作成功', '行政区域已修改', function(btn,txt){
  490. clear_modify_form();
  491. });
  492. },
  493. failure: function(form, action) {
  494. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  495. clear_modify_form();
  496. });
  497. }
  498. });
  499. this.up('window').hide();
  500. }
  501. }
  502. },{
  503. text: '关闭',
  504. iconCls: 'cancel_btn',
  505. handler: function() {
  506. this.up('window').hide();
  507. }
  508. }]
  509. });
  510. var modifywin = function(){
  511. Ext.create('Ext.window.Window', {
  512. title: '修改行政区域',
  513. height: 400,
  514. width: 400,
  515. layout: 'fit',
  516. items: ModifyForm,
  517. closeAction: 'hide'
  518. }).show();
  519. }
  520. var del_sm = function() {
  521. if(sm.getCount()==1){
  522. var selected = sm.getSelection( );
  523. var query = new Object();
  524. var list = new Array();
  525. var o = new Object();
  526. o.V_AREA_ID = selected[0].raw.V_AREA_ID;
  527. list.push(o);
  528. query.Area_LIST = list;
  529. var jsonstr= Ext.JSON.encode(query);
  530. Ext.MessageBox.confirm('注销行政区划','是否注销 '+selected[0].raw.V_AREA_NAME+' 行政区划?',function(btn){
  531. if(btn=='yes'){
  532. Ext.Ajax.request( {
  533. timeout : 3000000,
  534. url: baseUrl+'iot/area/delete',
  535. params : 'queryJson='+ jsonstr,
  536. success: function(resp,opts){
  537. myStore.reload();
  538. }
  539. });
  540. }
  541. },this);
  542. }else{
  543. if(sm.getCount()>1){
  544. var query = new Object();
  545. var list = new Array();
  546. for(var i=0;i<sm.getCount();i++){
  547. var selected = sm.getSelection( );
  548. var o = new Object();
  549. o.V_AREA_ID = selected[i].raw.V_AREA_ID;
  550. list.push(o);
  551. }
  552. query.Area_LIST = list;
  553. var jsonstr= Ext.JSON.encode(query);
  554. Ext.MessageBox.confirm('注销行政区划','是否注销选中的'+sm.getCount()+' 个行政区划?',function(btn){
  555. if(btn=='yes'){
  556. Ext.Ajax.request( {
  557. timeout : 3000000,
  558. url: baseUrl+'iot/area/delete',
  559. params : 'queryJson='+ jsonstr,
  560. success: function(resp,opts){
  561. myStore.reload();
  562. }
  563. });
  564. }
  565. },this);
  566. }else{
  567. Ext.Msg.alert('请先选择','至少选择一条记录,再点击注销');
  568. }
  569. }
  570. }
  571. var chk_sm = function() {
  572. if(sm.getCount()==1){
  573. modifywin();
  574. var selected = sm.getSelection( );
  575. Ext.getCmp('fm_V_AREA_ID').setValue(selected[0].raw.V_AREA_ID);
  576. Ext.getCmp('fm_V_AREA_NAME').setValue(selected[0].raw.V_AREA_NAME);
  577. Ext.getCmp('fm_V_PARENT_ID').setValue(selected[0].raw.V_PARENT_ID);
  578. Ext.getCmp('fm_V_CITYCODE').setValue(selected[0].raw.V_CITYCODE);
  579. Ext.getCmp('fm_V_ZIPCODE').setValue(selected[0].raw.V_ZIPCODE);
  580. Ext.getCmp('fm_V_MERGERNAME').setValue(selected[0].raw.V_MERGERNAME);
  581. Ext.getCmp('fm_V_PINYIN').setValue(selected[0].raw.V_PINYIN);
  582. Ext.getCmp('fm_E_LEVEL').setValue(selected[0].raw.E_LEVEL);
  583. }else{
  584. Ext.Msg.alert('请先选择','请先选择一条记录,再点击修改');
  585. }
  586. }
  587. Ext.create('Ext.grid.Panel', {
  588. title: '行政区划信息',
  589. id: 'AreaListPanel',
  590. store: myStore,
  591. selModel: sm,
  592. columns: [
  593. { header: 'ID', dataIndex: 'V_AREA_ID',hidden:true, menuDisabled:true },
  594. { header: '序号', dataIndex: 'I_ORDER_IDX', width:40, menuDisabled:true },
  595. { header: '行政区域名称', dataIndex: 'V_AREA_NAME', width:100,align:'center', menuDisabled:true },
  596. { header: '上级区域ID', dataIndex: 'V_PARENT_ID', width:100,align:'center', menuDisabled:true },
  597. { header: '区号', dataIndex: 'V_CITYCODE', width:100, align:'center', menuDisabled:true },
  598. { header: '邮政编号', dataIndex: 'V_ZIPCODE', width:100,align:'center', menuDisabled:true },
  599. { header: '行政区域级别', dataIndex: 'E_LEVEL', width:100, align:'center', menuDisabled:true },
  600. { header: '组合名称', dataIndex: 'V_MERGERNAME', width:100,align:'center', menuDisabled:true },
  601. { header: '保存时间', dataIndex: 'D_STORETIME',width:150, align:'center', menuDisabled:true },
  602. { header: '记录版本', dataIndex: 'I_VERSION', width:80, align:'center', menuDisabled:true },
  603. {
  604. xtype : 'actioncolumn',
  605. width:20,
  606. sortable:false,
  607. align:'center',
  608. menuDisabled:true,
  609. items:[{
  610. icon: '../../res/img/common/forum.gif',
  611. tooltip: '版本记录',
  612. handler: function(grid, rowIndex, colIndex) {
  613. var rec = grid.getStore().getAt(rowIndex);
  614. window.location = 'version.jsp?theme='+theme+'&areaId='+rec.get('V_AREA_ID');
  615. }
  616. }]
  617. }
  618. ],
  619. columnLines: true,
  620. tbar: [
  621. {
  622. xtype: 'button',
  623. iconCls:'filter_btn',
  624. text: '筛选',
  625. listeners: {
  626. click: filterwin
  627. }
  628. },'-',
  629. {xtype: 'tbfill'},'-',
  630. {
  631. xtype: 'button',
  632. iconCls:'append_btn',
  633. text: '新增',
  634. listeners: {
  635. click: appendwin
  636. }
  637. },
  638. {
  639. xtype: 'button',
  640. iconCls:'modify_btn',
  641. text: '修改',
  642. listeners: {
  643. click: chk_sm
  644. }
  645. },
  646. {
  647. xtype: 'button',
  648. iconCls:'delete_btn',
  649. text: '注销',
  650. listeners: {
  651. click: del_sm
  652. }
  653. }
  654. ],
  655. height: maxHeight,
  656. width: '100%',
  657. bbar: new Ext.PagingToolbar({
  658. store: myStore,
  659. id:'AreaListPageToolbar',
  660. displayInfo: true,
  661. pageSize: countPerPage,
  662. prependButtons: true,
  663. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  664. emptyMsg : "没有记录",
  665. firstText: '第一页',
  666. prevText: '前一页',
  667. nextText: '后一页',
  668. lastText: '最后一页',
  669. refreshText: '刷新'//,
  670. // doRefresh:function(start){
  671. // alert(start);
  672. // relushDataFunction(start); // 调用函数刷新数据
  673. // this.cursor = start; // 更新页签
  674. // }
  675. }),
  676. frame: true,
  677. border:false,
  678. iconCls: 'icon-grid',
  679. renderTo: Ext.getBody()
  680. });
  681. myStore.reload();
  682. maxHeight = document.documentElement.clientHeight;
  683. Ext.getCmp('AreaListPanel').setHeight(maxHeight);
  684. });