UpdateSTF.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * 更新信息
  3. */
  4. Ext.define('erp.view.core.button.UpdateSTF',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpUpdateSTFButton',
  7. iconCls: 'x-button-icon-submit',
  8. cls: 'x-btn-gray',
  9. tooltip: '移模',
  10. id: 'erpUpdateSTFButton',
  11. text: $I18N.common.button.erpUpdateSTFButton,
  12. initComponent : function(){
  13. this.callParent(arguments);
  14. },
  15. width: 70,
  16. listeners: {
  17. afterrender: function(btn) {
  18. var me = this;
  19. var status = Ext.getCmp('ws_statuscode');
  20. if(status && status.value == 'ENTERING'){
  21. btn.hide();
  22. }
  23. }
  24. },
  25. handler: function() {
  26. var me = this, win = Ext.getCmp('Complaint-win');
  27. if(!win) {
  28. var vc = Ext.getCmp('ws_stf'),val1 = vc ? vc.value : '';
  29. win = Ext.create('Ext.Window', {
  30. id: 'Complaint-win',
  31. title: '更新保管书 ' + Ext.getCmp('ws_code').value + ' 的委托方',
  32. height: 200,
  33. width: 400,
  34. items: [{
  35. xtype: 'form',
  36. height: '100%',
  37. width: '100%',
  38. bodyStyle: 'background:#f1f2f5;',
  39. items: [{
  40. margin: '10 0 0 0',
  41. xtype: 'dbfindtrigger',
  42. fieldLabel: '受托方',
  43. name:'ws_stf',
  44. allowBlank: false,
  45. value: val1
  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 form = btn.ownerCt.ownerCt,
  58. a = form.down('dbfindtrigger[name=ws_stf]');
  59. if(form.getForm().isDirty()) {
  60. me.updatestf(Ext.getCmp('ws_id').value, a.value);
  61. }
  62. }
  63. }, {
  64. text: $I18N.common.button.erpCloseButton,
  65. cls: 'x-btn-blue',
  66. handler: function(btn) {
  67. btn.up('window').hide();
  68. }
  69. }]
  70. }]
  71. });
  72. }
  73. win.show();
  74. },
  75. updatestf: function(id, val1) {
  76. Ext.Ajax.request({
  77. url: basePath + 'pm/mould/updatestf.action',
  78. params: {
  79. id: id,
  80. vend: val1
  81. },
  82. callback: function(opt, s, r) {
  83. var rs = Ext.decode(r.responseText);
  84. if(rs.exceptionInfo) {
  85. showError(rs.exceptionInfo);
  86. } else {
  87. Ext.Msg.alert("提示","更新成功!");
  88. window.location.reload();
  89. }
  90. }
  91. });
  92. }
  93. });