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/TruckMng/Viewsjs/MsWlTruck/CertView.js

88 lines
2.8 KiB
JavaScript

Ext.namespace('DsTruck');
var FilePath = '';
DsTruck.CertView = function (config) {
Ext.applyIf(this, config);
FilePath = config.filePath;
this.initUIComponents();
DsTruck.CertView.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;
printWindow = window.open(newstr);
printWindow.print();
return false;
} else {
}
});
},
id: "bt1"
});
Ext.extend(DsTruck.CertView, Ext.Window, {
ImgPath: null,
TruckNo: null,
initUIComponents: function () {
Ext.apply(this, {
height: 600,
modal: true,
width: 800,
layout: "border", //设置为手风琴布局
closable: true,
closeAction: 'hide',
draggable: true,
resizable: false,
items: [btnPrint,{
xtype: 'component', //或者xtype: 'component',
name: "CertImg",
region: "center",
autoEl: {
top: 30,
tag: 'img', //指定为img标签
src: FilePath, //指定url路径
name: 'certimg'
}
}],
xtype: "window"
});
}
});