device.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /**
  2. * Mock数据 - 设备管理
  3. */
  4. // 设备状态枚举
  5. export enum DeviceStatus {
  6. ONLINE = 1, // 在线
  7. OFFLINE = 0, // 离线
  8. MAINTENANCE = 2, // 维护中
  9. ERROR = 3 // 故障
  10. }
  11. // 设备状态文字映射
  12. export const DeviceStatusText: Record<number, string> = {
  13. [DeviceStatus.ONLINE]: '在线',
  14. [DeviceStatus.OFFLINE]: '离线',
  15. [DeviceStatus.MAINTENANCE]: '维护中',
  16. [DeviceStatus.ERROR]: '故障'
  17. };
  18. // 设备状态颜色映射
  19. export const DeviceStatusColor: Record<number, string> = {
  20. [DeviceStatus.ONLINE]: '#52c41a',
  21. [DeviceStatus.OFFLINE]: '#999999',
  22. [DeviceStatus.MAINTENANCE]: '#faad14',
  23. [DeviceStatus.ERROR]: '#ff4d4f'
  24. };
  25. // 设备列表Mock数据
  26. export const mockDeviceList = [
  27. {
  28. id: 1,
  29. deviceId: 'DEV001',
  30. name: '1号柜机',
  31. shopId: 1,
  32. shopName: '万达广场店',
  33. status: DeviceStatus.ONLINE,
  34. temperature: 8,
  35. volume: 75,
  36. lastOnlineTime: '2026-02-15 14:30:00',
  37. totalSales: 12560,
  38. todaySales: 680,
  39. inventory: 156,
  40. capacity: 200,
  41. createdAt: '2025-10-01 10:00:00'
  42. },
  43. {
  44. id: 2,
  45. deviceId: 'DEV002',
  46. name: '2号柜机',
  47. shopId: 2,
  48. shopName: '人民广场店',
  49. status: DeviceStatus.ONLINE,
  50. temperature: 7,
  51. volume: 80,
  52. lastOnlineTime: '2026-02-15 14:28:00',
  53. totalSales: 9820,
  54. todaySales: 520,
  55. inventory: 128,
  56. capacity: 200,
  57. createdAt: '2025-10-05 10:00:00'
  58. },
  59. {
  60. id: 3,
  61. deviceId: 'DEV003',
  62. name: '3号柜机',
  63. shopId: 3,
  64. shopName: '火车站店',
  65. status: DeviceStatus.OFFLINE,
  66. temperature: 0,
  67. volume: 0,
  68. lastOnlineTime: '2026-02-15 10:00:00',
  69. totalSales: 15680,
  70. todaySales: 0,
  71. inventory: 89,
  72. capacity: 200,
  73. createdAt: '2025-09-15 10:00:00'
  74. },
  75. {
  76. id: 4,
  77. deviceId: 'DEV004',
  78. name: '4号柜机',
  79. shopId: 4,
  80. shopName: '科技园店',
  81. status: DeviceStatus.MAINTENANCE,
  82. temperature: 6,
  83. volume: 60,
  84. lastOnlineTime: '2026-02-14 18:00:00',
  85. totalSales: 8960,
  86. todaySales: 0,
  87. inventory: 45,
  88. capacity: 150,
  89. createdAt: '2025-11-01 10:00:00'
  90. },
  91. {
  92. id: 5,
  93. deviceId: 'DEV005',
  94. name: '5号柜机',
  95. shopId: 1,
  96. shopName: '万达广场店',
  97. status: DeviceStatus.ONLINE,
  98. temperature: 9,
  99. volume: 70,
  100. lastOnlineTime: '2026-02-15 14:25:00',
  101. totalSales: 7680,
  102. todaySales: 380,
  103. inventory: 178,
  104. capacity: 200,
  105. createdAt: '2025-12-01 10:00:00'
  106. }
  107. ];
  108. // 设备详情Mock数据
  109. export const mockDeviceDetail = {
  110. id: 1,
  111. deviceId: 'DEV001',
  112. name: '1号柜机',
  113. shopId: 1,
  114. shopName: '万达广场店',
  115. shopAddress: '北京市朝阳区建国路93号万达广场B1层',
  116. status: DeviceStatus.ONLINE,
  117. temperature: 8,
  118. volume: 75,
  119. lastOnlineTime: '2026-02-15 14:30:00',
  120. totalSales: 12560,
  121. todaySales: 680,
  122. todayOrders: 23,
  123. inventory: 156,
  124. capacity: 200,
  125. // 库存预警
  126. lowStockItems: [
  127. { productName: '可口可乐', currentStock: 5, minStock: 10 },
  128. { productName: '矿泉水', currentStock: 3, minStock: 10 }
  129. ],
  130. // 最近订单
  131. recentOrders: [
  132. { orderNo: 'ORD202602150001', amount: 2560, time: '2026-02-15 14:30:25' },
  133. { orderNo: 'ORD202602150002', amount: 1880, time: '2026-02-15 13:20:15' },
  134. { orderNo: 'ORD202602150003', amount: 3200, time: '2026-02-15 12:15:30' }
  135. ],
  136. // 温度历史(最近24小时)
  137. temperatureHistory: [
  138. { time: '00:00', temperature: 7 },
  139. { time: '04:00', temperature: 8 },
  140. { time: '08:00', temperature: 7 },
  141. { time: '12:00', temperature: 8 },
  142. { time: '16:00', temperature: 9 },
  143. { time: '20:00', temperature: 8 }
  144. ],
  145. createdAt: '2025-10-01 10:00:00',
  146. updatedAt: '2026-02-15 14:30:00'
  147. };