预备signalR
This commit is contained in:
@@ -16,7 +16,7 @@ export default {
|
||||
token: {
|
||||
handler: function (val) {
|
||||
if (val) {
|
||||
this.signalr.start();
|
||||
this.signalr.start(); //todo 如果token发生更替 重启signal
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
|
||||
@@ -15,11 +15,11 @@ import store from './store'
|
||||
import router from './router'
|
||||
import permission from './directive/permission'
|
||||
import plugins from './plugins' // plugins
|
||||
import signalR from '@/utils/signalR'
|
||||
import signalR from '@/utils/signalR' // todo websocket实时传输
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
import './assets/icons' // icon
|
||||
import './permission' // permission control
|
||||
import './permission' // permission control 动态路由
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { getConfigKey } from "@/api/system/config";
|
||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree, handleDict } from "@/utils/ruoyi";
|
||||
@@ -95,7 +95,7 @@ DictData.install()
|
||||
Vue.config.productionTip = false
|
||||
|
||||
signalR.init(process.env.VUE_APP_SOCKET_API);
|
||||
Vue.prototype.signalr = signalR
|
||||
Vue.prototype.signalr = signalR //todo 绑定在原型对象里
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
|
||||
@@ -9,7 +9,7 @@ NProgress.configure({
|
||||
showSpinner: false
|
||||
})
|
||||
|
||||
const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/demo']
|
||||
const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/demo',"/firstFQC"] //白名单
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
|
||||
@@ -86,6 +86,12 @@ export const constantRoutes = [{
|
||||
component: (resolve) => require(['@/views/components/icons/index'], resolve),
|
||||
hidden: true
|
||||
},
|
||||
// 质量检验中的初次检验
|
||||
{
|
||||
path: '/firstFQC',
|
||||
component: (resolve) => require(['@/views/qualityManagement/FQC/firstFQC.vue'], resolve),
|
||||
hidden: true
|
||||
}
|
||||
]
|
||||
|
||||
export default new Router({
|
||||
|
||||
@@ -35,7 +35,7 @@ const permission = {
|
||||
// 生成路由
|
||||
GenerateRoutes({ commit }) {
|
||||
return new Promise(resolve => {
|
||||
// 向后端请求路由数据
|
||||
//todo 向后端请求路由数据
|
||||
getRouters().then(res => {
|
||||
const sdata = JSON.parse(JSON.stringify(res.data))
|
||||
const rdata = JSON.parse(JSON.stringify(res.data))
|
||||
|
||||
@@ -64,7 +64,7 @@ export default {
|
||||
// 接收欢迎语
|
||||
connection.on('welcome', (data) => {
|
||||
console.log('welcome', data)
|
||||
Notification.info(data)
|
||||
// Notification.info(data)
|
||||
})
|
||||
// 接收后台手动推送消息
|
||||
connection.on('receiveNotice', (title, data) => {
|
||||
@@ -82,5 +82,7 @@ export default {
|
||||
store.dispatch('socket/getNoticeList', data.data)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user