|
@@ -174,13 +174,14 @@ import addDeviceModal from './components/addDevice/index.vue'
|
|
import uploadDeviceModal from './components/uploadDevice/index.vue'
|
|
import uploadDeviceModal from './components/uploadDevice/index.vue'
|
|
import OTADeviceModal from './components/OTADevice/index.vue'
|
|
import OTADeviceModal from './components/OTADevice/index.vue'
|
|
import { useSearch } from '@/hooks/useSearch'
|
|
import { useSearch } from '@/hooks/useSearch'
|
|
-import { useRouter } from 'vue-router'
|
|
|
|
|
|
+import { useRouter, useRoute } from 'vue-router'
|
|
import * as tenantAPI from '@/api/tenant'
|
|
import * as tenantAPI from '@/api/tenant'
|
|
import type { TenantItem } from '@/api/tenant/types'
|
|
import type { TenantItem } from '@/api/tenant/types'
|
|
import * as adminAPI from '@/api/admin'
|
|
import * as adminAPI from '@/api/admin'
|
|
import * as deviceApi from '@/api/device'
|
|
import * as deviceApi from '@/api/device'
|
|
|
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
|
+const route = useRoute()
|
|
|
|
|
|
interface SearchData {
|
|
interface SearchData {
|
|
deviceId: string // 设备ID
|
|
deviceId: string // 设备ID
|
|
@@ -236,6 +237,7 @@ const fetchList = async () => {
|
|
createTimeStart: searchState.createTimeStart,
|
|
createTimeStart: searchState.createTimeStart,
|
|
createTimeEnd: searchState.createTimeEnd,
|
|
createTimeEnd: searchState.createTimeEnd,
|
|
online: searchState.deviceStatus,
|
|
online: searchState.deviceStatus,
|
|
|
|
+ tenantId: (route.query.tenantId as string) ?? undefined,
|
|
})
|
|
})
|
|
const allDeviceRes = await deviceAPI.getDeviceList({
|
|
const allDeviceRes = await deviceAPI.getDeviceList({
|
|
pageNo: current.value,
|
|
pageNo: current.value,
|
|
@@ -245,6 +247,7 @@ const fetchList = async () => {
|
|
createTimeStart: searchState.createTimeStart,
|
|
createTimeStart: searchState.createTimeStart,
|
|
createTimeEnd: searchState.createTimeEnd,
|
|
createTimeEnd: searchState.createTimeEnd,
|
|
online: null,
|
|
online: null,
|
|
|
|
+ tenantId: (route.query.tenantId as string) ?? undefined,
|
|
})
|
|
})
|
|
const onlineDeviceRes = await deviceAPI.getDeviceList({
|
|
const onlineDeviceRes = await deviceAPI.getDeviceList({
|
|
pageNo: current.value,
|
|
pageNo: current.value,
|
|
@@ -254,6 +257,7 @@ const fetchList = async () => {
|
|
createTimeStart: searchState.createTimeStart,
|
|
createTimeStart: searchState.createTimeStart,
|
|
createTimeEnd: searchState.createTimeEnd,
|
|
createTimeEnd: searchState.createTimeEnd,
|
|
online: 1,
|
|
online: 1,
|
|
|
|
+ tenantId: (route.query.tenantId as string) ?? undefined,
|
|
})
|
|
})
|
|
allDeviceTotal.value = Number(allDeviceRes.data.total) || 0 // 所有设备数量
|
|
allDeviceTotal.value = Number(allDeviceRes.data.total) || 0 // 所有设备数量
|
|
onlineDeviceTotal.value = Number(onlineDeviceRes.data.total) || 0 // 在线设备数量
|
|
onlineDeviceTotal.value = Number(onlineDeviceRes.data.total) || 0 // 在线设备数量
|