ledger_tree_col.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date
  7. * @version
  8. */
  9. const ledgerTreeCol = {
  10. readOnly: {
  11. unit_price: function (node) {
  12. return node.children && node.children.length > 0;
  13. },
  14. quantity: function (node) {
  15. return (node.children && node.children.length > 0);
  16. },
  17. total_price: function (node) {
  18. return node.children && node.children.length > 0;
  19. },
  20. dgnQty: function (node) {
  21. console.log(node.b_code);
  22. console.log(!_.isEmpty(node.b_code));
  23. return _.isEmpty(node.b_code);
  24. },
  25. },
  26. getEvent: function (eventName) {
  27. const 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. initSpreadSetting(setting) {
  43. for (const col of setting.cols) {
  44. if (col.readOnly && Object.prototype.toString.apply(col.readOnly) === "[object String]") {
  45. col.readOnly = this.getEvent(col.readOnly);
  46. }
  47. }
  48. }
  49. };