/**
|
* 初始化车辆管理详情对话框
|
*/
|
var TCarInfoDlg = {
|
tCarInfoData : {}/*,
|
validateFields: {
|
carBrandId: {
|
validators: {
|
notEmpty: {
|
message: '请选择车辆品牌'
|
}
|
}
|
},
|
carModelId: {
|
validators: {
|
notEmpty: {
|
message: '请选择车辆类型'
|
}
|
}
|
},
|
zcModel: {
|
validators: {
|
notEmpty: {
|
message: '请选择专车车型'
|
}
|
}
|
},
|
kcModel: {
|
validators: {
|
notEmpty: {
|
message: '请选择跨城出行车型'
|
}
|
}
|
},
|
carColor: {
|
validators: {
|
notEmpty: {
|
message: '车辆颜色不能为空'
|
}
|
}
|
},
|
drivingLicenseNumber: {
|
validators: {
|
notEmpty: {
|
message: '行驶证编号不能为空'
|
}
|
}
|
},
|
annualInspectionTime: {
|
validators: {
|
notEmpty: {
|
message: '年检到期时间不能为空'
|
}
|
}
|
},
|
commercialInsuranceTime: {
|
validators: {
|
notEmpty: {
|
message: '商业保险到期时间不能为空'
|
}
|
}
|
},
|
plateColor: {
|
validators: {
|
notEmpty: {
|
message: '车牌颜色不能为空'
|
}
|
}
|
},
|
vehicleType: {
|
validators: {
|
notEmpty: {
|
message: '车辆类型不能为空'
|
}
|
}
|
},
|
ownerName: {
|
validators: {
|
notEmpty: {
|
message: '车辆所有人不能为空'
|
}
|
}
|
},
|
engineId: {
|
validators: {
|
notEmpty: {
|
message: '发动机号不能为空'
|
}
|
}
|
},
|
VIN: {
|
validators: {
|
notEmpty: {
|
message: '车辆VIN码不能为空'
|
}
|
}
|
},
|
certifyDateA: {
|
validators: {
|
notEmpty: {
|
message: '车辆注册日期不能为空'
|
}
|
}
|
},
|
fuelType: {
|
validators: {
|
notEmpty: {
|
message: '车辆燃料类型不能为空'
|
}
|
}
|
},
|
engineDisplace: {
|
validators: {
|
notEmpty: {
|
message: '发动机排量不能为空'
|
}
|
}
|
},
|
certificate: {
|
validators: {
|
notEmpty: {
|
message: '运输证字号不能为空'
|
}
|
}
|
},
|
transAgency: {
|
validators: {
|
notEmpty: {
|
message: '车辆运输证发证机构不能为空'
|
}
|
}
|
},
|
transArea: {
|
validators: {
|
notEmpty: {
|
message: '车辆经营区域不能为空'
|
}
|
}
|
},
|
transDateStart: {
|
validators: {
|
notEmpty: {
|
message: '车辆运输证有效期起不能为空'
|
}
|
}
|
},
|
transDateStop: {
|
validators: {
|
notEmpty: {
|
message: '车辆运输证有效期止不能为空'
|
}
|
}
|
},
|
certifyDateB: {
|
validators: {
|
notEmpty: {
|
message: '车辆初次登记日期不能为空'
|
}
|
}
|
},
|
fixState: {
|
validators: {
|
notEmpty: {
|
message: '车辆维修状态不能为空'
|
}
|
}
|
},
|
nextFixDate: {
|
validators: {
|
notEmpty: {
|
message: '车辆下次年检时间不能为空'
|
}
|
}
|
},
|
checkState: {
|
validators: {
|
notEmpty: {
|
message: '车辆年度审核状态不能为空'
|
}
|
}
|
},
|
feePrintId: {
|
validators: {
|
notEmpty: {
|
message: '发票打印设备序列号不能为空'
|
}
|
}
|
},
|
GPSBrand: {
|
validators: {
|
notEmpty: {
|
message: '卫星定位装置品牌不能为空'
|
}
|
}
|
},
|
GPSModel: {
|
validators: {
|
notEmpty: {
|
message: '卫星定位装置型号不能为空'
|
}
|
}
|
},
|
GPSIMEI: {
|
validators: {
|
notEmpty: {
|
message: '卫星定位装置IMEI号不能为空'
|
}
|
}
|
},
|
GPSInstallDate: {
|
validators: {
|
notEmpty: {
|
message: '卫星定位装置安装时间不能为空'
|
}
|
}
|
},
|
registerDate: {
|
validators: {
|
notEmpty: {
|
message: '车辆报备日期不能为空'
|
}
|
}
|
},
|
commercialType: {
|
validators: {
|
notEmpty: {
|
message: '服务类型不能为空'
|
}
|
}
|
}
|
}*/
|
};
|
|
/**
|
* 验证数据是否为空
|
*/
|
TCarInfoDlg.validate = function () {
|
$('#carInfoForm').data("bootstrapValidator").resetForm();
|
$('#carInfoForm').bootstrapValidator('validate');
|
return $("#carInfoForm").data('bootstrapValidator').isValid();
|
};
|
|
/**
|
* 清除数据
|
*/
|
TCarInfoDlg.clearData = function() {
|
this.tCarInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TCarInfoDlg.set = function(key, val) {
|
this.tCarInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TCarInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
TCarInfoDlg.close = function() {
|
parent.layer.close(window.parent.TCar.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
TCarInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('isPlatCar')
|
.set('companyId')
|
.set('franchiseeId')
|
.set('carColor')
|
.set('carModelId')
|
.set('carBrandId')
|
.set('carLicensePlate')
|
.set('carPhoto')
|
.set('drivingLicenseNumber')
|
.set('drivingLicensePhoto')
|
.set('annualInspectionTime')
|
.set('commercialInsuranceTime')
|
.set('createTime')
|
.set('state')
|
.set('addType')
|
.set('addObjectId')
|
.set('plateColor')
|
.set('vehicleType')
|
.set('ownerName')
|
.set('engineId')
|
.set('VIN')
|
.set('certifyDateA')
|
.set('fuelType')
|
.set('engineDisplace')
|
.set('certificate')
|
.set('transAgency')
|
.set('transArea')
|
.set('transDateStart')
|
.set('transDateStop')
|
.set('certifyDateB')
|
.set('fixState')
|
.set('nextFixDate')
|
.set('checkState')
|
.set('feePrintId')
|
.set('GPSBrand')
|
.set('GPSModel')
|
.set('GPSIMEI')
|
.set('GPSInstallDate')
|
.set('registerDate')
|
.set('commercialType');
|
}
|
|
/**
|
* 提交添加
|
*/
|
TCarInfoDlg.addSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
if(!this.validate()){
|
return ;
|
}
|
var roleType = $("#roleType").val(); //1=平台 2=分公司 3=加盟商
|
var companyType = $("input[name='companyType']:checked").val();
|
if (1 == roleType){
|
if (2 == companyType){
|
var oneId = $("#oneId").val();
|
if ("" == oneId){
|
Feng.info("所属分公司不能为空!");
|
return;
|
}
|
}
|
}
|
var serverBox =[];
|
$('input[name="serverBox"]:checked').each(function(){
|
serverBox.push($(this).val());
|
});
|
if (serverBox.length == 0){
|
Feng.info("请选择服务模式");
|
return;
|
}
|
var carPhoto = $("#carPhoto").valueOf();
|
if ("" == carPhoto){
|
Feng.info("请上传车辆照片");
|
return;
|
}
|
var drivingLicensePhoto = $("#drivingLicensePhoto").valueOf();
|
if ("" == drivingLicensePhoto){
|
Feng.info("请上传行驶证照片");
|
return;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tCar/add", function(data){
|
Feng.success("添加成功!");
|
window.parent.TCar.table.refresh();
|
TCarInfoDlg.close();
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tCarInfoData);
|
ajax.set("serverBox",serverBox.toString());
|
ajax.set("zcModel",$("#zcModel").val());
|
ajax.set("xjModel",$("#xjModel").val());
|
ajax.set("kcModel",$("#kcModel").val());
|
ajax.set("roleType",roleType);
|
if (1 == roleType){
|
ajax.set("companyType",companyType);
|
ajax.set("oneId",$("#oneId").val());
|
ajax.set("twoId",$("#twoId").val());
|
ajax.set("franchiseeId",0);
|
} else if (2 == roleType) {
|
ajax.set("franchiseeId",$("#franchiseeId").val());
|
ajax.set("companyType",0);
|
ajax.set("oneId",0);
|
ajax.set("twoId",0);
|
}else if (3 == roleType){
|
ajax.set("franchiseeId",0);
|
ajax.set("companyType",0);
|
ajax.set("oneId",0);
|
ajax.set("twoId",0);
|
}
|
ajax.start();
|
}
|
|
/**
|
* 提交修改
|
*/
|
TCarInfoDlg.editSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
if(!this.validate()){
|
return ;
|
}
|
var roleType = $("#roleType").val(); //1=平台 2=分公司 3=加盟商
|
var companyType = $("input[name='companyType']:checked").val();
|
if (1 == roleType){
|
if (2 == companyType){
|
var oneId = $("#oneId").val();
|
if ("" == oneId){
|
Feng.info("所属分公司不能为空!");
|
return;
|
}
|
}
|
}
|
var serverBox =[];
|
$('input[name="serverBox"]:checked').each(function(){
|
serverBox.push($(this).val());
|
});
|
if (serverBox.length == 0){
|
Feng.info("请选择服务模式");
|
return;
|
}
|
var carPhoto = $("#carPhoto").valueOf();
|
if ("" == carPhoto){
|
Feng.info("请上传车辆照片");
|
return;
|
}
|
var drivingLicensePhoto = $("#drivingLicensePhoto").valueOf();
|
if ("" == drivingLicensePhoto){
|
Feng.info("请上传行驶证照片");
|
return;
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tCar/update", function(data){
|
Feng.success("修改成功!");
|
window.parent.TCar.table.refresh();
|
TCarInfoDlg.close();
|
},function(data){
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tCarInfoData);
|
ajax.set("serverBox",serverBox.toString());
|
ajax.set("zcModel",$("#zcModel").val());
|
ajax.set("kcModel",$("#kcModel").val());
|
ajax.set("xjModel",$("#xjModel").val());
|
ajax.set("roleType",roleType);
|
if (1 == roleType){
|
ajax.set("companyType",companyType);
|
ajax.set("oneId",$("#oneId").val());
|
ajax.set("twoId",$("#twoId").val());
|
ajax.set("franchiseeId",0);
|
} else if (2 == roleType) {
|
ajax.set("franchiseeId",$("#franchiseeId").val());
|
ajax.set("companyType",0);
|
ajax.set("oneId",0);
|
ajax.set("twoId",0);
|
}else if (3 == roleType){
|
ajax.set("franchiseeId",0);
|
ajax.set("companyType",0);
|
ajax.set("oneId",0);
|
ajax.set("twoId",0);
|
}
|
ajax.start();
|
}
|
|
TCarInfoDlg.editSubmitAuth = function() {
|
|
var authState = $("input[name='authState']:checked").val();
|
|
var serverBox =[];
|
$('input[name="serverBox"]:checked').each(function(){
|
serverBox.push($(this).val());
|
});
|
if(authState==2){
|
if (serverBox.length == 0){
|
Feng.info("请选择服务模式");
|
return;
|
}
|
var zcModel = $("#zcModel").val();
|
if ("" == zcModel){
|
Feng.info("请选择专车车型");
|
return;
|
}
|
var xjModel = $("#xjModel").val();
|
if ("" == xjModel){
|
Feng.info("请选择市内小件物流车型");
|
return;
|
}
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tCar/updateAuth", function(data){
|
Feng.success("操作成功!");
|
window.parent.TCar.table.refresh();
|
TCarInfoDlg.close();
|
},function(data){
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",$("#id").val());
|
ajax.set("serverBox",serverBox.toString());
|
ajax.set("zcModel",$("#zcModel").val());
|
ajax.set("xjModel",$("#xjModel").val());
|
ajax.set("authState",authState);
|
ajax.start();
|
}
|
|
$(function() {
|
Feng.initValidator("carInfoForm", TCarInfoDlg.validateFields);
|
// 初始化图片上传
|
var carPhoto = new $WebUpload("carPhoto");
|
carPhoto.setUploadBarId("progressBar");
|
carPhoto.init();
|
var drivingLicensePhoto = new $WebUpload("drivingLicensePhoto");
|
drivingLicensePhoto.setUploadBarId("progressBar");
|
drivingLicensePhoto.init();
|
});
|
|
/**
|
* 选择分公司后执行
|
*/
|
TCarInfoDlg.oneChange = function (e) {
|
var oneId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/oneChange", function(data){
|
if(data!=null){
|
var content='<option value="">选择所属加盟商</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#twoId").empty().append(content);
|
}
|
});
|
ajax.set("oneId",oneId);
|
ajax.start();
|
}
|
|
/**
|
* 类型改变执行
|
* @param e
|
*/
|
TCarInfoDlg.companyTypeClick = function (e) {
|
if (1 == e){
|
$(".companyDiv").hide();
|
} else if (2 == e){
|
$(".companyDiv").show();
|
}
|
}
|
|
/**
|
* 车辆品牌改变时执行
|
*/
|
TCarInfoDlg.brandChange = function (e) {
|
var carBrandId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tCar/brandChange", function(data){
|
if(data!=null){
|
var content='<option value="">选择车辆类型</option>';
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#carModelId").empty().append(content);
|
}
|
});
|
ajax.set("carBrandId",carBrandId);
|
ajax.start();
|
}
|
|
/**
|
* 专车服务被点击
|
*/
|
TCarInfoDlg.zcServerClick = function () {
|
var serverBox1 = $('#serverBox1').prop('checked');
|
if (serverBox1){
|
$("#zcModelDiv").show();
|
} else {
|
$("#zcModelDiv").hide();
|
}
|
}
|
/**
|
* 小件物流服务被点击
|
*/
|
TCarInfoDlg.xjServerClick = function () {
|
var serverBox1 = $('#serverBox4').prop('checked');
|
if (serverBox1){
|
$("#xjModelDiv").show();
|
} else {
|
$("#xjModelDiv").hide();
|
}
|
}
|
|
/**
|
* 跨城服务被点击
|
*/
|
TCarInfoDlg.kcServerClick = function () {
|
var serverBox3 = $('#serverBox3').prop('checked');
|
if (serverBox3){
|
$("#kcModelDiv").show();
|
} else {
|
$("#kcModelDiv").hide();
|
}
|
}
|