/**
 * Created by vian on 2017/4/10.
 */
var billsLibTree = {
    setting: {
        id: 'ID',
        pid: 'ParentID',
        nid: 'NextSiblingID',
        rootId: -1
    },
    virtualRoot: [{
        ID: 1,
        ParentID: -1,
        NextSiblingID: -1,
        code: '开始编辑',
    }],
    createBillsTree: function(){
        var billsTree = function(){
            this.datas = null;
            this.tree = null;
        };

        billsTree.prototype.loadDatas = function(datas){
            if(datas){
                this.datas = datas;
                this.tree = idTree.createNew(billsLibTree.setting);
                this.tree.loadDatas(this.datas);
           }
           else {
                this.datas = [];
                this.tree = idTree.createNew(billsLibTree.setting);
                this.tree.loadDatas(this.datas);
            }
        };

        return new billsTree();
    }
}
