Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
300 lines
6.3 KiB
TypeScript
300 lines
6.3 KiB
TypeScript
import request from '@/utils/request';
|
|
|
|
// ==================== 客户设备台账 ====================
|
|
|
|
export interface CustomerEquipment {
|
|
id: number;
|
|
equipmentNo: string;
|
|
equipmentName: string;
|
|
equipType?: string;
|
|
customerId?: number;
|
|
customerName?: string;
|
|
building?: string;
|
|
floor?: string;
|
|
location?: string;
|
|
photo?: string;
|
|
status?: number;
|
|
remark?: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface CustomerEquipmentQuery {
|
|
page?: number;
|
|
pageSize?: number;
|
|
keyword?: string;
|
|
customerId?: number;
|
|
building?: string;
|
|
equipType?: string;
|
|
}
|
|
|
|
export interface CustomerEquipmentListResult {
|
|
list: CustomerEquipment[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
export interface CustomerEquipmentCreateParams {
|
|
equipmentName: string;
|
|
equipType?: string;
|
|
customerId?: number;
|
|
building?: string;
|
|
floor?: string;
|
|
location?: string;
|
|
photo?: string;
|
|
status?: number;
|
|
remark?: string;
|
|
}
|
|
|
|
export interface CustomerEquipmentUpdateParams {
|
|
equipmentName?: string;
|
|
equipType?: string;
|
|
customerId?: number;
|
|
building?: string;
|
|
floor?: string;
|
|
location?: string;
|
|
photo?: string;
|
|
status?: number;
|
|
remark?: string;
|
|
}
|
|
|
|
export const customerEquipmentApi = {
|
|
getList: (params: CustomerEquipmentQuery) =>
|
|
request.get<CustomerEquipmentListResult>('/customer-equipments', { params }),
|
|
|
|
getDetail: (id: number) =>
|
|
request.get<CustomerEquipment>(`/customer-equipments/${id}`),
|
|
|
|
create: (data: CustomerEquipmentCreateParams) =>
|
|
request.post('/customer-equipments', data),
|
|
|
|
update: (id: number, data: CustomerEquipmentUpdateParams) =>
|
|
request.put(`/customer-equipments/${id}`, data),
|
|
|
|
delete: (id: number) =>
|
|
request.delete(`/customer-equipments/${id}`),
|
|
};
|
|
|
|
// ==================== 智电设备型号 ====================
|
|
|
|
export interface SmartDevice {
|
|
id: number;
|
|
modelNo: string;
|
|
modelName: string;
|
|
spec?: string;
|
|
deviceType?: string;
|
|
functionDesc?: string;
|
|
supplier?: string;
|
|
status?: number;
|
|
remark?: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface SmartDeviceQuery {
|
|
page?: number;
|
|
pageSize?: number;
|
|
keyword?: string;
|
|
deviceType?: string;
|
|
}
|
|
|
|
export interface SmartDeviceListResult {
|
|
list: SmartDevice[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
export interface SmartDeviceCreateParams {
|
|
modelNo: string;
|
|
modelName: string;
|
|
spec?: string;
|
|
deviceType?: string;
|
|
functionDesc?: string;
|
|
supplier?: string;
|
|
status?: number;
|
|
remark?: string;
|
|
}
|
|
|
|
export interface SmartDeviceUpdateParams {
|
|
modelNo?: string;
|
|
modelName?: string;
|
|
spec?: string;
|
|
deviceType?: string;
|
|
functionDesc?: string;
|
|
supplier?: string;
|
|
status?: number;
|
|
remark?: string;
|
|
}
|
|
|
|
export const smartDeviceApi = {
|
|
getList: (params: SmartDeviceQuery) =>
|
|
request.get<SmartDeviceListResult>('/smart-devices', { params }),
|
|
|
|
getDetail: (id: number) =>
|
|
request.get<SmartDevice>(`/smart-devices/${id}`),
|
|
|
|
create: (data: SmartDeviceCreateParams) =>
|
|
request.post('/smart-devices', data),
|
|
|
|
update: (id: number, data: SmartDeviceUpdateParams) =>
|
|
request.put(`/smart-devices/${id}`, data),
|
|
|
|
delete: (id: number) =>
|
|
request.delete(`/smart-devices/${id}`),
|
|
};
|
|
|
|
// ==================== 智电改造线路台账 ====================
|
|
|
|
export interface ElectricLine {
|
|
id: number;
|
|
lineCode: string;
|
|
equipId: number;
|
|
iccDeviceCode?: string;
|
|
lineName?: string;
|
|
customerId: number;
|
|
status: number;
|
|
syncedAt?: string;
|
|
createdAt: string;
|
|
// 联表补全字段
|
|
customerNo?: string;
|
|
customerName?: string;
|
|
equipCode?: string;
|
|
equipName?: string;
|
|
// 探测器 / 网关相关字段
|
|
imei?: string;
|
|
gatewayId?: number;
|
|
gatewayCode?: string;
|
|
gatewayName?: string;
|
|
typeCode?: string;
|
|
typeName?: string;
|
|
fireSystemCode?: string;
|
|
fireSystemName?: string;
|
|
partUnitLoopCode?: string;
|
|
channelNo?: string;
|
|
channelSn?: string;
|
|
produceDate?: string;
|
|
}
|
|
|
|
export interface ElectricLineQuery {
|
|
page?: number;
|
|
pageSize?: number;
|
|
keyword?: string;
|
|
customerId?: number;
|
|
equipId?: number;
|
|
buildingId?: number;
|
|
status?: number;
|
|
}
|
|
|
|
export interface ElectricLineListResult {
|
|
list: ElectricLine[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
export interface IccLineSyncResult {
|
|
pulled: number;
|
|
synced: number;
|
|
inserted: number;
|
|
updated: number;
|
|
skipped: number;
|
|
}
|
|
|
|
export const electricLineApi = {
|
|
getList: (params: ElectricLineQuery) =>
|
|
request.get<ElectricLineListResult>('/electric-lines', { params }),
|
|
|
|
getDetail: (id: number) =>
|
|
request.get<ElectricLine>(`/electric-lines/${id}`),
|
|
|
|
sync: () =>
|
|
request.post<IccLineSyncResult>('/electric-lines/sync'),
|
|
};
|
|
|
|
// ==================== 智电改造网关台账 ====================
|
|
|
|
export interface ElectricGatewayListItem {
|
|
id: number;
|
|
iccImei?: string;
|
|
deviceCode?: string;
|
|
deviceName?: string;
|
|
customerId: number;
|
|
equipId?: number;
|
|
orgCode?: string;
|
|
orgName?: string;
|
|
manufacturerCode?: string;
|
|
manufacturerName?: string;
|
|
typeCode?: string;
|
|
typeName?: string;
|
|
productModel?: string;
|
|
isOnline: number;
|
|
syncedAt?: string;
|
|
createdAt: string;
|
|
// 联表补全字段
|
|
customerNo?: string;
|
|
customerName?: string;
|
|
equipCode?: string;
|
|
equipName?: string;
|
|
}
|
|
|
|
export interface ElectricGatewayQuery {
|
|
page?: number;
|
|
pageSize?: number;
|
|
keyword?: string;
|
|
customerId?: number;
|
|
equipId?: number;
|
|
isOnline?: number;
|
|
}
|
|
|
|
export interface ElectricGatewayPageResult {
|
|
list: ElectricGatewayListItem[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
export interface IccGatewaySyncResult {
|
|
pulled: number;
|
|
synced: number;
|
|
inserted: number;
|
|
updated: number;
|
|
skipped: number;
|
|
}
|
|
|
|
export const electricGatewayApi = {
|
|
getList: (params: ElectricGatewayQuery) =>
|
|
request.get<ElectricGatewayPageResult>('/electric-gateways', { params }),
|
|
|
|
getDetail: (id: number) =>
|
|
request.get<ElectricGatewayListItem>(`/electric-gateways/${id}`),
|
|
|
|
sync: () =>
|
|
request.post<IccGatewaySyncResult>('/electric-gateways/sync'),
|
|
};
|
|
|
|
// ==================== 线路用电(ICC 模拟量) ====================
|
|
|
|
export interface ElectricityAnalogRow {
|
|
analogType?: string;
|
|
analogName?: string;
|
|
analogUnit?: string;
|
|
analogValue?: number | string | null;
|
|
}
|
|
|
|
export interface ElectricityLatestSnapshot {
|
|
lineId: number;
|
|
lineCode?: string;
|
|
lineName?: string;
|
|
imei?: string;
|
|
customerId?: number;
|
|
collectTime?: string | null;
|
|
hasData: boolean;
|
|
list: ElectricityAnalogRow[];
|
|
}
|
|
|
|
export const electricityDataApi = {
|
|
getLatestByLine: (lineId: number) =>
|
|
request.get<ElectricityLatestSnapshot>('/electricity-data/latest', { params: { lineId } }),
|
|
}; |