From 269ad4d38a3bb212c3eb4d8c789f89fa0d3c51ee Mon Sep 17 00:00:00 2001 From: Admin <978517621@qq.com> Date: 星期五, 12 八月 2022 19:04:36 +0800 Subject: [PATCH] 添加修改页面 --- src/views/intellectInspect/intelligentLine/index.vue | 58 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/views/intellectInspect/intelligentLine/index.vue b/src/views/intellectInspect/intelligentLine/index.vue index 256dd69..f80e94f 100644 --- a/src/views/intellectInspect/intelligentLine/index.vue +++ b/src/views/intellectInspect/intelligentLine/index.vue @@ -1,7 +1,7 @@ <template> <div class="container"> <div class="big-title" @click="goBack()">国泰新华智能巡检系统</div> - <div style="font-size: 14px; color: #00ffff; margin-top: 4px">{{ present }}</div> + <div style="height: 20px;font-size: 14px;line-height: 20px; color: #00ffff; margin-top: 4px">{{ present }}</div> <div class="btns"> <div class="fullbtn" @click="onScreenfullClick"> <div class="toFull"> @@ -22,7 +22,7 @@ <div class="line-map" v-if="dataList && dataList.length > 0"> <div class="line-item" v-for="(item, index) in dataList" :key="index"> <div class="picbox"> - <img src="../../../assets/loginPage/equipment.jpg" /> + <img src="../../../assets/loginPage/equipment.jpg"/> <p> RFID: <span>{{ item.rfid }}</span> </p> @@ -31,7 +31,7 @@ </p> </div> <div class="area-head" :class="item.points.some((e) => e.reportResult == null) ? 'fadeBorder' : ''"> - <div class="indicator" :class="item.points.some((e) => e.reportResult == null) ? 'someUndone' : item.points.some((e) => e.reportResult == 1) ? 'somewarning' : ''"> + <div class="indicator" :class="item.points.every((e) => e.reportResult == null) ? 'someUndone' : (item.points.some((e) => e.reportResult == 1) ? 'somewarning' : '')"> <div class="indi-dot"></div> <!-- <div class="indi-pulse"></div>--> <!-- <div class="indi-pulse1"></div>--> @@ -46,7 +46,7 @@ <div class="pulse"></div> <div class="pulse1"></div> </section> - <div> + <div :class="t.reportResult == null ? 'noBorder' : t.reportResult == 1 ? 'redBorder' : ''"> <div> <span>巡检点:</span><span>{{ t.point }}</span> </div> @@ -84,7 +84,7 @@ import screenfull from 'screenfull'; import { lineApi } from '/@/api/intelligentLine'; import { toRefs, reactive, ref, onMounted, onUnmounted, computed } from 'vue'; - +import {useRoute} from 'vue-router'; import { storeToRefs } from 'pinia'; import { initBackEndControlRoutes } from '/@/router/backEnd'; import { Session } from '/@/utils/storage'; @@ -101,6 +101,7 @@ socket: any; socketData: string; data: Array<any>; + id: string } export default { name: 'intelligentLine', @@ -108,21 +109,26 @@ setup() { const userInfo = useUserInfo(); const { userInfos } = storeToRefs(userInfo); + const route = useRoute(); const state = reactive<stateType>({ present: '', isScreenfull: false, path: 'http://192.168.0.29:8008/ws/test/', socketData: '', socket: null, - data: [] + data: [], + id: '' }); onMounted(() => { setInterval(() => { state.present = new Date().toLocaleString(); }, 1000); - init(); - // getLine() + let curId = route.query.id + state.id = curId.toString() + console.log(state.id) + getLine(state.id) + init(state.id); }); const dataList = computed(() => { @@ -130,12 +136,12 @@ }); // socket获取数据 - const init = () => { + const init = (id:string) => { if (typeof window.WebSocket === 'undefined') { alert('您的浏览器不支持socket'); } else { // 实例化socket - var url = state.path + '80938081556545536'; + var url = state.path + id; url = url.replace('https', 'ws').replace('http', 'ws'); console.log(url, '获取地址'); state.socket = new window.WebSocket(url); @@ -149,19 +155,8 @@ }; // 监听socket消息 state.socket.onmessage = (msg) => { - // console.log(msg, 'msg'); - // console.log(typeof msg.data, 'type'); if (msg.data === '连接成功') return; - // state.socketData = msg.data; - // console.log(JSON.parse(state.socketData), '------------------'); - // if (typeof JSON.parse(state.socketData) == Array) { - // debugger; - debugger; userInfos.value.dataList = JSON.parse(msg.data); - console.log(state.data); - // } - // console.log(msg,'msg') - // console.log(this.data,'data-------') }; } }; @@ -171,12 +166,11 @@ }; // 接口获取数据 - const getLine = async () => { - let res = await lineApi().getLine({ id: '80647416891768832' }); + const getLine = async (id:string) => { + let res = await lineApi().getLine({ id: id }); if (res.data.code === '200') { console.log(res.data.data, '获取巡检点'); - state.data = res.data.data; - console.log(state.data, '---'); + userInfos.value.dataList = res.data.data; } else { ElMessage({ type: 'warning', @@ -479,10 +473,11 @@ padding: 20px 40px 30px; box-sizing: border-box; display: flex; + justify-content: center; align-items: flex-start; overflow: hidden; - overflow-x: scroll; - overflow-y: scroll; + overflow-x: auto; + overflow-y: auto; .line-map { display: flex; @@ -741,7 +736,7 @@ transform: translateY(-14px); border-radius: 8px; background-image: linear-gradient(to right, rgba(8, 109, 209, 0.4), rgba(11, 255, 255, 0.2)); - border: 1px solid rgba(54, 252, 252, 0.6); + border: 1px solid rgba(54, 252, 252, 1); display: flex; flex-direction: column; justify-content: center; @@ -765,7 +760,12 @@ } } } - + .noBorder{ + border: 1px solid rgba(54, 252, 252, 0.1); + } + .redBorder{ + border: 1px solid #ff0000; + } p { width: 140px; height: 50px; -- Gitblit v1.9.2