From cd0ceed2fcec190559a3e83770376fc31ff1f3c2 Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: Tue, 16 Aug 2022 13:39:24 +0800
Subject: [PATCH] Default Changelist
---
src/views/intellectInspect/intelligentLine/index.vue | 152 ++++++++++++++++++++++++++++----------------------
1 files changed, 85 insertions(+), 67 deletions(-)
diff --git a/src/views/intellectInspect/intelligentLine/index.vue b/src/views/intellectInspect/intelligentLine/index.vue
index 256dd69..15d473e 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">
@@ -10,11 +10,12 @@
<div>全屏</div>
</div>
<div class="backBtn" @click="goBack()">
- <img src="../../../assets/loginPage/back-icon.png" />
+ <img src="../../../assets/loginPage/back-icon.png"/>
<div>退出</div>
</div>
</div>
<div class="blocks">
+ <div>
<div class="star-pic">
<div class="star-bg"><img src="../../../assets/loginPage/star-bg.png" /></div>
<div class="star"><img src="../../../assets/loginPage/device-pic.png" /></div>
@@ -22,7 +23,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>
@@ -30,14 +31,14 @@
位置: <span>{{ item.region.toString() }}</span>
</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="area-head">
+ <div class="indicator" :class="item.points.some((e) => e.reportResult == 1) ? 'somewarning' : (item.points.some((e) => e.reportResult == null) ? 'someUndone' : '')">
<div class="indi-dot"></div>
<!-- <div class="indi-pulse"></div>-->
<!-- <div class="indi-pulse1"></div>-->
</div>
<div class="arrow" v-if="item.points.some((e) => e.reportResult != null)"></div>
- <div class="top-line" :class="item.points.some((e) => e.reportResult == null) ? 'fadeLine' : ''"></div>
+ <div class="top-line" :class="item.points.some((e) => e.reportResult !== null) ? '' : 'fadeLine'"></div>
</div>
<div class="more-info">
<div class="item" v-for="(t, i) in item.points" :key="i" :class="t.reportResult == null ? 'undone' : t.reportResult == 1 ? 'warning' : ''">
@@ -46,7 +47,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>
@@ -76,6 +77,7 @@
</div>
</div>
<div class="tip" v-else>抱歉,暂时查询不到巡检路线...</div>
+ </div>
</div>
</div>
</template>
@@ -84,7 +86,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 +103,7 @@
socket: any;
socketData: string;
data: Array<any>;
+ id: string
}
export default {
name: 'intelligentLine',
@@ -108,75 +111,80 @@
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/',
+ path: '',
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()
+ getLine(state.id)
+ getUrl(state.id)
});
const dataList = computed(() => {
return userInfos.value.dataList;
});
- // socket获取数据
- const init = () => {
- if (typeof window.WebSocket === 'undefined') {
- alert('您的浏览器不支持socket');
- } else {
- // 实例化socket
- var url = state.path + '80938081556545536';
- url = url.replace('https', 'ws').replace('http', 'ws');
- console.log(url, '获取地址');
- state.socket = new window.WebSocket(url);
- // 监听socket连接
- state.socket.onopen = () => {
- console.log('socket连接成功');
- };
- // 监听socket错误信息
- state.socket.onerror = () => {
- console.log('socket连接错误');
- };
- // 监听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-------')
- };
- }
- };
+ // 获取url
- const send = () => {
- state.socket.send(params);
- };
+ const getUrl =async (id:string)=>{
+ const res = await lineApi().getUrl();
+ if (res.data.code === '200') {
+ state.path = 'http://' + res.data.data.ip + ':' + res.data.data.port + '/ws/test/'
+ if (typeof window.WebSocket === 'undefined') {
+ alert('您的浏览器不支持socket');
+ } else {
+ // 实例化socket
+ // debugger
+ let uid = userInfos.value.uid.toString()
+ var url = state.path + uid + '*' + id;
+ console.log(url,'url',uid,'uid')
+ url = url.replace('https', 'ws').replace('http', 'ws');
+ console.log(url, '获取地址');
+ state.socket = new window.WebSocket(url);
+ // 监听socket连接
+ state.socket.onopen = () => {
+ console.log('socket连接成功');
+ };
+ // 监听socket错误信息
+ state.socket.onerror = () => {
+ console.log('socket连接错误');
+ };
+ // 监听socket消息
+ state.socket.onmessage = (msg) => {
+ if (msg.data === '连接成功') return;
+ console.log(msg.data,'data')
+ userInfos.value.dataList = JSON.parse(msg.data);
+ };
+ }
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ }
+
+ // const send = () => {
+ // state.socket.send(params);
+ // };
// 接口获取数据
- 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',
@@ -476,13 +484,19 @@
.blocks {
width: 100%;
height: calc(100% - 90px);
- padding: 20px 40px 30px;
+ padding: 10px 40px 35px;
box-sizing: border-box;
- display: flex;
- align-items: flex-start;
- overflow: hidden;
- overflow-x: scroll;
- overflow-y: scroll;
+
+ &>div{
+ width: 100%;
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: flex-start;
+ overflow: hidden;
+ overflow-x: auto;
+ overflow-y: auto;
+ }
.line-map {
display: flex;
@@ -652,11 +666,11 @@
}
.fadeLine {
width: 100%;
- border-top: 1px solid #ccc;
+ border-top: 1px solid rgba(54,252,252,.6);
}
}
.fadeBorder {
- border-left: 1px solid rgba(54, 252, 252, 0.4);
+ border-left: 1px solid #ccc;
}
.more-info {
width: 100%;
@@ -741,7 +755,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 +779,12 @@
}
}
}
-
+ .noBorder{
+ border: 1px solid rgba(54, 252, 252, 0.1);
+ }
+ .redBorder{
+ border: 1px solid #ff0000;
+ }
p {
width: 140px;
height: 50px;
@@ -806,7 +825,6 @@
}
}
.undone {
- border-left: 1px solid rgba(54, 252, 252, 0.4);
& > section {
border: 1px solid #ccc;
--
Gitblit v1.9.2