UpdateProdInoutrate.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /**
  2. * 委外信息修改按钮
  3. */
  4. Ext.define('erp.view.core.button.UpdateProdInoutrate',{
  5. extend : 'Ext.Button',
  6. alias : 'widget.UpdateProdInoutrateButton',
  7. iconCls : 'x-button-icon-submit',
  8. cls : 'x-btn-gray',
  9. //text : $I18N.common.button.erpOSVendorUpdateButton,
  10. style : {
  11. marginLeft : '10px'
  12. },
  13. width : 140,
  14. initComponent : function() {
  15. this.callParent(arguments);
  16. },
  17. listeners: {
  18. afterrender: function(btn) {
  19. var status = Ext.getCmp('ma_statuscode');
  20. if(status && status.value == 'ENTERING'){
  21. btn.hide();
  22. }
  23. }
  24. },
  25. handler: function() {
  26. var me = this, win = Ext.getCmp('Complaint-win');
  27. if(!win) {
  28. var vc = Ext.getCmp('ma_vendcode'), vn = Ext.getCmp('ma_vendname'),
  29. pr = Ext.getCmp('ma_price'), cr = Ext.getCmp('ma_currency'),tr = Ext.getCmp('ma_taxrate'),
  30. pac = Ext.getCmp('ma_paymentscode'), pan = Ext.getCmp('ma_payments'),
  31. val1 = vc ? vc.value : '', val2 = vn ? vn.value : '', val3 = pr ? pr.value : '',
  32. val4 = cr ? cr.value : '', val5 = tr ? tr.value : '', val6 = pac ? pac.value : '',
  33. val7 = pan ? pan.value : '';
  34. win = Ext.create('Ext.Window', {
  35. id: 'Complaint-win',
  36. title: '更新委外单 ' + Ext.getCmp('ma_code').value + ' 的委外信息',
  37. height: 300,
  38. width: 400,
  39. items: [{
  40. margin: '10 0 0 0',
  41. xtype: 'dbfindtrigger',
  42. fieldLabel: '委外商号',
  43. name:'ma_vendcode',
  44. value: val1,
  45. listeners:{
  46. aftertrigger:function(t, d){
  47. t.ownerCt.down('textfield[name=ma_vendname]').setValue(d.get('ve_name'));
  48. }
  49. }
  50. },{
  51. margin: '3 0 0 0',
  52. xtype: 'textfield',
  53. fieldLabel: '委外商名',
  54. readOnly:true,
  55. name:'ma_vendname',
  56. value: val2
  57. },{
  58. margin: '3 0 0 0',
  59. xtype: 'dbfindtrigger',
  60. fieldLabel: '币别',
  61. name:'ma_currency',
  62. value: val4
  63. },{
  64. margin: '3 0 0 0',
  65. xtype: 'textfield',
  66. fieldLabel: '税率',
  67. name:'ma_taxrate',
  68. value: val5
  69. },{
  70. margin: '3 0 0 0',
  71. xtype: 'textfield',
  72. fieldLabel: '加工单价',
  73. name:'ma_price',
  74. value: val3
  75. },{
  76. margin: '3 0 0 0',
  77. xtype: 'dbfindtrigger',
  78. fieldLabel: '付款方式编号',
  79. name:'ma_paymentscode',
  80. value: val6,
  81. listeners:{
  82. aftertrigger:function(t, d){
  83. t.ownerCt.down('textfield[name=ma_payments]').setValue(d.get('pa_name'));
  84. }
  85. }
  86. },{
  87. margin: '3 0 0 0',
  88. xtype: 'textfield',
  89. fieldLabel: '付款方式',
  90. name:'ma_payments',
  91. readOnly:true,
  92. value: val7
  93. }],
  94. closeAction: 'hide',
  95. buttonAlign: 'center',
  96. layout: {
  97. type: 'vbox',
  98. align: 'center'
  99. },
  100. buttons: [{
  101. text: $I18N.common.button.erpConfirmButton,
  102. cls: 'x-btn-blue',
  103. handler: function(btn) {
  104. var form = btn.ownerCt.ownerCt,
  105. a = form.down('dbfindtrigger[name=ma_vendcode]'),
  106. b = form.down('dbfindtrigger[name=ma_currency]'),
  107. c = form.down('textfield[name=ma_taxrate]'),
  108. d = form.down('textfield[name=ma_price]'),
  109. e = form.down('textfield[name=ma_paymentscode]'),
  110. f = form.down('textfield[name=ma_payments]');
  111. if((a.isDirty() && !Ext.isEmpty(a.value)) || (b.isDirty() && !Ext.isEmpty(b.value)) || (
  112. c.isDirty() && !Ext.isEmpty(c.value)) ||(d.isDirty() && !Ext.isEmpty(d.value))) {
  113. me.updateOSVendor(Ext.getCmp('ma_id').value, a.value, b.value, c.value, d.value, e.value, f.value);
  114. }
  115. }
  116. }, {
  117. text: $I18N.common.button.erpCloseButton,
  118. cls: 'x-btn-blue',
  119. handler: function(btn) {
  120. btn.ownerCt.ownerCt.hide();
  121. }
  122. }]
  123. });
  124. }
  125. win.show();
  126. },
  127. updateOSVendor: function(id, val1, val2, val3, val4, val5, val6) {
  128. Ext.Ajax.request({
  129. url: basePath + 'pm/make/updateOSVendor.action',
  130. params: {
  131. id: id,
  132. vend: val1,
  133. curr: val2,
  134. taxr: val3,
  135. price: val4,
  136. paymc: val5,
  137. paym: val6
  138. },
  139. callback: function(opt, s, r) {
  140. var rs = Ext.decode(r.responseText);
  141. if(rs.exceptionInfo) {
  142. showError(rs.exceptionInfo);
  143. } else {
  144. Ext.Msg.alert("提示","更新成功!");
  145. window.location.reload();
  146. }
  147. }
  148. });
  149. }
  150. });