/**
 * 初始化channelplanInfo详情对话框
 */
var ChannelplanBasicinfoInfoDlg = {
    channelplanBasicinfoInfoData : {}
};

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

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

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

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

/**
 * 收集数据
 */
ChannelplanBasicinfoInfoDlg.collectData = function() {
    this
    .set('id')
    .set('project')
    .set('type')
    .set('batchId')
    .set('enterprise')
    .set('idCard')
    .set('field')
    .set('contactsName')
    .set('contactsPhone')
    .set('contactsMobile')
    .set('bankName')
    .set('bankAddress')
    .set('bankNumber')
    .set('patentDetail')
    .set('projectDetail')
    .set('teamProfile')
    .set('supportUnit')
    .set('registMonney')
    .set('doctorsNumber')
    .set('masterNumber')
    .set('undergraduateNumber')
    .set('otherNumber')
    .set('enterpriseDetail')
    .set('zbgcAndGqjg')
    .set('technicalAndManageTeam')
    .set('projectAndManageRes')
    .set('coreTechnology')
    .set('enterpriseSocietyResult')
    .set('productForeground')
    .set('workTarget')
    .set('mainWay')
    .set('foundation')
    .set('projectDegree')
    .set('projectScheme')
    .set('expectedContribution')
    .set('group')
    .set('checkState')
    .set('secScore')
    .set('secType')
    .set('secMsg')
    .set('thirdScore')
    .set('thirdType')
    .set('thirdMsg')
    .set('lastType')
    .set('lastMsg')
    .set('description')
    ;
}

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

    this.clearData();
    this.collectData();
    Feng.confirm("提交前请确认所有信息填写无误且无遗漏，确认提交后无法更改信息",function () {

        var id = $("#id").val();
        if(id!=null&&id!=""){
            //更新信息
            var ajax=new $ax(Feng.ctxPath+"/api/channelPlan/updateSubmit",function(data){
                Feng.success("提交成功！");
                updateIncome();
                window.parent.ChannelplanBasicinfo.table.refresh();
            },function (data) {
                Feng.error("提交失败！"+data.responseJson.message()+"!");
            })
            ajax.set(this.channelplanBasicinfoInfoData);
            ajax.start();
        }else{
            //提交信息
            var ajax = new $ax(Feng.ctxPath + "/api/channelPlan/addSubmit", function(data){
                Feng.success("提交成功!");
                var cpid=data.obj;
                submitIncome(cpid);
                window.parent.ChannelplanBasicinfo.table.refresh();
                ChannelplanBasicinfoInfoDlg.close();
            },function(data){
                Feng.error("添加失败!" + data.responseJSON.message + "!");
            });
            ajax.set(this.channelplanBasicinfoInfoData);
            ajax.start();
        }
    });

}

/**
 * 添加保存
 */
ChannelplanBasicinfoInfoDlg.addSave = function() {

    this.clearData();
    this.collectData();
    var id = $("#id").val();
    if(id!=null&&id!=""){
        //提交信息
        var ajax = new $ax(Feng.ctxPath + "/api/channelPlan/updateSave", function(data){
            Feng.success("修改成功!");
            updateIncome();
            window.parent.ChannelplanBasicinfo.table.refresh();
        },function(data){
            Feng.error("修改失败!" + data.responseJSON.message + "!");
        });
        ajax.set(this.channelplanBasicinfoInfoData);
        ajax.start();
    }else{
        //提交信息
        var ajax = new $ax(Feng.ctxPath + "/api/channelPlan/addSave", function(data){
            Feng.success("添加成功!");
            $('.cg').off('show.bs.tab');
            var cpid=data.obj;
            if(cpid!=null&&cpid!="") {
                submitIncome(cpid);
                $("#id").val(cpid);
                iniTreeView(cpid);
            }
            window.parent.ChannelplanBasicinfo.table.refresh();

        },function(data){
            Feng.error("添加失败!" + data.responseJSON.message + "!");
        });
        ajax.set(this.channelplanBasicinfoInfoData);
        ajax.start();
    }


}

/**
 * 修改后保存
 */
ChannelplanBasicinfoInfoDlg.editSave = function() {

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

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/api/channelPlan/updateSave", function(data){
        Feng.success("修改成功!");
        updateIncome();
        window.parent.ChannelplanBasicinfo.table.refresh();
    },function(data){
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.channelplanBasicinfoInfoData);
    ajax.start();

}
/**
 * 修改后提交
 */
ChannelplanBasicinfoInfoDlg.editSubmit = function() {

    this.clearData();
    this.collectData();
    Feng.confirm("提交前请确认所有信息填写无误且无遗漏，确认提交后无法更改信息",function () {
        //提交信息
        var ajax = new $ax(Feng.ctxPath + "/api/channelPlan/updateSubmit", function(data){
            Feng.success("修改成功!");
            updateIncome();
            window.parent.ChannelplanBasicinfo.table.refresh();
            ChannelplanBasicinfoInfoDlg.close();
        },function(data){
            Feng.error("修改失败!" + data.responseJSON.message + "!");
        });
        ajax.set(this.channelplanBasicinfoInfoData);
        ajax.start();
    })
}

function showBatchSelect() {
    var ajax = new $ax(Feng.ctxPath + "/api/commonBatch/channelPlanBatch", function(data){
        var h = "";
        $.each(data, function(key, value) {

            h += "<option value='" + value.id + "'>" + value.batch //下拉框序言的循环数据
                + "</option>";
        });
        $("#batchId").append(h);//append 添加进去并展示
        $("#batchId").on(
            "change",
            function(a, b, c) {
                $("#contentID").val(
                    $("#batchId option:selected").val());

                $("#contentName").val(
                    $("#batchId option:selected").text());

            })
    },function(data){
        Feng.error("获取Batch数据失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.unCommonFiletypeInfoData);
    ajax.start();
}

//提交企业收入数据
function submitIncome(cpid){
    var objs=new Array();
    $("#income_table tr").each(function(index){
        if(index==0){
            return true;
        }
        var year=$(this).find("input[name='year']").val();
        var researchIn=$(this).find("input[name='researchIn']").val();
        var coreProduct=$(this).find("input[name='coreProduct']").val();
        var proportion=$(this).find("input[name='proportion']").val();
        var addTax=$(this).find("input[name='addTax']").val();
        var incomeTax=$(this).find("input[name='incomeTax']").val();
        objs.push({"year":year,"researchIn":researchIn,"coreProduct":coreProduct,"proportion":proportion,"addTax":addTax,"incomeTax":incomeTax,"cpid":cpid});
    });
    $.ajax({
        type: "POST",
        url: Feng.ctxPath + "/api/channelplanEnterpriseIncome/add",
        contentType:'application/json;charset=utf-8',
        data: JSON.stringify(objs),
        success: function(data) {
            $('#incomesR').empty();
            var incomes=data.obj;
            $.each(incomes,function(i,item){
                $('#incomesR').append("<tr>\n" +
                    "\n" +
                    "                                        <td>\n" +
                    "                                            <input name=\"year\" type=\"text\" class=\"form-control input-small\" value=\""+item.year+"\"/>\n" +
                    "                                        </td>\n" +
                    "                                        <td> <input name=\"researchIn\" type=\"text\" class=\"form-control input-small\" value=\""+item.researchIn+"\"/> </td>\n" +
                    "                                        <td> <input name=\"coreProduct\" type=\"text\" class=\"form-control input-small\" value=\""+item.coreProduct+"\"/> </td>\n" +
                    "                                        <td> <input name=\"proportion\" type=\"text\" class=\"form-control input-small\" value=\""+item.proportion+"\"/> </td>\n" +
                    "                                        <td> <input name=\"addTax\" type=\"text\" class=\"form-control input-small\" value=\""+item.addTax+"\"/> </td>\n" +
                    "                                        <td> <input name=\"incomeTax\" type=\"text\" class=\"form-control input-small\" value=\""+item.incomeTax+"\"/> </td>\n" +
                    "                                        <td hidden=\"hidden\"><input name=\"id\" type=\"text\" hidden=\"hidden\" value=\""+item.id+"\"/></td>\n" +
                    "                                        <td hidden=\"hidden\"><input name=\"cpid\" type=\"text\" hidden=\"hidden\" value=\""+item.cpid+"\"/></td>\n" +
                    "                                    </tr>")
            });

            console.log(data);
        },
        error: function(e) {
            console.log(e);
        }
    });
}



//更改企业收入数据
function updateIncome(){
    var objs=new Array();
    $("#income_table tr").each(function(index){
        if(index==0){
            return true;
        }
        var id=$(this).find("input[name='id']").val();
        var cpid=$(this).find("input[name='cpid']").val();
        var year=$(this).find("input[name='year']").val();
        var researchIn=$(this).find("input[name='researchIn']").val();
        var coreProduct=$(this).find("input[name='coreProduct']").val();
        var proportion=$(this).find("input[name='proportion']").val();
        var addTax=$(this).find("input[name='addTax']").val();
        var incomeTax=$(this).find("input[name='incomeTax']").val();
        objs.push({"id":id,"year":year,"researchIn":researchIn,"coreProduct":coreProduct,"proportion":proportion,"addTax":addTax,"incomeTax":incomeTax,"cpid":cpid});
    });
    $.ajax({
        type: "POST",
        url: Feng.ctxPath + "/api/channelplanEnterpriseIncome/updateIncomes",
        contentType:'application/json;charset=utf-8',
        data: JSON.stringify(objs),
        success: function(data) {
            console.log(data);
        },
        error: function(e) {
            console.log(e);
        }
    });
}

//提交或更改成员基本信息
function upAddMemberInfo(){
    var objs=new Array();
    var id=$('#memberId').val();
    var cpId=$('#id').val();
    var cName=$('#cName').val();
    var eName=$('#eName').val();
    var sex=$('#sex').val();
    var birthday=$('#birthday').val();
    var birthplace=$('#birthplace').val();
    var photoUrl=$('#photoUrl').val();
    var nationality=$('#nationality').val();
    var cGraduate=$('#cGraduate').val();
    var eGraduate=$('#eGraduate').val();
    var cWorkUnit=$('#cWorkUnit').val();
    var eWorkUnit=$('#eWorkUnit').val();
    var education=$('#education').val();
    var companyName=$('#companyName').val();
    var post=$('#post').val();
    var companyAddress=$('#companyAddress').val();
    var zipCode=$('#zipCode').val();
    var field=$('#m_field').val();
    var workTime=$('#workTime').val();
    var memberType=$('#memberType').val();
    var fieldSummary=$('#fieldSummary').val();
    var developProduct=$('#developProduct').val();
    var publishThesis=$('#publishThesis').val();
    var getAwardsDetail=$('#getAwardsDetail').val();
    var banProtocol=$('#banProtocol').val();
    var description=$('#m_description').val();
    objs.push({"id":id
        ,"cpId":cpId
        ,"cName":cName
        ,"eName":eName
        ,"sex":sex
        ,"birthday":birthday
        ,"birthplace":birthplace
        ,"photoUrl":photoUrl
        ,"nationality":nationality
        ,"cGraduate":cGraduate
        ,"eGraduate":eGraduate
        ,"cWorkUnit":cWorkUnit
        ,"eWorkUnit":eWorkUnit
        ,"education":education
        ,"companyName":companyName
        ,"post":post
        ,"companyAddress":companyAddress
        ,"zipCode":zipCode
        ,"field":field
        ,"workTime":workTime
        ,"memberType":memberType
        ,"fieldSummary":fieldSummary
        ,"developProduct":developProduct
        ,"publishThesis":publishThesis
        ,"getAwardsDetail":getAwardsDetail
        ,"banProtocol":banProtocol
        ,"description":description
    })
    if(id!=null&&id!=""){
        $.ajax({
            type: "POST",
            url: Feng.ctxPath + "/api/channelplanMemberInfo/update",
            contentType:'application/json;charset=utf-8',
            data: JSON.stringify(objs),
            success: function(data) {
                Feng.success("更改成员基本信息成功");
                closeMemberInfo();
                tabShow();
            },
            error: function(e) {
                Feng.error(e);
            }
        });
    }else{
        $.ajax({
            type: "POST",
            url: Feng.ctxPath + "/api/channelplanMemberInfo/add",
            contentType:'application/json;charset=utf-8',
            data: JSON.stringify(objs),
            success: function(data) {
                Feng.success("添加成员基本信息成功");
                closeMemberInfo();
                tabShow();
            },
            error: function(e) {
                Feng.error(e);
            }
        });
    }
}



//关闭成员信息模态框
function closeMemberInfo(){
    $('#memberInfoModel').modal('hide');
}


/*//弹出成员信息模态框
$('#memberInfo_table').bootstrapTable({
    onDblClickRow: function (row) {
        $('#memberInfoModel').modal('show');
    }
});*/
//弹出成员信息模态框
function showMemberInfo(t){
    var memberId=$(t).parent().parent().children().eq(1).text();
    $("#memberId").val(memberId);
    var memberType=$(t).parent().parent().children().eq(0).text();
    if(memberType=="团队带头人"){
        $('#memberType').val('teamLeader');
    }else if(memberType=="第一核心成员"){
        $('#memberType').val('team01');
    }else if(memberType=="第二核心成员"){
        $('#memberType').val('team02');
    }else if(memberType=='第三核心成员'){
        $('#memberType').val('team03');
    }else if(memberType=='第四核心成员'){
        $('#memberType').val('team04');
    }else if(memberType=='第五核心成员'){
        $('#memberType').val('team05');
    }else if(memberType=='第六核心成员'){
        $('#memberType').val('team06');
    }
    if(memberId!=null&&memberId!=''){
        $.ajax({
            type: "POST",
            url: Feng.ctxPath + "/api/channelplanMemberInfo/selectMember/" + memberId,
            dataType: "json",
            success: function(res) {
                res=$.parseJSON(res);
                initMember(res);
            },
            error: function(e) {
                console.log(e);
            }
        });
    }
    $('#memberInfoModel').modal('show');
}


//弹出成员教育经历模态框
function popEducation(t) {
    var memberId=$(t).parent().parent().children().eq(1).text();
    if(memberId!=null&&memberId!=''){
        $("#educationExperience").modal({
            remote: Feng.ctxPath+"/api/channelplanMemberEduction?memberId="+memberId
        });
        $("#educationExperience").modal('show');
    }
}


//弹出成员工作经历模态框
function popWork(t) {
    var memberId=$(t).parent().parent().children().eq(1).text();
    if(memberId!=null&&memberId!='') {
        $("#workExperience").modal({
            remote: Feng.ctxPath + "/api/channelplanMemberWork?memberId="+memberId
        });
        $("#workExperience").modal('show');
    }
}


//弹出成员项目经历模态框
function popProject(t) {
    var memberId=$(t).parent().parent().children().eq(1).text();
    if(memberId!=null&&memberId!='') {
        $("#projectExperience").modal({
            remote: Feng.ctxPath + "/api/channelplanMemberProject?memberId="+memberId
        });
        $("#projectExperience").modal('show');
    }
}


//弹出成员专利经历模态框
function popPatent(t) {
    var memberId=$(t).parent().parent().children().eq(1).text();
    if(memberId!=null&&memberId!='') {
        $("#projectExperience").modal({
            remote: Feng.ctxPath + "/api/channelplanMemberPatent?memberId="+memberId
        });
        $("#projectExperience").modal('show');
    }
}
/*
//关闭成员项目经历模态框
function closeMemberInfo(){
    $("#projectExperience").on("hidden", function() {
        $(this).removeData("modal");
    })
    $('#projectExperience').modal('hide');
}*/

//初始化树形结构
function iniTreeView(cpId){
    $('#tree').empty();
    //获取申报文件类别
    $.ajax({
        type: "GET",
        url: Feng.ctxPath + "/api/channelPlan/listCPFiletype?cpId="+cpId,
        success: function(res) {
            $('#tree').treeview({
                data:res,
            });
            $('#tree').treeview('collapseAll',{silent:true});
            $('.node-tree').viewer({
                url: 'data-original'
            });
        },
        error: function(e) {
            console.log(e);
        }
    });

}


//选择附件并显示附件名
function checkFile(typeId,cpId,memberTypeId){
    /*if(!TalentInfoInfoDlg.validateIsEdit())return;
    if(state==3){
        Feng.info("该附件已通过审核，无法修改");
        return ;
    }*/
    $("#upload_file ").unbind("change");
    $("#upload_file ").change(function () {
        upload(typeId,cpId,memberTypeId);
    });
    $('#upload_file').val("");
    $('#upload_file').click();

}

//上传文件

function upload(typeId,cpId,memberTypeId){
    /*    var id = $("#id").val();
        if(id==null || id==''){
            Feng.info("请先添加基本信息并保存后再试");
            return ;
        }
        if(!TalentInfoInfoDlg.validateIsEdit())return;
        if(fileId!=null&&fileId!='null'){
            $("#fileId").val(fileId)
        }else{
            $("#fileId").val("");
        }
        $("#mainId").val(id);
        $("#fileTypeId").val(fileTypeId);*/
    $("#cpId").val(cpId);
    $("#typeId").val(typeId);
    $("#memberTypeId").val(memberTypeId);
    var index = layer.load(0, {shade: false,time:0});
    $("#index").val(index);
    $("#uploadForm").submit();
    iniTreeView(cpId);
}

//回调
ChannelplanBasicinfoInfoDlg.callBack = function (data){
    layer.close(data.obj);
    Feng.info(data.msg);
    if (data.code == 200) {
        $("#fileTable").bootstrapTable("refresh", {});
    }
}

//tab-2显示前执行
/*$("#memberInfoShow").on('show.bs.tab',function(tab){
    var cpid=$("#id").val();
    if(cpid!=null&&cpid!=""){
        $.ajax({
            type: "POST",
            url: Feng.ctxPath + "/api/channelplanMemberInfo/listMember/" + cpid,
            dataType:"json",
            success: function(res) {
                initMemberInfo(res);
                console.log(res);
            },
            error: function(e) {
                console.log(e);
            }
        });
    }
})*/
function tabShow(){
    var cpid=$("#id").val();
    if(cpid!=null&&cpid!=""){
        $.ajax({
            type: "POST",
            url: Feng.ctxPath + "/api/channelplanMemberInfo/listMember/" + cpid,
            dataType: "json",
            success: function(res) {
                initMemberInfo(res);
            },
            error: function(e) {
                Feng.error(e);
            }
        });
    }
}

//初始化成员信息
function initMemberInfo(memberInfos){
    var obj=$.parseJSON(memberInfos);
    $.each(obj,function(index,key){
        var sex=key.sex;
        if(sex==1){
            sex='男';
        }else if(sex==2){
            sex='女';
        }
        if(key.memberType=="teamLeader"){
            $("#teamLeader").children("td").eq(1).html(key.id);
            $("#teamLeader").children("td").eq(2).html(key.cName);
            $("#teamLeader").children("td").eq(3).html(sex);
            $("#teamLeader").children("td").eq(4).html(key.nationality);
            $("#teamLeader").children("td").eq(5).html(key.education);
            $("#teamLeader").children("td").eq(6).html(key.field);
            $("#teamLeader").children("td").eq(7).html(key.workTime);
        }else if(key.memberType=="team01"){
            $("#team01").children("td").eq(1).html(key.id);
            $("#team01").children("td").eq(2).html(key.cName);
            $("#team01").children("td").eq(3).html(sex);
            $("#team01").children("td").eq(4).html(key.nationality);
            $("#team01").children("td").eq(5).html(key.education);
            $("#team01").children("td").eq(6).html(key.field);
            $("#team01").children("td").eq(7).html(key.workTime);
        }else if(key.memberType=="team02"){
            $("#team02").children("td").eq(1).html(key.id);
            $("#team02").children("td").eq(2).html(key.cName);
            $("#team02").children("td").eq(3).html(sex);
            $("#team02").children("td").eq(4).html(key.nationality);
            $("#team02").children("td").eq(5).html(key.education);
            $("#team02").children("td").eq(6).html(key.field);
            $("#team02").children("td").eq(7).html(key.workTime);
        }else if(key.memberType=="team06"){
            $("#team06").children("td").eq(1).html(key.id);
            $("#team06").children("td").eq(2).html(key.cName);
            $("#team06").children("td").eq(3).html(sex);
            $("#team06").children("td").eq(4).html(key.nationality);
            $("#team06").children("td").eq(5).html(key.education);
            $("#team06").children("td").eq(6).html(key.field);
            $("#team06").children("td").eq(7).html(key.workTime);
        }else if(key.memberType=="team03"){
            $("#team03").children("td").eq(1).html(key.id);
            $("#team03").children("td").eq(2).html(key.cName);
            $("#team03").children("td").eq(3).html(sex);
            $("#team03").children("td").eq(4).html(key.nationality);
            $("#team03").children("td").eq(5).html(key.education);
            $("#team03").children("td").eq(6).html(key.field);
            $("#team03").children("td").eq(7).html(key.workTime);
        }else if(key.memberType=="team04"){
            $("#team04").children("td").eq(1).html(key.id);
            $("#team04").children("td").eq(2).html(key.cName);
            $("#team04").children("td").eq(3).html(sex);
            $("#team04").children("td").eq(4).html(key.nationality);
            $("#team04").children("td").eq(5).html(key.education);
            $("#team04").children("td").eq(6).html(key.field);
            $("#team04").children("td").eq(7).html(key.workTime);
        }else if(key.memberType=="team05"){
            $("#team05").children("td").eq(1).html(key.id);
            $("#team05").children("td").eq(2).html(key.cName);
            $("#team05").children("td").eq(3).html(sex);
            $("#team05").children("td").eq(4).html(key.nationality);
            $("#team05").children("td").eq(5).html(key.education);
            $("#team05").children("td").eq(6).html(key.field);
            $("#team05").children("td").eq(7).html(key.workTime);
        }
    });
}

//成员证件照
function fileChange(context){
    var file  = $(context).val();
    var pos = file.lastIndexOf("\\");
    $("#photoUrl").val(file.substring(pos+1));
}


//initMember
function initMember(res){
    $('#memberId').val(res.id);
    $('#cpId').val(res.cpId);
    $('#cName').val(res.cName);
    $('#eName').val(res.eName);
    $('#sex').val(res.sex);
    $('#birthday').val(res.birthday);
    $('#birthplace').val(res.birthplace);
    $('#photoUrl').val(res.photoUrl);
    $('#nationality').val(res.nationality);
    $('#cGraduate').val(res.cGraduate);
    $('#eGraduate').val(res.eGraduate);
    $('#cWorkUnit').val(res.cWorkUnit);
    $('#eWorkUnit').val(res.eWorkUnit);
    $('#education').val(res.education);
    $('#companyName').val(res.companyName);
    $('#post').val(res.post);
    $('#companyAddress').val(res.companyName);
    $('#zipCode').val(res.zipCode);
    $('#m_field').val(res.field);
    $('#workTime').val(res.workTime);
    $('#memberType').val(res.memberType);
    $('#fieldSummary').val(res.fieldSummary);
    $('#developProduct').val(res.developProduct);
    $('#publishThesis').val(res.publishThesis);
    $('#getAwardsDetail').val(res.getAwardsDetail);
    $('#banProtocol').val(res.banProtocol);
    $('#m_description').val(res.description);
}

//锁定标签页
$('.cg').on('show.bs.tab', function(e) {
    e.preventDefault();
    Feng.alert("请先保存基本信息，再填写后续信息")
});

//折叠treeview所有节点
function collapseAll(){
    $("#tree").treeview('collapseAll',{silent:true});
}

//展开treeview所有节点
function expandeAll(){
    $("#tree").treeview('expandAll',{silent:true});
}

//图片查看器
function showImg(a){
    /*$(".imgUrl").viewer({
        url : "data-original"
    });*/
    window.open(a.src);
}

//初始化方法
$(function() {
    //批量加载时间控件
    $(".date").each(function(){
        laydate.render({
            elem: this
            ,type: 'date'
            ,trigger: 'click'
        });
    });
    var date=new Date();
    var year=date.getFullYear();
    $("#income_table").find("tr").eq(1).find("td").eq(0).children().val(year-4);
    $("#income_table").find("tr").eq(2).find("td").eq(0).children().val(year-3);
    $("#income_table").find("tr").eq(3).find("td").eq(0).children().val(year-2);
    $("#income_table").find("tr").eq(4).find("td").eq(0).children().val(year-1);
    $("#income_table").find("tr").eq(5).find("td").eq(0).children().val(year);
    var arr = new Array();
    arr.push({"id":"field","code":"un_professionalField"});       //专业领域
    arr.push({"id":"type","code":"un_declareSort"});              //申报类别
    arr.push({"id":"education","code":"un_education"});           //学历学位
    arr.push({"id":"memberType","code":"un_teamMember"});         //成员类别
    arr.push({"id":"m_field","code":"un_professionalField"});     //研究领域
    arr.push({"id":"nationality","code":"un_nationality"});       //国籍
    for(var key in arr){
        Feng.addAjaxSelect({
            "id": arr[key].id,
            "displayCode": "code",
            "displayName": "name",
            "type": "GET",
            "url": Feng.ctxPath + "/api/common/findChildDictByCode?code="+arr[key].code
        });
    }
    //获取Batch
    Feng.addAjaxSelect({
        "id": "batchId",
        "displayCode": "id",
        "displayName": "batch",
        "type": "GET",
        "url": Feng.ctxPath + "/api/commonBatch/channelPlanBatch"
    });
    $("select").each(function () {
        $(this).val($(this).attr("selectVal"));
    });
/*    //初始化成员信息
    initMemberInfo();*/
    //初始化treeView
    var cpId=$("#id").val();
    iniTreeView(cpId);
});
