2024-09-29 21:58:03 +08:00
|
|
|
import request from '@/config/axios'
|
|
|
|
|
2024-12-15 23:15:51 +08:00
|
|
|
/**
|
|
|
|
* IoT 产品物模型
|
|
|
|
*/
|
|
|
|
export interface ThingModelData {
|
|
|
|
id?: number // 物模型功能编号
|
|
|
|
identifier?: string // 功能标识
|
|
|
|
name?: string // 功能名称
|
|
|
|
description?: string // 功能描述
|
|
|
|
productId?: number // 产品编号
|
|
|
|
productKey?: string // 产品标识
|
|
|
|
type: ProductFunctionTypeEnum // 功能类型
|
|
|
|
property: ThingModelProperty // 属性
|
|
|
|
event?: ThingModelEvent // 事件
|
|
|
|
service?: ThingModelService // 服务
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ThingModelProperty 类型
|
|
|
|
*/
|
|
|
|
export interface ThingModelProperty {
|
|
|
|
[key: string]: any
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ThingModelEvent 类型
|
|
|
|
*/
|
|
|
|
export interface ThingModelEvent {
|
|
|
|
[key: string]: any
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ThingModelService 类型
|
|
|
|
*/
|
|
|
|
export interface ThingModelService {
|
|
|
|
[key: string]: any
|
2024-09-29 21:58:03 +08:00
|
|
|
}
|
|
|
|
|
2024-10-10 21:02:55 +08:00
|
|
|
// IOT 产品功能(物模型)类型枚举类
|
|
|
|
export enum ProductFunctionTypeEnum {
|
|
|
|
PROPERTY = 1, // 属性
|
|
|
|
SERVICE = 2, // 服务
|
|
|
|
EVENT = 3 // 事件
|
|
|
|
}
|
|
|
|
|
|
|
|
// IOT 产品功能(物模型)访问模式枚举类
|
|
|
|
export enum ProductFunctionAccessModeEnum {
|
|
|
|
READ_WRITE = 'rw', // 读写
|
|
|
|
READ_ONLY = 'r' // 只读
|
|
|
|
}
|
|
|
|
|
2024-09-29 21:58:03 +08:00
|
|
|
// IoT 产品物模型 API
|
|
|
|
export const ThinkModelFunctionApi = {
|
2024-10-01 19:29:24 +08:00
|
|
|
// 查询产品物模型分页
|
2024-09-29 21:58:03 +08:00
|
|
|
getThinkModelFunctionPage: async (params: any) => {
|
|
|
|
return await request.get({ url: `/iot/think-model-function/page`, params })
|
|
|
|
},
|
2024-10-01 19:29:24 +08:00
|
|
|
// 获得产品物模型
|
2024-09-29 21:58:03 +08:00
|
|
|
getThinkModelFunctionListByProductId: async (params: any) => {
|
|
|
|
return await request.get({
|
|
|
|
url: `/iot/think-model-function/list-by-product-id`,
|
|
|
|
params
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-10-01 19:29:24 +08:00
|
|
|
// 查询产品物模型详情
|
2024-09-29 21:58:03 +08:00
|
|
|
getThinkModelFunction: async (id: number) => {
|
|
|
|
return await request.get({ url: `/iot/think-model-function/get?id=` + id })
|
|
|
|
},
|
|
|
|
|
2024-10-01 19:29:24 +08:00
|
|
|
// 新增产品物模型
|
2024-12-15 23:15:51 +08:00
|
|
|
createThinkModelFunction: async (data: ThingModelData) => {
|
2024-09-29 21:58:03 +08:00
|
|
|
return await request.post({ url: `/iot/think-model-function/create`, data })
|
|
|
|
},
|
|
|
|
|
2024-10-01 19:29:24 +08:00
|
|
|
// 修改产品物模型
|
2024-12-15 23:15:51 +08:00
|
|
|
updateThinkModelFunction: async (data: ThingModelData) => {
|
2024-09-29 21:58:03 +08:00
|
|
|
return await request.put({ url: `/iot/think-model-function/update`, data })
|
|
|
|
},
|
|
|
|
|
2024-10-01 19:29:24 +08:00
|
|
|
// 删除产品物模型
|
2024-09-29 21:58:03 +08:00
|
|
|
deleteThinkModelFunction: async (id: number) => {
|
|
|
|
return await request.delete({ url: `/iot/think-model-function/delete?id=` + id })
|
|
|
|
}
|
|
|
|
}
|