category.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. export const tableHeader = (type) => {
  2. switch (+type) {
  3. case 3:
  4. return [{ label: '牌号', prop: 'brandNum' }];
  5. case 8:
  6. return [
  7. { label: '型号', prop: 'modelType' ,
  8. formatter (row) {
  9. if (!row?.category) return '';
  10. return row.category.modelType;
  11. }
  12. },
  13. { label: '规格', prop: 'specification',
  14. formatter (row) {
  15. if (!row?.category) return '';
  16. return row.category.specification;
  17. }
  18. }
  19. ];
  20. case 4:
  21. return [
  22. { label: '牌号', prop: 'brandNum' },
  23. { label: '型号', prop: 'modelType' ,
  24. formatter (row) {
  25. if (!row?.category) return '';
  26. return row.category.modelType;
  27. }
  28. },
  29. ];
  30. case 5: //'周转车'
  31. return [
  32. { label: '规格', prop: 'specification',
  33. formatter (row) {
  34. if (!row?.category) return '';
  35. return row.category.specification;
  36. }
  37. },
  38. {
  39. label: '材质',
  40. prop: 'texture',
  41. formatter (row) {
  42. if (!row?.extendField) return '';
  43. const extendField = JSON.parse(row.extendField);
  44. return extendField.texture;
  45. }
  46. },
  47. {
  48. label: '长宽高',
  49. prop: '',
  50. formatter (row) {
  51. if (!row?.extendField) return '';
  52. const extendField = JSON.parse(row.extendField);
  53. return `${extendField.length || '-'}*${extendField.width || '-'}*${
  54. extendField.high || '-'
  55. }`;
  56. }
  57. }
  58. ];
  59. case 2: //'舟皿'
  60. return [
  61. { label: '规格', prop: 'specification',
  62. formatter (row) {
  63. if (!row?.category) return '';
  64. return row.category.specification;
  65. }
  66. },
  67. { label: '型号', prop: 'modelType' ,
  68. formatter (row) {
  69. if (!row?.category) return '';
  70. return row.category.modelType;
  71. }
  72. },
  73. {
  74. label: '长宽高',
  75. prop: '',
  76. formatter (row) {
  77. if (!row?.extendField) return '';
  78. const extendField = JSON.parse(row.extendField);
  79. return `${extendField.length || '-'}*${extendField.width || '-'}*${
  80. extendField.high || '-'
  81. }`;
  82. }
  83. }
  84. ];
  85. case 1: //'设备'
  86. return [
  87. { label: '型号', prop: 'modelType' ,
  88. formatter (row) {
  89. if (!row?.category) return '';
  90. return row.category.modelType;
  91. }
  92. },
  93. { label: '规格', prop: 'specification',
  94. formatter (row) {
  95. if (!row?.category) return '';
  96. return row.category.specification;
  97. }
  98. }
  99. ];
  100. case 6: //'模具'
  101. return [
  102. { label: '牌号', prop: 'brandNum' },
  103. { label: '型号', prop: 'modelType' ,
  104. formatter (row) {
  105. if (!row?.category) return '';
  106. return row.category.modelType;
  107. }
  108. },
  109. {
  110. label: '收缩系数',
  111. prop: '',
  112. formatter (row) {
  113. if (!row?.extendField) return '';
  114. const extendField = JSON.parse(row.extendField);
  115. return extendField.shrinkageCoefficient;
  116. }
  117. }
  118. ];
  119. case 7: //'备品备件'
  120. return [
  121. { label: '规格', prop: 'specification',
  122. formatter (row) {
  123. if (!row?.category) return '';
  124. return row.category.specification;
  125. }
  126. },
  127. { label: '型号', prop: 'modelType' ,
  128. formatter (row) {
  129. if (!row?.category) return '';
  130. return row.category.modelType;
  131. }
  132. },
  133. ];
  134. }
  135. return [];
  136. };