Ext.namespace('DsTruck'); DsTruck.FileImport = function (config) { Ext.applyIf(this, config); this.initUIComponents(); DsTruck.FileImport.superclass.constructor.call(this); }; Ext.extend(DsTruck.FileImport, Ext.Window, { StoreList: null, initUIComponents: function () { // BEGIN OF CODE GENERATION PARTS, DON'T DELETE CODE BELOW Ext.apply(this, { height: 170, width:200, closable: true, draggable: true, defaultButton: 'btnImport', resizable: false, items: [{ region: "center", frame: "true", items: [{ xtype: 'filefield', name: 'file', fieldLabel: 'Excel文件', labelWidth: 80, anchor: '100%', buttonText: '选择文件...' }, { xtype: 'label', //name: 'label1', text: '依照箱号导入,相同的数据会覆盖。', //labelWidth: 80, //anchor: '100%' }], xtype: "form", layout: "form", id: 'importForm', buttons: [{ text: "导入", id: 'btnImport', handler: function (button, event) { var form = Ext.getCmp("importForm").getForm(); var storeList = this.StoreList; //var form = this.up("form").getForm(); if (form.isValid()) { form.submit({ url: '/Import/xxh_single/File', waitMsg: '正在导入文件...', success: function (f, a) { var result = a.result; /*, dataList = result.data; for (var i = 0; i < dataList.length; i++) { var record = dataList[i]; storeList.add(record); }*/ var win = Ext.getCmp("importWin"); win.close(); Ext.Msg.alert('Success', result.Message); }, failure: function (f, a) { Ext.Msg.alert('Failure', a.result.Message); } }); } //this.onImportClick(button, event); }, scope: this }, { text: "关闭", handler: function (button, event) { var win = this.up("window"); // Ext.getCmp("importWin"); win.close(); } }] }], layout: "border", width: 300, xtype: "window", id: "importWin"/*, closeAction: "close"*/ }); // END OF CODE GENERATION PARTS, DON'T DELETE CODE ABOVE } });