You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
168 lines
5.0 KiB
JavaScript
168 lines
5.0 KiB
JavaScript
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: '<a href="' + this.FilePath + '" style=' + '"text-decoration:none"' + ' >下载</a>'
|
|
}]
|
|
}); //end 按钮Toolbar
|
|
//#endregion
|
|
|
|
this.panelpdf = new Ext.Panel({
|
|
title: 'PDF信息',
|
|
layout: "border",
|
|
region: 'center',
|
|
//height: 900,
|
|
visible: true,
|
|
|
|
// items: [this.gridCrChFee],
|
|
// html: '<iframe src="../../../../images/11111.pdf" frameborder="0" width="100%" height="100%"></iframe>',
|
|
animate: true,
|
|
frame: true
|
|
});
|
|
//this.panelpdf.update('<iframe src="' + FilePath + '" frameborder="0" width="100%" height="100%"></iframe>');
|
|
|
|
//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('<iframe src="' + this.EditRecord.get('ViewFilePath') + '" frameborder="0" width="100%" height="100%"></iframe>');
|
|
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();
|
|
|
|
}
|
|
|
|
}); |