牧安云哨-前端
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { pyRequestClient } from '#/api/request';
|
||||
|
||||
export namespace SentinelApi {
|
||||
export interface Record {
|
||||
id: string;
|
||||
name: string;
|
||||
is_inspected: 0 | 1;
|
||||
license_plate?: string;
|
||||
vehicle_type?: string;
|
||||
license_plate_image?: string;
|
||||
vehicle_image?: string;
|
||||
livestock_type?: string;
|
||||
livestock_source?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
remark?: string;
|
||||
dept_id?: string;
|
||||
dept_name?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取记录列表数据
|
||||
*/
|
||||
async function getSentinelRecordList(params: Recordable<any>) {
|
||||
return pyRequestClient.get<Array<SentinelApi.Record>>(
|
||||
'/iot/sentinel/record/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建记录
|
||||
* @param data 记录数据
|
||||
*/
|
||||
async function createSentinelRecord(data: Omit<SentinelApi.Record, 'id'>) {
|
||||
return pyRequestClient.post('/iot/sentinel/record', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新记录
|
||||
*
|
||||
* @param id 记录 ID
|
||||
* @param data 记录数据
|
||||
*/
|
||||
async function updateSentinelRecord(
|
||||
id: string,
|
||||
data: Omit<SentinelApi.Record, 'id'>,
|
||||
) {
|
||||
return pyRequestClient.put(`/iot/sentinel/record/${id}`, data);
|
||||
}
|
||||
/**
|
||||
* 更新记录(部分更新)
|
||||
*
|
||||
* @param id 记录 ID
|
||||
* @param data 需要更新的字段(部分字段即可)
|
||||
*/
|
||||
async function updateSentinelRecordPatch(
|
||||
id: string,
|
||||
data: Partial<Omit<SentinelApi.Record, 'id'>>,
|
||||
) {
|
||||
return pyRequestClient.patch(`/iot/sentinel/record/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
* @param id 记录 ID
|
||||
*/
|
||||
async function deleteSentinelRecord(id: string) {
|
||||
return pyRequestClient.delete(`/iot/sentinel/record/${id}`);
|
||||
}
|
||||
|
||||
export {
|
||||
createSentinelRecord,
|
||||
deleteSentinelRecord,
|
||||
getSentinelRecordList,
|
||||
updateSentinelRecord,
|
||||
updateSentinelRecordPatch,
|
||||
};
|
||||
Reference in New Issue
Block a user