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

/**
 * 初始化表格的列
 */
ChannelplanExpertDetail.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
            {title: '唯一标识', field: 'id', visible: true, align: 'center', valign: 'middle'},
            {title: '海峡计划申报专家评分id', field: 'cpExpertId', visible: true, align: 'center', valign: 'middle'},
            {title: '', field: 'parentId', visible: true, align: 'center', valign: 'middle'},
            {title: '评分标准ID', field: 'standardId', visible: true, align: 'center', valign: 'middle'},
            {title: '等级得分', field: 'score', 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'}
    ];
};

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

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

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

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

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

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