|
|
import type { MockMethod } from './types'
|
|
|
|
|
|
const alerts = [
|
|
|
{ id: 1, createdAt: '2026-04-25T17:30:00', alertType: 'collect_fail', title: '采集请求失败', machineName: '西-1.8', detail: 'HTTP超时(30s),连续失败3次', isResolved: 0, resolvedAt: null },
|
|
|
{ id: 2, createdAt: '2026-04-25T17:00:00', alertType: 'device_offline', title: '设备离线', machineName: '东-2.5', detail: '连续3次Ping失败,IP:10.1.2.5', isResolved: 0, resolvedAt: null },
|
|
|
{ id: 3, createdAt: '2026-04-25T16:00:00', alertType: 'production_anomaly', title: '产量骤降', machineName: '南-3.1', detail: '近1小时产量较前1小时下降>50%', isResolved: 1, resolvedAt: '2026-04-25T16:30:00' },
|
|
|
{ id: 4, createdAt: '2026-04-25T15:00:00', alertType: 'unknown_device', title: '未知设备接入', machineName: null, detail: '采集地址FANUC-A栋返回未注册设备: fanake_9.9', isResolved: 0, resolvedAt: null },
|
|
|
]
|
|
|
|
|
|
const mock: MockMethod[] = [
|
|
|
{ url: '/mock-api/admin/alert/statistics', method: 'get', response: () => ({ code: 0, data: { unresolved: 15, collectFail: 5, deviceOffline: 6, productionAnomaly: 2, unknownDevice: 2, serviceError: 0 } }) },
|
|
|
{ url: '/mock-api/admin/alert', method: 'get', response: () => ({ code: 0, data: { items: alerts, total: 320, page: 1, pageSize: 20 } }) },
|
|
|
{ url: '/mock-api/admin/alert/resolve', method: 'post', response: () => ({ code: 0, message: 'success', data: null }) },
|
|
|
{ url: '/mock-api/admin/alert/batch-resolve', method: 'post', response: () => ({ code: 0, message: 'success', data: null }) },
|
|
|
{ url: '/mock-api/admin/machine/list', method: 'get', response: () => ({ code: 0, data: { items: [{ id: 1, name: '西-1.8' }, { id: 2, name: '西-1.10' }] } }) },
|
|
|
]
|
|
|
|
|
|
export default mock
|