/**
 * 初始化channelplanMemberWork详情对话框
 */
var ChannelplanMemberProjectInfoDlg = {
    channelplanMemberProjectInfoData : {}
};

/**
 * 清除数据
 */
ChannelplanMemberProjectInfoDlg.clearData = function() {
    this.channelplanMemberProjectInfoData = {};
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
ChannelplanMemberProjectInfoDlg.set = function(key, val) {
    this.channelplanMemberProjectInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
ChannelplanMemberProjectInfoDlg.get = function(key) {
    return $("#" + key).val();
}

/**
 * 关闭此对话框
 */
ChannelplanMemberProjectInfoDlg.close = function() {
    parent.layer.close(window.parent.ChannelplanMemberProject.layerIndex);
}

/**
 * 收集数据
 */
ChannelplanMemberProjectInfoDlg.collectData = function() {
    this
    .set('id')
    .set('memberId')
    .set('startTime')
    .set('endTime')
    .set('source')
    .set('totalMoney')
    .set('number')
    .set('position')
    .set('description')
    .set('createTime')
    .set('createUser')
    .set('updateTime')
    .set('updateUser');
}

/**
 * 提交添加
 */
ChannelplanMemberProjectInfoDlg.addSubmit = function() {

    this.clearData();
    this.collectData();

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/api/channelplanMemberProject/add", function(data){
        Feng.success("添加成功!");
        window.parent.ChannelplanMemberProject.table.refresh();
        ChannelplanMemberProjectInfoDlg.close();
    },function(data){
        Feng.error("添加失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.channelplanMemberProjectInfoData);
    ajax.start();
}

/**
 * 提交修改
 */
ChannelplanMemberProjectInfoDlg.editSubmit = function() {

    this.clearData();
    this.collectData();

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/api/channelplanMemberProject/update", function(data){
        Feng.success("修改成功!");
        window.parent.ChannelplanMemberProject.table.refresh();
        ChannelplanMemberProjectInfoDlg.close();
    },function(data){
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.channelplanMemberProjectInfoData);
    ajax.start();
}

$(function() {

});
