/**
|
* 初始化车辆类型管理详情对话框
|
*/
|
var TOrderTapeInfoDlg = {
|
tOrderTapeInfoData : {},
|
validateFields: {
|
name: {
|
validators: {
|
notEmpty: {
|
message: '类型名称不能为空'
|
}
|
}
|
},
|
seat: {
|
validators: {
|
notEmpty: {
|
message: '座位数不能为空'
|
},
|
regexp: {
|
regexp: /^[1-9]\d*$/,
|
message: '座位数不正确'
|
}
|
}
|
},
|
brandId: {
|
validators: {
|
notEmpty: {
|
message: '请选择所属车辆品牌'
|
}
|
}
|
},
|
}
|
};
|
|
/**
|
* 验证数据是否为空
|
*/
|
TOrderTapeInfoDlg.validate = function () {
|
$('#orderTapeInfoForm').data("bootstrapValidator").resetForm();
|
$('#orderTapeInfoForm').bootstrapValidator('validate');
|
return $("#orderTapeInfoForm").data('bootstrapValidator').isValid();
|
};
|
|
/**
|
* 清除数据
|
*/
|
TOrderTapeInfoDlg.clearData = function() {
|
this.tOrderTapeInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TOrderTapeInfoDlg.set = function(key, val) {
|
this.tOrderTapeInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TOrderTapeInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
TOrderTapeInfoDlg.close = function() {
|
parent.layer.close(window.parent.TOrderTape.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
TOrderTapeInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('name')
|
.set('remark')
|
.set('createTime')
|
.set('state')
|
.set('seat')
|
.set('brandId');
|
}
|
|
/**
|
* 提交添加
|
*/
|
TOrderTapeInfoDlg.addSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
if(!this.validate()){
|
return ;
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tOrderTape/add", function(data){
|
Feng.success("添加成功!");
|
window.parent.TOrderTape.table.refresh();
|
TOrderTapeInfoDlg.close();
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tOrderTapeInfoData);
|
ajax.start();
|
}
|
|
/**
|
* 提交修改
|
*/
|
TOrderTapeInfoDlg.editSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
if(!this.validate()){
|
return ;
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tOrderTape/update", function(data){
|
Feng.success("修改成功!");
|
window.parent.TOrderTape.table.refresh();
|
TOrderTapeInfoDlg.close();
|
},function(data){
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tOrderTapeInfoData);
|
ajax.start();
|
}
|
|
$(function() {
|
Feng.initValidator("orderTapeInfoForm", TOrderTapeInfoDlg.validateFields);
|
});
|