Ext.namespace('Shipping'); var FilePath = ''; Shipping.ImgFileView = function (config) { Ext.applyIf(this, config); FilePath = config.filePath; this.initUIComponents(); //Shipping.ImgFileView.superclass.constructor.call(this); window.Shipping.ImgFileView.superclass.constructor.call(this); }; Ext.extend(Shipping.ImgFileView, Ext.Panel, { ImgPath: null, TruckNo: null, EditRecord: null, initUIComponents: function () { this.FilePath =''; Ext.define('ZipViewMode', { extend: 'Ext.data.Model', idProperty: 'GID', fields: [ { name: 'GID', type: 'string' }, { name: 'ViewFileName', type: 'string' }, { name: 'ViewFilePath', type: 'string' } ] }); _this = this; this.storeList = Ext.create('Ext.data.Store', { model: 'ZipViewMode', pageSize: 50, remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/ZipViewFiles', reader: { id: 'GID', root: 'Data', totalProperty: 'totalCount' } } }); this.storeList.load({ params: { start: 0, limit: 50, sort: '', ZipFile:FilePath }, waitMsg: "正在查询数据...", callback: function (r, options, success) { if (success) { if (r.length > 0) { _this.EditRecord = this.storeList.getAt(0); _this.loadpic(); } else { Ext.Msg.show({ title: '警告', msg: '当前文件不支持预览', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } } }, scope: this }); //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", height:50, tbar: [{ text: "上一张", // iconCls: "btnsave", handler: function (button, event) { this.PrevRecord(); }, scope: this }, { text: "下一张", // iconCls: "btnsave", handler: function (button, event) { this.NextRecord(); }, scope: this },{ xtype: 'label', html: '下载' }] }); //end 按钮Toolbar //#endregion this.panelpdf = new Ext.Panel({ title: 'PDF信息', layout: "border", region: 'center', //height: 900, visible: true, // items: [this.gridCrChFee], // html: '', animate: true, frame: true }); //this.panelpdf.update(''); //Ext.apply(this, { // items: [this.panelBtn, this.panelpdf] //}); Ext.apply(this, { items: [this.panelBtn, this.panelpdf] }); //Ext.apply(this, { // //height: 600, // modal: true, // //width: 1000, // layout: "border", //设置为手风琴布局 // closable: true, // closeAction: 'hide', // draggable: true, // resizable: false, // items: [ // this.panelBtn,this.panelpdf // ] // , // xtype: "window" //}); }, loadpic: function () { this.panelpdf.setTitle(this.EditRecord.get('ViewFileName') + ' 总页数' + this.storeList.getCount()); this.panelpdf.update(''); this.FilePath = this.EditRecord.get('ViewFileName'); }, PrevRecord: function () { var j = this.storeList.indexOf(this.EditRecord); if (j == 0) { Ext.Msg.show({ title: '警告', msg: '已是最前一张', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } j = j - 1; this.EditRecord = this.storeList.getAt(j); this.loadpic(); }, NextRecord: function () { var j = this.storeList.indexOf(this.EditRecord); if (j == (this.storeList.getCount() - 1)) { Ext.Msg.show({ title: '警告', msg: '已是最后一张', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } j = j + 1; this.EditRecord = this.storeList.getAt(j); this.loadpic(); } });