ledger_tree_col.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. return !_.isEmpty(node.b_code);
  22. },
  23. },
  24. getEvent: function (eventName) {
  25. const names = eventName.split('.');
  26. let event = this;
  27. for (let name of names) {
  28. if (event[name]) {
  29. event = event[name];
  30. } else {
  31. return null;
  32. }
  33. }
  34. if (event && Object.prototype.toString.apply(event) !== "[object Function]") {
  35. return null;
  36. } else {
  37. return event;
  38. }
  39. },
  40. initSpreadSetting(setting) {
  41. for (const col of setting.cols) {
  42. if (col.readOnly && Object.prototype.toString.apply(col.readOnly) === "[object String]") {
  43. //col.readOnly = this.getEvent(col.readOnly);
  44. delete col.readOnly;
  45. }
  46. }
  47. }
  48. };