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/CertUpload.js

122 lines
4.5 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.CertUpload = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
DsTruck.CertUpload.superclass.constructor.call(this);
};
Ext.regModel('CertType', {
fields: [{ name: 'value' }, { name: 'text'}]
})
Ext.extend(DsTruck.CertUpload, Ext.Window, {
GID: null,
TruckNo: null,
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': '车辆照片' },
2 years ago
{ 'value': '6', 'text': '驾驶员身份证'}]
});
_this = this;
this.cmbType = Ext.create('Ext.form.ComboBox', {
fieldLabel: '证件类型',
queryMode: 'local',
name: 'Cert_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: 140,
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: 'TruckNo',
labelWidth: 80
}],
xtype: "form",
layout: "form",
id: 'importForm',
buttons: [{
text: "上传",
handler: function (button, event) {
var form = Ext.getCmp("importForm").getForm();
form.findField('TruckNo').setValue(this.TruckNo);
var typenum = form.findField('Cert_Type').value;
if (typenum == null || typenum == 'null' || typenum == '0') {
Ext.MessageBox.alert('提示', '请选择要上传证件的类型!');
return;
}
if (form.isValid()) {
form.submit({
url: '/TruckMng/MsWlTruck/CertUpload',
waitMsg: '正在上传文件...',
success: function (f, a) {
var win = Ext.getCmp("uploadWin");
win.close();
Ext.Msg.alert('提示', '证件上传成功!');
panelTest.ReflashEdt();
},
failure: function (f, a) {
Ext.Msg.alert('提示', '证件上传失败!' + a.result.Message);
panelTest.ReflashEdt()
}
});
}
},
scope: this
}, {
text: "关闭",
handler: function (button, event) {
var win = this.up("window"); // Ext.getCmp("importWin");
panelTest.ReflashEdt();
win.close();
}
}]
}],
layout: "border",
xtype: "window",
id: 'uploadWin'
});
// END OF CODE GENERATION PARTS, DON'T DELETE CODE ABOVE
}
});