UpdateMaterialWH.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * 更新用料表仓库
  3. */
  4. Ext.define('erp.view.core.button.UpdateMaterialWH',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpUpdateMaterialWHButton',
  7. param: [],
  8. id: 'erpUpdateMaterialWHButton',
  9. text: $I18N.common.button.erpUpdateMaterialWHButton,
  10. iconCls: 'x-button-icon-save',
  11. cls: 'x-btn-gray',
  12. width: 130,
  13. style: {
  14. marginLeft: '10px'
  15. },
  16. initComponent : function(){
  17. this.callParent(arguments);
  18. },
  19. handler: function() {
  20. var me = this, win = Ext.getCmp('Complaint-win');
  21. if(!win) {
  22. win = Ext.create('Ext.Window', {
  23. id: 'Complaint-win',
  24. title: '更新用料表仓库',
  25. height: 200,
  26. width: 400,
  27. items: [{
  28. margin: '10 0 0 0',
  29. xtype: 'dbfindtrigger',
  30. fieldLabel: '仓库编号',
  31. name:'wh_code',
  32. listeners:{
  33. aftertrigger:function(t, d){
  34. t.ownerCt.down('textfield[name=wh_code]').setValue(d.get('wh_code'));
  35. t.ownerCt.down('textfield[name=wh_description]').setValue(d.get('wh_description'));
  36. }
  37. }
  38. },{
  39. margin: '3 0 0 0',
  40. xtype: 'textfield',
  41. fieldLabel: '仓库名称',
  42. readOnly:true,
  43. name:'wh_description'
  44. }],
  45. closeAction: 'hide',
  46. buttonAlign: 'center',
  47. layout: {
  48. type: 'vbox',
  49. align: 'center'
  50. },
  51. buttons: [{
  52. text: $I18N.common.button.erpConfirmButton,
  53. cls: 'x-btn-blue',
  54. handler: function(btn) {
  55. var form = btn.ownerCt.ownerCt,
  56. whcode = form.down('dbfindtrigger[name=wh_code]');
  57. if((whcode.isDirty() && !Ext.isEmpty(whcode.value))) {
  58. me.updateMaterialWH(Ext.getCmp('ma_id').value, whcode.value);
  59. }
  60. }
  61. }, {
  62. text: $I18N.common.button.erpCloseButton,
  63. cls: 'x-btn-blue',
  64. handler: function(btn) {
  65. btn.ownerCt.ownerCt.hide();
  66. }
  67. }]
  68. });
  69. }
  70. win.show();
  71. },
  72. updateMaterialWH: function(id, whcode) {
  73. Ext.Ajax.request({
  74. url: basePath + 'pm/make/updateMaterialWH.action',
  75. params: {
  76. id: id,
  77. whcode: whcode,
  78. caller: caller
  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. Ext.Msg.alert("提示","更新成功!");
  86. window.location.reload();
  87. }
  88. }
  89. });
  90. }
  91. });