category.js 4.0 KB

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