bills.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Created by Mai on 2017/4/1.
  3. */
  4. var Bills = {
  5. createNew: function (project) {
  6. var billsTreeSetting = {
  7. id: 'ID',
  8. pid: 'ParentID',
  9. nid: 'NextSiblingID',
  10. rootId: -1
  11. };
  12. // 用户定义private方法
  13. var tools = {};
  14. // 所有通过this访问的属性,都不应在此单元外部进行写入操作
  15. var bills = function (proj) {
  16. this.project = proj;
  17. this.datas = null;
  18. this.tree = idTree.createNew(billsTreeSetting);
  19. var sourceType = 'bills';
  20. this.getSourceType = function () {
  21. return sourceType;
  22. }
  23. };
  24. // prototype用于定义public方法
  25. bills.prototype.loadDatas = function (datas) {
  26. this.datas = datas;
  27. // generate Fees Index,For View & Calculate
  28. /*this.datas.forEach(function (data) {
  29. data.FeesIndex = {};
  30. data.fees.forEach(function (fee) {
  31. data.FeesIndex[fee.fieldName] = fee;
  32. });
  33. });*/
  34. // datas load to Tree
  35. this.tree.loadDatas(this.datas);
  36. };
  37. return new bills(project);
  38. }
  39. };