AfterInit.js 1011 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.common.AfterInit', {
  3. extend: 'Ext.app.Controller',
  4. requires: ['erp.util.BaseUtil'],
  5. views: ['common.init.AfterInit'],
  6. init: function(){
  7. var me = this;
  8. me.BaseUtil = Ext.create('erp.util.BaseUtil');
  9. this.control({
  10. 'button[name=prev]': {
  11. click: function(btn){
  12. var bt = parent.Ext.ComponentQuery.query('button[step=4]')[0];
  13. bt.fireEvent('click', bt);
  14. }
  15. },
  16. 'button[name=confirm]': {
  17. click: function(btn){
  18. var form = btn.ownerCt.ownerCt, fields = form.getForm().getFields();
  19. var c = 0;
  20. form.setLoading(true);
  21. fields.each(function(f){
  22. Ext.Ajax.request({
  23. url: basePath + f.action,
  24. callback: function(o, s, r) {
  25. if (s) {
  26. if(++c == fields.length) {
  27. form.setLoading(false);
  28. alert('完成操作!');
  29. }
  30. }
  31. }
  32. });
  33. });
  34. }
  35. }
  36. });
  37. },
  38. });