| | |
| | | * 初始化详情对话框 |
| | | */ |
| | | var TDriverInfoDlg = { |
| | | tDriverInfoData : {} |
| | | tDriverInfoData : {}, |
| | | validateFields: { |
| | | name: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '姓名不能为空' |
| | | } |
| | | } |
| | | }, |
| | | phone: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '手机号不能为空' |
| | | } |
| | | } |
| | | }, |
| | | emergencyContact: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '紧急联系人姓名不能为空' |
| | | } |
| | | } |
| | | }, |
| | | emergencyPhone: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '紧急联系人电话不能为空' |
| | | } |
| | | } |
| | | }, |
| | | area: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '请选择服务区域' |
| | | } |
| | | } |
| | | }, |
| | | idcard: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '身份证号码不能为空' |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 验证数据是否为空 |
| | | */ |
| | | TDriverInfoDlg.validate = function () { |
| | | $('#driverInfoForm').data("bootstrapValidator").resetForm(); |
| | | $('#driverInfoForm').bootstrapValidator('validate'); |
| | | return $("#driverInfoForm").data('bootstrapValidator').isValid(); |
| | | }; |
| | | |
| | | /** |
| | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | |
| | | var idcardFront = $("#idcardFront").val(); |
| | | if ("" == idcardFront){ |
| | | Feng.info("请上传身份证正面照"); |
| | | return; |
| | | } |
| | | |
| | | var idcardBack = $("#idcardBack").val(); |
| | | if ("" == idcardBack){ |
| | | Feng.info("请上传身份证背面照"); |
| | | return; |
| | | } |
| | | |
| | | var driverLicense = $("#driverLicense").val(); |
| | | if ("" == driverLicense){ |
| | | Feng.info("请上传驾驶证"); |
| | | return; |
| | | } |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tDriver/add", function(data){ |
| | | if(data.code == 500){ |
| | | Feng.error("添加失败!" + data.message + "!"); |
| | | return false; |
| | | }else { |
| | | Feng.success("添加成功!"); |
| | | window.parent.TDriver.table.refresh(); |
| | | TDriverInfoDlg.close(); |
| | | } |
| | | Feng.success("添加成功!"); |
| | | window.parent.TDriver.table.refresh(); |
| | | TDriverInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | |
| | | var idcardFront = $("#idcardFront").val(); |
| | | if ("" == idcardFront){ |
| | | Feng.info("请上传身份证正面照"); |
| | | return; |
| | | } |
| | | |
| | | var idcardBack = $("#idcardBack").val(); |
| | | if ("" == idcardBack){ |
| | | Feng.info("请上传身份证背面照"); |
| | | return; |
| | | } |
| | | |
| | | var driverLicense = $("#driverLicense").val(); |
| | | if ("" == driverLicense){ |
| | | Feng.info("请上传驾驶证"); |
| | | return; |
| | | } |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tDriver/update", function(data){ |
| | | if(data.code == 500){ |
| | | Feng.error("修改失败!" + data.message + "!"); |
| | | return false; |
| | | }else { |
| | | Feng.success("修改成功!"); |
| | | window.parent.TDriver.table.refresh(); |
| | | TDriverInfoDlg.close(); |
| | | } |
| | | Feng.success("修改成功!"); |
| | | window.parent.TDriver.table.refresh(); |
| | | TDriverInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | } |
| | | |
| | | $(function() { |
| | | |
| | | Feng.initValidator("driverInfoForm", TDriverInfoDlg.validateFields); |
| | | }); |