GridPanel.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. Ext.define('erp.view.oa.officialDocument.instruction.query.GridPanel',{
  2. extend: 'Ext.grid.Panel',
  3. alias: 'widget.erpInstructionQueryGridPanel',
  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: [],
  13. columns: [],
  14. iconCls: 'icon-grid',
  15. frame: true,
  16. bodyStyle:'background-color:#f1f1f1;',
  17. features: [Ext.create('Ext.grid.feature.Grouping',{
  18. groupHeaderTpl: '{name} ({rows.length} 封)'
  19. })],
  20. dockedItems: [{
  21. id : 'paging',
  22. xtype: 'erpMailPaging',
  23. dock: 'bottom',
  24. displayInfo: true
  25. }],
  26. tbar: [{
  27. iconCls: 'x-button-icon-print',
  28. text: $I18N.common.button.erpPrintButton,
  29. id: 'print',
  30. handler: function(btn){
  31. url = "oa/officialDocument/instruction/getInstructionList.action";
  32. Ext.getCmp('grid').getGroupData(page, pageSize);
  33. }
  34. }],
  35. initComponent : function(){
  36. var gridParam = {caller: caller, condition: ''};
  37. this.GridUtil.getGridColumnsAndStore(this, 'common/singleGridPanel.action', gridParam, "");
  38. this.callParent(arguments);
  39. url = "oa/officialDocument/instruction/getInstructionList.action";
  40. this.getGroupData(page, pageSize);
  41. },
  42. listeners: {//滚动条有时候没反应,添加此监听器
  43. scrollershow: function(scroller) {
  44. if (scroller && scroller.scrollEl) {
  45. scroller.clearManagedListeners();
  46. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  47. }
  48. }
  49. },
  50. getGroupData: function(page, pageSize){
  51. var me = this;
  52. if(!page){
  53. page = 1;
  54. }
  55. if(!pageSize){
  56. pageSize = 15;
  57. }
  58. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  59. Ext.Ajax.request({//拿到grid的columns
  60. url : basePath + url,
  61. params: {
  62. page: page,
  63. pageSize: pageSize
  64. },
  65. method : 'post',
  66. async: false,
  67. callback : function(options, success, response){
  68. // console.log(response);
  69. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  70. var res = new Ext.decode(response.responseText);
  71. if(res.exceptionInfo){
  72. showError(res.exceptionInfo);return;
  73. }
  74. if(res.error){
  75. showError(res.error);return;
  76. }
  77. if(!res.success){
  78. return;
  79. } else {
  80. // console.log(res.jprocesslist);
  81. dataCount = res.count;
  82. me.store.loadData(res.success);
  83. }
  84. }
  85. });
  86. },
  87. updateWindow: function(id){
  88. var win = new Ext.window.Window({
  89. id : 'win2',
  90. title: "修改日程",
  91. height: "90%",
  92. width: "80%",
  93. maximizable : false,
  94. buttonAlign : 'left',
  95. layout : 'anchor',
  96. items: [{
  97. tag : 'iframe',
  98. frame : true,
  99. anchor : '100% 100%',
  100. layout : 'fit',
  101. 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>'
  102. }]
  103. });
  104. win.show();
  105. }
  106. });