组件类回调事件

组件类--按钮回调事件

/**
 * 按钮操作类型:打开弹窗
 * 关闭后回调
 * function buttonIdDialogClose(dialogData){}
 * @param id string: 按钮id
 * @param dialogData object: 表单数据
 */
try {
    if (typeof eval(id + "DialogClose") === "function") {
        var dialogData = data;
        eval(id + "DialogClose( dialogData )");
    }
} catch (ex) {
    console.log("可能未定义关闭弹窗回调事件" + id + "DialogClose,请忽略~");
}

/**
 * 按钮操作类型:不做操作
 * 不做任何操作回调
 * function buttonIdClickEventOfNoneType(){}
 * @param id string: 按钮id
 */
try {
    if (typeof eval(id + "ClickEventOfNoneType") === "function") {
        eval(id + "ClickEventOfNoneType()");
    }
} catch (ex) {
    console.log("可能未自定义点击事件" + id + "ClickEventOfNoneType,请忽略~");
}

组件类--选择列表回调事件

/**
 * 点击checkbox|radio回调
 * function _buttonIdWidgetChangeEventCallback(this){}
 * @param _config.id string: 控件id
 */
try {
    if (typeof eval("_" + _config.id + "WidgetChangeEventCallback") == "function") {
        eval("_" + _config.id + "WidgetChangeEventCallback(this)")
    }
} catch (ex) {
    console.log("可能未定义值改变回调事件_" + _config.id + "WidgetChangeEventCallback,请忽略~");
}

组件类--列表回调事件

/**
 * 处理用于生成的模板的列表数据 
 * function buiListAddDataFun(data){}
 * @param data array: 请求到的列表数据
 */
var _list = bui.list({
    id: "#${id}",
    children: ".bui-listview",
    handle: "li",
    height: _config.height,
    timeout: _config.timeout,
    url: _config.url,
    localData: _config.localData,
    pageSize: _config.pageSize,
    data: _config.params,
    method: _config.method,
    headers: _config.headers,
    field: _fieldParam,
    page: _config.page,
    refresh: _config.refresh,
    template: function (data) {
        if(typeof buiListAddDataFun === "function"){
            eval( buiListAddDataFun(data) );
        }
        var html = template("${id}_template", { data: data });
        return html;
    }
})

组件类--图表回调事件

/**
 * 请求图表数据后调用
 * function chartIdCallback(res){}
 * @param res array: 请求到图表数据
 */
AppUtils.ajaxGet(config.url,{},{}).then(function(res){
    if(res){
        if(typeof ${id}Callback === "function"){
            eval("${id}Callback( res )");
        }
        if(!(res instanceof Array) && config.dataConfig.dataKey){
            res = res[config.dataConfig.dataKey];
        }
        for(var i = 0; i < res.length; i++ ){
            axisData.push(res[i][config.dataConfig.name]);
            data.push(res[i][config.dataConfig.value]);
        }
        _init();
    }
})

组件类--选项卡回调事件

/**
 * 跳转前触发、初始化前触发、初始化以后触发、每次跳转时触发 
 * function tabIdBeforeTo(){}
 */
var uiTab = bui.tab({
    id: tabId,
    menu: menuId,
    index: config.index,
    height: config.height,
    onBeforeTo: function () {
        console.log(config.id + "BeforeTo");
        try {
            if (typeof eval(config.id + "BeforeTo") == "function") {
                eval(config.id + "BeforeTo()")
            }
        } catch (ex) {
            console.log("可能未定义Tab控件BeforeTo事件:" + config.id + "BeforeTo");
        }
    },
    onBeforeInit: function () {
        console.log(config.id + "BeforeInit");
        try {
            if (typeof eval(config.id + "BeforeInit") == "function") {
                eval(config.id + "BeforeInit()")
            }
        } catch (ex) {
            console.log("可能未定义Tab控件BeforeInit事件:" + config.id + "BeforeInit");
        }
    },
    onInited: function () {
        console.log(config.id + "Inited");
        try {
            if (typeof eval(config.id + "Inited") == "function") {
                eval(config.id + "Inited()")
            }
        } catch (ex) {
            console.log("可能未定义Tab控件Inited事件:" + config.id + "Inited");
        }
    }
});

uiTab.on("to", function (index) {
    console.log(index);
    try {
        if (typeof eval(config.id + "To") == "function") {
            eval(config.id + "To(index)")
        }
    }catch (ex) {
        console.log("可能未定义Tab控件to事件:" + config.id + "To");
    }
});