BOMTurn.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. *bom类型转转 bo_style,bo_level
  3. * */
  4. Ext.define('erp.view.core.button.BOMTurn',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpBomTurnButton',
  7. iconCls: 'x-button-icon-submit',
  8. cls: 'x-btn-gray',
  9. text:'转BOM',
  10. style: {
  11. marginLeft: '10px'
  12. },
  13. width: 100,
  14. handler:function(){
  15. var style = Ext.getCmp('bo_style'),
  16. level = Ext.getCmp('bo_level'),
  17. bg = 'background:#fffac0;color:#515151;';
  18. if(!style){
  19. style = {};
  20. style.allowBlank = true;
  21. }
  22. Ext.create('Ext.window.Window',{
  23. width:300,
  24. height:165,
  25. id:'win',
  26. title:'<h1>转换BOM</h1>',
  27. items:[{
  28. xtype:'dbfindtrigger',
  29. fieldLabel:'BOM类型',
  30. name:'bostyle',
  31. editable:true,
  32. id:'bostyle',
  33. fieldStyle: style.allowBlank ? '' : bg
  34. },{
  35. xtype:'dbfindtrigger',
  36. fieldLabel:'BOM等级',
  37. name:'bolevel',
  38. fieldStyle: level.allowBlank ? '' : bg,
  39. id:'bolevel'
  40. },{
  41. xtype:'checkbox',
  42. fieldLabel:'是否重置流程',
  43. name:'isprocess',
  44. id:'isprocess'
  45. }],
  46. buttonAlign:'center',
  47. buttons:[{
  48. xtype:'button',
  49. columnWidth:0.12,
  50. text:'保存',
  51. width:60,
  52. iconCls: 'x-button-icon-save',
  53. handler:function(btn){
  54. var bostyle=Ext.getCmp('bostyle').getValue();
  55. var bolevel=Ext.getCmp('bolevel').getValue();
  56. var isprocess=Ext.getCmp('isprocess').getValue();
  57. var boid=Ext.getCmp('bo_id').getValue();
  58. if(!style.allowBlank && !bostyle){
  59. showError('请先设置相应BOM类型!');
  60. return;
  61. }else if(!level.allowBlank && !bolevel){
  62. showError('请先设置相应BOM等级!');
  63. return;
  64. } else{
  65. var dd=new Object();
  66. dd['bolevel']=bolevel || '';
  67. dd['boid']=boid;
  68. dd['bostyle']=bostyle || '';
  69. dd['isprocess']=isprocess?1:0;
  70. Ext.Ajax.request({
  71. url : basePath +'pm/bom/turnBOM.action',
  72. params :{
  73. _noc:1,
  74. data:unescape(Ext.JSON.encode(dd))
  75. },
  76. method : 'post',
  77. callback : function(options,success,response){
  78. var localJson = new Ext.decode(response.responseText);
  79. if(localJson.success){
  80. Ext.Msg.alert('提示','更新成功!',function(){
  81. Ext.getCmp('win').close();
  82. window.location.reload();
  83. });
  84. } else if(localJson.exceptionInfo){
  85. var str = localJson.exceptionInfo;
  86. showError(str);
  87. return;
  88. } else{
  89. saveFailure();
  90. }
  91. }
  92. });
  93. }
  94. }
  95. },{
  96. xtype:'button',
  97. columnWidth:0.1,
  98. text:'关闭',
  99. width:60,
  100. iconCls: 'x-button-icon-close',
  101. margin:'0 0 0 10',
  102. handler:function(btn){
  103. Ext.getCmp('win').close();
  104. }
  105. }]
  106. }).show();
  107. },
  108. initComponent : function(){
  109. this.callParent(arguments);
  110. }
  111. });