GridPanel.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. Ext.define('erp.view.oa.myProcess.synergy.synergyQuery.GridPanel',{
  2. extend: 'Ext.grid.Panel',
  3. alias: 'widget.erpSynergyQueryGridPanel',
  4. id: 'grid',
  5. emptyText : '无数据',
  6. columnLines : true,
  7. autoScroll : true,
  8. FormUtil: Ext.create('erp.util.FormUtil'),
  9. GridUtil: Ext.create('erp.util.GridUtil'),
  10. plugins: [Ext.create('Ext.ux.grid.GridHeaderFilters')],
  11. BaseUtil: Ext.create('erp.util.BaseUtil'),
  12. store: Ext.create('Ext.data.Store', {
  13. fields: [{
  14. name:'id',
  15. type:'string'
  16. },{
  17. name:'title',
  18. type:'string'
  19. },{
  20. name:'date',
  21. type:'date'
  22. },{
  23. name:'type',
  24. type:'string'
  25. },{
  26. name:'releaser',
  27. type:'string'
  28. },{
  29. name:'attach',
  30. type:'string'
  31. }]
  32. }),
  33. iconCls: 'icon-grid',
  34. frame: true,
  35. bodyStyle:'background-color:#f1f1f1;',
  36. features: [Ext.create('Ext.grid.feature.Grouping',{
  37. groupHeaderTpl: '{name} ({rows.length} 封)'
  38. })],
  39. // selModel: Ext.create('Ext.selection.CheckboxModel',{
  40. //
  41. // }),
  42. dockedItems: [{
  43. id : 'paging',
  44. xtype: 'erpMailPaging',
  45. dock: 'bottom',
  46. displayInfo: true
  47. }],
  48. columns: [{
  49. text: 'ID',
  50. width: 0,
  51. dataIndex: 'sy_id'
  52. },{
  53. text: '标题',
  54. width: 160,
  55. dataIndex: 'sy_title'
  56. },{
  57. text: '发布日期',
  58. width: 160,
  59. dataIndex: 'sy_date',
  60. renderer: function(val, meta, record){
  61. return Ext.util.Format.date(new Date(val),'Y-m-d');
  62. }
  63. },{
  64. text: '协同类型',
  65. width: 160,
  66. dataIndex: 'sy_type'
  67. },{
  68. text: '发布人',
  69. width: 80,
  70. dataIndex: 'sy_releaser'
  71. },{
  72. text: '附件数',
  73. width: 80,
  74. dataIndex: 'sy_attach_id',
  75. renderer: function(val, meta, record){
  76. if(val != null){
  77. return val.split(',').length + ' 个';
  78. } else {
  79. return '无';
  80. }
  81. }
  82. }],
  83. // tbar: [{
  84. // iconCls: 'group-delete',
  85. // text: $I18N.common.button.erpDeleteButton,
  86. // handler: function(btn){
  87. // var selectItem = Ext.getCmp('grid').selModel.selected.items;
  88. // if (selectItem.length == 0) {
  89. // showError("请先选中要删除的流程");return;
  90. // } else {
  91. // var ids = new Array();
  92. // Ext.each(selectItem, function(item, index){
  93. // ids[index] = item.data.jp_id;
  94. //// alert(ids[index]);
  95. // });
  96. // Ext.Ajax.request({//拿到grid的columns
  97. // url : basePath + 'oa/myprocess/delete.action',
  98. // params: {
  99. // ids : ids.join(',')
  100. // },
  101. // method : 'post',
  102. // async: false,
  103. // callback : function(options, success, response){
  104. // parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  105. // var res = new Ext.decode(response.responseText);
  106. // if(res.exceptionInfo){
  107. // showError(res.exceptionInfo);return;
  108. // }
  109. // if(res.success){
  110. // alert(' 删除成功!');
  111. // }
  112. // }
  113. // });
  114. // url = "oa/myprocess/getJProcessList.action";
  115. //// url = "oa/myprocess/getMyList.action";
  116. // btn.ownerCt.ownerCt.getGroupData();
  117. // }
  118. // }
  119. // },{
  120. // iconCls: 'x-button-icon-print',
  121. // text: $I18N.common.button.erpPrintButton,
  122. // id: 'print',
  123. // handler: function(btn){
  124. //
  125. // }
  126. // },{
  127. // iconCls: 'x-button-icon-print',
  128. // text: '催办',
  129. // id: 'fast',
  130. // handler: function(btn){
  131. //
  132. // }
  133. // },{
  134. // iconCls: 'x-button-icon-print',
  135. // text: '控制',
  136. // id: 'control',
  137. // handler: function(btn){
  138. //
  139. // }
  140. // }],
  141. initComponent : function(){
  142. this.callParent(arguments);
  143. url = "oa/myProcess/synergy/getSynergyList.action";
  144. // url = "oa/myprocess/getMyList.action";
  145. this.getGroupData(page, pageSize);
  146. },
  147. listeners: {//滚动条有时候没反应,添加此监听器
  148. scrollershow: function(scroller) {
  149. if (scroller && scroller.scrollEl) {
  150. scroller.clearManagedListeners();
  151. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  152. }
  153. }
  154. },
  155. getGroupData: function(page, pageSize){
  156. var me = this;
  157. if(!page){
  158. page = 1;
  159. }
  160. if(!pageSize){
  161. pageSize = 15;
  162. }
  163. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  164. Ext.Ajax.request({//拿到grid的columns
  165. url : basePath + url,
  166. params: {
  167. page: page,
  168. pageSize: pageSize
  169. },
  170. method : 'post',
  171. async: false,
  172. callback : function(options, success, response){
  173. // console.log(response);
  174. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  175. var res = new Ext.decode(response.responseText);
  176. if(res.exceptionInfo){
  177. showError(res.exceptionInfo);return;
  178. }
  179. if(res.error){
  180. showError(res.error);return;
  181. }
  182. if(!res.success){
  183. return;
  184. } else {
  185. // console.log(res.jprocesslist);
  186. dataCount = res.count;
  187. me.store.loadData(res.success);
  188. }
  189. }
  190. });
  191. },
  192. updateWindow: function(id){
  193. var win = new Ext.window.Window({
  194. id : 'win2',
  195. title: "修改日程",
  196. height: "90%",
  197. width: "80%",
  198. maximizable : false,
  199. buttonAlign : 'left',
  200. layout : 'anchor',
  201. items: [{
  202. tag : 'iframe',
  203. frame : true,
  204. anchor : '100% 100%',
  205. layout : 'fit',
  206. html : '<iframe id="iframe_' + id + '" src="' + basePath + 'jsps/common/commonpage.jsp?whoami=Agenda&formCondition=ag_idIS' + id + '&gridCondition=" height="100%" width="100%" frameborder="0" scrolling="yes"></iframe>'
  207. }]
  208. });
  209. win.show();
  210. }
  211. });