GridPanel.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. Ext.define('erp.view.oa.officialDocument.sendODManagement.manage.GridPanel',{
  2. extend: 'Ext.grid.Panel',
  3. alias: 'widget.erpSODManageGridPanel',
  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:'sod_id',
  15. type:'int'
  16. },{
  17. name:'sod_type',
  18. type:'string'
  19. },{
  20. name:'sod_title',
  21. type:'string'
  22. },{
  23. name:'sod_cs_organ',
  24. type:'string'
  25. },{
  26. name:'sod_drafter',
  27. type:'string'
  28. },{
  29. name:'date',
  30. type:'date'
  31. },{
  32. name:'sod_status',
  33. type:'string'
  34. },{
  35. name:'sod_number',
  36. type:'string'
  37. },{
  38. name:'sod_statuscode',
  39. type:'string'
  40. }]
  41. }),
  42. iconCls: 'icon-grid',
  43. frame: true,
  44. bodyStyle:'background-color:#f1f1f1;',
  45. features: [Ext.create('Ext.grid.feature.Grouping',{
  46. groupHeaderTpl: '{name} ({rows.length} 封)'
  47. })],
  48. selModel: Ext.create('Ext.selection.CheckboxModel',{
  49. // renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
  50. // if(record.data.rod_statuscode != 'OVERED'){
  51. // metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special';
  52. // return '<div class="' + Ext.baseCSSPrefix + 'grid-row-checker">&#160;</div>';
  53. // }
  54. // }
  55. onRowMouseDown: function(view, record, item, index, e) {
  56. view.el.focus();
  57. var me = this,
  58. checker = e.getTarget('.' + Ext.baseCSSPrefix + 'grid-row-checker');
  59. if (!me.allowRightMouseSelection(e)) {
  60. return;
  61. }
  62. // checkOnly set, but we didn't click on a checker.
  63. if (me.checkOnly && !checker) {
  64. return;
  65. }
  66. if (checker) {
  67. var mode = me.getSelectionMode();
  68. // dont change the mode if its single otherwise
  69. // we would get multiple selection
  70. if (mode !== 'SINGLE') {
  71. me.setSelectionMode('SIMPLE');
  72. }
  73. me.selectWithEvent(record, e);
  74. me.setSelectionMode(mode);
  75. } else {
  76. me.selectWithEvent(record, e);
  77. }
  78. }
  79. }),
  80. dockedItems: [{
  81. id : 'paging',
  82. xtype: 'erpMailPaging',
  83. dock: 'bottom',
  84. displayInfo: true
  85. }],
  86. columns: [{
  87. text: 'ID',
  88. width: 0,
  89. dataIndex: 'sod_id'
  90. },{
  91. text: '发文类型',
  92. width: 90,
  93. dataIndex: 'sod_type'
  94. },{
  95. text: '发文标题',
  96. width: 80,
  97. dataIndex: 'sod_title'
  98. },{
  99. text: '抄送部门',
  100. width: 150,
  101. dataIndex: 'sod_cs_organ'
  102. },{
  103. text: '拟稿人',
  104. width: 80,
  105. dataIndex: 'sod_drafter'
  106. },{
  107. text: '拟稿日期',
  108. width: 90,
  109. dataIndex: 'sod_date',
  110. renderer: function(val, meta, record){
  111. return Ext.util.Format.date(new Date(val),'Y-m-d');
  112. }
  113. },{
  114. text: '审批状态',
  115. width: 80,
  116. // id: 'sod_status',
  117. // xtype:'gridcolumn',
  118. dataIndex: 'sod_status'
  119. },{
  120. text: '发文字号',
  121. width: 80,
  122. dataIndex: 'sod_number'
  123. },{
  124. text: '审批状态码',
  125. width: 0,
  126. // xtype:'gridcolumn',
  127. dataIndex: 'sod_statuscode'
  128. }],
  129. tbar: [{
  130. iconCls: 'group-delete',
  131. text: $I18N.common.button.erpDeleteButton,
  132. handler: function(btn){
  133. var selectItem = Ext.getCmp('grid').selModel.selected.items;
  134. console.log(selectItem);
  135. // if (selectItem.length == 0) {
  136. // showError("请先选中要删除的收文");return;
  137. // } else {
  138. // var ids = new Array();
  139. // Ext.each(selectItem, function(item, index){
  140. // ids[index] = item.data.rod_id;
  141. //// alert(ids[index]);
  142. // });
  143. // Ext.Ajax.request({//拿到grid的columns
  144. // url : basePath + 'oa/officialDocument/receiveODM/deleteROD.action',
  145. // params: {
  146. // ids : ids.join(',')
  147. // },
  148. // method : 'post',
  149. // async: false,
  150. // callback : function(options, success, response){
  151. // parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  152. // var res = new Ext.decode(response.responseText);
  153. // if(res.exceptionInfo){
  154. // showError(res.exceptionInfo);return;
  155. // }
  156. // if(res.success){
  157. // alert(' 删除成功!');
  158. // }
  159. // }
  160. // });
  161. // url = "oa/officialDocument/receiveODM/getRODList.action";
  162. // btn.ownerCt.ownerCt.getGroupData();
  163. // }
  164. }
  165. },{
  166. iconCls: 'x-button-icon-print',
  167. text: $I18N.common.button.erpPrintButton,
  168. id: 'print',
  169. handler: function(btn){
  170. }
  171. }],
  172. initComponent : function(){
  173. this.callParent(arguments);
  174. url = "oa/officialDocument/sendODM/getSODList.action";
  175. this.getGroupData(page, pageSize);
  176. },
  177. listeners: {//滚动条有时候没反应,添加此监听器
  178. scrollershow: function(scroller) {
  179. if (scroller && scroller.scrollEl) {
  180. scroller.clearManagedListeners();
  181. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  182. }
  183. }
  184. },
  185. getGroupData: function(page, pageSize){
  186. var me = this;
  187. if(!page){
  188. page = 1;
  189. }
  190. if(!pageSize){
  191. pageSize = 15;
  192. }
  193. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  194. Ext.Ajax.request({//拿到grid的columns
  195. url : basePath + url,
  196. params: {
  197. page: page,
  198. pageSize: pageSize
  199. },
  200. method : 'post',
  201. async: false,
  202. callback : function(options, success, response){
  203. console.log(response);
  204. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  205. var res = new Ext.decode(response.responseText);
  206. if(res.exceptionInfo){
  207. showError(res.exceptionInfo);return;
  208. }
  209. if(res.error){
  210. showError(res.error);return;
  211. }
  212. if(!res.success){
  213. return;
  214. } else {
  215. // console.log(res.jprocesslist);
  216. dataCount = res.count;
  217. me.store.loadData(res.success);
  218. }
  219. }
  220. });
  221. },
  222. // updateWindow: function(id){
  223. // var win = new Ext.window.Window({
  224. // id : 'win2',
  225. // title: "修改协同",
  226. // height: "90%",
  227. // width: "80%",
  228. // maximizable : false,
  229. // buttonAlign : 'left',
  230. // layout : 'anchor',
  231. // items: [{
  232. // tag : 'iframe',
  233. // frame : true,
  234. // anchor : '100% 100%',
  235. // layout : 'fit',
  236. // 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>'
  237. // }]
  238. // });
  239. // win.show();
  240. // }
  241. });