完善牧安云哨-前端

This commit is contained in:
BBIT-Kai
2025-12-29 16:29:15 +08:00
parent e1fcc64236
commit d78d3be5e0
12 changed files with 1905 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
import type { Recordable } from '@vben/types';
import { pyRequestClient } from '#/api/request';
export namespace SystemUpdateApi {
export interface SystemUpdate {
[key: string]: any;
id: string;
code: number;
dept_id?: string;
dept_name?: string;
remark?: string;
oss_url?: string;
size?: number;
created_at?: string;
}
}
/**
* 获取升级包列表
*/
async function getUpdateList(params: Recordable<any>) {
return pyRequestClient.get<Array<SystemUpdateApi.SystemUpdate>>(
'/iot/common/update/list',
{ params },
);
}
/**
* 创建升级包
* @param data 升级包数据
*/
async function createUpdate(
data: Omit<SystemUpdateApi.SystemUpdate, 'id' | 'created_at'>,
) {
delete data.oss_url
return pyRequestClient.post('/iot/common/update', data);
}
/**
* 删除升级包
* @param id 升级包 ID
*/
async function deleteUpdate(id: string) {
return pyRequestClient.delete(`/iot/common/update/${id}`);
}
/**
* 上传
*/
export async function getUpdateUploadUrl() {
return pyRequestClient.get('/iot/common/update/getUploadUrl');
}
/**
* 上传
*/
export async function getMaxCodeByDeptId(dept_id: string) {
return pyRequestClient.get('/iot/common/update/getMaxCodeByDeptId',{
params: {dept_id}
});
}
export {
createUpdate,
deleteUpdate,
getUpdateList,
};
@@ -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,
};