TurnExOut.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * 转换货出库单按钮
  3. */
  4. Ext.define('erp.view.core.button.TurnExOut', {
  5. extend : 'Ext.Button',
  6. alias : 'widget.erpTurnExOutButton',
  7. iconCls : 'x-button-icon-submit',
  8. cls : 'x-btn-gray',
  9. id : 'turnout',
  10. text : $I18N.common.button.erpTurnExOutButton,
  11. style : {
  12. marginLeft : '10px'
  13. },
  14. width : 120,
  15. initComponent : function() {
  16. this.callParent(arguments);
  17. },
  18. listeners: {
  19. afterrender: function(btn){
  20. var status = Ext.getCmp('pi_statuscode');
  21. if(status && status.value != 'POSTED'){
  22. btn.hide();
  23. }
  24. },
  25. click: function(m){
  26. Ext.getCmp('turnout').turn('ProdInOut!ToExchangeOut!Deal', ' pd_piid=' + Ext.getCmp('pi_id').value +' and pd_yqty < pd_inqty + pd_outqty', 'scm/reserve/turnDefectOut.action?type=ProdInOut!ExchangeOut');
  27. }
  28. },
  29. turn: function(nCaller, condition, url){
  30. var win = new Ext.window.Window({
  31. id : 'win',
  32. height: "100%",
  33. width: "80%",
  34. maximizable : true,
  35. buttonAlign : 'center',
  36. layout : 'anchor',
  37. items: [{
  38. tag : 'iframe',
  39. frame : true,
  40. anchor : '100% 100%',
  41. layout : 'fit',
  42. html : '<iframe id="iframe_' + caller + '" src="' + basePath + 'jsps/common/editorColumn.jsp?caller=' + nCaller
  43. + "&condition=" + condition +'" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
  44. }],
  45. buttons : [{
  46. name: 'confirm',
  47. text : $I18N.common.button.erpConfirmButton,
  48. iconCls: 'x-button-icon-confirm',
  49. cls: 'x-btn-gray',
  50. listeners: {
  51. buffer: 500,
  52. click: function(btn) {
  53. var grid = Ext.getCmp('win').items.items[0].body.dom.getElementsByTagName('iframe')[0].contentWindow.Ext.getCmp("editorColumnGridPanel");
  54. btn.setDisabled(true);
  55. grid.updateAction(url);
  56. window.location.reload();
  57. }
  58. }
  59. }, {
  60. text : $I18N.common.button.erpCloseButton,
  61. iconCls: 'x-button-icon-close',
  62. cls: 'x-btn-gray',
  63. handler : function(){
  64. Ext.getCmp('win').close();
  65. }
  66. }]
  67. });
  68. win.show();
  69. }
  70. });