carInfo.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. import { Request, Response } from 'express';
  2. const carInfo = [
  3. {
  4. id: 1,
  5. vehicleIndex: 'C',
  6. brand: '东风',
  7. type: '车型',
  8. vehicleLoad: '半载',
  9. vehicleLevel: 1,
  10. category: 1,
  11. classification: 1,
  12. wheelbase: 20,
  13. frontGauge: 20,
  14. backGauge: 20,
  15. steeringSystem: 1,
  16. frontSuspensionForm: 1,
  17. backSuspensionForm: 1,
  18. particularYear: null,
  19. country: null,
  20. energy: null,
  21. },
  22. {
  23. id: 2,
  24. vehicleIndex: 'A',
  25. brand: 'wow',
  26. type: null,
  27. vehicleLoad: '全载',
  28. vehicleLevel: 2,
  29. category: 2,
  30. classification: 3,
  31. wheelbase: 50,
  32. frontGauge: 40,
  33. backGauge: 30,
  34. steeringSystem: 2,
  35. frontSuspensionForm: 4,
  36. backSuspensionForm: 3,
  37. particularYear: 2019,
  38. country: '中国',
  39. energy: '汽油',
  40. },
  41. {
  42. id: 5,
  43. vehicleIndex: 'C',
  44. brand: '北风',
  45. type: '车型',
  46. vehicleLoad: '半载',
  47. vehicleLevel: 3,
  48. category: 3,
  49. classification: 4,
  50. wheelbase: 40,
  51. frontGauge: 20,
  52. backGauge: 30,
  53. steeringSystem: 3,
  54. frontSuspensionForm: 2,
  55. backSuspensionForm: 4,
  56. particularYear: 2020,
  57. country: '日本',
  58. energy: '植物油',
  59. },
  60. {
  61. id: 6,
  62. vehicleIndex: 'B',
  63. brand: '东风',
  64. type: '车型',
  65. vehicleLoad: '半载',
  66. vehicleLevel: 2,
  67. category: 3,
  68. classification: 3,
  69. wheelbase: 30,
  70. frontGauge: 30,
  71. backGauge: 40,
  72. steeringSystem: 4,
  73. frontSuspensionForm: 3,
  74. backSuspensionForm: 3,
  75. particularYear: 2020,
  76. country: '德国',
  77. energy: '石油',
  78. },
  79. {
  80. id: 7,
  81. vehicleIndex: 'C',
  82. brand: '西风',
  83. type: '车型',
  84. vehicleLoad: '全载',
  85. vehicleLevel: 1,
  86. category: 2,
  87. classification: 3,
  88. wheelbase: 50,
  89. frontGauge: 40,
  90. backGauge: 30,
  91. steeringSystem: 2,
  92. frontSuspensionForm: 4,
  93. backSuspensionForm: 3,
  94. particularYear: 2019,
  95. country: '中国',
  96. energy: '汽油',
  97. },
  98. {
  99. id: 8,
  100. vehicleIndex: 'B',
  101. brand: '南风',
  102. type: '车型',
  103. vehicleLoad: '全载',
  104. vehicleLevel: 3,
  105. category: 3,
  106. classification: 3,
  107. wheelbase: 40,
  108. frontGauge: 20,
  109. backGauge: 20,
  110. steeringSystem: 2,
  111. frontSuspensionForm: 3,
  112. backSuspensionForm: 2,
  113. particularYear: 2018,
  114. country: '德国',
  115. energy: '柴油',
  116. },
  117. {
  118. id: 9,
  119. vehicleIndex: 'D',
  120. brand: 'test',
  121. type: null,
  122. vehicleLoad: null,
  123. vehicleLevel: null,
  124. category: null,
  125. classification: null,
  126. wheelbase: null,
  127. frontGauge: null,
  128. backGauge: null,
  129. steeringSystem: null,
  130. frontSuspensionForm: null,
  131. backSuspensionForm: null,
  132. particularYear: null,
  133. country: null,
  134. energy: null,
  135. },
  136. {
  137. id: 10,
  138. vehicleIndex: null,
  139. brand: 'test1',
  140. type: null,
  141. vehicleLoad: null,
  142. vehicleLevel: null,
  143. category: null,
  144. classification: null,
  145. wheelbase: null,
  146. frontGauge: null,
  147. backGauge: null,
  148. steeringSystem: null,
  149. frontSuspensionForm: null,
  150. backSuspensionForm: null,
  151. particularYear: null,
  152. country: null,
  153. energy: null,
  154. },
  155. {
  156. id: 11,
  157. vehicleIndex: null,
  158. brand: 'test',
  159. type: null,
  160. vehicleLoad: null,
  161. vehicleLevel: null,
  162. category: null,
  163. classification: null,
  164. wheelbase: null,
  165. frontGauge: null,
  166. backGauge: null,
  167. steeringSystem: null,
  168. frontSuspensionForm: null,
  169. backSuspensionForm: null,
  170. particularYear: null,
  171. country: null,
  172. energy: null,
  173. },
  174. ];
  175. export default {
  176. 'POST /api/api/vehicleInfo/getCarDataList': (req: Request, res: Response) => {
  177. const data = req.body.brand
  178. ? carInfo.filter((item) => item.brand.indexOf(req.body.brand) > -1)
  179. : carInfo;
  180. res.send({
  181. code: 200,
  182. msg: 'success',
  183. data: {
  184. list: data,
  185. count: data.length,
  186. },
  187. });
  188. },
  189. };