AttendDataCom.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.hr.attendance.AttendDataCom', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'hr.attendance.AttendDataComForm','hr.attendance.AttendDataCom','core.form.ConDateField',
  8. 'core.button.Close','core.button.AttendDataCom','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. 'erpAttendDataComButton': {
  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 mb = new Ext.window.MessageBox();
  30. mb.wait('正在计算中','请稍后...',{
  31. interval: 60000, //bar will move fast!
  32. duration: 1800000,
  33. increment: 20,
  34. scope: this,
  35. });
  36. Ext.Ajax.request({
  37. url : basePath + "hr/attendance/attendDataCom.action",
  38. params:{
  39. startdate:Ext.Date.toString(Ext.getCmp('searchdate').firstVal),
  40. enddate:Ext.Date.toString(Ext.getCmp('searchdate').secondVal),
  41. emcode:''
  42. },
  43. method:'post',
  44. timeout: 2400000,
  45. callback:function(options,success,response){
  46. var localJson = new Ext.decode(response.responseText);
  47. mb.close();
  48. if(localJson.success){
  49. attendDataComSuccess(function(){
  50. window.location.reload();
  51. });
  52. } else {
  53. if(localJson.exceptionInfo){
  54. var str = localJson.exceptionInfo;
  55. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  56. str = str.replace('AFTERSUCCESS', '');
  57. showMessage('提示', str);
  58. window.location.reload();
  59. } else {
  60. showError(str);return;
  61. }
  62. }
  63. }
  64. }
  65. });
  66. }
  67. });