|
@@ -3,7 +3,11 @@
|
|
|
<template #title>
|
|
<template #title>
|
|
|
<a-row :gutter="[8, 8]">
|
|
<a-row :gutter="[8, 8]">
|
|
|
<a-col> <h1>{{state.model?.modelLabel}}</h1> </a-col>
|
|
<a-col> <h1>{{state.model?.modelLabel}}</h1> </a-col>
|
|
|
- <a-col> <span class="subtitle" >ID: {{state.model?.id}}</span> </a-col>
|
|
|
|
|
|
|
+ <a-col>
|
|
|
|
|
+ <span class="subtitle" >ID: {{state.model?.id}}</span>
|
|
|
|
|
+ <a-divider type="vertical" style="height: 10px; width: 6px; border-color: #7cb305" />
|
|
|
|
|
+ <span>注册设备数: <a>{{state.deviceCount}}</a> </span>
|
|
|
|
|
+ </a-col>
|
|
|
</a-row>
|
|
</a-row>
|
|
|
</template>
|
|
</template>
|
|
|
<a-descriptions
|
|
<a-descriptions
|
|
@@ -33,7 +37,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup >
|
|
<script lang="ts" setup >
|
|
|
-import { ModelController } from '@/controller'
|
|
|
|
|
|
|
+import { DeviceContriller, ModelController } from '@/controller'
|
|
|
import { onMounted, reactive } from 'vue'
|
|
import { onMounted, reactive } from 'vue'
|
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
|
import ModelDefine from './components/modelDefine.vue'
|
|
import ModelDefine from './components/modelDefine.vue'
|
|
@@ -41,14 +45,18 @@ import OnlineTest from './components/onlineTest.vue'
|
|
|
import Plugins from './components/plugins.vue'
|
|
import Plugins from './components/plugins.vue'
|
|
|
import Topic from './components/topic.vue'
|
|
import Topic from './components/topic.vue'
|
|
|
|
|
|
|
|
-const queryParams = useRoute().query as {id: string}
|
|
|
|
|
|
|
+const route = useRoute()
|
|
|
|
|
+
|
|
|
|
|
+const modelId = route.query.id as string
|
|
|
|
|
|
|
|
const state = reactive<{
|
|
const state = reactive<{
|
|
|
model: IOT.API.MODEL.ModelDot | null,
|
|
model: IOT.API.MODEL.ModelDot | null,
|
|
|
- activeKey: number
|
|
|
|
|
|
|
+ activeKey: number,
|
|
|
|
|
+ deviceCount: string
|
|
|
}>({
|
|
}>({
|
|
|
model: null,
|
|
model: null,
|
|
|
- activeKey: 0
|
|
|
|
|
|
|
+ activeKey: 0,
|
|
|
|
|
+ deviceCount: ''
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const tabsdata = [
|
|
const tabsdata = [
|
|
@@ -70,17 +78,25 @@ const tabsdata = [
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
+const getDeviceCount = async () => {
|
|
|
|
|
+ const data = await DeviceContriller.statistics({ modelId: modelId })
|
|
|
|
|
+ state.deviceCount = data.find(item => item.key === 'TOTAL')!.value!
|
|
|
|
|
+
|
|
|
|
|
+ // state.deviceCount = data
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const changeTabs = (record: number) => {
|
|
const changeTabs = (record: number) => {
|
|
|
console.log(record)
|
|
console.log(record)
|
|
|
state.activeKey = record
|
|
state.activeKey = record
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const getModelById = async (id: string) => {
|
|
|
|
|
- state.model = await ModelController.detail(id)
|
|
|
|
|
|
|
+const getModelById = async () => {
|
|
|
|
|
+ state.model = await ModelController.detail(modelId)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- getModelById(queryParams.id)
|
|
|
|
|
|
|
+ getModelById()
|
|
|
|
|
+ getDeviceCount()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
</script>
|
|
</script>
|