BOMTurn.js 3.5 KB

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