UpdateMakeRemark.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /**
  2. * 修改供应商UU按钮
  3. */
  4. Ext.define('erp.view.core.button.UpdateMakeRemark', {
  5. extend : 'Ext.Button',
  6. alias : 'widget.erpUpdateMakeRemarkButton',
  7. iconCls : 'x-btn-uu-medium',
  8. cls : 'x-btn-gray',
  9. text : $I18N.common.button.erpUpdateMakeRemarkButton,
  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('ma_statuscode');
  20. if(status && status.value == 'ENTERING'){
  21. btn.hide();
  22. }
  23. }
  24. },
  25. handler: function() {
  26. var me = this, win = Ext.getCmp('vendoruu-win');
  27. if(!win) {
  28. var f = Ext.getCmp('ma_remark'),
  29. val = f ? f.value : '';
  30. win = Ext.create('Ext.Window', {
  31. id: 'vendoruu-win',
  32. title: '更新备注',
  33. height: 200,
  34. width: 400,
  35. items: [{
  36. margin: '30 0 0 0',
  37. xtype: 'textfield',
  38. fieldLabel: '更新备注',
  39. value: val
  40. }],
  41. closeAction: 'hide',
  42. buttonAlign: 'center',
  43. layout: {
  44. type: 'vbox',
  45. align: 'center'
  46. },
  47. buttons: [{
  48. text: $I18N.common.button.erpConfirmButton,
  49. cls: 'x-btn-blue',
  50. handler: function(btn) {
  51. var tx = btn.ownerCt.ownerCt.down('textfield');
  52. if(tx.isDirty() && !Ext.isEmpty(tx.value)) {
  53. me.updateProductStatus(Ext.getCmp('ma_id').value, tx.value);
  54. }
  55. }
  56. }, {
  57. text: $I18N.common.button.erpCloseButton,
  58. cls: 'x-btn-blue',
  59. handler: function(btn) {
  60. btn.ownerCt.ownerCt.hide();
  61. }
  62. }]
  63. });
  64. }
  65. win.show();
  66. },
  67. updateProductStatus: function(id, val) {
  68. Ext.Ajax.request({
  69. url: basePath + 'pm/make/updateRemark.action',
  70. params: {
  71. id: id,
  72. value: val
  73. },
  74. callback: function(opt, s, r) {
  75. var rs = Ext.decode(r.responseText);
  76. if(rs.exceptionInfo) {
  77. showError(rs.exceptionInfo);
  78. } else {
  79. alert('设置成功!');
  80. window.location.reload();
  81. }
  82. }
  83. });
  84. }
  85. });