LoadRelation.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * 载入替代关系
  3. */
  4. Ext.define('erp.view.core.button.LoadRelation',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpLoadRelationButton',
  7. iconCls: 'x-button-icon-submit',
  8. cls: 'x-btn-gray',
  9. text: $I18N.common.button.erpLoadRelationButton,
  10. style: {
  11. marginLeft: '10px'
  12. },
  13. width: 130,
  14. initComponent : function(){
  15. this.callParent(arguments);
  16. },
  17. listeners: {
  18. afterrender: function(btn){
  19. var status = Ext.getCmp("bo_statuscode");
  20. if(status && status.value != 'ENTERING'){
  21. btn.hide();
  22. }
  23. },
  24. click: function(m){
  25. m.turn();
  26. }
  27. },
  28. turn: function(){
  29. var win = new Ext.window.Window({
  30. id : 'win',
  31. height: "100%",
  32. width: "80%",
  33. maximizable : true,
  34. buttonAlign : 'center',
  35. layout : 'anchor',
  36. items: [{
  37. tag : 'iframe',
  38. frame : true,
  39. anchor : '100% 100%',
  40. layout : 'fit',
  41. html : '<iframe src="' + basePath + 'jsps/common/editorColumn.jsp?caller=LoadRelation'
  42. + "&condition=prr_usestatuscode='AUDITED' and NVL(bd_usestatus,' ')<>'DISABLE' and bd_bomid=" + Ext.getCmp("bo_id").value + '" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>'
  43. }],
  44. buttons : [{
  45. name: 'confirm',
  46. text : $I18N.common.button.erpConfirmButton,
  47. iconCls: 'x-button-icon-confirm',
  48. cls: 'x-btn-gray',
  49. listeners: {
  50. buffer: 500,
  51. click: function(btn) {
  52. var _win = Ext.getCmp('win').items.items[0].body.dom.getElementsByTagName('iframe')[0].contentWindow,
  53. grid = _win.Ext.getCmp("editorColumnGridPanel");
  54. btn.setDisabled(true);
  55. grid.updateAction('pm/bom/loadRelation.action');
  56. _win.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. });