78 lines
1.9 KiB
TypeScript
78 lines
1.9 KiB
TypeScript
import request from '@/utils/request'
|
|
|
|
// ==================== 设备相关类型 ====================
|
|
|
|
export interface EquipmentForm {
|
|
id?: string
|
|
code: string
|
|
name: string
|
|
isEquipment?: boolean
|
|
designLifeYears?: number
|
|
ratedPower?: number
|
|
ratedVoltage?: string
|
|
ratedCurrent?: number
|
|
maintenanceVendor?: string
|
|
maintenanceVendorPhone?: string
|
|
specialEquipmentType?: string
|
|
inspectionCycle?: number
|
|
nextInspectionDate?: string
|
|
}
|
|
|
|
export interface Equipment {
|
|
id: string
|
|
code: string
|
|
name: string
|
|
isEquipment: boolean
|
|
designLifeYears?: number
|
|
ratedPower?: number
|
|
ratedVoltage?: string
|
|
ratedCurrent?: number
|
|
maintenanceVendor?: string
|
|
maintenanceVendorPhone?: string
|
|
specialEquipmentType?: string
|
|
inspectionCycle?: number
|
|
nextInspectionDate?: string
|
|
spaceNodeId?: string
|
|
spaceNodeName?: string
|
|
projectId?: string
|
|
projectName?: string
|
|
createdAt?: string
|
|
updatedAt?: string
|
|
}
|
|
|
|
export interface PageResponse<T> {
|
|
content: T[]
|
|
totalElements: number
|
|
totalPages: number
|
|
size: number
|
|
number: number
|
|
}
|
|
|
|
// ==================== 设备 API ====================
|
|
|
|
// 获取设备列表
|
|
export function getEquipmentList(projectId: string) {
|
|
return request.get<PageResponse<Equipment>>('/api/v1/mdm/space-nodes/equipment', {
|
|
params: { projectId }
|
|
})
|
|
}
|
|
|
|
// 获取设备详情
|
|
export function getEquipmentDetail(id: string) {
|
|
return request.get<Equipment>(`/api/v1/mdm/space-nodes/${id}/equipment`)
|
|
}
|
|
|
|
// 获取特种设备列表
|
|
export function getSpecialEquipment(projectId: string) {
|
|
return request.get<Equipment[]>('/api/v1/mdm/space-nodes/special-equipment', {
|
|
params: { projectId }
|
|
})
|
|
}
|
|
|
|
// 获取即将年检设备
|
|
export function getExpiringInspection(projectId: string, daysAhead?: number) {
|
|
return request.get<Equipment[]>('/api/v1/mdm/space-nodes/expiring-inspection', {
|
|
params: { projectId, daysAhead }
|
|
})
|
|
}
|