Contract.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.hr.emplmana.Contract', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'hr.emplmana.Contract','core.form.Panel','core.form.MultiField','core.form.FileField',
  8. 'core.button.Add','core.button.Save','core.button.Close','core.button.Submit','core.button.ResSubmit',
  9. 'core.button.ResAudit','core.button.Audit','core.button.Update','core.button.Delete',
  10. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.form.YnField'
  11. ],
  12. init:function(){
  13. var me = this;
  14. this.control({
  15. 'erpSaveButton': {
  16. click: function(btn){
  17. var statdate = Ext.getCmp('co_begintime').value,
  18. enddate = Ext.getCmp('co_endtime').value;
  19. if(!Ext.isEmpty(enddate)){
  20. if(Ext.Date.format(statdate,'Y-m-d') > Ext.Date.format(enddate,'Y-m-d')){
  21. showError('结束时间不能小于开始时间!');return;
  22. }
  23. if(Ext.Date.format(enddate,'Y-m-d') < Ext.Date.format(new Date(),'Y-m-d')){
  24. showError('结束时间不能小于当前日期!');return;
  25. }
  26. }
  27. this.FormUtil.beforeSave(this);
  28. }
  29. },
  30. 'erpCloseButton': {
  31. click: function(btn){
  32. this.FormUtil.beforeClose(this);
  33. }
  34. },
  35. 'erpUpdateButton': {
  36. click: function(btn){
  37. var statdate = Ext.getCmp('co_begintime').value,
  38. enddate = Ext.getCmp('co_endtime').value;
  39. if(!Ext.isEmpty(enddate)){
  40. if(Ext.Date.format(statdate,'Y-m-d') > Ext.Date.format(enddate,'Y-m-d')){
  41. showError('结束时间不能小于开始时间!');return;
  42. }
  43. if(Ext.Date.format(enddate,'Y-m-d') < Ext.Date.format(new Date(),'Y-m-d')){
  44. showError('结束时间不能小于当前日期!');return;
  45. }
  46. }
  47. this.FormUtil.onUpdate(this);
  48. }
  49. },
  50. 'erpDeleteButton': {
  51. click: function(btn){
  52. me.FormUtil.onDelete(Ext.getCmp('co_id').value);
  53. }
  54. },
  55. 'erpAddButton': {
  56. click: function(){
  57. me.FormUtil.onAdd('addContract', '新增合同', 'jsps/hr/emplmana/contract/contract.jsp');
  58. }
  59. },
  60. 'erpSubmitButton': {
  61. afterrender: function(btn){
  62. var status = Ext.getCmp('co_statuscode');
  63. if(status && status.value != 'ENTERING'){
  64. btn.hide();
  65. }
  66. },
  67. click: function(btn){
  68. me.FormUtil.onSubmit(Ext.getCmp('co_id').value);
  69. }
  70. },
  71. 'erpResSubmitButton': {
  72. afterrender: function(btn){
  73. var status = Ext.getCmp('co_statuscode');
  74. if(status && status.value != 'COMMITED'){
  75. btn.hide();
  76. }
  77. },
  78. click: function(btn){
  79. me.FormUtil.onResSubmit(Ext.getCmp('co_id').value);
  80. }
  81. },
  82. 'erpAuditButton': {
  83. afterrender: function(btn){
  84. var status = Ext.getCmp('co_statuscode');
  85. if(status && status.value != 'COMMITED'){
  86. btn.hide();
  87. }
  88. },
  89. click: function(btn){
  90. me.FormUtil.onAudit(Ext.getCmp('co_id').value);
  91. }
  92. },
  93. 'erpResAuditButton': {
  94. afterrender: function(btn){
  95. var status = Ext.getCmp('co_statuscode');
  96. if(status && status.value != 'AUDITED'){
  97. btn.hide();
  98. }
  99. },
  100. click: function(btn){
  101. me.FormUtil.onResAudit(Ext.getCmp('co_id').value);
  102. }
  103. }
  104. });
  105. },
  106. getForm: function(btn){
  107. return btn.ownerCt.ownerCt;
  108. }
  109. });