StencilUse.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.pm.mes.StencilUse', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'pm.mes.Device','core.form.Panel','core.button.BackStencil',
  8. 'core.button.Add','core.button.Save','core.button.Close',
  9. 'core.button.Submit','core.button.ResSubmit','core.button.Audit','core.button.ResAudit',
  10. 'core.button.Update','core.button.Delete','core.form.YnField',
  11. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger'
  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 || Ext.getCmp(form.codeField).value == ''){
  20. me.BaseUtil.getRandomNumber();//自动添加编号
  21. }
  22. this.FormUtil.beforeSave(this);
  23. }
  24. },
  25. 'erpCloseButton': {
  26. click: function(btn){
  27. this.FormUtil.beforeClose(this);
  28. }
  29. },
  30. 'erpUpdateButton': {
  31. click: function(btn){
  32. this.FormUtil.onUpdate(this);
  33. }
  34. },
  35. 'erpDeleteButton': {
  36. click: function(btn){
  37. me.FormUtil.onDelete(Ext.getCmp('su_id').value);
  38. }
  39. },
  40. 'erpAddButton': {
  41. click: function(){
  42. me.FormUtil.onAdd('addStencilUse', '新增钢网登记', 'jsps/pm/mes/stencilU.jsp');
  43. }
  44. },
  45. 'erpSubmitButton': {
  46. afterrender: function(btn){
  47. var status = Ext.getCmp('su_statuscode');
  48. if(status && status.value != 'ENTERING'){
  49. btn.hide();
  50. }
  51. },
  52. click: function(btn){
  53. me.FormUtil.onSubmit(Ext.getCmp('su_id').value);
  54. }
  55. },
  56. 'erpResSubmitButton': {
  57. afterrender: function(btn){
  58. var status = Ext.getCmp('su_statuscode');
  59. if(status && status.value != 'COMMITED'){
  60. btn.hide();
  61. }
  62. },
  63. click: function(btn){
  64. me.FormUtil.onResSubmit(Ext.getCmp('su_id').value);
  65. }
  66. },
  67. 'erpAuditButton': {
  68. afterrender: function(btn){
  69. var status = Ext.getCmp('su_statuscode');
  70. if(status && status.value != 'COMMITED'){
  71. btn.hide();
  72. }
  73. },
  74. click: function(btn){
  75. me.FormUtil.onAudit(Ext.getCmp('su_id').value);
  76. }
  77. },
  78. 'erpResAuditButton': {
  79. afterrender: function(btn){
  80. var status = Ext.getCmp('su_statuscode');
  81. if(status && status.value != 'AUDITED'){
  82. btn.hide();
  83. }
  84. },
  85. click: function(btn){
  86. me.FormUtil.onResAudit(Ext.getCmp('su_id').value);
  87. }
  88. },
  89. 'erpBackStencilButton':{//钢网归还
  90. click:function(btn){
  91. var win = new Ext.window.Window({
  92. modal : true,
  93. id : 'win',
  94. height : '35%',
  95. width : '30%',
  96. layout : 'anchor',
  97. bodyStyle: 'background: #f1f1f1;',
  98. bodyPadding:5,
  99. items : [{
  100. anchor: '100% 100%',
  101. xtype: 'form',
  102. bodyStyle: 'background: #f1f1f1;',
  103. defaults:{
  104. fieldStyle : "background:rgb(224, 224, 255);",
  105. labelStyle:"color:red;",
  106. allowBlank:false
  107. },
  108. items:[{
  109. xtype:'textareatrigger',
  110. name:'record',
  111. fieldLabel:'归还外观检测',
  112. id:'record'
  113. },{
  114. xtype:'datefield',
  115. name:'date',
  116. fieldLabel:'归还日期',
  117. id:'date'
  118. },{
  119. xtype:'dbfindtrigger',
  120. name:'pr_location',
  121. fieldLabel:'归还储位',
  122. id:'pr_location'
  123. }],
  124. buttonAlign : 'center',
  125. buttons: [{
  126. text: '确定' ,
  127. cls: 'x-btn-gray',
  128. iconCls: 'x-button-icon-save',
  129. id:'confirmBtn',
  130. formBind: true, //only enabled once the form is valid
  131. handler: function(btn) {
  132. me.backStencil(me.getForm(btn).getValues());
  133. }
  134. },{
  135. text: '取消' ,
  136. cls: 'x-btn-gray',
  137. iconCls: 'x-button-icon-close',
  138. handler: function(btn) {
  139. win.close();
  140. }
  141. }]
  142. }]
  143. });
  144. win.show();
  145. },
  146. afterrender: function(btn){
  147. var status = Ext.getCmp('su_statuscode');
  148. if(status && status.value != 'AUDITED'){
  149. btn.hide();
  150. }
  151. }
  152. }
  153. });
  154. },
  155. getForm: function(btn){
  156. return btn.ownerCt.ownerCt;
  157. },
  158. backStencil:function(data){//归还钢网
  159. Ext.getCmp('win').close();
  160. var su_id = Ext.getCmp("su_id").value,record = data['record'],
  161. date = data['date'],location = data['pr_location'];
  162. Ext.Ajax.request({
  163. url: basePath + 'pm/mes/backStencil.action',
  164. params: {
  165. caller : caller,
  166. id : su_id,
  167. record : record,
  168. location : location,
  169. date : date
  170. },
  171. async: false,
  172. callback: function(opt, s, r) {
  173. var rs = Ext.decode(r.responseText);
  174. if(rs.exceptionInfo) {
  175. showError(rs.exceptionInfo);
  176. }else{
  177. showMessage('提示','归还成功');
  178. window.location.href = window.location.href + '&formCondition=' +
  179. formCondition + '&gridCondition=' + gridCondition;
  180. }
  181. }
  182. });
  183. }
  184. });