VendorLevel.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * 修改供应商等级按钮
  3. */
  4. Ext.define('erp.view.core.button.VendorLevel', {
  5. extend : 'Ext.Button',
  6. alias : 'widget.erpVendorLevelButton',
  7. iconCls : 'x-button-icon-submit',
  8. cls : 'x-btn-gray',
  9. text : $I18N.common.button.erpVendorLevelButton,
  10. style : {
  11. marginLeft : '10px'
  12. },
  13. width : 120,
  14. initComponent : function() {
  15. this.callParent(arguments);
  16. },
  17. listeners: {
  18. afterrender: function(btn) {
  19. var status = Ext.getCmp('ve_auditstatuscode');
  20. if(status && status.value == 'ENTERING'){
  21. btn.hide();
  22. }
  23. }
  24. },
  25. handler: function() {
  26. var me = this, win = Ext.getCmp('vendorlevel-win');
  27. if(!win) {
  28. var f = Ext.getCmp('ve_level'),
  29. val = f ? f.value : '';
  30. win = Ext.create('Ext.Window', {
  31. id: 'vendorlevel-win',
  32. title: '设置供应商 ' + Ext.getCmp('ve_code').value + ' 的级别',
  33. height: 200,
  34. width: 400,
  35. items: [{
  36. margin: '30 0 0 0',
  37. xtype: 'combobox',
  38. allowBlank: false,
  39. editable: false,
  40. fieldLabel: '供应商级别',
  41. store:f.store,
  42. displayField: 'display',
  43. valueField: 'value',
  44. queryMode: 'local',
  45. value:val
  46. }],
  47. closeAction: 'hide',
  48. buttonAlign: 'center',
  49. layout: {
  50. type: 'vbox',
  51. align: 'center'
  52. },
  53. buttons: [{
  54. text: $I18N.common.button.erpConfirmButton,
  55. cls: 'x-btn-blue',
  56. handler: function(btn) {
  57. var tx = btn.ownerCt.ownerCt.down('combobox');
  58. if(tx.isDirty() && !Ext.isEmpty(tx.value)) {
  59. me.updateVendorUU(Ext.getCmp('ve_id').value, tx.value);
  60. }
  61. }
  62. }, {
  63. text: $I18N.common.button.erpCloseButton,
  64. cls: 'x-btn-blue',
  65. handler: function(btn) {
  66. btn.ownerCt.ownerCt.hide();
  67. }
  68. }]
  69. });
  70. }
  71. win.show();
  72. },
  73. updateVendorUU: function(id, val) {
  74. Ext.Ajax.request({
  75. url: basePath + 'scm/vendor/updateLevel.action',
  76. params: {
  77. id: id,
  78. ve_level: val
  79. },
  80. callback: function(opt, s, r) {
  81. var rs = Ext.decode(r.responseText);
  82. if(rs.exceptionInfo) {
  83. showError(rs.exceptionInfo);
  84. } else {
  85. alert('设置成功!');
  86. window.location.reload();
  87. }
  88. }
  89. });
  90. }
  91. });