| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <template>
- <a-card>
- <a-spin spinning="" >
- <a-tabs v-model:activeKey="state.tabsActive">
- <a-tab-pane
- v-for="item in state.tabs"
- :key="item.key"
- :tab="item.name"
- />
- </a-tabs>
- </a-spin>
- <OverView :deviceId="state.deviceId" :key="state.deviceId" v-if="state.tabsActive === '1'"/>
- <CloudView v-else-if="state.tabsActive === '2'"/>
- <DeviceShadow v-else-if="state.tabsActive === '3'" />
- <MsgTrack v-else-if="state.tabsActive === '4'" />
- <SubDevice @goDetail="goDetail" v-else-if="state.tabsActive === '5'" />
- <DeviceTag @goDetail="goDetail" v-else-if="state.tabsActive === '6'" />
- <Ota v-else-if="state.tabsActive === '7'" />
- <Live v-else-if="state.tabsActive === '8'" />
- </a-card>
- </template>
- <script lang="ts" setup >
- import { onMounted, reactive } from 'vue'
- import OverView from './components/overview.vue'
- import CloudView from './components/cloudview.vue'
- import DeviceShadow from './components/deviceShadow.vue'
- import MsgTrack from './components/msgTrack.vue'
- import SubDevice from './components/subDevice.vue'
- import DeviceTag from './components/deviceTag.vue'
- import Ota from './components/ota.vue'
- import Live from './components/live.vue'
- import { useRoute } from 'vue-router'
- import { DeviceContriller } from '@/controller'
- // const tabs = [
- // {
- // name: '概述',
- // key: '1'
- // },
- // {
- // name: '云端下发',
- // key: '2'
- // },
- // {
- // name: '设备影子',
- // key: '3'
- // },
- // {
- // name: '消息跟踪',
- // key: '4'
- // },
- // {
- // name: '子设备',
- // key: '5'
- // },
- // {
- // name: '标签',
- // key: '6'
- // },
- // {
- // name: 'OTA',
- // key: '7'
- // },
- // {
- // name: 'Live',
- // key: '8'
- // }
- // ]
- const route = useRoute()
- const deviceId = route.query.id as string
- const state = reactive({
- tabsActive: '1',
- spinning: false,
- deviceId: deviceId,
- deviceDetail: {},
- tabs: [
- {
- name: '概述',
- key: '1'
- },
- {
- name: '云端下发',
- key: '2'
- },
- {
- name: '设备影子',
- key: '3'
- },
- {
- name: '消息跟踪',
- key: '4'
- },
- {
- name: '子设备',
- key: '5'
- },
- {
- name: '标签',
- key: '6'
- },
- {
- name: 'OTA',
- key: '7'
- },
- {
- name: 'Live',
- key: '8'
- }
- ]
- })
- const goDetail = ({ id }) => {
- state.tabsActive = '1'
- state.deviceId = id
- }
- const getDeviceById = async () => {
- state.spinning = true
- const deviceDetail = await DeviceContriller.byId(deviceId)
- state.deviceDetail = deviceDetail
- if (!deviceDetail.rtsUrl) {
- state.tabs.splice(7, 1)
- }
- state.spinning = false
- }
- onMounted(() => {
- getDeviceById()
- })
- </script>
- <style lang="less" scoped >
- </style>
|