version.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /**
  2. * version.js
  3. * 监控单元版本管理界面
  4. * emial: yaoqiang@chinausky.com
  5. * create: 2018-12-08
  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('UnitVer',{
  18. extend: 'Ext.data.Model',
  19. fields: [
  20. {name:'UQ_UNIT_ID', type:'string'},
  21. {name:'I_ORDER_IDX', type:'int'},
  22. {name:'V_UNIT_CODE', type:'string'},
  23. {name:'UQ_IOTCARD_ID', type:'string'},
  24. {name:'UQ_COMPANY_ID', type:'string'},
  25. {name:'UQ_UNIT_MODEL_ID', type:'string'},
  26. {name:'V_UNIT_NAME', type:'string'},
  27. {name:'V_POSITION', type:'string'},
  28. {name:'UQ_EMPLOYEE_ID', type:'string'},
  29. {name:'E_STATUS', type:'string'},
  30. {name:'UQ_ADMIN_ID', type:'string'},
  31. {name:'I_VERSION', type:'int'},
  32. {name:'D_INSTALLTIME', type:'string'},
  33. { name: 'V_COMMENT', type:'string'}
  34. ]
  35. });
  36. var baseUrl="";
  37. var sm = Ext.create('Ext.selection.CheckboxModel');
  38. Ext.onReady(function(){
  39. var baseUrl = document.getElementById('basePath').value;
  40. var unitId = document.getElementById('unitId').value;
  41. var chkIcon = '<img src="'+baseUrl+'/res/img/common/check.gif"/>'
  42. var unchkIcon = '<img src="'+baseUrl+'/res/img/common/uncheck.gif"/>'
  43. var countPerPage = 20;
  44. var maxHeight = 10000;
  45. var chkBoolean = function(flag) {
  46. if(flag)
  47. return chkIcon;
  48. return unchkIcon;
  49. }
  50. var backurl = function() {
  51. history.back();
  52. }
  53. var myVerStore = Ext.create('Ext.data.Store', {
  54. model: 'UnitVer',
  55. pageSize: countPerPage,
  56. proxy: {
  57. type: 'ajax',
  58. url: baseUrl+'/iot/unit/getVerList',
  59. reader: {
  60. type: 'json',
  61. root: 'RESULT',
  62. totalProperty: 'totalCount'
  63. },
  64. actionMethods: {
  65. read: 'POST'
  66. },
  67. extraParams : {
  68. queryJson : '{"UQ_UNIT_ID" : "'+unitId+'"}'
  69. }
  70. },
  71. remoteSort: true
  72. });
  73. var clear_filter_form = function(){
  74. Ext.getCmp('fb_V_UNIT_NAME').setValue("");
  75. Ext.getCmp('fb_UQ_EMPLOYEE_ID').setValue("");
  76. Ext.getCmp('fb_E_STATUS').setValue("");
  77. Ext.getCmp('fb_UQ_ADMIN_ID').setValue("");
  78. }
  79. var states2 = Ext.create('Ext.data.Store', {
  80. fields: ['status', 'name'],
  81. data : [
  82. {"status":10, "name":"全选"},
  83. {"status":0, "name":"待开通"},
  84. {"status":1, "name":"已开通"},
  85. {"status":2, "name":"已锁定"},
  86. {"status":3, "name":"注销"},
  87. ]
  88. });
  89. var FilterForm = Ext.create('Ext.form.Panel', {
  90. id: 'UnitVerFilterForm',
  91. labelWidth: 55,
  92. defaultType: 'textfield',
  93. bodyPadding: 15,
  94. items: [{
  95. fieldLabel:'监控单元名称',
  96. id: 'fb_V_UNIT_NAME',
  97. name:'V_UNIT_NAME',
  98. maxLength:20,
  99. maxLengthText:'长度不得超出{0}',
  100. value : document.getElementById('unitName').value,
  101. anchor:'75%'
  102. },
  103. {
  104. fieldLabel:'当前状态',
  105. id:'fb_E_STATUS',
  106. name:'E_STATUS',
  107. xtype:'combo',
  108. store:states2,
  109. displayField : 'name',
  110. valueField : 'status',
  111. value : 10,
  112. editable : false
  113. },
  114. {
  115. fieldLabel:'安装人ID',
  116. id: 'fb_UQ_EMPLOYEE_ID',
  117. name: 'UQ_EMPLOYEE_ID',
  118. maxLength: 250,
  119. maxLengthText:'长度不得超出{0}',
  120. value : document.getElementById('employeeId').value,
  121. anchor:'95%'
  122. },{
  123. fieldLabel:'录入人ID',
  124. id: 'fb_UQ_ADMIN_ID',
  125. name: 'UQ_ADMIN_ID',
  126. maxLength: 250,
  127. maxLengthText:'长度不得超出{0}',
  128. value : document.getElementById('adminId').value,
  129. anchor:'95%'
  130. },{
  131. id:'fb_queryJson',
  132. name:'queryJson',
  133. hidden:true
  134. }],
  135. buttons: [{
  136. text: '提交',
  137. iconCls:'ok_btn',
  138. handler: function() {
  139. var form = this.up('form').getForm();
  140. if (form.isValid()) {
  141. var query = new Object();
  142. if(Ext.getCmp('fb_V_UNIT_NAME').getValue().length>0)
  143. query.V_UNIT_NAME = Ext.getCmp('fb_V_UNIT_NAME').getValue();
  144. if(Ext.getCmp('fb_UQ_EMPLOYEE_ID').getValue().length>0)
  145. query.UQ_EMPLOYEE_ID = Ext.getCmp('fb_UQ_EMPLOYEE_ID').getValue();
  146. query.E_STATUS = Ext.getCmp('fb_E_STATUS').getValue();
  147. if(Ext.getCmp('fb_UQ_ADMIN_ID').getValue().length>0)
  148. query.UQ_ADMIN_ID = Ext.getCmp('fb_UQ_ADMIN_ID').getValue();
  149. query.UQ_UNIT_ID = unitId;
  150. var jsonstr = Ext.JSON.encode(query);
  151. myVerStore.getProxy().extraParams = {
  152. queryJson : jsonstr,
  153. };
  154. Ext.getCmp('UnitListPageToolbar').moveFirst();
  155. Ext.getCmp('unitName').setValue(query.V_UNIT_NAME);
  156. Ext.getCmp('employeeId').setValue(query.UQ_EMPLOYEE_ID);
  157. Ext.getCmp('adminId').setValue(query.UQ_ADMIN_ID);
  158. //myStore.reload();
  159. clear_filter_form();
  160. this.up('window').hide();
  161. }
  162. }
  163. },{
  164. text: '关闭',
  165. iconCls: 'cancel_btn',
  166. handler: function() {
  167. this.up('window').hide();
  168. }
  169. }]
  170. });
  171. var filterwin = function() {
  172. Ext.create('Ext.window.Window',{
  173. id: 'UnitVerFilterWin',
  174. title: '筛选',
  175. height: 250,
  176. width: 350,
  177. layout: 'fit',
  178. items: FilterForm,
  179. closeAction: 'hide'
  180. }).show();
  181. }
  182. Ext.create('Ext.grid.Panel', {
  183. title: '监控单元管理记录',
  184. id: 'UnitVerListPanel',
  185. store: myVerStore,
  186. // selModel: sm,
  187. columns: [
  188. //{name:'E_STATUS', type:'string'},
  189. { header: '记录版本', dataIndex: 'I_VERSION', width:70, align:'center', menuDisabled:true },
  190. { header: '监控单元名称', dataIndex: 'V_UNIT_NAME', width:120,align:'center', menuDisabled:true },
  191. { header: '监控单元编号', dataIndex: 'V_UNIT_CODE', width:120,align:'center', menuDisabled:true },
  192. { header: '单位/部门ID', dataIndex: 'UQ_COMPANY_ID', width:120,align:'center', menuDisabled:true },
  193. { header: '当前状态', dataIndex: 'E_STATUS', width:120, align:'center', menuDisabled:true },
  194. { header: '安装人ID', dataIndex: 'UQ_EMPLOYEE_ID', width:120, align:'center', menuDisabled:true },
  195. { header: '录入人ID', dataIndex: 'UQ_ADMIN_ID', width:120, align:'center', menuDisabled:true },
  196. { header: '监控单元安装位置', dataIndex: 'V_POSITION', width:160,align:'center', menuDisabled:true },
  197. { header: '新增/修改/注销说明', dataIndex: 'V_COMMENT', width:160, menuDisabled:true },
  198. { header: '保存时间', dataIndex: 'D_INSTALLTIME',width:160, align:'center', menuDisabled:true }
  199. ],
  200. columnLines: true,
  201. tbar: [{
  202. xtype: 'button',
  203. iconCls:'back_btn',
  204. text: '返回',
  205. listeners : {
  206. click : backurl
  207. }
  208. },'-',{
  209. xtype: 'button',
  210. iconCls:'filter_btn',
  211. text: '筛选',
  212. listeners: {
  213. click: filterwin
  214. }
  215. }
  216. ],
  217. height: maxHeight,
  218. width: '100%',
  219. bbar: new Ext.PagingToolbar({
  220. id:'UnitListPageToolbar',
  221. store: myVerStore,
  222. displayInfo: true,
  223. pageSize: countPerPage,
  224. prependButtons: true,
  225. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  226. emptyMsg : "没有记录",
  227. doLoad:function(start){
  228. relushDataFunction(start); // 调用函数刷新数据
  229. this.cursor = start; // 更新页签
  230. }
  231. }),
  232. frame: true,
  233. border:false,
  234. iconCls: 'icon-grid',
  235. renderTo: Ext.getBody()
  236. });
  237. myVerStore.load();
  238. maxHeight = document.documentElement.clientHeight;
  239. Ext.getCmp('UnitVerListPanel').setHeight(maxHeight);
  240. });