预备signalR

This commit is contained in:
qianhao.xu
2023-12-01 15:38:15 +08:00
parent 4a32635b07
commit 4697aef3ee
7 changed files with 60 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="app-container">
<div>
<div class="animate__animated animate__shakeX title">车镜油漆缺陷采集系统</div>
<el-row>
<el-col :span="1">
@@ -73,6 +73,7 @@
</div>
</div>
</div>
<div>"------------------"+{{ data }}</div>
</el-col>
</el-row>
</div>
@@ -80,24 +81,30 @@
<script>
import { GetcheckItemTable } from '@/api/qualityManagement/firstFQC.js'
import * as signalR from '@microsoft/signalr'
export default {
name: 'firstFQC',
data() {
return {
checkItemTable: {
paint: [],
device: [],
blank: [], // 毛坯
program: [], // 程序
team: [], //班组
paint: [{ inspectionModule: '' }],
device: [{ inspectionModule: '' }],
blank: [{ inspectionModule: '' }], // 毛坯
program: [{ inspectionModule: '' }], // 程序
team: [{ inspectionModule: '' }], //班组
},
ProductSituationForm: {
name: '',
},
signal: null,
data: null,
}
},
mounted() {
created() {
this.getCheckItemList()
},
mounted() {
},
methods: {
//todo 获取检测项
@@ -110,6 +117,33 @@ export default {
})
.catch((err) => {})
},
//todo 初始话 signalR
/*initSignalR() {
this.signal = new signalR.HubConnectionBuilder()
//服务器地址
// .withUrl('http://192.168.0.110:8100/myHub', {})
.withUrl('http://localhost:8888/myHub', {})
.withAutomaticReconnect()
.configureLogging(signalR.LogLevel.Information)
.build()
// 接受集线器的方法
this.signal.on('receive_my', (res) => {
this.data = res
})
this.signal
.start()
.then(() => {
console.log('myhub连接成功')
//vue 发送请求
this.signal.invoke('SendPublicMessage', '1111').catch((err) => console.log('err', err))
})
.catch(() => {
console.log('myhub连接失败')
})
// this.signalr.SR.invoke('SendMessage', 'All', 'root', '123456').catch((err) => console.log('err', err))
},*/
},
}
</script>
@@ -208,7 +242,7 @@ export default {
}
.grid > * {
height: 250px;
background-color: #EBEEF5;
background-color: #ebeef5;
color: white;
border-radius: 0.5em;
}
@@ -220,10 +254,9 @@ export default {
border-radius: 0.2em;
transition: all 0.2s ease-in-out;
&:hover {
cursor: pointer;
box-shadow: 0 0 0 rgba(0, 0, 0, 0.2), 0 0 0 #c6e2ff, inset 18px 18px 30px rgba(0, 0, 0, 0.1),
inset -18px -18px 30px #c6e2ff;
}
cursor: pointer;
box-shadow: 0 0 0 rgba(0, 0, 0, 0.2), 0 0 0 #c6e2ff, inset 18px 18px 30px rgba(0, 0, 0, 0.1), inset -18px -18px 30px #c6e2ff;
}
}
.title_Line {