云上文旅可视化
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

chartApi.ts 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import { Request, Response } from 'express';
  2. const mouthList = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
  3. // chart1 销售额趋势
  4. const getSalesVolume = (req: Request, res: Response)=>{
  5. res.json({
  6. mouthList: mouthList,
  7. mouthData:[820, 932, 901, 934, 1290, 1330, 1320,820, 932, 1290, 1330, 1320]
  8. });
  9. }
  10. // chart2 国外销售额占比
  11. const getSalesRatio = (req: Request, res: Response)=>{
  12. res.json({
  13. data:[
  14. { value: 1048, name: '国内' },
  15. { value: 735, name: '国外' },
  16. ]
  17. });
  18. }
  19. // chart3 航司销售额统计(万/年)
  20. const getSalesStatistics = (req: Request, res: Response)=>{
  21. res.json({
  22. nameList: ['厦门航空','西藏航空', '四川航空','吉祥航空','东方航空'].reverse(), // 国内航空名称数据
  23. nameListAbroad: ['厦门航空','西藏航空', '四川航空','吉祥航空','东方航空'].reverse(), // 国外航空名称数据
  24. data: [2256, 1223, 1052, 656,456].reverse(), // 航空名称所对应的国内数据
  25. dataAbroad:[2056, 1023, 852, 456,256].reverse(), // 航空名称所对应的国外数据
  26. });
  27. }
  28. // chart4 客单价趋势
  29. const getUnitPriceTrend = (req: Request, res: Response)=>{
  30. res.json({
  31. mouthList: mouthList, // 月份名称数据
  32. data:[
  33. {name:'今年',data:[60, 60, 60, 70, 60, 100, 80, 80, 90, 120, 110, 100]},
  34. {name:'去年',data:[120, 120, 120, 120, 70, 120, 100, 110, 100, 120, 110, 110]},
  35. ]
  36. });
  37. }
  38. // chart5 国内外订单对比
  39. const getOrderComparison = (req: Request, res: Response)=>{
  40. res.json({
  41. data: [
  42. { value: 40, name: '国际' },
  43. { value: 60, name: '国内' },
  44. ]
  45. });
  46. }
  47. // chart6 机场排名(国内)
  48. const getAirportRankingDomestic = (req: Request, res: Response)=>{
  49. res.json({
  50. nameList:[ '双流机场', '萧山机场', '虹桥机场', '高崎机场','江北机场'],
  51. data: [456, 656, 1025, 1223,2256 ]
  52. });
  53. }
  54. // chart7 机场排名(国外)
  55. const getAirportRankingAbroad = (req: Request, res: Response)=>{
  56. res.json({
  57. nameList:[ '双流机场', '萧山机场', '虹桥机场', '高崎机场','江北机场'],
  58. data: [456, 656, 1025, 1223,2256 ]
  59. });
  60. }
  61. // chart8 服务类型
  62. const getServiceTypeData = (req: Request, res: Response)=>{
  63. res.json({
  64. data: [
  65. { value: 31282, name: '机票服务' },
  66. { value: 23236, name: '酒店服务' },
  67. { value: 12432, name: '火车票服务' },
  68. { value: 2645, name: '其他服务' },
  69. ]
  70. });
  71. }
  72. // chart9 用户画像
  73. const getUserProfile = (req: Request, res: Response)=>{
  74. res.json({
  75. mouthList:mouthList,
  76. data: [
  77. { data: [100, 302, 301, 334, 390, 330, 320,334, 390, 330, 320, 320], name: '青年' },
  78. { data: [320, 132, 101, 134, 90, 230, 210, 132, 101, 134, 90, 230, 210], name: '中年' },
  79. { data: [220, 182, 191, 234, 290, 330, 310, 182, 191, 234, 290, 330, 310], name: '老年' },
  80. ]
  81. });
  82. }
  83. // 大屏数值数据
  84. const getNumericalData = (req: Request, res: Response)=>{
  85. res.json({
  86. totalSalesAmount:24894,
  87. totalOrder:4404824,
  88. numberServicePersonnel:2583955,
  89. numberAirborneCustomers:658879,
  90. todaySalesVolume :1423253,
  91. yearSalesVolume :122342,
  92. todayOrder :1282,
  93. yearOrder :410240,
  94. });
  95. }
  96. export default {
  97. 'GET /api/getSalesVolume': getSalesVolume,
  98. 'GET /api/getSalesRatio': getSalesRatio,
  99. 'GET /api/getSalesStatistics': getSalesStatistics,
  100. 'GET /api/getUnitPriceTrend': getUnitPriceTrend,
  101. 'GET /api/getOrderComparison': getOrderComparison,
  102. 'GET /api/getAirportRankingDomestic': getAirportRankingDomestic,
  103. 'GET /api/getAirportRankingAbroad': getAirportRankingAbroad,
  104. 'GET /api/getServiceTypeData': getServiceTypeData,
  105. 'GET /api/getUserProfile': getUserProfile,
  106. 'GET /api/getNumericalData': getNumericalData,
  107. };