UpdateChargeStatus.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /**
  2. * 更新供应商返还
  3. */
  4. Ext.define('erp.view.core.button.UpdateChargeStatus',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpUpdateChargeStatusButton',
  7. iconCls: 'x-button-icon-submit',
  8. cls: 'x-btn-gray',
  9. tooltip: '更新收款状态',
  10. id: 'erpUpdateChargeStatusButton',
  11. text: $I18N.common.button.erpUpdateChargeStatusButton,
  12. width: 120,
  13. initComponent : function(){
  14. this.callParent(arguments);
  15. },
  16. listeners: {
  17. afterrender: function(btn) {
  18. var me = this;
  19. var status = Ext.getCmp('msa_statuscode');
  20. if(status && (status.value != 'AUDITED')){
  21. btn.hide();
  22. }
  23. }
  24. },
  25. handler: function() {
  26. var me = this, win = Ext.getCmp('Complaint-win');
  27. var states = Ext.create('Ext.data.Store', {
  28. fields: ['abbr', 'name'],
  29. data : [
  30. {"abbr":"未收款", "name":"未收款"},
  31. {"abbr":"部分收款", "name":"部分收款"},
  32. {"abbr":"已收款", "name":"已收款"}
  33. ]
  34. });
  35. if(!win) {
  36. var cs = Ext.getCmp('msa_chargestatus'), cr = Ext.getCmp('msa_chargeremark'),
  37. val1 = cs ? cs.value : '', val2 = cr ? cr.value : '';
  38. win = Ext.create('Ext.Window', {
  39. id: 'Complaint-win',
  40. title: '更新收款状态',
  41. height: 200,
  42. width: 400,
  43. items: [{
  44. xtype: 'form',
  45. height: '100%',
  46. width: '100%',
  47. bodyStyle: 'background:#f1f2f5;',
  48. items: [{
  49. margin: '10 0 0 0',
  50. xtype: 'combo',
  51. fieldLabel: '收款状态',
  52. name:'msa_chargestatus',
  53. allowBlank: false,
  54. store: states,
  55. queryMode: 'local',
  56. displayField: 'name',
  57. valueField: 'abbr',
  58. value: val1
  59. },{
  60. margin: '3 0 0 0',
  61. xtype: 'textareatrigger',
  62. name:'msa_chargeremark',
  63. fieldLabel: '收款备注',
  64. value: val2
  65. }],
  66. closeAction: 'hide',
  67. buttonAlign: 'center',
  68. layout: {
  69. type: 'vbox',
  70. align: 'center'
  71. },
  72. buttons: [{
  73. text: $I18N.common.button.erpConfirmButton,
  74. cls: 'x-btn-blue',
  75. handler: function(btn) {
  76. var form = btn.ownerCt.ownerCt,
  77. cs = form.down('textfield[name=msa_chargestatus]'),
  78. cr = form.down('textfield[name=msa_chargeremark]')
  79. if(form.getForm().isDirty()) {
  80. me.updatevendReturn(Ext.getCmp('msa_id').value, cs.value, cr.value);
  81. }
  82. }
  83. }, {
  84. text: $I18N.common.button.erpCloseButton,
  85. cls: 'x-btn-blue',
  86. handler: function(btn) {
  87. btn.up('window').hide();
  88. }
  89. }]
  90. }]
  91. });
  92. }
  93. win.show();
  94. },
  95. updatevendReturn: function(id, cs, cr) {
  96. Ext.Ajax.request({
  97. url: basePath + 'pm/mould/mouldsale/updatechargestatus.action',
  98. params: {
  99. id: id,
  100. returnstatus: cs,
  101. returnremark: cr
  102. },
  103. callback: function(opt, s, r) {
  104. var rs = Ext.decode(r.responseText);
  105. if(rs.exceptionInfo) {
  106. showError(rs.exceptionInfo);
  107. } else {
  108. Ext.Msg.alert("提示","更新成功!");
  109. window.location.reload();
  110. }
  111. }
  112. });
  113. }
  114. });