- 数据库:新增迁移脚本20261011_icc_line_ledger.sql(electric_line/line_room/icc_sync_log三表、菜单61、role_menu(1,61)、定时任务icc_line_sync),同步db_seed.sql - 后端:新增ElectricLine/IccSyncLog实体、查询DTO、线路台账服务与ICC拉取同步服务、/api/electric-lines控制器,接入RBAC(device:list)与定时任务 - 前端:新增智电改造线路台账页面及路由,API封装electricLineApi - ICC同步采用本系统主动拉取模式,失败仅记日志不抛错,接口统一code/message/data格式兼容APP
205 lines
4.2 KiB
TypeScript
205 lines
4.2 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;
|
|
buildingId?: number;
|
|
floorNo?: string;
|
|
location?: string;
|
|
status: number;
|
|
syncedAt?: string;
|
|
createdAt: string;
|
|
// 联表补全字段
|
|
customerNo?: string;
|
|
customerName?: string;
|
|
equipCode?: string;
|
|
equipName?: string;
|
|
buildingName?: 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'),
|
|
}; |