Your Name
2022-08-17 0cbef2d33036643cd971f9132f88db8360817f49
src/views/intellectInspect/intelligentLine/index.vue
@@ -32,7 +32,7 @@
                        </p>
                    </div>
                    <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="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>-->
@@ -94,6 +94,7 @@
import { ElTable } from 'element-plus';
import { FormInstance, FormRules, ElMessage } from 'element-plus';
import { useUserInfo } from '/@/stores/userInfo';
import Cookies from 'js-cookie';
// 定义接口来定义对象的类型
interface stateType {
@@ -103,7 +104,7 @@
    socket: any;
    socketData: string;
    data: Array<any>;
    id: string
    id: string;
}
export default {
    name: 'intelligentLine',
@@ -126,10 +127,10 @@
            setInterval(() => {
                state.present = new Date().toLocaleString();
            }, 1000);
            let curId = route.query.id
            state.id = curId.toString()
            getLine(state.id)
            getUrl(state.id)
            let curId = route.query.id;
            state.id = curId.toString();
            getLine(state.id);
            getUrl(state.id);
        });
        const dataList = computed(() => {
@@ -141,15 +142,15 @@
        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/'
                state.path = 'http://' + res.data.data.ip + ':' + res.data.data.port + '/ws/test/';
                if (typeof 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')
                    let uid = userInfos.value.uid.toString();
                    var url = state.path + Cookies.get('uid') + '*' + id;
                    console.log(url, 'url', uid, 'uid');
                    url = url.replace('https', 'ws').replace('http', 'ws');
                    console.log(url, '获取地址');
                    state.socket = new WebSocket(url);
@@ -164,7 +165,7 @@
                    // 监听socket消息
                    state.socket.onmessage = (msg) => {
                        if (msg.data === '连接成功') return;
                        console.log(msg.data,'data')
                        console.log(msg.data, 'data');
                        userInfos.value.dataList = JSON.parse(msg.data);
                    };
                }
@@ -174,7 +175,7 @@
                    message: res.data.msg
                });
            }
        }
        };
        // const send = () => {
        //     state.socket.send(params);
@@ -221,7 +222,7 @@
                state.socket.onclose = () => {
                    console.log('socket已经关闭');
                };
            })
            });
        });
        return {
            dataList,
@@ -977,7 +978,6 @@
            align-items: flex-start;
            .line-item {
                .area-head {
                    position: relative;
                    width: 100%;
@@ -1109,7 +1109,7 @@
                    }
                    .fadeLine {
                        width: 100%;
                        border-top: 1px solid rgba(54,252,252,.6);
                        border-top: 1px solid rgba(54, 252, 252, 0.6);
                    }
                }
                .fadeBorder {