CardLogImp.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.hr.attendance.CardLogImp', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'hr.attendance.CardLogImpForm','hr.attendance.CardLogImp','core.form.MonthDateField',
  8. 'core.button.Close','core.button.CardLogImp','core.trigger.DbfindTrigger'
  9. ] ,
  10. init:function(){
  11. var me = this;
  12. this.control({
  13. 'erpCloseButton': {
  14. click: function(btn){
  15. me.FormUtil.onClose();
  16. }
  17. },
  18. 'erpCardLogImpButton': {
  19. click: function(btn){
  20. this.startAccount();
  21. }
  22. }
  23. });
  24. },
  25. getForm: function(btn){
  26. return btn.ownerCt.ownerCt;
  27. },
  28. startAccount: function(){
  29. var me = this;
  30. console.log(Ext.getCmp('startdate').rawValue);
  31. console.log(Ext.getCmp('enddate').rawValue);
  32. console.log(Ext.getCmp('cardcode').rawValue);
  33. console.log(Ext.getCmp('yearmonth').rawValue);
  34. me.FormUtil.getActiveTab().setLoading(true);
  35. Ext.Ajax.request({
  36. url : basePath + "hr/attendance/cardLogImp.action",
  37. params:{
  38. startdate:Ext.getCmp('startdate').rawValue,
  39. enddate:Ext.getCmp('enddate').rawValue,
  40. cardcode:Ext.getCmp('cardcode').rawValue,
  41. yearmonth:Ext.getCmp('yearmonth').rawValue
  42. },
  43. method:'post',
  44. callback:function(options,success,response){
  45. me.FormUtil.getActiveTab().setLoading(false);
  46. var localJson = new Ext.decode(response.responseText);
  47. if(localJson.success){
  48. cardLogImpSuccess(function(){
  49. window.location.reload();
  50. });
  51. } else {
  52. if(localJson.exceptionInfo){
  53. var str = localJson.exceptionInfo;
  54. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  55. str = str.replace('AFTERSUCCESS', '');
  56. showMessage('提示', str);
  57. window.location.reload();
  58. } else {
  59. showError(str);return;
  60. }
  61. }
  62. }
  63. }
  64. });
  65. }
  66. });