xuhy
2023-03-24 213f6b217ba9eb8f5562adb7e90407a7797a581a
management/guns-admin/src/main/webapp/static/modular/system/tAgent/tAgent_info.js
@@ -2,7 +2,39 @@
 * 初始化详情对话框
 */
var TAgentInfoDlg = {
    tAgentInfoData : {}
    tAgentInfoData : {},
    validateFields: {
        principal: {
            validators: {
                notEmpty: {
                    message: '负责人姓名不能为空'
                }
            }
        },
        principalPhone: {
            validators: {
                notEmpty: {
                    message: '联系电话不能为空'
                }
            }
        },
        area: {
            validators: {
                notEmpty: {
                    message: '请选择代理区域'
                }
            }
        },
    }
};
/**
 * 验证数据是否为空
 */
TAgentInfoDlg.validate = function () {
    $('#tAgentInfoForm').data("bootstrapValidator").resetForm();
    $('#tAgentInfoForm').bootstrapValidator('validate');
    return $("#tAgentInfoForm").data('bootstrapValidator').isValid();
};
/**
@@ -67,13 +99,21 @@
    this.clearData();
    this.collectData();
    if(!this.validate()){
        return ;
    }
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/tAgent/add", function(data){
        if(data.code == 500){
            Feng.error("添加失败!" + data.message + "!");
            return false;
        }
        Feng.success("添加成功!");
        window.parent.TAgent.table.refresh();
        TAgentInfoDlg.close();
    },function(data){
        Feng.error("添加失败!" + data.responseJSON.message + "!");
        Feng.error("添加失败!" + data.message + "!");
    });
    ajax.set(this.tAgentInfoData);
    ajax.start();
@@ -86,6 +126,10 @@
    this.clearData();
    this.collectData();
    if(!this.validate()){
        return ;
    }
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/tAgent/update", function(data){
@@ -100,5 +144,5 @@
}
$(function() {
    Feng.initValidator("tAgentInfoForm", TAgentInfoDlg.validateFields);
});