/**
 * 报销 的左侧树形列表参数 
 * 
 * @link      http://www.u-bo.com
 * @copyright 南京友博网络科技有限公司 
 * @license   http://www.u-bo.com/license/ 
 * 
 * @author Strief http://blog.u-bo.com
 * @since 0.1
 */

/**
 * 报销列表页左侧人员和任务树的切换
 */
$(document).on('click', '#labelLink', function() {
    $('.labelfocus').removeAttr('class');
    $(this).attr('class','labelfocus');
    if ($(this).text() == '人员') {
        $('.lefttree-user').show();
        $('.lefttree-task').hide();
        $('.lefttree-category').hide();
    } else if ($(this).text() == '人员') {
        $('.lefttree-task').show();
        $('.lefttree-user').hide();
        $('.lefttree-category').hide();
    } else if ($(this).text() == '类别') {
        $('.lefttree-category').show();
        $('.lefttree-task').hide();
        $('.lefttree-user').hide();
    }
});

//iframe自适应高度
$("#iframe_default").load(function(){
    var mainheight = $(this).contents().find("body").height();
    $("#iframe_default").attr("style","min-height: "+mainheight+"px; min-height: 700px; width: 100%;");
});

/*************人员树***************/
var setting = {
    async: {
        enable: true,
        url: getTreeDataUrl,
        type: "get"
    },
    data: {
        simpleData: {
            enable: true,
            idKey: "dept_id",
            pIdKey: "parent_id"
        }
    },
    view: {
        showIcon: false,
        selectedMulti: false,
        fontCss: {
            color: "#005bb8"
        }
    },
    callback: {
        onClick: zTreeOnClick
    },
    editable: true // 开启可编辑
}


$(document).ready(function() {
    $.fn.zTree.init($("#tree"), setting);
});

