|
|
@@ -2,7 +2,7 @@ |
|
|
|
* @Author: zwq |
|
|
|
* @Date: 2020-12-29 15:41:11 |
|
|
|
* @LastEditors: zwq |
|
|
|
* @LastEditTime: 2022-07-22 16:34:32 |
|
|
|
* @LastEditTime: 2022-07-29 16:01:24 |
|
|
|
* @Description: |
|
|
|
--> |
|
|
|
<template> |
|
|
@@ -17,16 +17,12 @@ |
|
|
|
> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="communication状态" prop="communicationState" required> |
|
|
|
<el-switch |
|
|
|
v-model="dataForm.communicationState" |
|
|
|
:active-value="1" |
|
|
|
:inactive-value="0" |
|
|
|
@change="switchChange()" |
|
|
|
/> |
|
|
|
<span :class="dataForm.communicationState === 0? 'waring' : 'normal'">{{ dataForm.communicationState === 0? 'off' : 'on' }}</span> |
|
|
|
<el-button type="primary" size="mini" @click="switchChange()">控制</el-button> |
|
|
|
</el-form-item> |
|
|
|
<div v-show="communicationShow">Result ={{ communicationStatus }}</div> |
|
|
|
</el-col> |
|
|
|
<el-col :span="6" :offset="1"> |
|
|
|
<el-col v-if="false" :span="6" :offset="1"> |
|
|
|
<el-form-item label="eqpState" prop="eqpState"> |
|
|
|
<el-select v-model="dataForm.eqpState" placeholder="请选择下拉选择" clearable @change="eqpStateChange"> |
|
|
|
<el-option |
|
|
@@ -49,12 +45,15 @@ |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<span :class="dataForm.controllerState === 1? 'waring' : 'normal'">{{ controllerInfo }}</span> |
|
|
|
<span :class="controllerInfo === 'offline'? 'waring' : 'normal'">{{ controllerInfo }}</span> |
|
|
|
<div v-show="controllerStatusShow">Result ={{ controllerStatus }}</div> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-form> |
|
|
|
<el-col :span="3"> |
|
|
|
<el-col :span="3" :offset="2"> |
|
|
|
<el-button type="primary" @click="sendSecsGemSetting()">Setting</el-button> |
|
|
|
</el-col> |
|
|
|
<el-col v-if="false" :span="3"> |
|
|
|
<el-button type="primary" @click="sendReportLinkedEventAndVid()"> ReportLinkedEventAndVid </el-button> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@@ -68,7 +67,8 @@ import { |
|
|
|
getcontrollerState, |
|
|
|
sendEqpState, |
|
|
|
sendControllerState, |
|
|
|
sendReportLinkedEventAndVid |
|
|
|
sendReportLinkedEventAndVid, |
|
|
|
sendSecsGemSetting |
|
|
|
} from '@/api/00a-spc' |
|
|
|
/** |
|
|
|
* 表格表头配置项 TypeScript接口注释 |
|
|
@@ -126,8 +126,11 @@ export default { |
|
|
|
'label': 'offline', |
|
|
|
'value': 1 |
|
|
|
}, { |
|
|
|
'label': 'online', |
|
|
|
'label': 'local', |
|
|
|
'value': 2 |
|
|
|
}, { |
|
|
|
'label': 'remote', |
|
|
|
'value': 3 |
|
|
|
}], |
|
|
|
websock: '', |
|
|
|
url: '', |
|
|
@@ -151,7 +154,8 @@ export default { |
|
|
|
methods: { |
|
|
|
switchChange() { |
|
|
|
this.communicationShow = false |
|
|
|
DisableEnableCommunication(this.dataForm.communicationState).then(response => { |
|
|
|
const cState = this.dataForm.communicationState ? 0 : 1 |
|
|
|
DisableEnableCommunication(cState).then(response => { |
|
|
|
this.$message({ |
|
|
|
message: this.$t('module.basicData.visual.success'), |
|
|
|
type: 'success', |
|
|
@@ -173,7 +177,7 @@ export default { |
|
|
|
this.controllerStatusShow = false |
|
|
|
sendControllerState(this.dataForm.controllerState).then(response => { |
|
|
|
this.$message({ |
|
|
|
message: this.$t('module.basicData. visual.success'), |
|
|
|
message: this.$t('module.basicData.visual.success'), |
|
|
|
type: 'success', |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
@@ -182,14 +186,16 @@ export default { |
|
|
|
getState() { |
|
|
|
getcontrollerState().then(res => { |
|
|
|
if (res.data.controllerState === 1) { |
|
|
|
this.dataForm.controllerState = 1 |
|
|
|
this.controllerInfo = 'offline' |
|
|
|
} else if (res.data.eqpState === 4) { |
|
|
|
this.dataForm.controllerState = 2 |
|
|
|
this.controllerInfo = 'local' |
|
|
|
} else if (res.data.eqpState === 5) { |
|
|
|
this.dataForm.controllerState = 3 |
|
|
|
this.controllerInfo = 'remote' |
|
|
|
} |
|
|
|
this.dataForm.eqpState = res.data.eqpState |
|
|
|
this.dataForm.controllerState = res.data.controllerState |
|
|
|
}) |
|
|
|
}, |
|
|
|
sendReportLinkedEventAndVid() { |
|
|
@@ -201,9 +207,18 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
sendSecsGemSetting() { |
|
|
|
sendSecsGemSetting().then(response => { |
|
|
|
this.$message({ |
|
|
|
message: this.$t('module.basicData.visual.success'), |
|
|
|
type: 'success', |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
initWebSocket() { |
|
|
|
// 初始化weosocket |
|
|
|
const path = `ws://${this.url}/opcua/websocket/1` |
|
|
|
const path = `ws://${this.url}/opcua/websocket/${Math.round(Math.random() * 100)}` |
|
|
|
this.websock = new WebSocket(path) |
|
|
|
this.websock.onmessage = this.websocketonmessage |
|
|
|
this.websock.onopen = this.websocketonopen |
|
|
@@ -221,24 +236,27 @@ export default { |
|
|
|
websocketonmessage(e) { |
|
|
|
// 数据接收 |
|
|
|
this.wbData = JSON.parse(e.data) |
|
|
|
if (this.wbData.eqpResult) { |
|
|
|
this.eqpStatus = this.wbData.eqpResult |
|
|
|
this.dataForm.eqpState = parseInt(this.wbData.eqpState) |
|
|
|
this.eqpStatusShow = true |
|
|
|
} else if (this.wbData.vidResult) { |
|
|
|
console.log(this.wbData) |
|
|
|
if (this.wbData.controllerState) { |
|
|
|
this.controllerStatus = this.wbData.vidResult |
|
|
|
this.dataForm.controllerState = parseInt(this.wbData.controllerState) |
|
|
|
if (this.wbData.controllerState === '1') { |
|
|
|
this.dataForm.controllerState = 1 |
|
|
|
this.controllerInfo = 'offline' |
|
|
|
} else if (this.wbData.eqpState === '4') { |
|
|
|
this.dataForm.controllerState = 2 |
|
|
|
this.controllerInfo = 'local' |
|
|
|
} else if (this.wbData.eqpState === '5') { |
|
|
|
this.dataForm.controllerState = 3 |
|
|
|
this.controllerInfo = 'remote' |
|
|
|
} |
|
|
|
this.controllerStatusShow = true |
|
|
|
} else if (this.wbData.eqpState) { |
|
|
|
this.eqpStatus = this.wbData.eqpResult |
|
|
|
this.dataForm.eqpState = parseInt(this.wbData.eqpState) |
|
|
|
this.eqpStatusShow = true |
|
|
|
} else { |
|
|
|
this.communicationStatus = this.wbData.communicationResult |
|
|
|
this.dataForm.communicationState = parseInt(this.wbData.communicationState) |
|
|
|
this.dataForm.communicationState = parseInt(this.wbData.connectState) |
|
|
|
this.communicationShow = true |
|
|
|
} |
|
|
|
}, |
|
|
|