12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- Ext.define('erp.view.core.button.BomDetailPanelImp', {
- extend : 'Ext.form.Panel',
- alias : 'widget.erpBomDetailPanelImpButton',
- id : 'BomDetailPanelImp',
- hidden : true,
- initComponent : function() {
- if (this.iconCls) {
- this.items[0].buttonConfig.iconCls = this.iconCls;
- }
- if (this.cls) {
- this.items[0].buttonConfig.cls = this.cls;
- }
- if (this.itemCls) {
- this.items[0].buttonConfig.cls = this.itemCls;
- }
- if (this.iconCls) {
- this.items[0].buttonConfig.text = this.text;
- }
- this.callParent(arguments);
- },
- items : [ {
- xtype : 'filefield',
- name : 'file',
- buttonOnly : true,
- hideLabel : true,
- buttonConfig : {
- width : 150,
- height : 26,
- iconCls : 'x-button-icon-excel',
- cls : 'x-btn-gray',
- id:'filefieldBtn',
- enableKeyEvents : true,
- text : $I18N.common.button.erpBomDetailPanelImpButton
- },
- listeners : {
- change : function(field) {
- field.ownerCt.upexcel(field);
- }
- }
- } ],
- upexcel : function(field) {
- var me=this;
- var form = Ext.getCmp('form'), keyValue=Ext.getCmp(form.keyField).value;
- if(!keyValue){
- showError("请选择需要匹配的BOM!");
- return;
- }
- me.getForm().submit({
- url : basePath + 'scm/product/uploadBomDetailPanelImp.action?caller=' + caller+'&keyValue='+keyValue,
- waitMsg : "正在解析Excel",
- timeout:100000,
- success : function(fp, o) {
- field.reset();
- var bomDetailPanelGrid = Ext.getCmp('bomDetailPanelGrid'),
- grid = Ext.getCmp('grid'),
- tab = Ext.getCmp('BOMDetailPanelTab');
- if(bomDetailPanelGrid && o.result.remark && o.result.remark != "[]"){
- showError("匹配失败!");
- bomDetailPanelGrid.store.loadData(eval(o.result.remark));
- tab.setActiveTab('bomDetailPanelGrid');
- }else{
- bomDetailPanelGrid.store.loadData([]);
- tab.setActiveTab('grid');
- showMessage('提示', '匹配成功!');
- }
- if(grid){
- var param={
- caller:caller,
- condition:'bdi_bomid ='+keyValue
- };
- grid.GridUtil.loadNewStore(grid,param);
- }
- },
- failure : function(fp, o) {
- if (o.result.size) {
- showError(o.result.error + " " + Ext.util.Format.fileSize(o.result.size));
- field.reset();
- } else {
- showError(o.result.error);
- field.reset();
- }
- }
- });
- }
- });
|