SubsApply.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.common.SubsApply', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'common.subs.SubsApply','core.form.Panel','core.form.FileField','core.form.MultiField',
  8. 'core.button.Save','core.button.Add','core.button.Submit','core.button.Print','core.button.Upload','core.button.ResAudit',
  9. 'core.button.Audit','core.button.Close','core.button.Delete','core.button.Update','core.button.ResSubmit',
  10. 'core.button.Flow','core.button.DownLoad','core.button.Scan','common.datalist.Toolbar','core.form.ColorField',
  11. 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.form.YnField',
  12. ],
  13. init:function(){
  14. var me = this;
  15. this.control({
  16. 'erpSaveButton': {
  17. click: function(btn){
  18. var form = me.getForm(btn);
  19. if (Ext.getCmp(form.codeField).value == null
  20. || Ext.getCmp(form.codeField).value == '') {
  21. me.BaseUtil.getRandomNumber();// 自动添加编号
  22. }
  23. this.FormUtil.beforeSave(this);
  24. }
  25. },
  26. 'erpDeleteButton' : {
  27. click: function(btn){
  28. me.FormUtil.onDelete(Ext.getCmp('id_').value);
  29. }
  30. },
  31. 'erpUpdateButton': {
  32. click: function(btn){
  33. this.FormUtil.onUpdate(this);
  34. }
  35. },
  36. 'erpAddButton': {
  37. click: function(){
  38. me.FormUtil.onAdd('addSubsApply', '新增订阅申请', 'jsps/common/subsapply.jsp');
  39. }
  40. },
  41. 'erpCloseButton': {
  42. click: function(btn){
  43. me.FormUtil.beforeClose(me);
  44. }
  45. },
  46. 'erpAuditButton' : {
  47. afterrender : function(btn) {
  48. var status = Ext.getCmp('statuscode_');
  49. if (status && status.value != 'COMMITED') {
  50. btn.hide();
  51. }
  52. },
  53. click : function(btn) {
  54. this.FormUtil.onAudit(Ext.getCmp('id_').value);
  55. }
  56. },
  57. 'erpResAuditButton' : {
  58. afterrender : function(btn) {
  59. var status = Ext.getCmp('statuscode_');
  60. if (status && status.value != 'AUDITED') {
  61. btn.hide();
  62. }
  63. },
  64. click : function(btn) {
  65. this.FormUtil.onResAudit(Ext.getCmp('id_').value);
  66. }
  67. },
  68. 'erpSubmitButton' : {
  69. afterrender : function(btn) {
  70. var status = Ext.getCmp('statuscode_');
  71. if (status && status.value != 'ENTERING') {
  72. btn.hide();
  73. }
  74. },
  75. click : function(btn) {
  76. this.FormUtil.onSubmit(Ext.getCmp('id_').value);
  77. }
  78. },
  79. 'erpResSubmitButton' : {
  80. afterrender : function(btn) {
  81. var status = Ext.getCmp('statuscode_');
  82. if (status && status.value != 'COMMITED') {
  83. btn.hide();
  84. }
  85. },
  86. click : function(btn) {
  87. this.FormUtil.onResSubmit(Ext.getCmp('id_').value);
  88. }
  89. }
  90. });
  91. },
  92. getForm: function(btn){
  93. return btn.ownerCt.ownerCt;
  94. }
  95. });