/**
 * 初始化硕博人才生活补贴申报详情对话框
 */
var LivingAllowanceInfoInfoDlg = {
    livingAllowanceInfoInfoData : {}
};

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

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

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

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

/**
 * 收集数据
 */
LivingAllowanceInfoInfoDlg.collectData = function() {
    this
    .set('id')
    .set('year')
    .set('enterpriseId')
    .set('enterpriseName')
    .set('type')
    .set('talentType')
    .set('cardType')
    .set('idCard')
    .set('name')
    .set('photo')
    .set('sex')
    .set('nation')
    .set('nationality')
    .set('provinceCode')
    .set('provinceName')
    .set('cityCode')
    .set('cityName')
    .set('countyCode')
    .set('countyName')
    .set('birthday')
    .set('address')
    .set('politics')
    .set('highEducation')
    .set('graduateSchool')
    .set('major')
    .set('post')
    .set('phone')
    .set('email')
    .set('bank')
    .set('bankNetwork')
    .set('bankAccount')
    .set('bankNumber')
    .set('entryTime')
    .set('quitTime')
    .set('startTime')
    .set('endTime')
    .set('educationAndResume')
    .set('mainHonours')
    .set('firstInJJTime')
    .set('isIntroduction')
    .set('industryField')
    .set('title')
    .set('professionalQualifications')
    .set('studyAbroad')
    .set('studyAbroadCountry')
    .set('studyAbroadTime')
    .set('introductionMode')
    .set('letterTime')
    .set('applyCount')
    .set('isPublic')
    .set('amount')
    .set('isPay')
    .set('publicBatch')
    .set('active')
    .set('checkState')
    .set('checkMsg')
    .set('fields')
    .set('files')
    .set('firstSubmitTime')
    .set('newSubmitTime')
    .set('outMsg')
    .set('highProcess')
    .set('isEffect')
    .set('description')
    .set('createTime')
    .set('createUser')
    .set('updateTime')
    .set('updateUser');
}

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

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

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

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

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

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

$(function() {

});
