Ext.QuickTips.init(); Ext.define('erp.controller.pm.bom.BOMCost', { extend: 'Ext.app.Controller', FormUtil: Ext.create('erp.util.FormUtil'), BaseUtil: Ext.create('erp.util.BaseUtil'), views:[ 'pm.bom.BOMCost','core.form.Panel', 'core.trigger.DbfindTrigger', 'core.button.Print','core.button.Close','core.button.BOMCost','core.button.Gather' ], init:function(){ this.control({ 'erpCloseButton': { click: function(btn){ this.FormUtil.beforeClose(this); } }, 'erpBOMCostButton': { click: function(btn) { var form = btn.ownerCt.ownerCt, bo_id = Ext.getCmp('bo_id').value, pr_code = Ext.getCmp('bo_mothercode').value; if(bo_id==""){bo_id=0;} //if(bo_id > 0) { console.log(bo_id); form.setLoading(true); Ext.Ajax.request({ url: basePath + 'pm/bom/cost.action', params: { bo_id: bo_id, pr_code: pr_code }, timeout: 60000, callback: function(opt, s, r) { form.setLoading(false); var rs = Ext.decode(r.responseText); Ext.getCmp('bo_id').setValue(rs.data.boid); if(rs.success) { alert('计算完成!'); } } }); //} } }, 'erpPrintButton': { click:function(btn){ var reportName = "BOMCostView", id = Ext.getCmp('bo_id').value, prodcode=Ext.getCmp('bo_mothercode').value, condition = '{BOM.bo_id}=' + id+' and {BomStruct.bs_topmothercode}='+"'"+Ext.getCmp('bo_mothercode').value+"'"; console.log(condition); this.FormUtil.onwindowsPrintBom(id, reportName, condition,prodcode); } }, 'erpGatherButton': { click:function(btn){ var reportName = "BOMCostView", id = Ext.getCmp('bo_id').value, condition = '{BOM.bo_id}=' + id+' and '+'{BOMSTRUCT.bs_sonbomid}>'+"0"; this.FormUtil.onwindowsPrint(id, reportName, condition); } } }); } });