SysUpdate.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. Ext.define('erp.view.ma.SysUpdate', {
  2. extend : 'Ext.Viewport',
  3. layout : 'anchor',
  4. hideBorders : true,
  5. initComponent : function() {
  6. var me = this, store = me.getStore();
  7. Ext.apply(me, {
  8. items : [ {
  9. xtype: 'form',
  10. layout: {
  11. align: 'center',
  12. pack: 'center',
  13. type: 'vbox'
  14. },
  15. anchor : '100% 15%',
  16. bodyStyle: 'background:#f1f2f5;',
  17. items: [{
  18. xtype: 'fieldcontainer',
  19. layout: 'column',
  20. width: window.innerWidth,
  21. items: [{
  22. columnWidth: .3,
  23. fieldLabel: '创建时间',
  24. labelWidth: 80,
  25. id: 'date',
  26. xtype: 'ftdatefield'
  27. },{
  28. xtype: 'fieldcontainer',
  29. columnWidth: .3,
  30. layout: 'hbox',
  31. defaults: {
  32. style: {
  33. marginLeft: '5px'
  34. }
  35. },
  36. items: [{
  37. xtype: 'button',
  38. text: '近三天',
  39. param: ['d', -2, 'd', 0]
  40. },{
  41. xtype: 'button',
  42. text: '近一周',
  43. param: ['d', -6, 'd', 0]
  44. },{
  45. xtype: 'button',
  46. text: '近一个月',
  47. param: ['m', -1, 'd', 0]
  48. },{
  49. xtype: 'button',
  50. text: '全部',
  51. param: ['y', -3, 'd', 0]
  52. }]
  53. },{
  54. xtype: 'textfield',
  55. fieldLabel: '方案描述',
  56. labelWidth: 70,
  57. columnWidth: .3,
  58. id: 'title'
  59. }]
  60. }],
  61. buttonAlign: 'center',
  62. buttons: [{
  63. cls : 'x-btn-blue',
  64. id : 'refresh',
  65. text : $I18N.common.button.erpRefreshButton,
  66. width : 80,
  67. margin : '0 0 0 5'
  68. }, {
  69. cls : 'x-btn-blue',
  70. id : 'close',
  71. text : $I18N.common.button.erpCloseButton,
  72. width : 80,
  73. margin : '0 0 0 5'
  74. }]
  75. },{
  76. xtype : 'grid',
  77. id : 'grid',
  78. cls: 'custom-grid-autoheight',
  79. anchor : '100% 85%',
  80. columns : [ {
  81. text : '方案',
  82. dataIndex : 'title',
  83. width: 330
  84. },{
  85. text : '创建时间',
  86. dataIndex : 'createDate',
  87. width: 150,
  88. renderer: function(val) {
  89. return Ext.Date.format(new Date(val), 'Y-m-d H:i');
  90. },
  91. align: 'center'
  92. },{
  93. text : '最近修改',
  94. dataIndex : 'modifyDate',
  95. width: 150,
  96. renderer: function(val) {
  97. return val ? Ext.Date.format(new Date(val), 'Y-m-d H:i') : '';
  98. },
  99. align: 'center'
  100. }, {
  101. text : '版本',
  102. dataIndex : 'version',
  103. width: 80,
  104. align: 'center'
  105. }, {
  106. text : '推荐模式',
  107. dataIndex : 'installType',
  108. width: 80,
  109. renderer: function(val) {
  110. return val == 'COVER' ? '覆盖' : '修复';
  111. },
  112. align: 'center'
  113. }, {
  114. text : '我的系统',
  115. width: 230,
  116. columns: [{
  117. text: '升级时间',
  118. dataIndex: 'install_date',
  119. width: 150,
  120. renderer: function(val) {
  121. return val ? Ext.Date.format(new Date(val), 'Y-m-d H:i') : '';
  122. },
  123. align: 'center'
  124. },{
  125. text: '版本',
  126. dataIndex: 'install_version',
  127. width: 80,
  128. align: 'center'
  129. },{
  130. xtype: 'actioncolumn',
  131. width: 50,
  132. align: 'center',
  133. items: [{
  134. icon: basePath + 'resource/ext/resources/themes/images/gray/shared/right-btn.gif',
  135. tooltip: '升级',
  136. handler: function(view, rowIndex, colIndex, opts, e) {
  137. // grid.fireEvent('action', grid, grid.getStore().getAt(rowIndex));
  138. me.onContextmenu(view, view.getStore().getAt(rowIndex), e);
  139. }
  140. }]
  141. }]
  142. } ],
  143. columnLines : true,
  144. enableColumnResize : true,
  145. store : store,
  146. dockedItems: [{
  147. xtype: 'pagingtoolbar',
  148. store: store,
  149. dock: 'bottom',
  150. displayInfo: true,
  151. moveFirst : function(){
  152. if (this.fireEvent('beforechange', this, 1) !== false){
  153. this.store.loadPage(1, {
  154. params: {
  155. condition : this.ownerCt.condition
  156. }
  157. });
  158. }
  159. },
  160. movePrevious : function(){
  161. var me = this,
  162. prev = me.store.currentPage - 1;
  163. if (prev > 0) {
  164. if (me.fireEvent('beforechange', me, prev) !== false) {
  165. this.store.previousPage({
  166. params: {
  167. condition : this.ownerCt.condition
  168. }
  169. });
  170. }
  171. }
  172. },
  173. moveNext : function(){
  174. var me = this,
  175. total = me.getPageData().pageCount,
  176. next = me.store.currentPage + 1;
  177. if (next <= total) {
  178. if (me.fireEvent('beforechange', me, next) !== false) {
  179. me.store.nextPage({
  180. params: {
  181. condition : this.ownerCt.condition
  182. }
  183. });
  184. }
  185. }
  186. },
  187. moveLast : function(){
  188. var me = this,
  189. last = me.getPageData().pageCount;
  190. if (me.fireEvent('beforechange', me, last) !== false) {
  191. me.store.loadPage(last, {
  192. params: {
  193. condition : this.ownerCt.condition
  194. }
  195. });
  196. }
  197. },
  198. doRefresh : function(){
  199. var me = this,
  200. current = me.store.currentPage;
  201. if (me.fireEvent('beforechange', me, current) !== false) {
  202. me.store.loadPage(current, {
  203. params: {
  204. condition : this.ownerCt.condition
  205. }
  206. });
  207. }
  208. }
  209. }],
  210. viewConfig: {
  211. listeners: {
  212. itemcontextmenu: function(view, record, item, index, e) {
  213. me.onContextmenu(view, record, e);
  214. }
  215. }
  216. }
  217. } ]
  218. });
  219. me.callParent(arguments);
  220. },
  221. getStore: function() {
  222. return Ext.create('Ext.data.Store', {
  223. fields : [ 'id', 'title', 'createDate', 'modifyDate', 'version', 'installType', 'install', 'install_version', 'install_date' ],
  224. pageSize: 15,
  225. autoLoad: false,
  226. proxy : {
  227. type : 'ajax',
  228. url : basePath + 'ma/upgrade/plan.action',
  229. reader : {
  230. type : 'json',
  231. root : 'content',
  232. totalProperty: 'totalElements'
  233. }
  234. }
  235. });
  236. },
  237. onContextmenu: function(view, record, e) {
  238. e.preventDefault();
  239. var menu = view.contextMenu;
  240. if (!menu) {
  241. menu = view.contextMenu = new Ext.menu.Menu({
  242. items: [{
  243. text : '查看方案',
  244. name: 'item-find',
  245. iconCls: 'x-button-icon-content'
  246. },{
  247. xtype: 'menuseparator'
  248. },{
  249. text : '覆盖式升级',
  250. name: 'item-cover',
  251. iconCls: 'x-button-icon-content'
  252. },{
  253. text : '修复式升级',
  254. name: 'item-repair',
  255. iconCls: 'x-button-icon-readed'
  256. }]
  257. });
  258. }
  259. menu.showAt(e.getXY());
  260. menu.record = record;
  261. }
  262. });