version.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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('AdminVer',{
  18. extend: 'Ext.data.Model',
  19. fields: [
  20. { name: 'I_ADMINVER_ID', type:'int'},
  21. { name:'UQ_ADMIN_ID', type:'string' },
  22. { name:'V_ADMIN_NAME', type:'string' },
  23. { name:'V_LOGINNAME', type:'string' },
  24. { name:'V_PASSWORD', type:'string' },
  25. { name:'UQ_PERMISSION_GROUP_ID', type:'string' },
  26. { name:'E_STATUS', type:'string' },
  27. { name: 'T_COMMIT', type:'string' },
  28. { name: 'UQ_EDITOR_ID', type:'string' },
  29. { name:'I_VERSION', type:'int' },
  30. { name:'D_STORETIME', type:'string' }
  31. ]
  32. });
  33. var baseUrl="";
  34. var sm = Ext.create('Ext.selection.CheckboxModel');
  35. Ext.onReady(function(){
  36. var baseUrl = document.getElementById('basePath').value;
  37. var adminId = document.getElementById('adminId').value;
  38. var chkIcon = '<img src="'+baseUrl+'/res/img/common/check.gif"/>'
  39. var unchkIcon = '<img src="'+baseUrl+'/res/img/common/uncheck.gif"/>'
  40. var countPerPage = 20;
  41. var maxHeight = 10000;
  42. var chkBoolean = function(flag) {
  43. if(flag)
  44. return chkIcon;
  45. return unchkIcon;
  46. }
  47. var backurl = function() {
  48. history.back();
  49. }
  50. var myVerStore = Ext.create('Ext.data.Store', {
  51. model: 'AdminVer',
  52. pageSize: countPerPage,
  53. proxy: {
  54. type: 'ajax',
  55. url: baseUrl+'/iot/admin/getVerList',
  56. reader: {
  57. type: 'json',
  58. root: 'RESULT',
  59. totalProperty: 'totalCount'
  60. },
  61. actionMethods: {
  62. read: 'POST'
  63. },
  64. extraParams : {
  65. queryJson : '{"UQ_ADMIN_ID" : "'+adminId+'"}'
  66. }
  67. },
  68. remoteSort: true
  69. });
  70. var clear_filter_form = function(){
  71. Ext.getCmp('ff_I_VERSION').setValue("");
  72. Ext.getCmp('ff_E_STATUS').setValue("");
  73. }
  74. var FilterForm = Ext.create('Ext.form.Panel', {
  75. id: 'AdminFilterForm',
  76. labelWidth: 55,
  77. defaultType: 'textfield',
  78. bodyPadding: 15,
  79. items: [{
  80. fieldLabel:'记录版本',
  81. id: 'ff_I_VERSION',
  82. name:'I_VERSION',
  83. maxLength:20,
  84. maxLengthText:'长度不得超出{0}',
  85. anchor:'75%'
  86. },{
  87. fieldLabel:'用户状态',
  88. id: 'ff_E_STATUS',
  89. name: 'E_STATUS',
  90. maxLength: 7,
  91. maxLengthText:'长度不得超出{0}',
  92. anchor:'75%'
  93. },{
  94. id:'ff_queryJson',
  95. name:'queryJson',
  96. hidden:true
  97. }],
  98. buttons: [{
  99. text: '提交',
  100. iconCls:'ok_btn',
  101. handler: function() {
  102. var form = this.up('form').getForm();
  103. if (form.isValid()) {
  104. var query = new Object();
  105. if(Ext.getCmp('ff_I_VERSION').getValue().length>0)
  106. query.I_VERSION = Ext.getCmp('ff_I_VERSION').getValue();
  107. if(Ext.getCmp('ff_E_STATUS').getValue().length>0)
  108. if(Ext.getCmp('ff_E_STATUS').getValue()=='未激活'){
  109. query.E_STATUS=0;
  110. }
  111. if(Ext.getCmp('ff_E_STATUS').getValue()=='激活'){
  112. query.E_STATUS=1;
  113. }
  114. if(Ext.getCmp('ff_E_STATUS').getValue()=='锁定'){
  115. query.E_STATUS=2;
  116. }
  117. if(Ext.getCmp('ff_E_STATUS').getValue()=='注销'){
  118. query.E_STATUS=3;
  119. }
  120. query.UQ_ADMIN_ID = adminId;
  121. var jsonstr = Ext.JSON.encode(query);
  122. myVerStore.getProxy().extraParams = {
  123. queryJson : jsonstr
  124. };
  125. Ext.getCmp('AdminListPageToolbar').moveFirst();
  126. clear_filter_form();
  127. this.up('window').hide();
  128. }
  129. }
  130. },{
  131. text: '关闭',
  132. iconCls: 'cancel_btn',
  133. handler: function() {
  134. this.up('window').hide();
  135. }
  136. }]
  137. });
  138. var filterwin = function() {
  139. Ext.create('Ext.window.Window',{
  140. id: 'AdminFilterWin',
  141. title: '修改版本筛选',
  142. height: 300,
  143. width: 400,
  144. layout: 'fit',
  145. items: FilterForm,
  146. closeAction: 'hide'
  147. }).show();
  148. }
  149. Ext.create('Ext.grid.Panel', {
  150. title: '用户信息修改记录',
  151. id: 'AdminVerListPanel',
  152. store: myVerStore,
  153. selModel: sm,
  154. columns: [
  155. { header: '用户姓名', dataIndex: 'V_ADMIN_NAME', width:80, menuDisabled:true },
  156. { header: '用户登录名', dataIndex: 'V_LOGINNAME', width:80, menuDisabled:true },
  157. { header: '用户状态', dataIndex: 'E_STATUS', width:100, menuDisabled:true },
  158. { header: '记录版本', dataIndex: 'I_VERSION', width:80, align:'center', menuDisabled:true },
  159. { header: '版本说明', dataIndex: 'T_COMMIT', width:150, menuDisabled:true },
  160. { header: '保存时间', dataIndex: 'D_STORETIME',width:150, align:'center', menuDisabled:true },
  161. ],
  162. columnLines: true,
  163. tbar: [{
  164. xtype: 'button',
  165. iconCls:'back_btn',
  166. text: '返回',
  167. listeners : {
  168. click : backurl
  169. }
  170. },'-',{
  171. xtype: 'button',
  172. iconCls:'filter_btn',
  173. text: '筛选',
  174. listeners: {
  175. click: filterwin
  176. }
  177. }
  178. ],
  179. height: maxHeight,
  180. width: '100%',
  181. bbar: new Ext.PagingToolbar({
  182. store: myVerStore,
  183. id:'AdminListPageToolbar',
  184. displayInfo: true,
  185. pageSize: countPerPage,
  186. prependButtons: true,
  187. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  188. emptyMsg : "没有记录",
  189. firstText: '第一页',
  190. prevText: '前一页',
  191. nextText: '后一页',
  192. lastText: '最后一页',
  193. refreshText: '刷新',
  194. doRefresh:function(start){
  195. alert(start);
  196. relushDataFunction(start); // 调用函数刷新数据
  197. this.cursor = start; // 更新页签
  198. }
  199. }),
  200. frame: true,
  201. border:false,
  202. iconCls: 'icon-grid',
  203. renderTo: Ext.getBody()
  204. });
  205. myVerStore.load();
  206. maxHeight = document.documentElement.clientHeight;
  207. Ext.getCmp('AdminVerListPanel').setHeight(maxHeight);
  208. });