RemainQuery.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.fa.gla.RemainQuery', {
  3. extend : 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. GridUtil: Ext.create('erp.util.GridUtil'),
  6. views : [ 'fa.gla.RemainQuery', 'common.batchDeal.GridPanel', 'core.trigger.DbfindTrigger',
  7. 'core.button.Query', 'core.button.Export', 'core.button.Print', 'core.button.Close',
  8. 'core.form.MonthDateField'],
  9. init : function() {
  10. this.control({
  11. 'button[id=query]': {
  12. click: function(btn) {
  13. this.query();
  14. }
  15. },
  16. 'button[name=export]': {
  17. click: function(btn) {
  18. var grid = btn.ownerCt.ownerCt.ownerCt.down('gridpanel');
  19. grid.BaseUtil.exportGrid(grid);
  20. }
  21. },
  22. 'monthdatefield': {
  23. afterrender: function(f) {
  24. this.getCurrentMonth(f);
  25. }
  26. }
  27. });
  28. },
  29. getCurrentMonth: function(f) {
  30. Ext.Ajax.request({
  31. url: basePath + 'fa/getMonth.action',
  32. params: {
  33. type: 'MONTH-A'
  34. },
  35. callback: function(opt, s, r) {
  36. var rs = Ext.decode(r.responseText);
  37. if(rs.data) {
  38. f.setValue(rs.data.PD_DETNO);
  39. }
  40. }
  41. });
  42. },
  43. query: function() {
  44. var grid = Ext.getCmp('batchDealGridPanel'),
  45. form = grid.ownerCt.down('form');
  46. grid.setLoading(true);
  47. Ext.Ajax.request({
  48. url: basePath + 'fa/gls/getRemainQuery.action',
  49. params: {
  50. condition: Ext.encode(form.getForm().getValues())
  51. },
  52. callback: function(opt, s, r) {
  53. grid.setLoading(false);
  54. var res = Ext.decode(r.responseText);
  55. if(grid && res.data) {
  56. grid.store.loadData(res.data);
  57. }
  58. }
  59. });
  60. }
  61. });