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.
DS7/DSWeb/Areas/Account/Viewsjs/Chfee_payapplication/FileView.js

111 lines
3.4 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
var FilePath = '';
Shipping.FileView = function (config) {
Ext.applyIf(this, config);
FilePath = config.filePath;
this.initUIComponents();
Shipping.FileView.superclass.constructor.call(this);
};
Ext.regModel('CertType', {
fields: [{ name: 'value' }, { name: 'text'}]
})
var 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': '驾驶员身份证'}]
});
var cmbType = Ext.create('Ext.form.ComboBox', {
fieldLabel: '文件类型',
queryMode: 'local',
name: 'Cert_Type',
id: 'CertType',
triggerAction: 'all',
valueField: 'value',
displayField: 'text',
store: storeType,
listeners: {
afterRender: function (combo) {
var firstValue = storeType.data.items[0].data.value;
combo.setValue(firstValue); //同时下拉框会将与name为firstValue值对应的 text显示
}
}
});
var btnPrint = Ext.create("Ext.Button", {
text: "打印文件",
region: "north",
allowDepress: true, //是否允许按钮被按下的状态
enableToggle: true, //是否允许按钮在弹起和按下两种状态中切换
height: 30,
width: 80,
handler: function () {
Ext.MessageBox.confirm('提示', '确定打印此图片?', function (btn) {
if (btn == 'yes') {
var newstr = document.getElementsByName('certimg')[0].src;
var printWindow = window.open(newstr + "?" + Math.random());
printWindow.print();
return false;
} else {
}
});
},
id: "bt1"
});
Ext.extend(Shipping.FileView, Ext.Window, {
ImgPath: null,
TruckNo: null,
initUIComponents: function () {
this.panelpdf = new Ext.Panel({
//title: 'PDF信息',
layout: "border",
region: 'center',
height: 1000,
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, {
height: 800,
modal: true,
width: 1000,
layout: "border", //设置为手风琴布局
closable: true,
closeAction: 'hide',
draggable: true,
resizable: false,
items: [
this.panelpdf
//{
//xtype: 'component', //或者xtype: 'component',
//name: "CertImg",
//region: "center",
//autoEl: {
// top: 30,
// tag: 'img', //指定为img标签
// src: FilePath, //指定url路径
// name: 'certimg'
//}
//}
],
xtype: "window"
});
}
});