【代码优化】IOT: ThingModel 优化

This commit is contained in:
puhui999
2024-12-23 10:13:14 +08:00
parent b6d3a85a8b
commit d5f3d4006a
12 changed files with 62 additions and 63 deletions

View File

@ -3,7 +3,7 @@ import request from '@/config/axios'
/**
* IoT
*/
export interface ThinkModelData {
export interface ThingModelData {
id?: number // 物模型功能编号
identifier?: string // 功能标识
name?: string // 功能名称
@ -12,29 +12,29 @@ export interface ThinkModelData {
productKey?: string // 产品标识
dataType: string // 数据类型,与 dataSpecs 的 dataType 保持一致
type: ProductFunctionTypeEnum // 功能类型
property: ThinkModelProperty // 属性
event?: ThinkModelEvent // 事件
service?: ThinkModelService // 服务
property: ThingModelProperty // 属性
event?: ThingModelEvent // 事件
service?: ThingModelService // 服务
}
/**
* ThinkModelProperty
* ThingModelProperty
*/
export interface ThinkModelProperty {
export interface ThingModelProperty {
[key: string]: any
}
/**
* ThinkModelEvent
* ThingModelEvent
*/
export interface ThinkModelEvent {
export interface ThingModelEvent {
[key: string]: any
}
/**
* ThinkModelService
* ThingModelService
*/
export interface ThinkModelService {
export interface ThingModelService {
[key: string]: any
}
@ -52,38 +52,37 @@ export enum ProductFunctionAccessModeEnum {
}
// IoT 产品物模型 API
export const ThinkModelApi = {
export const ThingModelApi = {
// 查询产品物模型分页
// TODO @puhui999product 前缀,是不是去掉哈。
getThinkModelPage: async (params: any) => {
return await request.get({ url: `/iot/product-think-model/page`, params })
getThingModelPage: async (params: any) => {
return await request.get({ url: `/iot/product-thing-model/page`, params })
},
// 获得产品物模型
getThinkModelListByProductId: async (params: any) => {
getThingModelListByProductId: async (params: any) => {
return await request.get({
url: `/iot/product-think-model/list-by-product-id`,
url: `/iot/product-thing-model/list-by-product-id`,
params
})
},
// 查询产品物模型详情
getThinkModel: async (id: number) => {
return await request.get({ url: `/iot/product-think-model/get?id=` + id })
getThingModel: async (id: number) => {
return await request.get({ url: `/iot/product-thing-model/get?id=` + id })
},
// 新增产品物模型
createThinkModel: async (data: ThinkModelData) => {
return await request.post({ url: `/iot/product-think-model/create`, data })
createThingModel: async (data: ThingModelData) => {
return await request.post({ url: `/iot/product-thing-model/create`, data })
},
// 修改产品物模型
updateThinkModel: async (data: ThinkModelData) => {
return await request.put({ url: `/iot/product-think-model/update`, data })
updateThingModel: async (data: ThingModelData) => {
return await request.put({ url: `/iot/product-thing-model/update`, data })
},
// 删除产品物模型
deleteThinkModel: async (id: number) => {
return await request.delete({ url: `/iot/product-think-model/delete?id=` + id })
deleteThingModel: async (id: number) => {
return await request.delete({ url: `/iot/product-thing-model/delete?id=` + id })
}
}