index.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import request from '@/config/axios'
  2. /**
  3. * IoT 产品物模型
  4. */
  5. export interface ThingModelData {
  6. id?: number // 物模型功能编号
  7. identifier?: string // 功能标识
  8. name?: string // 功能名称
  9. description?: string // 功能描述
  10. productId?: number // 产品编号
  11. productKey?: string // 产品标识
  12. dataType: string // 数据类型,与 dataSpecs 的 dataType 保持一致
  13. type: number // 功能类型
  14. property: ThingModelProperty // 属性
  15. event?: ThingModelEvent // 事件
  16. service?: ThingModelService // 服务
  17. }
  18. /**
  19. * ThingModelProperty 类型
  20. */
  21. export interface ThingModelProperty {
  22. [key: string]: any
  23. }
  24. /**
  25. * ThingModelEvent 类型
  26. */
  27. export interface ThingModelEvent {
  28. [key: string]: any
  29. }
  30. /**
  31. * ThingModelService 类型
  32. */
  33. export interface ThingModelService {
  34. [key: string]: any
  35. }
  36. // IoT 产品物模型 API
  37. export const ThingModelApi = {
  38. // 查询产品物模型分页
  39. getThingModelPage: async (params: any) => {
  40. return await request.get({ url: `/iot/thing-model/page`, params })
  41. },
  42. // 获得产品物模型
  43. getThingModelListByProductId: async (params: any) => {
  44. return await request.get({
  45. url: `/iot/thing-model/list-by-product-id`,
  46. params
  47. })
  48. },
  49. // 查询产品物模型详情
  50. getThingModel: async (id: number) => {
  51. return await request.get({ url: `/iot/thing-model/get?id=` + id })
  52. },
  53. // 新增产品物模型
  54. createThingModel: async (data: ThingModelData) => {
  55. return await request.post({ url: `/iot/thing-model/create`, data })
  56. },
  57. // 修改产品物模型
  58. updateThingModel: async (data: ThingModelData) => {
  59. return await request.put({ url: `/iot/thing-model/update`, data })
  60. },
  61. // 删除产品物模型
  62. deleteThingModel: async (id: number) => {
  63. return await request.delete({ url: `/iot/thing-model/delete?id=` + id })
  64. }
  65. }