|
@@ -1,6 +1,6 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { onMounted, ref, useTemplateRef } from 'vue';
|
|
import { onMounted, ref, useTemplateRef } from 'vue';
|
|
-import { useRouter } from 'vue-router';
|
|
|
|
|
|
+import { useRoute, useRouter } from 'vue-router';
|
|
import { useInfiniteScroll } from '@vueuse/core';
|
|
import { useInfiniteScroll } from '@vueuse/core';
|
|
|
|
|
|
import SvgIcon from '@/components/SvgIcon.vue';
|
|
import SvgIcon from '@/components/SvgIcon.vue';
|
|
@@ -18,8 +18,10 @@ import type { DevGroupTabCompProps, DevicesListItem, DeviceTypeCount, PageParams
|
|
const props = defineProps<DevGroupTabCompProps>();
|
|
const props = defineProps<DevGroupTabCompProps>();
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
|
+const route = useRoute();
|
|
const { isLoading, handleRequest } = useRequest();
|
|
const { isLoading, handleRequest } = useRequest();
|
|
const deviceTypes = ref<DeviceTypeCount[]>([]);
|
|
const deviceTypes = ref<DeviceTypeCount[]>([]);
|
|
|
|
+const activeDeviceId = ref<number>();
|
|
const activeDeviceType = ref<DeviceType>(DeviceType.空);
|
|
const activeDeviceType = ref<DeviceType>(DeviceType.空);
|
|
const activeDeviceStatus = ref<DeviceStatusQuery>(DeviceStatusQuery.All);
|
|
const activeDeviceStatus = ref<DeviceStatusQuery>(DeviceStatusQuery.All);
|
|
|
|
|
|
@@ -34,7 +36,26 @@ onMounted(() => {
|
|
]);
|
|
]);
|
|
|
|
|
|
if (deviceTypes.value.length) {
|
|
if (deviceTypes.value.length) {
|
|
- activeDeviceType.value = deviceTypes.value[0].deviceType;
|
|
|
|
|
|
+ if (route.query.deviceType && route.query.deviceId) {
|
|
|
|
+ const deviceType = Number(route.query.deviceType);
|
|
|
|
+ const isDeviceTypeExisted = deviceTypes.value.find((item) => item.deviceType === deviceType);
|
|
|
|
+
|
|
|
|
+ if (isDeviceTypeExisted) {
|
|
|
|
+ activeDeviceId.value = Number(route.query.deviceId);
|
|
|
|
+ activeDeviceType.value = deviceType;
|
|
|
|
+
|
|
|
|
+ router.replace({
|
|
|
|
+ path: route.path,
|
|
|
|
+ query: {
|
|
|
|
+ tab: 'deviceWorkStatus',
|
|
|
|
+ r: route.query.r,
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ activeDeviceType.value = deviceTypes.value[0].deviceType;
|
|
|
|
+ }
|
|
|
|
+
|
|
getDeviceList();
|
|
getDeviceList();
|
|
}
|
|
}
|
|
});
|
|
});
|