feat(device): 新增设备管理模块全栈实现并拆分菜单 - 客户设备台账(customer_equipment)与智电设备型号目录(smart_device)CRUD,JWT+RBAC鉴权、参数绑定防SQL注入;设备监控改目录挂台账(/device/equipment),新建基础数据目录挂型号(/base/smart-device);前端防XSS样式对齐客户模块;远程库菜单迁移20261007_device_menu_split_fix.sql(id 58-60)

This commit is contained in:
wk committed 2026-10-07 08:58:34 +08:00
1 parent 91aa3c06f0
commit 09f7345e8a
18 files changed
+2482 -7

No files matched your search

+146
View File
@@ -0,0 +1,146 @@
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}`),
};