ether-admin/src/api/inspection-item.ts

74 lines
2.3 KiB
TypeScript

import request from '@/utils/request'
import type { ApiResponse } from '@/types'
// ==================== 巡检标准项类型 ====================
export interface InspectionItem {
id?: string
equipmentType: string
systemType: string
itemName: string
checkMethod?: string
standardValue?: string
isRequired: boolean
remark?: string
sortOrder?: number
}
export interface InspectionItemForm {
id?: string
equipmentType: string
systemType: string
itemName: string
checkMethod?: string
standardValue?: string
isRequired?: boolean
remark?: string
sortOrder?: number
}
// ==================== 巡检标准项 API ====================
// 获取巡检标准项列表
export function getInspectionItems() {
return request.get<ApiResponse<InspectionItem[]>>('/api/mdm/inspection-items')
}
// 创建巡检标准项
export function createInspectionItem(data: InspectionItemForm) {
return request.post<ApiResponse<InspectionItem>>('/api/mdm/inspection-items', data)
}
// 更新巡检标准项
export function updateInspectionItem(id: string, data: InspectionItemForm) {
return request.put<ApiResponse<InspectionItem>>(`/api/mdm/inspection-items/${id}`, data)
}
// 删除巡检标准项
export function deleteInspectionItem(id: string) {
return request.delete<ApiResponse<void>>(`/api/mdm/inspection-items/${id}`)
}
// ==================== 设备类型和系统类型选项 ====================
export const EQUIPMENT_TYPE_OPTIONS = [
{ value: 'ELEVATOR', label: '电梯' },
{ value: 'HVAC', label: '暖通空调' },
{ value: 'FIRE_PROTECTION', label: '消防系统' },
{ value: 'PLUMBING', label: '给排水' },
{ value: 'ELECTRICAL', label: '电气系统' },
{ value: 'SECURITY', label: '弱电系统' },
{ value: 'LANDSCAPE', label: '景观绿化' },
{ value: 'ENERGY_METER', label: '能源计量' },
{ value: 'KITCHEN', label: '厨余设备' },
{ value: 'OTHER', label: '其他' }
]
export const SYSTEM_TYPE_OPTIONS = [
{ value: 'ELEVATOR', label: '电梯系统' },
{ value: 'HVAC', label: '暖通空调' },
{ value: 'FIRE_PROTECTION', label: '消防系统' },
{ value: 'PLUMBING', label: '给排水系统' },
{ value: 'ELECTRICAL', label: '电气系统' },
{ value: 'SECURITY', label: '弱电系统' },
{ value: 'LANDSCAPE', label: '景观绿化' },
{ value: 'ENERGY_METER', label: '能源计量' }
]