| | |
| | | console.log('设置工位编码' + this.headContent.processesCode) |
| | | |
| | | }); |
| | | this.conCom() |
| | | console.log('websocket连接工位为' + this.headContent.processesCode) |
| | | const wsuri = this.url + this.headContent.processesCode; |
| | | this.ws = new WebSocket(wsuri); |
| | |
| | | return body; |
| | | }); |
| | | }, |
| | | conCom(){ |
| | | try { |
| | | this.myserialport.state.baudRate = this.form1.baudRate; |
| | | this.myserialport.state.dataBits = this.form1.dataBits; |
| | | this.myserialport.state.stopBits = this.form1.stopBits; |
| | | this.myserialport.state.parity = this.form1.parity; |
| | | this.myserialport.state.flowControl = this.form1.flowControl; |
| | | this.myserialport.openPort(0, true, this.callBack); |
| | | console.log(this.form1.port) |
| | | } catch (error) { |
| | | this.$message.error("串口连接失败!请检查串口是否已被占用"); |
| | | } |
| | | if (this.myserialport.state.isOpen) { |
| | | this.$message.success("串口连接成功"); |
| | | } |
| | | }, |
| | | //连接 |
| | | async connectBtn() { |
| | | if (this.btnType === "primary") { |