/**
 * channelplanMemberEducation管理初始化
 */
var ChannelplanMemberEduction = {
    id: "ChannelplanMemberEductionTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
ChannelplanMemberEduction.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '唯一标识', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '成员ID', field: 'memberId', visible: false, align: 'center', valign: 'middle'},
        {title: '学位（加注英文）', field: 'degree', visible: true, align: 'center', valign: 'middle'},
        {title: '开始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle'},
        {title: '结束时间', field: 'endTime', visible: true, align: 'center', valign: 'middle'},
        {title: '国家', field: 'country', visible: true, align: 'center', valign: 'middle'},
        {title: '院校', field: 'college', visible: true, align: 'center', valign: 'middle'},
        {title: '专业', field: 'major', visible: true, align: 'center', valign: 'middle'},
        {title: '备注', field: 'descriptione', visible: true, align: 'center', valign: 'middle'}
    ];
};

/**
 * 检查是否选中
 */
ChannelplanMemberEduction.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录！");
        return false;
    }else{
        ChannelplanMemberEduction.seItem = selected[0];
        return true;
    }
};

/**
 * 点击添加channelplanMemberEducation
 */
ChannelplanMemberEduction.openAddChannelplanMemberEduction = function () {
    var index = layer.open({
        type: 2,
        title: '添加channelplanMemberEducation',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/channelplanMemberEduction/channelplanMemberEduction_add'
    });
    this.layerIndex = index;
};

/**
 * 打开查看channelplanMemberEducation详情
 */
ChannelplanMemberEduction.openChannelplanMemberEductionDetail = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: 'channelplanMemberEducation详情',
            area: ['800px', '420px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/channelplanMemberEduction/channelplanMemberEduction_update/' + ChannelplanMemberEduction.seItem.id
        });
        this.layerIndex = index;
    }
};

/**
 * 删除channelplanMemberEducation
 */
ChannelplanMemberEduction.delete = function () {
    if (this.check()) {
        var ajax = new $ax(Feng.ctxPath + "/channelplanMemberEduction/delete", function (data) {
            Feng.success("删除成功!");
            ChannelplanMemberEduction.table.refresh();
        }, function (data) {
            Feng.error("删除失败!" + data.responseJSON.message + "!");
        });
        ajax.set("channelplanMemberEductionId",this.seItem.id);
        ajax.start();
    }
};

/**
 * 查询channelplanMemberEducation列表
 */
ChannelplanMemberEduction.search = function () {
    var queryData = {};
    queryData['condition'] = $("#condition").val();
    ChannelplanMemberEduction.table.refresh({query: queryData});
};

$(function () {
    var defaultColunms = ChannelplanMemberEduction.initColumn();
    var table = new BSTable(ChannelplanMemberEduction.id, "/channelplanMemberEduction/list", defaultColunms);
    table.setPaginationType("server");
    ChannelplanMemberEduction.table = table.init();
});
