sjs_setting.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const sjsSettingObj = (function () {
  2. const FxTreeStyle = {
  3. jz: 'jianzhu',
  4. };
  5. const setJzFxTreeStyle = function (setting) {
  6. setting.selectedBackColor = '#fffacd';
  7. setting.tree = {
  8. getFont: function (sheet, data, row, col, defaultFont) {
  9. if (sheet.zh_tree && data.level === 1) {
  10. return 'bold ' + defaultFont;
  11. } else {
  12. return defaultFont;
  13. }
  14. },
  15. getColor: function (sheet, data, row, col, defaultColor) {
  16. if (sheet.zh_tree) {
  17. if (data.level === 2) {
  18. return '#C4CAFB';
  19. } else if ((!data.b_code || data.b_code === '') && data.level > 2) {
  20. return '#DFE8F9';
  21. } else {
  22. return defaultColor;
  23. }
  24. } else {
  25. return defaultColor;
  26. }
  27. }
  28. }
  29. };
  30. const setFxTreeStyle = function (setting, tag) {
  31. switch (tag) {
  32. case FxTreeStyle.jz:
  33. setJzFxTreeStyle(setting);
  34. break;
  35. }
  36. };
  37. const setGridSelectStyle = function (setting) {
  38. setting.selectedBackColor = '#fffacd';
  39. };
  40. const setTpThousandthFormat = function (setting, fields = []) {
  41. for (const col of setting.cols) {
  42. if (col.field === 'total_price' || col.field.indexOf('tp') >= 0 || fields.indexOf(col.field) >= 0)
  43. col.formatter = '0.000';
  44. }
  45. };
  46. const setThousandthFormat = function (setting, fields) {
  47. for (const f of fields) {
  48. const col = setting.cols.find(function (x) {
  49. return x.field === f
  50. });
  51. if (col) col.formatter = '0.000';
  52. }
  53. };
  54. return {setFxTreeStyle, FxTreeStyle, setGridSelectStyle, setTpThousandthFormat, setThousandthFormat};
  55. })();