From 341eb570e94c5a238a0a0cd28736406b6d22d9c8 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 17 Dec 2024 15:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91IOT:=20=E4=BA=A7=E5=93=81=E7=89=A9=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../index.ts | 34 +++++++++---------- .../detail/ThingModel/dataSpecs/index.ts | 5 --- .../iot/product/product/detail/index.vue | 6 ++-- src/views/iot/product/product/index.vue | 2 +- .../ThinkModelDataSpecs.vue} | 18 +++++----- .../ThinkModelForm.vue} | 22 +++++------- .../ThingModel => thinkmodel}/config.ts | 0 .../ThinkModelArrayTypeDataSpecs.vue} | 2 +- .../ThinkModelEnumTypeDataSpecs.vue} | 7 ++-- .../ThinkModelNumberTypeDataSpecs.vue} | 2 +- src/views/iot/thinkmodel/dataSpecs/index.ts | 5 +++ .../ThingModel => thinkmodel}/index.vue | 16 ++++----- 12 files changed, 56 insertions(+), 63 deletions(-) rename src/api/iot/{thinkmodelfunction => thinkmodel}/index.ts (68%) delete mode 100644 src/views/iot/product/product/detail/ThingModel/dataSpecs/index.ts rename src/views/iot/{product/product/detail/ThingModel/ThingModelDataSpecs.vue => thinkmodel/ThinkModelDataSpecs.vue} (94%) rename src/views/iot/{product/product/detail/ThingModel/ThingModelForm.vue => thinkmodel/ThinkModelForm.vue} (89%) rename src/views/iot/{product/product/detail/ThingModel => thinkmodel}/config.ts (100%) rename src/views/iot/{product/product/detail/ThingModel/dataSpecs/ThingModelArrayTypeDataSpecs.vue => thinkmodel/dataSpecs/ThinkModelArrayTypeDataSpecs.vue} (96%) rename src/views/iot/{product/product/detail/ThingModel/dataSpecs/ThingModelEnumTypeDataSpecs.vue => thinkmodel/dataSpecs/ThinkModelEnumTypeDataSpecs.vue} (96%) rename src/views/iot/{product/product/detail/ThingModel/dataSpecs/ThingModelNumberTypeDataSpecs.vue => thinkmodel/dataSpecs/ThinkModelNumberTypeDataSpecs.vue} (98%) create mode 100644 src/views/iot/thinkmodel/dataSpecs/index.ts rename src/views/iot/{product/product/detail/ThingModel => thinkmodel}/index.vue (90%) diff --git a/src/api/iot/thinkmodelfunction/index.ts b/src/api/iot/thinkmodel/index.ts similarity index 68% rename from src/api/iot/thinkmodelfunction/index.ts rename to src/api/iot/thinkmodel/index.ts index 9c01cfa9..ee314790 100644 --- a/src/api/iot/thinkmodelfunction/index.ts +++ b/src/api/iot/thinkmodel/index.ts @@ -3,7 +3,7 @@ import request from '@/config/axios' /** * IoT 产品物模型 */ -export interface ThingModelData { +export interface ThinkModelData { id?: number // 物模型功能编号 identifier?: string // 功能标识 name?: string // 功能名称 @@ -12,29 +12,29 @@ export interface ThingModelData { productKey?: string // 产品标识 dataType: string // 数据类型,与 dataSpecs 的 dataType 保持一致 type: ProductFunctionTypeEnum // 功能类型 - property: ThingModelProperty // 属性 - event?: ThingModelEvent // 事件 - service?: ThingModelService // 服务 + property: ThinkModelProperty // 属性 + event?: ThinkModelEvent // 事件 + service?: ThinkModelService // 服务 } /** - * ThingModelProperty 类型 + * ThinkModelProperty 类型 */ -export interface ThingModelProperty { +export interface ThinkModelProperty { [key: string]: any } /** - * ThingModelEvent 类型 + * ThinkModelEvent 类型 */ -export interface ThingModelEvent { +export interface ThinkModelEvent { [key: string]: any } /** - * ThingModelService 类型 + * ThinkModelService 类型 */ -export interface ThingModelService { +export interface ThinkModelService { [key: string]: any } @@ -52,14 +52,14 @@ export enum ProductFunctionAccessModeEnum { } // IoT 产品物模型 API -export const ThinkModelFunctionApi = { +export const ThinkModelApi = { // 查询产品物模型分页 - getProductThingModelPage: async (params: any) => { + getProductThinkModelPage: async (params: any) => { return await request.get({ url: `/iot/product-thing-model/page`, params }) }, // 获得产品物模型 - getProductThingModelListByProductId: async (params: any) => { + getProductThinkModelListByProductId: async (params: any) => { return await request.get({ url: `/iot/product-thing-model/list-by-product-id`, params @@ -67,22 +67,22 @@ export const ThinkModelFunctionApi = { }, // 查询产品物模型详情 - getProductThingModel: async (id: number) => { + getProductThinkModel: async (id: number) => { return await request.get({ url: `/iot/product-thing-model/get?id=` + id }) }, // 新增产品物模型 - createProductThingModel: async (data: ThingModelData) => { + createProductThinkModel: async (data: ThinkModelData) => { return await request.post({ url: `/iot/product-thing-model/create`, data }) }, // 修改产品物模型 - updateProductThingModel: async (data: ThingModelData) => { + updateProductThinkModel: async (data: ThinkModelData) => { return await request.put({ url: `/iot/product-thing-model/update`, data }) }, // 删除产品物模型 - deleteProductThingModel: async (id: number) => { + deleteProductThinkModel: async (id: number) => { return await request.delete({ url: `/iot/product-thing-model/delete?id=` + id }) } } diff --git a/src/views/iot/product/product/detail/ThingModel/dataSpecs/index.ts b/src/views/iot/product/product/detail/ThingModel/dataSpecs/index.ts deleted file mode 100644 index f2e1daaf..00000000 --- a/src/views/iot/product/product/detail/ThingModel/dataSpecs/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import ThingModelEnumTypeDataSpecs from './ThingModelEnumTypeDataSpecs.vue' -import ThingModelNumberTypeDataSpecs from './ThingModelNumberTypeDataSpecs.vue' -import ThingModelArrayTypeDataSpecs from './ThingModelArrayTypeDataSpecs.vue' - -export { ThingModelEnumTypeDataSpecs, ThingModelNumberTypeDataSpecs, ThingModelArrayTypeDataSpecs } diff --git a/src/views/iot/product/product/detail/index.vue b/src/views/iot/product/product/detail/index.vue index cdf3103a..c74c10a9 100644 --- a/src/views/iot/product/product/detail/index.vue +++ b/src/views/iot/product/product/detail/index.vue @@ -8,8 +8,8 @@ - - + + @@ -22,7 +22,7 @@ import { DeviceApi } from '@/api/iot/device' import ProductDetailsHeader from './ProductDetailsHeader.vue' import ProductDetailsInfo from './ProductDetailsInfo.vue' import ProductTopic from './ProductTopic.vue' -import IoTProductThingModel from './ThingModel/index.vue' +import IoTProductThinkModel from '@/views/iot/thinkmodel/index.vue' import { useTagsViewStore } from '@/store/modules/tagsView' import { useRouter } from 'vue-router' import { IOT_PROVIDE_KEY } from '@/views/iot/utils/constants' diff --git a/src/views/iot/product/product/index.vue b/src/views/iot/product/product/index.vue index db61ccfe..09fa0237 100644 --- a/src/views/iot/product/product/index.vue +++ b/src/views/iot/product/product/index.vue @@ -309,7 +309,7 @@ const openObjectModel = (item: ProductVO) => { push({ name: 'IoTProductDetail', params: { id: item.id }, - query: { tab: 'thingModel' } + query: { tab: 'thinkModel' } }) } diff --git a/src/views/iot/product/product/detail/ThingModel/ThingModelDataSpecs.vue b/src/views/iot/thinkmodel/ThinkModelDataSpecs.vue similarity index 94% rename from src/views/iot/product/product/detail/ThingModel/ThingModelDataSpecs.vue rename to src/views/iot/thinkmodel/ThinkModelDataSpecs.vue index 9a920017..d352695c 100644 --- a/src/views/iot/product/product/detail/ThingModel/ThingModelDataSpecs.vue +++ b/src/views/iot/thinkmodel/ThinkModelDataSpecs.vue @@ -14,7 +14,7 @@ - - @@ -74,7 +74,7 @@ - @@ -104,18 +104,18 @@ import { useVModel } from '@vueuse/core' import { DataSpecsDataType, dataTypeOptions } from './config' import { - ThingModelArrayTypeDataSpecs, - ThingModelEnumTypeDataSpecs, - ThingModelNumberTypeDataSpecs + ThinkModelArrayTypeDataSpecs, + ThinkModelEnumTypeDataSpecs, + ThinkModelNumberTypeDataSpecs } from './dataSpecs' -import { ThingModelProperty } from '@/api/iot/thinkmodelfunction' +import { ThinkModelProperty } from '@/api/iot/thinkmodel' import { isEmpty } from '@/utils/is' /** 物模型数据 */ -defineOptions({ name: 'ThingModelDataSpecs' }) +defineOptions({ name: 'IoTProductThinkModelDataSpecs' }) const props = defineProps<{ modelValue: any }>() const emits = defineEmits(['update:modelValue']) -const property = useVModel(props, 'modelValue', emits) as Ref +const property = useVModel(props, 'modelValue', emits) as Ref /** 属性值的数据类型切换时初始化相关数据 */ const handleChange = (dataType: any) => { diff --git a/src/views/iot/product/product/detail/ThingModel/ThingModelForm.vue b/src/views/iot/thinkmodel/ThinkModelForm.vue similarity index 89% rename from src/views/iot/product/product/detail/ThingModel/ThingModelForm.vue rename to src/views/iot/thinkmodel/ThinkModelForm.vue index b662a9eb..0674cebd 100644 --- a/src/views/iot/product/product/detail/ThingModel/ThingModelForm.vue +++ b/src/views/iot/thinkmodel/ThinkModelForm.vue @@ -21,7 +21,7 @@ - @@ -36,17 +36,13 @@