Transaction.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.plm.project.Transaction', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'plm.project.Transaction','core.form.Panel','core.button.Scan',
  8. 'core.button.Add','core.button.Submit','core.button.Audit','core.button.Save','core.button.Close','core.button.Print',
  9. 'core.button.Upload','core.button.Update','core.button.Delete','core.button.ResAudit','core.button.ResSubmit',
  10. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger'
  11. ],
  12. init:function(){
  13. this.control({
  14. 'erpSaveButton': {
  15. click: function(btn){
  16. this.save(btn);
  17. }
  18. },
  19. 'erpCloseButton': {
  20. afterrender:function(btn){
  21. Ext.getCmp('tt_remark').setHeight(350);
  22. },
  23. click: function(btn){
  24. this.FormUtil.beforeClose(this);
  25. }
  26. },
  27. 'erpUpdateButton': {
  28. click: function(btn){
  29. this.FormUtil.onUpdate(this);
  30. }
  31. },
  32. 'erpDeleteButton': {
  33. click: function(btn){
  34. this.FormUtil.onDelete({pre_id: Number(Ext.getCmp('tt_id').value)});
  35. }
  36. },
  37. 'erpSubmitButton': {
  38. afterrender: function(btn){
  39. var status = Ext.getCmp('tt_statuscode');
  40. if(status && status.value != 'ENTERING'){
  41. btn.hide();
  42. }
  43. },
  44. click: function(btn){
  45. me.FormUtil.onSubmit(Ext.getCmp('tt_id').value);
  46. }
  47. },
  48. 'erpAuditButton': {
  49. afterrender: function(btn){
  50. var status = Ext.getCmp('tt_statuscode');
  51. if(status && status.value != 'COMMITED'){
  52. btn.hide();
  53. }
  54. },
  55. click: function(btn){
  56. me.FormUtil.onAudit(Ext.getCmp('tt_id').value);
  57. }
  58. },
  59. 'datefield[name=tt_startdate]':{
  60. change:function(field){
  61. if(field.value){
  62. Ext.getCmp('tt_enddate').setMinValue(field.value);
  63. }
  64. }
  65. },
  66. 'dbfindtrigger[name=tt_employeecode]':{
  67. afterrender:function(trigger){
  68. trigger.dbKey='tt_prjid';
  69. trigger.mappingKey='tm_prjid';
  70. trigger.dbMessage='请选择该成员所属项目ID';
  71. },
  72. }
  73. });
  74. },
  75. getForm: function(btn){
  76. return btn.ownerCt.ownerCt;
  77. },
  78. save: function(btn){
  79. var me = this;
  80. if(Ext.getCmp('tt_code').value == null || Ext.getCmp('tt_code').value == ''){
  81. me.BaseUtil.getRandomNumber();
  82. }
  83. me.FormUtil.beforeSave(me);
  84. }
  85. });