billsLibTree.js 922 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Created by vian on 2017/4/10.
  3. */
  4. var billsLibTree = {
  5. setting: {
  6. id: 'ID',
  7. pid: 'ParentID',
  8. nid: 'NextSiblingID',
  9. rootId: -1
  10. },
  11. virtualRoot: [{
  12. ID: 1,
  13. ParentID: -1,
  14. NextSiblingID: -1,
  15. code: '开始编辑',
  16. }],
  17. createBillsTree: function(){
  18. var billsTree = function(){
  19. this.datas = null;
  20. this.tree = null;
  21. };
  22. billsTree.prototype.loadDatas = function(datas){
  23. if(datas){
  24. this.datas = datas;
  25. this.tree = idTree.createInit(billsLibTree.setting);
  26. this.tree.loadDatas(this.datas);
  27. }
  28. else {
  29. this.datas = [];
  30. this.tree = idTree.createInit(billsLibTree.setting);
  31. this.tree.loadDatas(this.datas);
  32. }
  33. };
  34. return new billsTree();
  35. }
  36. }