T8DReport.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.scm.qc.T8DReport', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'core.form.Panel','scm.qc.T8DReport','core.toolbar.Toolbar','core.form.MultiField',
  8. 'core.form.FileField','core.form.CheckBoxGroup',
  9. 'core.button.Save','core.button.Add','core.button.Submit','core.button.Print','core.button.ResAudit',
  10. 'core.button.Audit','core.button.Close','core.button.Delete','core.button.Update',
  11. 'core.button.ResSubmit','core.button.Flow','core.button.Check','core.button.ResCheck',
  12. 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.form.YnField'
  13. ],
  14. init:function(){
  15. var me = this;
  16. this.control({
  17. 'erpSaveButton': {
  18. click: function(btn){
  19. var form = me.getForm(btn);
  20. if(Ext.getCmp(form.codeField).value == null || 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('re_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('addT8DReport', '新增8D报告', 'jsps/scm/qc/t8dreport.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('re_statuscode'), checkstatus = Ext.getCmp('re_checkstatuscode');
  49. if(status && status.value != 'COMMITED'){
  50. btn.hide();
  51. }
  52. if(checkstatus && checkstatus.value == 'APPROVE'){
  53. btn.hide();
  54. }
  55. },
  56. click: function(btn){
  57. me.FormUtil.onAudit(Ext.getCmp('re_id').value);
  58. }
  59. },
  60. 'erpResAuditButton': {
  61. afterrender: function(btn){
  62. var status = Ext.getCmp('re_statuscode'), checkstatus = Ext.getCmp('re_checkstatuscode');
  63. if(status && status.value != 'AUDITED'){
  64. btn.hide();
  65. }
  66. if(checkstatus && checkstatus.value == 'APPROVE'){
  67. btn.hide();
  68. }
  69. },
  70. click: function(btn){
  71. me.FormUtil.onResAudit(Ext.getCmp('re_id').value);
  72. }
  73. },
  74. 'erpSubmitButton': {
  75. afterrender: function(btn){
  76. var status = Ext.getCmp('re_checkstatuscode');
  77. if(status && status.value != 'UNAPPROVED'){
  78. btn.hide();
  79. }
  80. var auditstatus = Ext.getCmp('re_statuscode');
  81. if(auditstatus && auditstatus.value != 'ENTERING'){
  82. btn.hide();
  83. }
  84. },
  85. click: function(btn){
  86. me.FormUtil.onSubmit(Ext.getCmp('re_id').value);
  87. }
  88. },
  89. 'erpResSubmitButton': {
  90. afterrender: function(btn){
  91. var status = Ext.getCmp('re_statuscode'), checkstatus = Ext.getCmp('re_checkstatuscode');
  92. if(status && status.value != 'COMMITED'){
  93. btn.hide();
  94. }
  95. if(checkstatus && checkstatus.value == 'APPROVE'){
  96. btn.hide();
  97. }
  98. },
  99. click: function(btn){
  100. me.FormUtil.onResSubmit(Ext.getCmp('re_id').value);
  101. }
  102. },
  103. 'erpCheckButton': {
  104. afterrender: function(btn){
  105. var status = Ext.getCmp('re_statuscode'), checkstatus = Ext.getCmp('re_checkstatuscode');
  106. if(status && status.value != 'AUDITED'){
  107. btn.hide();
  108. }
  109. if(checkstatus && checkstatus.value != 'UNAPPROVED'){
  110. btn.hide();
  111. }
  112. },
  113. click: function(btn){
  114. me.FormUtil.onCheck(Ext.getCmp('re_id').value);
  115. }
  116. },
  117. 'erpResCheckButton': {
  118. afterrender: function(btn){
  119. var status = Ext.getCmp('re_checkstatuscode');
  120. if(status && status.value != 'APPROVE' ){
  121. btn.hide();
  122. }
  123. },
  124. click: function(btn){
  125. me.FormUtil.onResCheck(Ext.getCmp('re_id').value);
  126. }
  127. },
  128. 'erpPrintButton': {
  129. click: function(btn){
  130. var condition = '{T8DReport.re_id}=' + Ext.getCmp('re_id').value + '';
  131. var id = Ext.getCmp('re_id').value;
  132. reportName="T8DReport";
  133. me.FormUtil.onwindowsPrint(id, reportName, condition);
  134. }
  135. }
  136. });
  137. },
  138. getForm: function(btn){
  139. return btn.ownerCt.ownerCt;
  140. }
  141. });