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

/**
 * 初始化表格的列
 */
ChannelplanMemberInfo.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
            {title: '唯一标志', field: 'id', visible: true, align: 'center', valign: 'middle'},
            {title: '海峡计划申报id', field: 'cpId', visible: true, align: 'center', valign: 'middle'},
            {title: '姓名（中文）', field: 'cName', visible: true, align: 'center', valign: 'middle'},
            {title: '姓名（英文）', field: 'eName', visible: true, align: 'center', valign: 'middle'},
            {title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle'},
            {title: '出生日期', field: 'birthday', visible: true, align: 'center', valign: 'middle'},
            {title: '出生地', field: 'birthplace', visible: true, align: 'center', valign: 'middle'},
            {title: '证件照', field: 'photoUrl', visible: true, align: 'center', valign: 'middle'},
            {title: '国籍/地区', field: 'nationality', visible: true, align: 'center', valign: 'middle'},
            {title: '毕业院校及专业，学位（中文）', field: 'cGraduate', visible: true, align: 'center', valign: 'middle'},
            {title: '毕业院校及专业，学位（英文）', field: 'eGraduate', visible: true, align: 'center', valign: 'middle'},
            {title: '回国（来晋）前工作单位及职务（中文）', field: 'cWorkUnit', visible: true, align: 'center', valign: 'middle'},
            {title: '回国（来晋）前工作单位及职务（英文）', field: 'eWorkUnit', visible: true, align: 'center', valign: 'middle'},
            {title: '学历学位', field: 'education', visible: true, align: 'center', valign: 'middle'},
            {title: '公司名称', field: 'companyName', visible: true, align: 'center', valign: 'middle'},
            {title: '职务（岗位）', field: 'post', visible: true, align: 'center', valign: 'middle'},
            {title: '公司地址', field: 'companyAddress', visible: true, align: 'center', valign: 'middle'},
            {title: '邮编', field: 'zipCode', visible: true, align: 'center', valign: 'middle'},
            {title: '研究领域', field: 'field', visible: true, align: 'center', valign: 'middle'},
            {title: '工作时间', field: 'workTime', visible: true, align: 'center', valign: 'middle'},
            {title: '成员类别', field: 'memberType', visible: true, align: 'center', valign: 'middle'},
            {title: '研究领域概述', field: 'fieldSummary', visible: true, align: 'center', valign: 'middle'},
            {title: '研究成果产品', field: 'developProduct', visible: true, align: 'center', valign: 'middle'},
            {title: '发表的论文', field: 'publishThesis', visible: true, align: 'center', valign: 'middle'},
            {title: '获得各级奖励情况', field: 'getAwardsDetail', visible: true, align: 'center', valign: 'middle'},
            {title: '禁止协议', field: 'banProtocol', visible: true, align: 'center', valign: 'middle'},
            {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'},
            {title: '创建时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
            {title: '创建用户', field: 'createUser', visible: true, align: 'center', valign: 'middle'},
            {title: '更新时间', field: 'updateTime', visible: true, align: 'center', valign: 'middle'},
            {title: '更新用户', field: 'updateUser', visible: true, align: 'center', valign: 'middle'}
    ];
};

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

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

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

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

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

$(function () {
    var defaultColunms = ChannelplanMemberInfo.initColumn();
    var table = new BSTable(ChannelplanMemberInfo.id, "/channelplanMemberInfo/list", defaultColunms);
    table.setPaginationType("client");
    ChannelplanMemberInfo.table = table.init();
});
