AttendanceManage.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.hr.attendance.AttendanceManage', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'hr.attendance.AttendanceForm','hr.attendance.AttendanceManage',
  8. 'core.button.Confirm','core.button.Close','core.form.ConDateField'
  9. ] ,
  10. init:function(){
  11. var me = this;
  12. this.control({
  13. 'erpCloseButton': {
  14. click: function(btn){
  15. me.FormUtil.onClose();
  16. }
  17. },
  18. 'erpConfirmButton': {
  19. click: function(btn){
  20. this.confirm();
  21. }
  22. }
  23. });
  24. },
  25. getForm: function(btn){
  26. return btn.ownerCt.ownerCt;
  27. },
  28. confirm: function(){
  29. var start=Ext.Date.format(Ext.getCmp('searchdate_from').getValue(),'Y-m-d');
  30. var end=Ext.Date.format(Ext.getCmp('searchdate_to').getValue(),'Y-m-d');
  31. var mb = new Ext.window.MessageBox();
  32. mb.wait('正在分析','请稍后...',{
  33. interval: 1000, //bar will move fast!
  34. duration: 1000000,
  35. increment: 20,
  36. scope: this
  37. });
  38. Ext.Ajax.request({
  39. url : basePath + "hr/attendance/result.action",
  40. params:{
  41. startdate: start,
  42. enddate: end
  43. },
  44. method:'post',
  45. timeout: 600000,
  46. callback:function(options,success,response){
  47. mb.close();
  48. var localJson = new Ext.decode(response.responseText);
  49. if(localJson.success){
  50. Ext.Msg.alert("提示","操作成功!");
  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. showError(str);
  57. } else {
  58. showError(str);return;
  59. }
  60. }
  61. }
  62. }
  63. });
  64. },
  65. getCurrentMonth: function(f, type) {
  66. Ext.Ajax.request({
  67. url: basePath + 'fa/getMonth.action',
  68. params: {
  69. type: type
  70. },
  71. callback: function(opt, s, r) {
  72. var rs = Ext.decode(r.responseText);
  73. if(rs.data) {
  74. f.setValue(rs.data.PD_DETNO);
  75. }
  76. }
  77. });
  78. }
  79. });