GetMakePrepareBarcode.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. Ext.define('erp.view.core.button.GetMakePrepareBarcode',{
  2. extend: 'Ext.Button',
  3. alias: 'widget.erpGetMPBarcodeButton',
  4. id: 'erpGetMPBarcodeButton',
  5. iconCls : 'x-button-icon-submit',
  6. cls : 'x-btn-gray',
  7. text : $I18N.common.button.erpGetMPBarcodeButton,
  8. style : {
  9. marginLeft : '10px'
  10. },
  11. width:120,
  12. initComponent : function(){
  13. this.callParent(arguments);
  14. },
  15. handler: function(btn){
  16. this.getMPBarcodeButton(btn);
  17. },
  18. getMPBarcodeButton:function(btn){
  19. var form = Ext.getCmp('form'),
  20. keyvalue = Ext.getCmp(form.keyField).value;
  21. warnMsg('是否确认获取料卷号?', function(btn){
  22. if(btn == 'yes'){
  23. form.BaseUtil.getActiveTab().setLoading(true);//loading...
  24. Ext.Ajax.request({
  25. url : basePath + "pm/mes/getMakePrepareBarcode.action",
  26. params: {
  27. id: keyvalue
  28. },
  29. method : 'post',
  30. callback : function(options,success,response){
  31. form.BaseUtil.getActiveTab().setLoading(false);
  32. var localJson = new Ext.decode(response.responseText);
  33. if(localJson.exceptionInfo){
  34. var str = localJson.exceptionInfo;
  35. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  36. str = str.replace('AFTERSUCCESS<br>', '');
  37. showMessage('提示', str);
  38. return;
  39. }else{
  40. showError(str);return;
  41. }
  42. }
  43. if(localJson.success){
  44. showMessage('提示', '获取成功!', 1000);
  45. window.location.reload();
  46. } else {
  47. showError('获取失败!');
  48. return;
  49. }
  50. }
  51. });
  52. }
  53. });
  54. }
  55. });