version.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. /**
  2. * version.js
  3. * 用户信息管理界面
  4. * emial: hanzhengyi@chinausky.com
  5. * create: 2018-12-12
  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. Ext.define('Areaver',{
  18. extend: 'Ext.data.Model',
  19. fields: [
  20. { name:'I_AREAVER_ID', type:'int' },
  21. { name:'V_AREA_ID', type:'string' },
  22. { name:'V_AREA_NAME', type:'string' },
  23. { name:'V_PARENT_ID', type:'string' },
  24. { name:'E_LEVEL', type:'string' },
  25. { name:'V_CITYCODE', type:'string' },
  26. { name:'V_ZIPCODE', type:'string' },
  27. { name:'V_MERGERNAME', type:'string' },
  28. { name:'V_PINYIN', type:'string' },
  29. { name:'I_VERSION', type:'int' },
  30. { name:'D_STORETIME', type:'string' },
  31. { name: 'V_COMMENT', type:'string' },
  32. { name: 'UQ_ADMIN_ID', type:'string' },
  33. ]
  34. });
  35. var baseUrl="";
  36. var sm = Ext.create('Ext.selection.CheckboxModel');
  37. Ext.onReady(function(){
  38. var baseUrl = document.getElementById('basePath').value;
  39. var areaId = document.getElementById('areaId').value;
  40. var chkIcon = '<img src="'+baseUrl+'/res/img/common/check.gif"/>'
  41. var unchkIcon = '<img src="'+baseUrl+'/res/img/common/uncheck.gif"/>'
  42. var countPerPage = 20;
  43. var maxHeight = 10000;
  44. var chkBoolean = function(flag) {
  45. if(flag)
  46. return chkIcon;
  47. return unchkIcon;
  48. }
  49. var backurl = function() {
  50. history.back();
  51. }
  52. var myVerStore = Ext.create('Ext.data.Store', {
  53. model: 'Areaver',
  54. pageSize: countPerPage,
  55. proxy: {
  56. type: 'ajax',
  57. url: baseUrl+'/iot/area/getverList',
  58. reader: {
  59. type: 'json',
  60. root: 'RESULT',
  61. totalProperty: 'totalCount'
  62. },
  63. actionMethods: {
  64. read: 'POST'
  65. },
  66. extraParams : {
  67. queryJson : '{"V_AREA_ID" : "'+areaId+'"}'
  68. }
  69. },
  70. remoteSort: true
  71. });
  72. var states3 = Ext.create('Ext.data.Store', {
  73. fields: ['status', 'name'],
  74. data : [
  75. {"status": "8", "name":"不选"},
  76. {"status": "国家", "name":"国家"},
  77. {"status": "省、直辖市、自治区、特别行政区", "name":"省、直辖市、自治区、特别行政区"},
  78. {"status": "地区、市、自治州、盟", "name":"地区、市、自治州、盟"},
  79. {"status": "县、市辖区、县级市、旗", "name":"县、市辖区、县级市、旗"},
  80. ]
  81. });
  82. var clear_filter_form = function(){
  83. Ext.getCmp('ff_V_AREA_NAME').setValue("");
  84. Ext.getCmp('ff_V_PARENT_ID').setValue("");
  85. Ext.getCmp('ff_V_ZIPCODE').setValue("");
  86. Ext.getCmp('ff_V_MERGERNAME').setValue("");
  87. Ext.getCmp('ff_E_LEVEL').setValue("");
  88. }
  89. var FilterForm = Ext.create('Ext.form.Panel', {
  90. id: 'AreaFilterForm',
  91. labelWidth: 55,
  92. defaultType: 'textfield',
  93. bodyPadding: 15,
  94. items: [{
  95. fieldLabel:'行政区域名称',
  96. id: 'ff_V_AREA_NAME',
  97. name:'V_AREA_NAME',
  98. maxLength:20,
  99. maxLengthText:'长度不得超出{0}',
  100. anchor:'75%',
  101. value:document.getElementById('version').value
  102. },{
  103. fieldLabel:'上级区域ID',
  104. id: 'ff_V_PARENT_ID',
  105. name: 'V_PARENT_ID',
  106. maxLength: 7,
  107. maxLengthText:'长度不得超出{0}',
  108. anchor:'75%',
  109. value:document.getElementById('parentId').value
  110. },{
  111. fieldLabel:'邮政编码',
  112. id: 'ff_V_ZIPCODE',
  113. name: 'V_ZIPCODE',
  114. maxLength: 7,
  115. maxLengthText:'长度不得超出{0}',
  116. anchor:'75%',
  117. value:document.getElementById('zipCode').value
  118. },{
  119. fieldLabel:'联合名称',
  120. id: 'ff_V_MERGERNAME',
  121. name: 'V_MERGERNAME',
  122. maxLength: 7,
  123. maxLengthText:'长度不得超出{0}',
  124. anchor:'75%',
  125. value:document.getElementById('mergerName').value
  126. },{
  127. fieldLabel:'行政区域级别',
  128. id:'ff_E_LEVEL',
  129. name:'E_LEVEL',
  130. xtype:'combo',
  131. store:states3,
  132. displayField : 'name',
  133. valueField : 'status',
  134. editable : false,
  135. maxLength: 30,
  136. maxLengthText:'长度不得超出{0}',
  137. anchor:'75%',
  138. value:document.getElementById('level').value
  139. },{
  140. id:'ff_queryJson',
  141. name:'queryJson',
  142. hidden:true
  143. }],
  144. buttons: [{
  145. text: '提交',
  146. iconCls:'ok_btn',
  147. handler: function() {
  148. var form = this.up('form').getForm();
  149. if (form.isValid()) {
  150. var query = new Object();
  151. if(Ext.getCmp('ff_V_AREA_NAME').getValue().length>0)
  152. query.V_AREA_NAME = Ext.getCmp('ff_V_AREA_NAME').getValue();
  153. if(Ext.getCmp('ff_V_PARENT_ID').getValue().length>0)
  154. query.V_PARENT_ID = Ext.getCmp('ff_V_PARENT_ID').getValue();
  155. if(Ext.getCmp('ff_V_ZIPCODE').getValue().length>0)
  156. query.V_ZIPCODE = Ext.getCmp('ff_V_ZIPCODE').getValue();
  157. if(Ext.getCmp('ff_V_MERGERNAME').getValue().length>0)
  158. query.V_MERGERNAME = Ext.getCmp('ff_V_MERGERNAME').getValue();
  159. if(Ext.getCmp('ff_E_LEVEL').getValue().length>0)
  160. if(Ext.getCmp('ff_E_LEVEL').getValue()=='国家'){
  161. query.E_LEVEL=0;
  162. }
  163. if(Ext.getCmp('ff_E_LEVEL').getValue()=='省、直辖市、自治区、特别行政区'){
  164. query.E_LEVEL=1;
  165. }
  166. if(Ext.getCmp('ff_E_LEVEL').getValue()=='地区、市、自治州、盟'){
  167. query.E_LEVEL=2;
  168. }
  169. if(Ext.getCmp('ff_E_LEVEL').getValue()=='县、市辖区、县级市、旗'){
  170. query.E_LEVEL=3;
  171. }
  172. query.V_AREA_ID = areaId;
  173. var jsonstr = Ext.JSON.encode(query);
  174. myVerStore.getProxy().extraParams = {
  175. queryJson : jsonstr
  176. };
  177. Ext.getCmp('AreaListPageToolbar').moveFirst();
  178. Ext.getCmp('version').setValue(query.V_AREA_NAME);
  179. Ext.getCmp('parentId').setValue(query.V_PARENT_ID);
  180. Ext.getCmp('zipCode').setValue(query.V_ZIPCODE);
  181. Ext.getCmp('mergerName').setValue(query.V_MERGERNAME);
  182. Ext.getCmp('level').setValue(Ext.getCmp('ff_E_LEVEL').getValue());
  183. clear_filter_form();
  184. this.up('window').hide();
  185. }
  186. }
  187. },{
  188. text: '关闭',
  189. iconCls: 'cancel_btn',
  190. handler: function() {
  191. this.up('window').hide();
  192. }
  193. }]
  194. });
  195. var filterwin = function() {
  196. Ext.create('Ext.window.Window',{
  197. id: 'AreaFilterWin',
  198. title: '修改版本筛选',
  199. height: 300,
  200. width: 400,
  201. layout: 'fit',
  202. items: FilterForm,
  203. closeAction: 'hide'
  204. }).show();
  205. }
  206. Ext.create('Ext.grid.Panel', {
  207. title: '行政区域信息修改记录',
  208. id: 'AreaverListPanel',
  209. store: myVerStore,
  210. selModel: sm,
  211. columns: [
  212. { header: '行政区域名称', dataIndex: 'V_AREA_NAME', width:100,align:'center', menuDisabled:true },
  213. { header: '上级区域ID', dataIndex: 'V_PARENT_ID', width:100, align:'center',menuDisabled:true },
  214. { header: '邮政编号', dataIndex: 'V_ZIPCODE', width:100, align:'center', menuDisabled:true },
  215. { header: '组合名称', dataIndex: 'V_MERGERNAME', width:100, align:'center', menuDisabled:true },
  216. { header: '拼音', dataIndex: 'V_PINYIN', width:100, align:'center', menuDisabled:true },
  217. { header: '记录版本', dataIndex: 'I_VERSION', width:100, align:'center', menuDisabled:true },
  218. { header: '版本说明', dataIndex: 'V_COMMENT', width:150,align:'center', menuDisabled:true },
  219. { header: '保存时间', dataIndex: 'D_STORETIME',width:150, align:'center', menuDisabled:true },
  220. ],
  221. columnLines: true,
  222. tbar: [{
  223. xtype: 'button',
  224. iconCls:'back_btn',
  225. text: '返回',
  226. listeners : {
  227. click : backurl
  228. }
  229. },'-',{
  230. xtype: 'button',
  231. iconCls:'filter_btn',
  232. text: '筛选',
  233. listeners: {
  234. click: filterwin
  235. }
  236. }
  237. ],
  238. height: maxHeight,
  239. width: '100%',
  240. bbar: new Ext.PagingToolbar({
  241. store: myVerStore,
  242. id:'AreaListPageToolbar',
  243. displayInfo: true,
  244. pageSize: countPerPage,
  245. prependButtons: true,
  246. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  247. emptyMsg : "没有记录",
  248. firstText: '第一页',
  249. prevText: '前一页',
  250. nextText: '后一页',
  251. lastText: '最后一页',
  252. refreshText: '刷新'
  253. // doRefresh:function(start){
  254. // alert(start);
  255. // relushDataFunction(start); // 调用函数刷新数据
  256. // this.cursor = start; // 更新页签
  257. // }
  258. }),
  259. frame: true,
  260. border:false,
  261. iconCls: 'icon-grid',
  262. renderTo: Ext.getBody()
  263. });
  264. myVerStore.load();
  265. maxHeight = document.documentElement.clientHeight;
  266. Ext.getCmp('AreaverListPanel').setHeight(maxHeight);
  267. });