邓洁: 隧道管理中点击预览隧道

This commit is contained in:
邓洁
2024-01-03 19:58:32 +08:00
parent 5557b7109e
commit 53cdb854a3
4 changed files with 38 additions and 13 deletions

View File

@@ -56,7 +56,7 @@
</div>
<div class="switch-btn">
<div class="arrow" @click="previousBtn"></div>
<el-carousel height="150px" type="card" ref="tunnelBtn" :autoplay="false" @change="changeTunnel">
<el-carousel height="150px" type="card" ref="tunnelBtn" :autoplay="false" :initial-index="initialIndex" @change="changeTunnel" >
<div class="btn">
<el-carousel-item v-for="item in tunnelList" :key="item.value">
{{ item.label }}
@@ -85,9 +85,11 @@ import {getUserInfo} from "@/api/login";
import {initSceneData} from "@/api/tunnelScene";
const authStore = useAuthStore();
const router = useRouter();
const previewId = reactive(router.currentRoute.value.params.tunnelId)
const selectIndex = ref(-1);
const showFan = ref(false);
const drawerLeft = ref(true);
const initialIndex = ref(0)
const showFanLoading = ref(0)
const showWindLoading = ref(0)
const showBadLoading = ref(0)
@@ -152,11 +154,15 @@ const socketData = reactive({
sensor: [],
});
onMounted(() => {
if(previewId){
getScreenInfo(previewId)
}
getUser()
getOtherInfo()
nextTick(() => {
showFan.value = true;
});
getUser()
getOtherInfo()
});
const getUser = () => {
getUserInfo().then(res => {
@@ -185,7 +191,15 @@ const getOtherInfo = () => {
currentSite.value = res.data.siteOption[0].label
localStorage.setItem('site', currentSite.value)
tunnelList.value = res.data.tunnelOption
getTunnel(res.data.siteOption[0].value)
if(previewId){
tunnelList.value.forEach((item, index) => {
if(item.value == previewId){
initialIndex.value = index
}
})
}else{
getTunnel(res.data.siteOption[0].value)
}
}
});
};
@@ -223,7 +237,6 @@ const getScreenInfo = (id) => {
showBadLoading.value=1
}
largeScreenData.value = res.data;
console.log('largeScreenData.value',largeScreenData.value)
} else {
ElMessage.warning(res.msg)
}
@@ -243,7 +256,6 @@ const getTunnel = (id) => {
});
}
const changeTunnel = (e) => {
console.log('tunnelList.value',e,tunnelList.value)
let newObj = {}
tunnelList.value.forEach((item, index) => {
if (index === e) {