SendToProdInout.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /**
  2. * 保存按钮
  3. * 适用于单据新增页面的保存,
  4. * 使用时,只需传递一个提交后台的saveUrl即可
  5. * @author yingp
  6. * @date 2012-08-03 10:45:49
  7. */
  8. Ext.define('erp.view.core.button.SendToProdInout',{
  9. extend: 'Ext.Button',
  10. alias: 'widget.erpSendToProdInoutButton',
  11. iconCls: 'x-button-icon-delete',
  12. cls: 'x-btn-gray',
  13. id: 'SendToProdInout',
  14. tooltip: '关联认定入库',
  15. text: $I18N.common.button.erpSendToProdInoutButton,
  16. width: 120,
  17. menu: [{
  18. iconCls: 'main-msg',
  19. text: $I18N.common.button.erpToPurInoutButton,
  20. listeners: {
  21. click: function(btn){
  22. var form= Ext.getCmp("form");
  23. var id = Ext.getCmp("ss_id").value;
  24. form.setLoading(true);
  25. warnMsg('确定要关联入库吗?', function(btn){
  26. if (btn == 'yes') {
  27. Ext.Ajax.request({
  28. url:basePath + "scm/product/SendToPurInout.action",
  29. params:{
  30. formStore: unescape(Ext.JSON.encode(form.getValues()).replace(/\\/g,"%"))
  31. },
  32. method:'post',
  33. callback:function(options,success,response){
  34. form.setLoading(false);
  35. var res = new Ext.decode(response.responseText);
  36. if(res.success){
  37. var id = res.id;
  38. var url = "jsps/scm/reserve/prodInOut.jsp?whoami=ProdInOut!PurcCheckin&formCondition=pi_id=" + id + "&gridCondition=pd_piid=" + id;
  39. showError('<a href="javascript:openUrl(\''+url+'\');">' + '采购验收单'+id + '</a>');
  40. }
  41. if(res.exceptionInfo){
  42. showError(res.exceptionInfo);
  43. }
  44. }
  45. });
  46. } else {
  47. return;
  48. }
  49. });
  50. }
  51. }
  52. },{
  53. iconCls: 'main-msg',
  54. text: $I18N.common.button.erpToOtherInoutButton,
  55. listeners: {
  56. click: function(btn){
  57. var form= Ext.getCmp("form");
  58. var id = Ext.getCmp("ss_id").value;
  59. form.setLoading(true);
  60. warnMsg('确定要关联入库吗?', function(btn){
  61. if (btn == 'yes') {
  62. Ext.Ajax.request({
  63. url:basePath + "scm/product/SendToProdInout.action",
  64. params:{
  65. formStore: unescape(Ext.JSON.encode(form.getValues()).replace(/\\/g,"%"))
  66. },
  67. method:'post',
  68. callback:function(options,success,response){
  69. form.setLoading(false);
  70. var res = new Ext.decode(response.responseText);
  71. if(res.success){
  72. var id = res.id;
  73. var url = "jsps/scm/reserve/prodInOut.jsp?whoami=ProdInOut!OtherIn&formCondition=pi_id=" + id + "&gridCondition=pd_piid=" + id;
  74. showError('<a href="javascript:openUrl(\''+url+'\');">' + '其它入库单'+id + '</a>');
  75. }
  76. if(res.exceptionInfo){
  77. showError(res.exceptionInfo);
  78. }
  79. }
  80. });
  81. } else {
  82. return;
  83. }
  84. });
  85. }
  86. }
  87. }],
  88. initComponent : function(){
  89. this.callParent(arguments);
  90. },
  91. handler: function(){
  92. }
  93. });