解决冲突
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
<div id="main">
|
||||
<div class="box-top">
|
||||
<manage-btn v-model="selectIndex" @select="manageSelect" :list="routeList" v-if="showMenu" />
|
||||
<div class="tunnel-title"></div>
|
||||
<!-- <manage-length class="tunnel-length"></manage-length>-->
|
||||
<tunnel-title v-if="showTunnelTitle" />
|
||||
<div class="top-length">
|
||||
<!-- <span>隧道总长度: {{ tunnelLength }}米</span>-->
|
||||
<span>当前施工长度: {{ constructionLength }}米</span>
|
||||
@@ -32,7 +31,6 @@
|
||||
</div>
|
||||
<!-- <tunnel-scene id="tunnel-box" :isedit="false" /> -->
|
||||
<!-- 一进去的话应该是预览模式,所以引入这个组件1 -->
|
||||
|
||||
<preview-scene id="tunnel-box" :isedit="false" :tunnelId="tunnelId" :key="tunnelId" :tunnelLen="tunnelLen"
|
||||
:tunnelName="tunnelName" :largeScreen="largeScreen"></preview-scene>
|
||||
<div class="left">
|
||||
@@ -80,6 +78,7 @@ import WindPressureList from "@/components/content/windPressure/WindPressureList
|
||||
import AirInfo from "@/components/content/airInfo/AirInfo.vue";
|
||||
import BadGasInfo from "@/components/content/badGasInfo/BadGasInfo.vue";
|
||||
import ManageBtn from "@/components/manageBtn/index.vue";
|
||||
import TunnelTitle from "@/components/tunnelTitle/index.vue";
|
||||
import { dateFormat } from "@/utils/date.js";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { useAuthStore } from "@/store/userstore.js";
|
||||
@@ -87,13 +86,18 @@ import { getLargeScreen, getLargeScreenInfo, getTunnelBySiteId } from "@/api/lar
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { getUserInfo } from "@/api/login";
|
||||
import { initSceneData } from "@/api/tunnelScene";
|
||||
import { getTunnelList } from "@/api/tunnelManage";
|
||||
import { computed } from "vue";
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const router = useRouter();
|
||||
const previewId = reactive(router.currentRoute.value.params.tunnelId)
|
||||
const siteId = reactive(router.currentRoute.value.params.siteId)
|
||||
const tunnelIdFlag = reactive(router.currentRoute.value.params.tunnelId)
|
||||
const selectIndex = ref(-1);
|
||||
const showFan = ref(false);
|
||||
const drawerLeft = ref(true);
|
||||
const showTunnelTitle = ref(true);
|
||||
const initialIndex = ref(0)
|
||||
const showFanLoading = ref(0)
|
||||
const showWindLoading = ref(0)
|
||||
@@ -103,6 +107,7 @@ const showMenu = ref(false);
|
||||
const currentSiteId = ref(0);
|
||||
const currentSite = ref("");
|
||||
const siteList = ref([])
|
||||
const totalTunnelList = ref([])
|
||||
const currentUser = ref("");
|
||||
const currentUserId = ref(0);
|
||||
const currentDate = ref(dateFormat());
|
||||
@@ -113,7 +118,9 @@ const tunnelLength = ref(0);
|
||||
const constructionLength = ref(0);
|
||||
const routeList = ref([]);
|
||||
let socket = reactive("");
|
||||
let pattern = reactive(new RegExp("[A-Za-z]+"));
|
||||
let tunnelName = reactive("")
|
||||
let isTunnel = reactive(false)
|
||||
|
||||
const btnList = ref([
|
||||
{
|
||||
@@ -155,9 +162,7 @@ const socketData = reactive({
|
||||
let tunnelLen = computed(() => tunnelLength);
|
||||
|
||||
onMounted(() => {
|
||||
if (previewId) {
|
||||
getScreenInfo(previewId)
|
||||
}
|
||||
getList()
|
||||
getUser()
|
||||
getOtherInfo()
|
||||
nextTick(() => {
|
||||
@@ -178,7 +183,7 @@ const getOtherInfo = () => {
|
||||
getLargeScreenInfo().then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
let routeArr = [];
|
||||
res.data.routeList.forEach((item, index) => {
|
||||
res.data.routeList.forEach((item) => {
|
||||
for (let btn of btnList.value) {
|
||||
if (item === btn.route) {
|
||||
routeArr.push(btn)
|
||||
@@ -188,22 +193,25 @@ const getOtherInfo = () => {
|
||||
routeList.value = routeArr
|
||||
showMenu.value = true
|
||||
siteList.value = res.data.siteOption
|
||||
currentSiteId.value = res.data.siteOption[0].value
|
||||
currentSite.value = res.data.siteOption[0].label
|
||||
localStorage.setItem('site', currentSite.value)
|
||||
if (res.data.tunnelOption.length === 0) {
|
||||
getTunnel(res.data.siteOption[0].value)
|
||||
} else {
|
||||
if (!siteId) {
|
||||
tunnelList.value = res.data.tunnelOption
|
||||
}
|
||||
if (previewId) {
|
||||
tunnelList.value.forEach((item, index) => {
|
||||
if (item.value == previewId) {
|
||||
initialIndex.value = index
|
||||
}
|
||||
})
|
||||
|
||||
if (siteId) {
|
||||
currentSiteId.value = siteId
|
||||
currentSite.value = localStorage.getItem('site')
|
||||
showTunnelTitle.value = false
|
||||
nextTick(() => {
|
||||
showTunnelTitle.value = true
|
||||
});
|
||||
console.log('siteId', siteId)
|
||||
getTunnel(siteId)
|
||||
} else {
|
||||
getTunnel(res.data.siteOption[0].value)
|
||||
currentSiteId.value = res.data.siteOption[0].value
|
||||
currentSite.value = res.data.siteOption[0].label
|
||||
localStorage.setItem('site', currentSite.value)
|
||||
localStorage.setItem('currentSiteId', currentSiteId.value)
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -224,7 +232,7 @@ const getScreenInfo = (id) => {
|
||||
showWindLoading.value = 1
|
||||
}
|
||||
if (res.data.sensorList.length !== 0) {
|
||||
res.data.sensorList.forEach((item, index) => {
|
||||
res.data.sensorList.forEach((item) => {
|
||||
if (
|
||||
item.equipmentType === "carbonDioxide" ||
|
||||
item.equipmentType === "carbonMonoxide" ||
|
||||
@@ -255,18 +263,45 @@ const getScreenInfo = (id) => {
|
||||
})
|
||||
}
|
||||
};
|
||||
//根据站点id获取隧道信息
|
||||
const getList = () => {
|
||||
getTunnelList({
|
||||
siteId: siteId
|
||||
}).then(res => {
|
||||
if (res.code === 1000) {
|
||||
if (res.data.rows.length !== 0) {
|
||||
isTunnel = true;
|
||||
totalTunnelList.value = res.data.rows
|
||||
} else {
|
||||
isTunnel = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
//根据站点id获取隧道信息option
|
||||
let largeScreen = computed(() => largeScreenData)
|
||||
const getTunnel = (id) => {
|
||||
getTunnelBySiteId(id).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
if (res.data.length === 0) {
|
||||
ElMessage.warning('该站点下无隧道, 请新增隧道后再尝试!')
|
||||
if (isTunnel) {
|
||||
ElMessage.warning('该站点下没有隧道可展示, 请添加设备后再试!')
|
||||
} else {
|
||||
ElMessage.warning('该站点下没有隧道, 请新增隧道后再试!')
|
||||
}
|
||||
tunnelList.value = []
|
||||
} else {
|
||||
getScreenInfo(res.data[0]?.value)
|
||||
tunnelName = res.data[0].label
|
||||
if (!pattern.test(previewId)) {
|
||||
getScreenInfo(previewId)
|
||||
} else {
|
||||
getScreenInfo(res.data[0]?.value)
|
||||
tunnelName = res.data[0].label
|
||||
}
|
||||
tunnelList.value = res.data
|
||||
tunnelList.value.forEach((item, index) => {
|
||||
if (item.value == previewId) {
|
||||
initialIndex.value = index
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -288,17 +323,17 @@ const changeTunnel = (e) => {
|
||||
}
|
||||
const manageSelect = (index) => {
|
||||
console.log("首页点击-", index);
|
||||
if (index == '站点管理') {
|
||||
if (index === '站点管理') {
|
||||
if (currentUserId.value) {
|
||||
router.push("/site/" + currentUserId.value);
|
||||
router.push("/site/" + currentUserId.value + '/' + currentSiteId.value);
|
||||
}
|
||||
} else if (index == '隧道管理') {
|
||||
} else if (index === '隧道管理') {
|
||||
if (currentSiteId.value && currentUserId.value) {
|
||||
router.push("/tunnel/" + currentSiteId.value + '/byHome/' + currentUserId.value);
|
||||
router.push("/tunnel/" + localStorage.getItem('currentSiteId') + '/byHome/' + currentUserId.value);
|
||||
}
|
||||
} else if (index == '用户管理') {
|
||||
} else if (index === '用户管理') {
|
||||
if (currentSiteId.value) {
|
||||
router.push("/user/" + currentSiteId.value);
|
||||
router.push("/user/" + localStorage.getItem('currentSiteId'));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -310,6 +345,15 @@ const handleChangeSite = (item) => {
|
||||
nextTick(() => {
|
||||
showFan.value = true;
|
||||
});
|
||||
localStorage.setItem('site', currentSite.value)
|
||||
localStorage.setItem('currentSiteId', currentSiteId.value)
|
||||
if (tunnelIdFlag) {
|
||||
router.push('/' + tunnelIdFlag + '/' + currentSiteId.value)
|
||||
}
|
||||
showTunnelTitle.value = false
|
||||
nextTick(() => {
|
||||
showTunnelTitle.value = true
|
||||
});
|
||||
}
|
||||
const closeLeft = () => {
|
||||
drawerLeft.value = !drawerLeft.value;
|
||||
|
||||
Reference in New Issue
Block a user