浏览代码

fix: 产品模型库详情展示

lvkun 2 年之前
父节点
当前提交
cc0fae9e1d
共有 2 个文件被更改,包括 32 次插入24 次删除
  1. 2 2
      src/pages/Iot/model/components/modelDefine.vue
  2. 30 22
      src/pages/Iot/model/detail.vue

+ 2 - 2
src/pages/Iot/model/components/modelDefine.vue

@@ -2,7 +2,7 @@
   <a-row justify="end">
     <a-col  >
       <a-space>
-        <a-button type="primary" @click="openModel('attrVisible', 'add')" >新增属性</a-button>
+        <a-button v-if="route.query.type === 'model'" type="primary" @click="openModel('attrVisible', 'add')" >新增属性</a-button>
       </a-space>
     </a-col>
   </a-row>
@@ -35,7 +35,7 @@
   <a-row style="margin-top: 20px;"  justify="end" >
     <a-col  >
       <a-space>
-        <a-button type="primary" @click="openModel('cmdVisible', 'add')" >新增命令</a-button>
+        <a-button v-if="route.query.type === 'model'" type="primary" @click="openModel('cmdVisible', 'add')" >新增命令</a-button>
       </a-space>
     </a-col>
   </a-row>

+ 30 - 22
src/pages/Iot/model/detail.vue

@@ -26,19 +26,18 @@
   <a-card style="margin-top: 20px;" >
     <a-tabs v-model:activeKey="state.activeKey" @change="changeTabs">
       <a-tab-pane  :key="item.key" :tab="item.label" v-for="item in tabsdata">
-
       </a-tab-pane>
     </a-tabs>
         <ModelDefine v-if="state.activeKey === 0"/>
-        <OnlineTest v-else-if="state.activeKey === 2" />
         <Plugins v-else-if="state.activeKey === 1" />
-        <Topic v-else-if="state.activeKey === 3" />
+        <OnlineTest v-else-if="state.activeKey === 2 " />
+        <Topic v-else-if="state.activeKey === 3 " />
   </a-card>
 </template>
 
 <script lang="ts" setup >
 import { DeviceContriller, ModelController } from '@/controller'
-import { onMounted, reactive } from 'vue'
+import { computed, onMounted, reactive } from 'vue'
 import { useRoute } from 'vue-router'
 import ModelDefine from './components/modelDefine.vue'
 import OnlineTest from './components/onlineTest.vue'
@@ -60,24 +59,33 @@ const state = reactive<{
   deviceCount: ''
 })
 
-const tabsdata = [
-  {
-    label: '模型定义',
-    key: 0
-  },
-  {
-    label: '插件开发',
-    key: 1
-  },
-  {
-    label: '在线调试',
-    key: 2
-  },
-  {
-    label: 'Topic管理',
-    key: 3
-  }
-]
+const tabsdata = computed(() => modelType === 'model'
+  ? [
+      {
+        label: '模型定义',
+        key: 0
+      },
+      {
+        label: '插件开发',
+        key: 1
+      },
+      {
+        label: '在线调试',
+        key: 2
+      },
+      {
+        label: 'Topic管理',
+        key: 3
+      }
+    ]
+  : [{
+      label: '模型定义',
+      key: 0
+    },
+    {
+      label: '插件开发',
+      key: 1
+    }])
 
 const getDeviceCount = async () => {
   const data = await DeviceContriller.statistics({ modelId: modelId })