version.js 7.8 KB

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