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

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

@@ -74,7 +74,6 @@ const bgImage = computed(() =>
: "bg.png" : "bg.png"
); );
watch(() => props.eleData, (now) => { watch(() => props.eleData, (now) => {
console.log('now.frequencyChangerList',now)
if(now.frequencyChangerList.length===0){ if(now.frequencyChangerList.length===0){
electricityConsumptionMonthly.value=0 electricityConsumptionMonthly.value=0
}else { }else {

View File

@@ -23,6 +23,15 @@ const routes = [
breadcrumb: true breadcrumb: true
}, },
}, },
{
path: '/:tunnelId',
name: 'previewTunnel',
component: () => import('@/views/tunnel/index.vue'),
meta: {
title: '隧道预览',
breadcrumb: true
},
},
{ {
path: '/edit/:tunnelId(\\d+)/:type/:userId(\\d+)', path: '/edit/:tunnelId(\\d+)/:type/:userId(\\d+)',
name: 'tunneledit', name: 'tunneledit',

View File

@@ -31,7 +31,7 @@
</div> </div>
<div class="box-center"> <div class="box-center">
<div> <div>
<div class="left-img" @click="handlePreview"></div> <div class="left-img" @click="handlePreview(item.tunnelId)"></div>
<div> <div>
<div class="edit-btn" @click.stop="handleGoToEditTunnel(item.tunnelId)"> <div class="edit-btn" @click.stop="handleGoToEditTunnel(item.tunnelId)">
<div class="edit-icon"></div> <div class="edit-icon"></div>
@@ -113,9 +113,10 @@ import {getSiteDetail} from "@/api/site";
const router = useRouter() const router = useRouter()
const showAddIcon = ref(true) const showAddIcon = ref(true)
const siteId = reactive(router.currentRoute.value.params.siteId) const params = router.currentRoute.value.params;
const userId = reactive(router.currentRoute.value.params.userId) const siteId = reactive(params.siteId)
const type = reactive(router.currentRoute.value.params.type) const userId = reactive(params.userId)
const type = reactive(params.type)
const formRules = ref({ const formRules = ref({
tunnelName: [{required: true, message: '请输入隧道名称', trigger: 'blur'}], tunnelName: [{required: true, message: '请输入隧道名称', trigger: 'blur'}],
serialNumber: [{required: true, message: '请输入序列号', trigger: 'blur'}] serialNumber: [{required: true, message: '请输入序列号', trigger: 'blur'}]
@@ -256,8 +257,11 @@ const handleSubmit = (instance) => {
// }) // })
} }
//预览隧道 //预览隧道
const handlePreview=()=>{ const handlePreview=(id)=>{
console.log('预览')
if(id){
router.push('/'+id)
}
} }
const handleGoToEditTunnel = (tunnelId) => { const handleGoToEditTunnel = (tunnelId) => {
isEdit.value = true isEdit.value = true
@@ -589,6 +593,7 @@ const handleMoreDelete = () => {
} }
.left-img { .left-img {
cursor: pointer;
margin-top: 110px; margin-top: 110px;
margin-right: 50px; margin-right: 50px;
width: 340px; width: 340px;

View File

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