You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haoliang-net/frontend/mock/screen.ts

42 lines
2.8 KiB
TypeScript

import type { MockMethod } from './types'
const mock: MockMethod[] = [
{ url: '/mock-api/screen/summary', method: 'get', response: () => ({ code: 0, data: { onlineCount: 142, totalMachines: 160, todayProduction: 8520, activeAlerts: 3, avgQuantityPerMachine: 60 } }) },
{ url: '/mock-api/screen/collector-status', method: 'get', response: () => ({ code: 0, data: { status: 'running', uptime: '3天16小时', successCount: 12800, failCount: 5, lastCollectTime: '2026-04-25T17:36:38' } }) },
{ url: '/mock-api/screen/workshop-production', method: 'get', response: () => ({ code: 0, data: { items: [{ name: 'A栋', quantity: 3200 }, { name: 'B栋', quantity: 2800 }, { name: 'C栋', quantity: 2520 }] } }) },
{ url: '/mock-api/screen/production-trend', method: 'get', response: () => ({ code: 0, data: { items: [
{ date: '04-19', quantity: 8200 }, { date: '04-20', quantity: 7600 },
{ date: '04-21', quantity: 9100 }, { date: '04-22', quantity: 8500 },
{ date: '04-23', quantity: 7800 }, { date: '04-24', quantity: 9000 },
{ date: '04-25', quantity: 8520 },
] } }) },
{ url: '/mock-api/screen/machine-rank', method: 'get', response: () => ({ code: 0, data: { items: [
{ rank: 1, machineName: '西-1.8', quantity: 580 },
{ rank: 2, machineName: '西-1.10', quantity: 420 },
{ rank: 3, machineName: '东-2.0', quantity: 380 },
{ rank: 4, machineName: '东-2.5', quantity: 310 },
{ rank: 5, machineName: '南-3.1', quantity: 290 },
] } }) },
{ url: '/mock-api/screen/worker-rank', method: 'get', response: () => ({ code: 0, data: { items: [
{ rank: 1, workerName: '张三', quantity: 1240 },
{ rank: 2, workerName: '李四', quantity: 980 },
{ rank: 3, workerName: '王五', quantity: 870 },
{ rank: 4, workerName: '赵六', quantity: 650 },
{ rank: 5, workerName: '孙七', quantity: 520 },
] } }) },
{ url: '/mock-api/screen/machine-status', method: 'get', response: () => ({ code: 0, data: { items: [
{ machineId: 1, machineName: '西-1.8', isOnline: 1 }, { machineId: 2, machineName: '西-1.10', isOnline: 1 },
{ machineId: 3, machineName: '东-2.0', isOnline: 0 }, { machineId: 4, machineName: '东-2.5', isOnline: 0 },
{ machineId: 5, machineName: '南-3.1', isOnline: 1 }, { machineId: 6, machineName: '南-3.2', isOnline: 1 },
{ machineId: 7, machineName: '北-4.0', isOnline: 1 }, { machineId: 8, machineName: '北-4.1', isOnline: 0 },
] } }) },
{ url: '/mock-api/screen/filters', method: 'get', response: () => ({ code: 0, data: { items: [
{ filterType: 'workshop', filterValue: 'A栋', isDefault: 1 },
{ filterType: 'workshop', filterValue: 'B栋', isDefault: 0 },
{ filterType: 'brand', filterValue: 'FANUC', isDefault: 0 },
] } }) },
{ url: '/mock-api/screen/refresh-interval', method: 'get', response: () => ({ code: 0, data: { interval: 15000 } }) },
]
export default mock