ShiPAddressUpdate.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * 更新交货地点按钮
  3. */
  4. Ext.define('erp.view.core.button.ShiPAddressUpdate',{
  5. extend : 'Ext.Button',
  6. alias : 'widget.erpShiPAddressUpdateButton',
  7. iconCls : 'x-button-icon-submit',
  8. cls : 'x-btn-gray',
  9. text : $I18N.common.button.erpShiPAddressUpdateButton,
  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 me = this;
  20. }
  21. },
  22. handler: function() {
  23. var me = this, win = Ext.getCmp('ShiPAddress-win');
  24. if(!win) {
  25. var address=Ext.getCmp('ma_shipaddresscode'),
  26. val1 = address ? address.value:'';
  27. win = Ext.create('Ext.Window', {
  28. id: 'ShiPAddress-win',
  29. title: '更新委外单 ' + Ext.getCmp('ma_code').value + ' 的交货地点',
  30. height: 100,
  31. width: 400,
  32. buttonAlign: 'center',
  33. items: [{
  34. xtype: 'form',
  35. height: '100%',
  36. width: '100%',
  37. bodyStyle: 'background:#f1f2f5;',
  38. items: [{
  39. margin: '10 0 0 0',
  40. xtype: 'dbfindtrigger',
  41. fieldLabel: '交货地点',
  42. name:'ma_shipaddresscode',
  43. allowBlank: false,
  44. value: val1,
  45. width: 350
  46. }],
  47. buttons: [{
  48. text: $I18N.common.button.erpConfirmButton,
  49. cls: 'x-btn-blue',
  50. handler: function(btn) {
  51. var form = btn.ownerCt.ownerCt,
  52. a = form.down('dbfindtrigger[name=ma_shipaddresscode]');
  53. if(form.getForm().isDirty()) {
  54. me.updateShiPAddress(Ext.getCmp('ma_id').value, a.value);
  55. }
  56. }
  57. },{
  58. text: $I18N.common.button.erpCloseButton,
  59. cls: 'x-btn-blue',
  60. handler: function(btn) {
  61. btn.up('window').hide();
  62. }
  63. }]
  64. }]
  65. });
  66. }
  67. win.show();
  68. },
  69. updateShiPAddress: function(id, val1, i) {
  70. Ext.Ajax.request({
  71. url: basePath + 'pm/make/updateShiPAddress.action',
  72. params: {
  73. id: id,
  74. address: val1,
  75. caller: caller
  76. },
  77. callback: function(opt, s, r) {
  78. var rs = Ext.decode(r.responseText);
  79. if(rs.exceptionInfo) {
  80. showError(rs.exceptionInfo);
  81. } else {
  82. Ext.Msg.alert("提示","更新成功!");
  83. window.location.reload();
  84. }
  85. }
  86. });
  87. }
  88. });