廖杰:预览初始化+隧道切换
This commit is contained in:
@@ -64,13 +64,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="current" @click="handleOpenChart(item)">
|
||||
<div class="current" @click="handleOpenChart(item,index)">
|
||||
<fan-info-item :wp="transducerData[index]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="digital-tunnel">
|
||||
<el-dialog :close-on-click-modal="false" v-model="isVisited" :title="'电流监控数据'" width="2175px"
|
||||
<el-dialog :close-on-click-modal="false" v-model="isVisited" :title="changeNum(fanIndex)+'号风机电流监控数据'" width="2175px"
|
||||
:modal="false">
|
||||
<div class="left-top-icon"></div>
|
||||
<div class="right-top-icon"></div>
|
||||
@@ -111,7 +111,9 @@ const stateA = ref(false)
|
||||
const stateB = ref(false)
|
||||
const stateC = ref(false)
|
||||
const isVisited = ref(false)
|
||||
const fanIndex = ref(0)
|
||||
let myEcharts = reactive({});
|
||||
|
||||
watch(() => props.transducerData, (now) => {
|
||||
getTransData(now.frequencyChangerList)
|
||||
}, {deep: true});
|
||||
@@ -155,8 +157,9 @@ const getFanInfo = (equipmentId) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleOpenChart = (item) => {
|
||||
const handleOpenChart = (item,index) => {
|
||||
getFanInfo(item.equipmentId)
|
||||
fanIndex.value=index+1
|
||||
}
|
||||
const getTransData = (data) => {
|
||||
let tranObj = {}
|
||||
@@ -505,7 +508,6 @@ input[type="number"] {
|
||||
|
||||
:deep( .el-radio__label) {
|
||||
font-size: 28px;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #38cafb;
|
||||
line-height: 37px;
|
||||
}
|
||||
@@ -520,17 +522,14 @@ input[type="number"] {
|
||||
left: 68px;
|
||||
padding: 10px;
|
||||
background-image: url(../../../assets/images/fanInfo/bg.png);
|
||||
//clip-path: polygon(0% 0%, 40% 0%, 48% 15%, 100% 15%, 100% 100%, 0% 100%);
|
||||
color: #2fb0df;
|
||||
box-sizing: border-box;
|
||||
|
||||
.title {
|
||||
width: 40%;
|
||||
text-align: left;
|
||||
font-size: 20px;
|
||||
padding: 0px 0px 0px 62px;
|
||||
padding: 0 0 0 62px;
|
||||
font-size: 32px;
|
||||
font-family: MicrosoftYaHei, MicrosoftYaHei;
|
||||
font-weight: bold;
|
||||
color: #38cafb;
|
||||
line-height: 42px;
|
||||
@@ -560,7 +559,6 @@ input[type="number"] {
|
||||
.echart::after {
|
||||
content: "Hz";
|
||||
font-size: 24px;
|
||||
font-family: MicrosoftYaHei, MicrosoftYaHei;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
line-height: 31px;
|
||||
@@ -574,7 +572,6 @@ input[type="number"] {
|
||||
width: 39px;
|
||||
height: 140px;
|
||||
font-size: 26px;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #38cafb;
|
||||
line-height: 35px;
|
||||
text-align: center;
|
||||
@@ -598,7 +595,6 @@ input[type="number"] {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
font-size: 26px;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #38cafb;
|
||||
line-height: 35px;
|
||||
gap: 40px;
|
||||
@@ -644,7 +640,6 @@ input[type="number"] {
|
||||
border-radius: 22px;
|
||||
border: 2px solid #0f82af;
|
||||
overflow: hidden;
|
||||
font-family: MicrosoftYaHei, MicrosoftYaHei;
|
||||
font-weight: bold;
|
||||
color: #127399;
|
||||
line-height: 35px;
|
||||
@@ -662,9 +657,8 @@ input[type="number"] {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 0px 20px;
|
||||
padding: 0 20px;
|
||||
font-size: 28px;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #38cafb;
|
||||
line-height: 37px;
|
||||
gap: 33px;
|
||||
@@ -683,7 +677,6 @@ input[type="number"] {
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 28px;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #38cafb;
|
||||
line-height: 37px;
|
||||
}
|
||||
@@ -696,7 +689,6 @@ input[type="number"] {
|
||||
margin-left: 14px;
|
||||
outline: none;
|
||||
font-size: 28px;
|
||||
font-family: MicrosoftYaHei, MicrosoftYaHei;
|
||||
font-weight: bold;
|
||||
color: #38cafb;
|
||||
line-height: 37px;
|
||||
@@ -714,7 +706,6 @@ input[type="number"] {
|
||||
padding-top: 30px;
|
||||
padding-right: 25px;
|
||||
font-size: 28px;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #FFFFFF;
|
||||
|
||||
.fenliu-icon {
|
||||
@@ -737,7 +728,6 @@ input[type="number"] {
|
||||
margin-left: 14px;
|
||||
outline: none;
|
||||
font-size: 28px;
|
||||
font-family: MicrosoftYaHei, MicrosoftYaHei;
|
||||
font-weight: bold;
|
||||
color: #38cafb;
|
||||
line-height: 37px;
|
||||
@@ -751,7 +741,6 @@ input[type="number"] {
|
||||
bottom: 0;
|
||||
transform: translateY(-50%);
|
||||
font-size: 28px;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #38cafb;
|
||||
line-height: 37px;
|
||||
}
|
||||
@@ -761,13 +750,17 @@ input[type="number"] {
|
||||
|
||||
.current {
|
||||
margin-top: 30px;
|
||||
margin-right: 20px;
|
||||
margin-left: 26px;
|
||||
height: 37px;
|
||||
//height: 37px;
|
||||
font-size: 28px;
|
||||
color: #FFFFFF;
|
||||
cursor: pointer;
|
||||
&:hover{
|
||||
background-color: #2E5589;
|
||||
border-radius: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,15 +110,16 @@ let isWaringC = computed(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 6px 38px 7px 10px;
|
||||
padding: 6px 0 7px 10px;
|
||||
margin-bottom: 17px;
|
||||
|
||||
&:hover {
|
||||
background: #2E5589;
|
||||
border-radius: 6px;
|
||||
//background: #2E5589;
|
||||
//border-radius: 6px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
.label {
|
||||
span {
|
||||
margin: 0 5px 0 14px;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="manage-btn">
|
||||
<div v-for="(item,index) in btnList" :key="item.name" class="btn-box" @click="select(index)">
|
||||
<div v-for="(item,index) in btnList" :key="item.name" class="btn-box" @click="select(item,index)">
|
||||
<div :style="{ backgroundImage:'url(' +getImageUrl(item.icon)+')' }"></div>
|
||||
<div :class="{'select-active':selectButton===index}">{{ item.name }}</div>
|
||||
</div>
|
||||
@@ -60,10 +60,10 @@ const selectButton = ref(props.modelValue);
|
||||
const getImageUrl = (name) => {
|
||||
return new URL(`../../assets/images/topAndDown/${name}`, import.meta.url).href
|
||||
}
|
||||
const select = (index) => {
|
||||
const select = (item,index) => {
|
||||
if (selectButton.value === index) return;
|
||||
selectButton.value = index;
|
||||
emit("update:modelValue", index);
|
||||
emit("select", index);
|
||||
emit("select", item.name);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -60,7 +60,7 @@ const routes = [
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/tunnel/:siteId(\\d+)/:type/:userId(\\d+)',
|
||||
path: '/tunnel/:siteId/:type/:userId',
|
||||
name: 'tunnel',
|
||||
component: () => import('@/views/tunnel-manage/index.vue'),
|
||||
meta: {
|
||||
@@ -85,6 +85,7 @@ const router = createRouter({
|
||||
});
|
||||
router.beforeEach((to, form, next) => {
|
||||
NProgress.start()
|
||||
console.log('token-----',getToken())
|
||||
if (!getToken()) {
|
||||
if (to.path === '/login') {
|
||||
next()
|
||||
@@ -94,12 +95,12 @@ router.beforeEach((to, form, next) => {
|
||||
}
|
||||
} else {
|
||||
console.log('有token')
|
||||
if (to.path === '/login') {
|
||||
next('/')
|
||||
NProgress.done()
|
||||
} else {
|
||||
// if (to.path === '/login') {
|
||||
// next('/')
|
||||
// NProgress.done()
|
||||
// } else {
|
||||
next()
|
||||
}
|
||||
// }
|
||||
}
|
||||
})
|
||||
router.afterEach(() => {
|
||||
|
||||
@@ -68,13 +68,13 @@ serveice.interceptors.response.use(response=>{
|
||||
window.location = '/login'
|
||||
})
|
||||
return Promise.reject('会话已过期,请重新登录')
|
||||
case 402:
|
||||
break;
|
||||
case 403:
|
||||
ElMessage.warning('禁止访问')
|
||||
removeToken()
|
||||
window.location = '/forbidden'
|
||||
break;
|
||||
// case 402:
|
||||
// break;
|
||||
// case 403:
|
||||
// ElMessage.warning('禁止访问')
|
||||
// removeToken()
|
||||
// window.location = '/forbidden'
|
||||
// break;
|
||||
case 404:
|
||||
ElMessage.warning('不存在的地址')
|
||||
break;
|
||||
|
||||
@@ -45,9 +45,9 @@ import {User, Lock, Key} from "@element-plus/icons-vue";
|
||||
const router = useRouter();
|
||||
const authStore = useAuthStore();
|
||||
const loginForm = reactive({
|
||||
username: "admin",
|
||||
password: "123456",
|
||||
// username: "",
|
||||
// username: "admin",
|
||||
password: "",
|
||||
username: "",
|
||||
// password: "",
|
||||
code: "",
|
||||
uuid: "",
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
<div class="back-icon"></div>
|
||||
<span>返回</span>
|
||||
</div>
|
||||
<div class="site-name">
|
||||
{{ siteName }}
|
||||
</div>
|
||||
<!-- <div class="site-name">-->
|
||||
<!-- {{ siteName }}-->
|
||||
<!-- </div>-->
|
||||
<div class="tunnel-title"></div>
|
||||
<div class="all-del-btn">
|
||||
<div class="all-btn" style=" margin-right: 40px;" v-if="!showAddIcon" @click="handleAdd">
|
||||
@@ -259,13 +259,13 @@ const pageInfo = reactive({
|
||||
});
|
||||
const total = ref(10);
|
||||
onMounted(() => {
|
||||
getSiteDetail(siteId).then((res) => {
|
||||
siteName.value = res.data.siteName
|
||||
});
|
||||
// getSiteDetail(siteId).then((res) => {
|
||||
// siteName.value = res.data.siteName
|
||||
// });
|
||||
})
|
||||
const handleGoSiteOrIndex = () => {
|
||||
if (type === 's') {
|
||||
router.push('/site/'+userId)
|
||||
router.push('/site/' + userId)
|
||||
} else if (type === 'i') {
|
||||
router.push('/')
|
||||
}
|
||||
@@ -279,16 +279,18 @@ const getList = () => {
|
||||
total.value = res.data.total
|
||||
tunnelList.value = res.data.rows
|
||||
showFirst.value = total.value / pageInfo.pageSize >= 1;
|
||||
} else {
|
||||
ElMessage.warning(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
getList()
|
||||
const firstPage=()=>{
|
||||
const firstPage = () => {
|
||||
pageInfo.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
const lastPage=()=>{
|
||||
pageInfo.pageNum = total.value/pageInfo.pageSize
|
||||
const lastPage = () => {
|
||||
pageInfo.pageNum = total.value / pageInfo.pageSize
|
||||
getList()
|
||||
}
|
||||
//点击页码进行分页功能
|
||||
@@ -312,7 +314,7 @@ const handleSubmit = (instance) => {
|
||||
ElMessage.success('新增成功')
|
||||
getList()
|
||||
isVisited.value = false
|
||||
}else {
|
||||
} else {
|
||||
ElMessage.warning(res.msg)
|
||||
}
|
||||
})
|
||||
@@ -324,17 +326,17 @@ const handleSubmit = (instance) => {
|
||||
const handleGoToEditTunnel = (tunnelId) => {
|
||||
isEdit.value = true
|
||||
if (type === 's') {
|
||||
router.push('/edit/' + tunnelId + '/s/'+userId)
|
||||
router.push('/edit/' + tunnelId + '/s/' + userId)
|
||||
} else if (type === 'i') {
|
||||
router.push('/edit/' + tunnelId + '/i/'+userId)
|
||||
router.push('/edit/' + tunnelId + '/i/' + userId)
|
||||
}
|
||||
}
|
||||
const handleChooseAll = () => {
|
||||
tunnelList.value.map(item => {
|
||||
item.checked = !item.checked
|
||||
if(item.checked&&!item.isDefault){
|
||||
if (item.checked && !item.isDefault) {
|
||||
tunnelIds.value.push(item.tunnelId)
|
||||
}else if(!item.checked&&!item.isDefault){
|
||||
} else if (!item.checked && !item.isDefault) {
|
||||
tunnelIds.value.map((newItem, index) => {
|
||||
if (newItem === item.tunnelId) {
|
||||
tunnelIds.value.splice(index, 1)
|
||||
@@ -345,9 +347,9 @@ const handleChooseAll = () => {
|
||||
}
|
||||
const handleEditDevice = (tunnelId) => {
|
||||
if (type === 's') {
|
||||
router.push('/device/' + tunnelId + '/s/'+userId)
|
||||
router.push('/device/' + tunnelId + '/s/' + userId)
|
||||
} else if (type === 'i') {
|
||||
router.push('/device/' + tunnelId + '/i/'+userId)
|
||||
router.push('/device/' + tunnelId + '/i/' + userId)
|
||||
}
|
||||
}
|
||||
const restFrom = () => {
|
||||
@@ -388,23 +390,23 @@ const handleMoreDelete = () => {
|
||||
if (tunnelIds.value.length === 0) {
|
||||
ElMessage.warning('请先选择隧道进行删除')
|
||||
} else {
|
||||
ElMessageBox.confirm(`是否确定删除该隧道`, '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
customClass: 'delBox'
|
||||
}).then(() => {
|
||||
deleteTunnel(tunnelIds.value).then(res => {
|
||||
if (res.code === 1000) {
|
||||
ElMessage.success(res.msg)
|
||||
getList()
|
||||
tunnelIds.value = []
|
||||
tunnelNameList.value = []
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
})
|
||||
ElMessageBox.confirm(`是否确定删除该隧道`, '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
customClass: 'delBox'
|
||||
}).then(() => {
|
||||
deleteTunnel(tunnelIds.value).then(res => {
|
||||
if (res.code === 1000) {
|
||||
ElMessage.success(res.msg)
|
||||
getList()
|
||||
tunnelIds.value = []
|
||||
tunnelNameList.value = []
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,10 +630,10 @@ const handleMoreDelete = () => {
|
||||
|
||||
|
||||
> span:last-child {
|
||||
padding:1px 8px;
|
||||
padding: 1px 8px;
|
||||
font-size: 32px;
|
||||
border: 2px solid #05FEFF;
|
||||
border-radius:10px;
|
||||
border-radius: 10px;
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
<div class="top-length">
|
||||
<span>隧道总长度: {{ tunnelLength }}米</span>
|
||||
<span>当前施工长度: {{ constructionLength }}米</span>
|
||||
<span>隧道总长度: {{ tunnelLength }}米</span>
|
||||
<span>当前施工长度: {{ constructionLength }}米</span>
|
||||
</div>
|
||||
<div class="top-right">
|
||||
<div class="current-site">
|
||||
@@ -80,7 +82,7 @@ import { dateFormat } from "@/utils/date.js";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { useAuthStore } from "@/store/userstore.js";
|
||||
import { getLargeScreen, getLargeScreenInfo, getTunnelBySiteId } from "@/api/largeScreen";
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { getUserInfo } from "@/api/login";
|
||||
import { initSceneData } from "@/api/tunnelScene";
|
||||
import { getSiteDetail } from "../../api/site";
|
||||
@@ -130,145 +132,159 @@ const getUser = () => {
|
||||
})
|
||||
}
|
||||
const getDefaultSite = (siteId) => {
|
||||
// console.log('siteList.value',siteList.value)
|
||||
// getSiteDetail(siteId).then((res) => {
|
||||
// console.log('res',res)
|
||||
// });
|
||||
}
|
||||
const getOtherInfo = () => {
|
||||
getLargeScreenInfo().then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
routeList.value = res.data.routeList
|
||||
siteList.value = res.data.siteOption
|
||||
currentSiteId.value = res.data.siteOption[res.data.siteOption.length - 1].value
|
||||
currentSite.value = res.data.siteOption[res.data.siteOption.length - 1].label
|
||||
getTunnel(res.data.siteOption[res.data.siteOption.length - 1].value)
|
||||
}
|
||||
});
|
||||
};
|
||||
const getScreenInfo = (id) => {
|
||||
tunnelId.value = id
|
||||
getLargeScreen(id).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
largeScreenData.value = res.data;
|
||||
}
|
||||
});
|
||||
initSceneData(id).then((res) => {
|
||||
tunnelLength.value = res.data.tunnelLength
|
||||
constructionLength.value = res.data.constructionLength
|
||||
})
|
||||
};
|
||||
//根据站点id获取隧道信息
|
||||
const getTunnel = (id) => {
|
||||
getTunnelBySiteId(id).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
tunnelList.value = res.data
|
||||
getScreenInfo(res.data[0].value)
|
||||
}
|
||||
});
|
||||
}
|
||||
const changeTunnel = (e) => {
|
||||
let newObj = {}
|
||||
tunnelList.value.forEach((item, index) => {
|
||||
if (index === e) {
|
||||
newObj = item
|
||||
}
|
||||
})
|
||||
getScreenInfo(newObj.value)
|
||||
// nextTick(() => {
|
||||
// showFan.value = true;
|
||||
// });
|
||||
}
|
||||
const manageSelect = (index) => {
|
||||
console.log("首页点击-", index);
|
||||
if (index === 0) {
|
||||
router.push("/site" + '/' + currentUserId.value);
|
||||
} else if (index === 1) {
|
||||
router.push("/tunnel/" + currentSiteId.value + '/i' + '/' + currentUserId.value);
|
||||
} else if (index === 2) {
|
||||
router.push("/user/" + currentSiteId.value);
|
||||
const getDefaultSite = (siteId) => {
|
||||
// console.log('siteList.value',siteList.value)
|
||||
// getSiteDetail(siteId).then((res) => {
|
||||
// console.log('res',res)
|
||||
// });
|
||||
}
|
||||
};
|
||||
const handleChangeSite = (item) => {
|
||||
currentSite.value = item.label
|
||||
currentSiteId.value = item.value
|
||||
getTunnel(item.value)
|
||||
}
|
||||
const closeLeft = () => {
|
||||
drawerLeft.value = !drawerLeft.value;
|
||||
};
|
||||
const closeRight = () => {
|
||||
drawerRight.value = !drawerRight.value;
|
||||
};
|
||||
const handleLogout = () => {
|
||||
ElMessageBox.confirm(`确认退出登录吗`, '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
authStore.userLogout();
|
||||
router.push("/login");
|
||||
})
|
||||
};
|
||||
const previousBtn = () => {
|
||||
tunnelBtn.value.prev();
|
||||
};
|
||||
const nextBtn = () => {
|
||||
tunnelBtn.value.next();
|
||||
};
|
||||
|
||||
const initWebSocket = () => {
|
||||
// let wsUrl = `ws://192.168.31.175:9000/websocket/equipment/${token}/${serialNumber.value}`
|
||||
let wsUrl = `ws://web-tunnel.feashow.com/api/wstunnel/websocket/equipment/${token}/${serialNumber.value}`;
|
||||
console.log(wsUrl);
|
||||
socket = new WebSocket(wsUrl);
|
||||
//连接发生错误的回调方法
|
||||
socket.onerror = function () {
|
||||
console.log("ws连接发生错误");
|
||||
const getOtherInfo = () => {
|
||||
getLargeScreenInfo().then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
routeList.value = res.data.routeList
|
||||
siteList.value = res.data.siteOption
|
||||
currentSiteId.value = res.data.siteOption[res.data.siteOption.length - 1].value
|
||||
currentSite.value = res.data.siteOption[res.data.siteOption.length - 1].label
|
||||
getTunnel(res.data.siteOption[res.data.siteOption.length - 1].value)
|
||||
currentSiteId.value = res.data.siteOption[res.data.siteOption.length - 1].value
|
||||
currentSite.value = res.data.siteOption[res.data.siteOption.length - 1].label
|
||||
getTunnel(res.data.siteOption[res.data.siteOption.length - 1].value)
|
||||
}
|
||||
});
|
||||
};
|
||||
//连接成功建立的回调方法
|
||||
socket.onopen = function () {
|
||||
console.log("ws连接成功");
|
||||
};
|
||||
//接收到消息的回调方法
|
||||
socket.onmessage = function (event) {
|
||||
console.log("服务器返回的信息: ", JSON.parse(event.data));
|
||||
const type = JSON.parse(event.data).type;
|
||||
const data = JSON.parse(event.data).data;
|
||||
if (type === "equipment") {
|
||||
data.forEach((item) => {
|
||||
if (item.typeKey === "frequency") {
|
||||
socketData.leftData = data;
|
||||
} else if (item.typeKey === "windPressure") {
|
||||
socketData.windPressure = data;
|
||||
} else if (item.typeKey === "sensor") {
|
||||
socketData.sensor = data;
|
||||
const getScreenInfo = (id) => {
|
||||
if (id) {
|
||||
tunnelId.value = id
|
||||
getLargeScreen(id).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
largeScreenData.value = res.data;
|
||||
} else {
|
||||
ElMessage.warning(res.msg)
|
||||
}
|
||||
});
|
||||
initSceneData(id).then((res) => {
|
||||
tunnelLength.value = res.data.tunnelLength
|
||||
constructionLength.value = res.data.constructionLength
|
||||
})
|
||||
}
|
||||
};
|
||||
//连接关闭的回调方法
|
||||
socket.onclose = function () {
|
||||
console.log("ws连接关闭");
|
||||
// initWebSocket()
|
||||
//根据站点id获取隧道信息
|
||||
const getTunnel = (id) => {
|
||||
getTunnelBySiteId(id).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
tunnelList.value = res.data
|
||||
getScreenInfo(res.data[0]?.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
const changeTunnel = (e) => {
|
||||
let newObj = {}
|
||||
tunnelList.value.forEach((item, index) => {
|
||||
if (index === e) {
|
||||
newObj = item
|
||||
}
|
||||
})
|
||||
getScreenInfo(newObj.value)
|
||||
// nextTick(() => {
|
||||
// showFan.value = true;
|
||||
// });
|
||||
}
|
||||
const manageSelect = (index) => {
|
||||
console.log("首页点击-", index);
|
||||
if (index == '站点管理') {
|
||||
if (currentUserId.value) {
|
||||
router.push("/site" + '/' + currentUserId.value);
|
||||
}
|
||||
} else if (index == '隧道管理') {
|
||||
if (currentSiteId.value && currentUserId.value) {
|
||||
router.push("/tunnel/" + currentSiteId.value + '/i' + '/' + currentUserId.value);
|
||||
}
|
||||
} else if (index == '用户管理') {
|
||||
if (currentSiteId.value) {
|
||||
router.push("/user/" + currentSiteId.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
setInterval(() => {
|
||||
socket.send(JSON.stringify(send));
|
||||
}, 30000);
|
||||
};
|
||||
const closeSocket = () => {
|
||||
socket.close();
|
||||
};
|
||||
initWebSocket();
|
||||
const handleChangeSite = (item) => {
|
||||
currentSite.value = item.label
|
||||
currentSiteId.value = item.value
|
||||
getTunnel(item.value)
|
||||
}
|
||||
const closeLeft = () => {
|
||||
drawerLeft.value = !drawerLeft.value;
|
||||
};
|
||||
const closeRight = () => {
|
||||
drawerRight.value = !drawerRight.value;
|
||||
};
|
||||
const handleLogout = () => {
|
||||
ElMessageBox.confirm(`确认退出登录吗`, '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
authStore.userLogout();
|
||||
router.push("/login");
|
||||
})
|
||||
};
|
||||
const previousBtn = () => {
|
||||
tunnelBtn.value.prev();
|
||||
};
|
||||
const nextBtn = () => {
|
||||
tunnelBtn.value.next();
|
||||
};
|
||||
|
||||
const initWebSocket = () => {
|
||||
// let wsUrl = `ws://192.168.31.175:9000/websocket/equipment/${token}/${serialNumber.value}`
|
||||
let wsUrl = `ws://web-tunnel.feashow.com/api/wstunnel/websocket/equipment/${token}/${serialNumber.value}`;
|
||||
console.log(wsUrl);
|
||||
socket = new WebSocket(wsUrl);
|
||||
//连接发生错误的回调方法
|
||||
socket.onerror = function () {
|
||||
console.log("ws连接发生错误");
|
||||
};
|
||||
//连接成功建立的回调方法
|
||||
socket.onopen = function () {
|
||||
console.log("ws连接成功");
|
||||
};
|
||||
//接收到消息的回调方法
|
||||
socket.onmessage = function (event) {
|
||||
console.log("服务器返回的信息: ", JSON.parse(event.data));
|
||||
const type = JSON.parse(event.data).type;
|
||||
const data = JSON.parse(event.data).data;
|
||||
if (type === "equipment") {
|
||||
data.forEach((item) => {
|
||||
if (item.typeKey === "frequency") {
|
||||
socketData.leftData = data;
|
||||
} else if (item.typeKey === "windPressure") {
|
||||
socketData.windPressure = data;
|
||||
} else if (item.typeKey === "sensor") {
|
||||
socketData.sensor = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//连接关闭的回调方法
|
||||
socket.onclose = function () {
|
||||
console.log("ws连接关闭");
|
||||
// initWebSocket()
|
||||
};
|
||||
setInterval(() => {
|
||||
socket.send(JSON.stringify(send));
|
||||
}, 30000);
|
||||
};
|
||||
const closeSocket = () => {
|
||||
socket.close();
|
||||
};
|
||||
initWebSocket();
|
||||
|
||||
|
||||
watch(
|
||||
() => tunnelId.value,
|
||||
(now) => {
|
||||
tunnelId.value = now
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
watch(
|
||||
() => tunnelId.value,
|
||||
(now) => {
|
||||
tunnelId.value = now
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.el-dropdown__popper.el-popper {
|
||||
|
||||
@@ -47,6 +47,11 @@
|
||||
<el-table-column prop="nickName" label="昵称" align="center"/>
|
||||
<el-table-column prop="roleName" label="身份" align="center"/>
|
||||
<el-table-column prop="phoneNumber" label="电话号码" align="center"/>
|
||||
<el-table-column prop="state" label="状态" align="center">
|
||||
<template #default="scope">
|
||||
{{scope.row.state=="1"?'启用':'停用'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" size="large" style="font-size: 40px;color: #17E1E2;"
|
||||
@@ -67,8 +72,8 @@
|
||||
<el-form-item label="当前站点">
|
||||
<div class="current-site">{{ currentSite }}<span>如果需要切换站点,请返回首屏切换</span></div>
|
||||
</el-form-item>
|
||||
<el-form-item label="输入账户">
|
||||
<el-input v-model="form.userName" placeholder="请输入账户"/>
|
||||
<el-form-item label="输入用户名">
|
||||
<el-input v-model="form.userName" placeholder="请输入用户名"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="输入密码" v-if="title==='添加用户'">
|
||||
<el-input type="password" show-password v-model="form.password" placeholder="请输入密码"/>
|
||||
@@ -79,19 +84,23 @@
|
||||
<el-form-item label="输入电话号码">
|
||||
<el-input v-model="form.phoneNumber" placeholder="输入电话号码"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="是否启用">
|
||||
<el-radio-group v-model="form.state">
|
||||
<el-radio label="1">启用</el-radio>
|
||||
<el-radio label="0">停用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择身份">
|
||||
<el-radio-group v-model="form.roleId" @change="(val) => {
|
||||
console.log('vaaa',val)
|
||||
if (val >3){
|
||||
getTunnel()
|
||||
}}">
|
||||
<el-radio v-for="item in radioList" :label="item.value" :key="item.value">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择隧道" v-if="checkList.length!==0&&form.roleId>3">
|
||||
<el-form-item label="选择隧道" v-if="tunnelList.length!==0&&form.roleId>3">
|
||||
<el-select
|
||||
v-model="tunnelIndex"
|
||||
v-model="form.tunnelIds"
|
||||
multiple
|
||||
filterable
|
||||
clearable
|
||||
@@ -99,7 +108,7 @@
|
||||
:fit-input-width="true"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in checkList"
|
||||
v-for="item in tunnelList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
@@ -157,20 +166,21 @@ const form = ref({
|
||||
userName: '',
|
||||
nickName: '',
|
||||
phoneNumber: '',
|
||||
state: '1',
|
||||
roleId: [],
|
||||
tunnelIds: []
|
||||
});
|
||||
const formRules = ref({
|
||||
userName: [{required: true, message: '请输入用户名称', trigger: 'blur'}],
|
||||
userName: [{required: true, message: '请输入用户名', trigger: 'blur'}],
|
||||
password: [{required: true, message: '请输入密码', trigger: 'blur'}]
|
||||
})
|
||||
const radioList = ref([])
|
||||
const checkList = ref([])
|
||||
const tunnelList = ref([])
|
||||
const multipleTable = ref()
|
||||
const getTunnel = () => {
|
||||
getTunnelOption(siteId).then(res => {
|
||||
if (res.code === 1000) {
|
||||
checkList.value = res.data
|
||||
tunnelList.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -198,7 +208,6 @@ const handleAll = () => {
|
||||
multipleTable.value.toggleAllSelection()
|
||||
}
|
||||
const handleDelete = () => {
|
||||
console.log('userIds.value',userIds.value)
|
||||
if (userIds.value ===undefined) {
|
||||
ElMessage.warning('请先选择用户进行删除')
|
||||
} else {
|
||||
@@ -222,6 +231,7 @@ const reset = () => {
|
||||
userName: '',
|
||||
nickName: '',
|
||||
phoneNumber: '',
|
||||
state: '1',
|
||||
roleId: [],
|
||||
tunnelIds: []
|
||||
}
|
||||
@@ -262,13 +272,19 @@ const handleCurrentChange = (val) => {
|
||||
getInfo()
|
||||
}
|
||||
const handleSubmit = async (formInstance) => {
|
||||
|
||||
if (!formInstance) return;
|
||||
formInstance.validate(async (valid) => {
|
||||
if (!valid) return;
|
||||
const data = {
|
||||
siteId: siteId,
|
||||
nickName: form.value.nickName,
|
||||
password: form.value.password,
|
||||
phoneNumber: form.value.phoneNumber,
|
||||
state:form.value.state,
|
||||
userName: form.value.userName,
|
||||
roleIds: [form.value.roleId],
|
||||
...form.value
|
||||
tunnelList: form.value.tunnelIds
|
||||
}
|
||||
if (title.value === '添加用户') {
|
||||
await addUser(data).then(res => {
|
||||
@@ -281,7 +297,11 @@ const handleSubmit = async (formInstance) => {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
await editUser(data).then(res => {
|
||||
const editData={
|
||||
userId:form.value.userId,
|
||||
...data
|
||||
}
|
||||
await editUser(editData).then(res => {
|
||||
if (res.code === 1000) {
|
||||
getInfo()
|
||||
isVisited.value = false
|
||||
|
||||
Reference in New Issue
Block a user