shop-front-end/src/api/cabinet/smart-cabinet.ts

76 lines
1.9 KiB
TypeScript
Raw Normal View History

2025-03-21 16:59:44 +08:00
import { http } from '@/utils/http';
import { CabinetCellDTO } from './cabinet-cell';
export interface SmartCabinetQuery extends BasePageQuery {
cabinetName?: string;
cabinetType?: number;
templateNo?: string;
}
export interface SmartCabinetDTO {
cabinetId?: number;
cabinetName: string;
cabinetType: number;
mqttServerId?: number;
shopId?: number;
2025-03-21 16:59:44 +08:00
templateNo: string;
lockControlNo: number;
location: number;
operator?: string;
}
export interface AddSmartCabinetCommand {
cabinetName: string;
cabinetType: number;
mqttServerId?: number;
shopId?: number;
2025-03-21 16:59:44 +08:00
templateNo: string;
lockControlNo: number;
location: number;
}
export interface UpdateSmartCabinetCommand {
cabinetId: number;
cabinetName?: string;
cabinetType?: number;
mqttServerId?: number;
shopId?: number;
templateNo?: string;
lockControlNo?: number;
location?: number;
2025-03-21 16:59:44 +08:00
}
export interface AllCabinetDataDTO {
smartCabinetList: SmartCabinetDTO[];
cells: CabinetCellDTO[];
}
export const getSmartCabinetList = (params?: SmartCabinetQuery) => {
return http.request<ResponseData<PageDTO<SmartCabinetDTO>>>('get', '/cabinet/smartCabinet', {
params
});
};
export const addSmartCabinet = (data: AddSmartCabinetCommand) => {
return http.request<ResponseData<void>>('post', '/cabinet/smartCabinet', {
data
});
};
export const updateSmartCabinet = (id: number, data: UpdateSmartCabinetCommand) => {
return http.request<ResponseData<void>>('put', `/cabinet/smartCabinet/${id}`, {
data
});
};
export const deleteSmartCabinet = (ids: string) => {
return http.request<ResponseData<void>>('delete', `/cabinet/smartCabinet/${ids}`);
};
export const getAllCabinetsWithCells = () => {
return http.request<ResponseData<AllCabinetDataDTO>>('get', '/cabinet/smartCabinet/all');
};
export const allCabinets = () => {
return http.request<ResponseData<Array<SmartCabinetDTO>>>('get', '/cabinet/smartCabinet/allCabinets');
};