| | |
| | | * 初始化详情对话框 |
| | | */ |
| | | var TBranchOfficeInfoDlg = { |
| | | tBranchOfficeInfoData : {} |
| | | tBranchOfficeInfoData : {}, |
| | | validateFields: { |
| | | branchOfficeName: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '分公司名称不能为空' |
| | | } |
| | | } |
| | | }, |
| | | name: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '负责人姓名不能为空' |
| | | } |
| | | } |
| | | }, |
| | | phone: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '联系电话不能为空' |
| | | } |
| | | } |
| | | }, |
| | | area: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '请选择服务区域' |
| | | } |
| | | } |
| | | }, |
| | | emergencyPhone: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '代理商抽成不能为空' |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 验证数据是否为空 |
| | | */ |
| | | TBranchOfficeInfoDlg.validate = function () { |
| | | $('#branchOfficeInfoForm').data("bootstrapValidator").resetForm(); |
| | | $('#branchOfficeInfoForm').bootstrapValidator('validate'); |
| | | return $("#branchOfficeInfoForm").data('bootstrapValidator').isValid(); |
| | | }; |
| | | |
| | | /** |
| | |
| | | .set('districtName') |
| | | .set('branchOfficeName') |
| | | .set('operatingBusiness') |
| | | .set('bankDeposit') |
| | | .set('bankAccount') |
| | | .set('area') |
| | | .set('areaId') |
| | | .set('status') |
| | | .set('createTime'); |
| | | } |
| | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/add", function(data){ |
| | | Feng.success("添加成功!"); |
| | | window.parent.TBranchOffice.table.refresh(); |
| | | TBranchOfficeInfoDlg.close(); |
| | | if(data.code == 500){ |
| | | Feng.error("添加失败!" + data.message + "!"); |
| | | return false; |
| | | }else { |
| | | Feng.success("添加成功!"); |
| | | window.parent.TBranchOffice.table.refresh(); |
| | | TBranchOfficeInfoDlg.close(); |
| | | } |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/update", function(data){ |
| | | Feng.success("修改成功!"); |
| | | window.parent.TBranchOffice.table.refresh(); |
| | | TBranchOfficeInfoDlg.close(); |
| | | if(data.code == 500){ |
| | | Feng.error("修改失败!" + data.message + "!"); |
| | | return false; |
| | | }else { |
| | | Feng.success("修改成功!"); |
| | | window.parent.TBranchOffice.table.refresh(); |
| | | TBranchOfficeInfoDlg.close(); |
| | | } |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | } |
| | | |
| | | $(function() { |
| | | |
| | | Feng.initValidator("branchOfficeInfoForm", TBranchOfficeInfoDlg.validateFields); |
| | | }); |