From d5b3e5a413bcfccba294793ee093722f31b2448a Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 16 八月 2023 17:02:13 +0800 Subject: [PATCH] 添加推单日志 --- management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js | 143 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 135 insertions(+), 8 deletions(-) diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js b/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js index 86c4666..e6370ee 100644 --- a/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js +++ b/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice_info.js @@ -2,7 +2,90 @@ * 初始化详情对话框 */ var TBranchOfficeInfoDlg = { - tBranchOfficeInfoData : {} + tBranchOfficeInfoData : {}, + validateFields: { + branchOfficeName: { + validators: { + notEmpty: { + message: '分公司名称不能为空' + } + } + }, + name: { + validators: { + notEmpty: { + message: '负责人姓名不能为空' + }, + regexp: { + regexp: /^[\u4E00-\u9FA5A-Za-z\s]+$/, + message: '不能输入特殊字符和数字' + } + } + }, + phone: { + validators: { + notEmpty: { + message: '联系电话不能为空' + }, + regexp: { + regexp: /^1[3-9]\d{9}$/, + message: '请输入合法手机号' + } + } + }, + area: { + validators: { + notEmpty: { + message: '请选择服务区域' + } + } + }, + emergencyPhone: { + validators: { + notEmpty: { + message: '代理商抽成不能为空' + } + } + }, + account: { + validators: { + notEmpty: { + message: '登录账号不能为空' + } + } + }, + password: { + validators: { + notEmpty: { + message: '登录密码不能为空' + }, + identical: { + field: 'rePassword', + message: '两次密码不一致' + }, + } + }, + rePassword: { + validators: { + notEmpty: { + message: '密码不能为空' + }, + identical: { + field: 'password', + message: '两次密码不一致' + }, + } + } + } +}; + +/** + * 验证数据是否为空 + */ +TBranchOfficeInfoDlg.validate = function () { + $('#branchOfficeInfoForm').data("bootstrapValidator").resetForm(); + $('#branchOfficeInfoForm').bootstrapValidator('validate'); + return $("#branchOfficeInfoForm").data('bootstrapValidator').isValid(); }; /** @@ -56,7 +139,15 @@ .set('cityName') .set('districtCode') .set('districtName') + .set('branchOfficeName') + .set('operatingBusiness') + .set('bankDeposit') + .set('bankAccount') + .set('area') + .set('areaId') .set('status') + .set('account') + .set('password') .set('createTime'); } @@ -68,11 +159,20 @@ 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 + "!"); }); @@ -88,11 +188,38 @@ this.clearData(); this.collectData(); + var branchOfficeName = $('#branchOfficeName').val(); + var principal = $('#principal').val(); + var principalPhone = $('#principalPhone').val(); + var area = $('#area').val(); + if(null == branchOfficeName || '' == branchOfficeName){ + Feng.error("分公司名称不能为空"); + return + } + if(null == principal || '' == principal){ + Feng.error("负责人姓名不能为空"); + return + } + if(null == principalPhone || '' == principalPhone){ + Feng.error("联系电话不能为空"); + return + } + if(null == area || '' == area){ + Feng.error("代理区域不能为空"); + 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 + "!"); }); @@ -101,5 +228,5 @@ } $(function() { - + Feng.initValidator("branchOfficeInfoForm", TBranchOfficeInfoDlg.validateFields); }); -- Gitblit v1.7.1