main_tree_col.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * Created by Mai on 2017/7/25.
  3. */
  4. let MainTreeCol = {
  5. getText: {
  6. type: function (node) {
  7. if (node.sourceType === projectObj.project.Bills.getSourceType()) {
  8. return '';
  9. } else if (node.sourceType === projectObj.project.Ration.getSourceType()) {
  10. return '定';
  11. } else if (node.sourceType === projectObj.project.VolumePrice.getSourceType()) {
  12. return '量';
  13. } else if (node.sourceType === projectObj.project.ration_glj.getSourceType()) {
  14. return '主';
  15. }
  16. }
  17. },
  18. readOnly: {
  19. volumePrice: function (node) {
  20. return node.sourceType === projectObj.project.VolumePrice.getSourceType();
  21. },
  22. billsParent: function (node) {
  23. return node.sourceType === projectObj.project.Bills.getSourceType() && node.source.children.length > 0;
  24. }
  25. },
  26. getEvent: function (eventName) {
  27. let names = eventName.split('.');
  28. let event = this;
  29. for (let name of names) {
  30. if (event[name]) {
  31. event = event[name];
  32. } else {
  33. return null;
  34. }
  35. }
  36. if (event && Object.prototype.toString.apply(event) !== "[object Function]") {
  37. return null;
  38. } else {
  39. return event;
  40. }
  41. },
  42. getNumberFormatter: function (digit) {
  43. switch (digit) {
  44. case 1:
  45. return '0.#';
  46. case 2:
  47. return '0.##';
  48. case 3:
  49. return '0.###';
  50. case 4:
  51. return '0.####';
  52. case 5:
  53. return '0.#####';
  54. case 6:
  55. return '0.######';
  56. default:
  57. return '0.##';
  58. }
  59. }
  60. }