Ext.namespace('Shipping'); Shipping.FileUpload = function (config) { Ext.applyIf(this, config); this.initUIComponents(); Shipping.FileUpload.superclass.constructor.call(this); }; Ext.regModel('CertType', { fields: [{ name: 'value' }, { name: 'text' }] }); Ext.extend(Shipping.FileUpload, Ext.Window, { GID: null, BillNo: null, File_DocType: null, File_DocNo:null, Obj: null, FileBillType: "",//用于表示附件属于什么业务 在结算中需要做相应的处理 CallBackFun: function() {}, initUIComponents: function () { this.storeType = new Ext.data.Store({ model: 'CertType', data: [ { 'value': '0', 'text': '请选择' }, { 'value': '1', 'text': '行车证' }, { 'value': '2', 'text': '营运证' }, { 'value': '3', 'text': '驾驶证' }, { 'value': '4', 'text': '资格证' }, { 'value': '5', 'text': '车俩照片' }, { 'value': '6', 'text': '驾驶员身份证'}] }); _this = this; this.cmbType = Ext.create('Ext.form.ComboBox', { fieldLabel: '文件类型', queryMode: 'local', name: 'File_Type', triggerAction: 'all', valueField: 'value', displayField: 'text', store: this.storeType, listeners: { afterRender: function (combo) { var firstValue = _this.storeType.data.items[0].data.value; combo.setValue(firstValue); //同时下拉框会将与name为firstValue值对应的 text显示 } } }); Ext.apply(this, { height: 150, width: 300, closable: true, draggable: true, defaultButton: 'btnImport', closeAction: 'destroy', resizable: false, modal: true, items: [{ region: "center", frame: "true", items: [ //this.cmbType, { xtype: 'filefield', name: 'file', fieldLabel: '附件', labelWidth: 80, anchor: '100%', buttonText: '选择文件...' }, { xtype: 'textfield', hidden: true, hideLabel: true, name: 'BillNo', labelWidth: 80 }, { xtype: 'textfield', hidden: true, hideLabel: true, name: 'FileBillType', labelWidth: 80 } , { xtype: 'textfield', fieldLabel: '单据类型', name: 'File_DocType', // readOnly:true, labelWidth: 80 }, { xtype: 'textfield', fieldLabel: '单据编号', name: 'File_DocNo', // readOnly: true, labelWidth: 80 } ], xtype: "form", layout: "form", id: 'importForm', buttons: [{ text: "上传", handler: function (button, event) { var form = Ext.getCmp("importForm").getForm(); form.findField('BillNo').setValue(this.BillNo); form.findField('FileBillType').setValue(this.FileBillType); var typenum = 1; if (typenum == null || typenum == 'null' || typenum == '0') { Ext.MessageBox.alert('提示', '请选择要上传证件的类型!'); return; } if (form.isValid()) { form.submit({ url: '/Account/Chfee_payapplication/FileUpload', waitMsg: '正在上传文件...', success: function (f, a) { var win = Ext.getCmp("uploadWin"); win.close(); Ext.Msg.alert('提示', '附件上传成功!'); //if (_this.Obj != null) // _this.CallBackFun(_this.Obj); //else try { if (panelEdit) panelEdit.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: win.BillNo } }); } catch { } try { if (panelIndex) panelIndex.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: win.BillNo } }); } catch { } // .LoadData('edit', "BILLNO='" + win.BillNo + "'"); }, failure: function (f, a) { Ext.Msg.alert('提示', '附件上传失败!' + a.result.Message); } }); } }, scope: this }, { text: '批量上传附件', tooltip: '批量上传附件', iconCls: "btnadddetail", handler: function (button, event) { this.UploadFile("", ""); }, scope: this }, { text: "关闭", handler: function (button, event) { var win = Ext.getCmp("uploadWin"); win.close(); } }] }], layout: "border", xtype: "window", id: 'uploadWin', listeners: { afterRender: function (combo) { var form = Ext.getCmp("importForm").getForm(); form.findField('File_DocType').setValue(this.File_DocType); form.findField('File_DocNo').setValue(this.File_DocNo); } } }); // END OF CODE GENERATION PARTS, DON'T DELETE CODE ABOVE } , UploadFile: function (uploadFileType, title) { var billno = this.BillNo; //var BSNO = this.strBSNO; var winUpload = Ext.create('Ext.window.Window', { layout: 'fit', title: '上传' + title, width: 600, height: 500, modal: true, plain: true, autoScroll: true, bodyStyle: "padding:5px 0 0 5px", items: { xtype: "panel", layout: 'fit', border: false, frame: false, autoScroll: true, html: "" }, buttonAlign: "center", buttons: [{ text: "关 闭", handler: function () { winUpload.close(); } }] }); //_UploadFileStore = panelEdit.storeChfeeFile; //_condition = " BSNO='" + BSNO + "' "; _BILLNO = billno; _FileBillType = this.FileBillType //_CUSTNO = billno; winFXTZModifyShow = _this.winFXTZModifyShow; extParentWinFrame = winUpload; winUpload.show(); this.close(); } });