|  |  | @ -1,9 +1,21 @@ | 
			
		
	
		
			
				
					|  |  |  | <template> | 
			
		
	
		
			
				
					|  |  |  |   <div id="operation-record" style=" background: #fff; padding: 10px 20px 50px 20px;page-break-after:always"> | 
			
		
	
		
			
				
					|  |  |  |     <div v-if="!onlyRead && isPlatform" class="btnBox"> | 
			
		
	
		
			
				
					|  |  |  |       <el-button v-print="print" size="small" @click="handleSaveTable">打印</el-button> | 
			
		
	
		
			
				
					|  |  |  |       <el-button type="primary" size="small" @click="handleSaveTable">保存</el-button> | 
			
		
	
		
			
				
					|  |  |  |       <el-button type="danger" size="small" @click="handleDelete">删除</el-button> | 
			
		
	
		
			
				
					|  |  |  |     <div v-if="!onlyRead && isPlatform" style="display: flex;justify-content: space-between"> | 
			
		
	
		
			
				
					|  |  |  |       <div> | 
			
		
	
		
			
				
					|  |  |  |         <el-switch | 
			
		
	
		
			
				
					|  |  |  |           disabled | 
			
		
	
		
			
				
					|  |  |  |           v-model="connectFlag" | 
			
		
	
		
			
				
					|  |  |  |           active-color="#13ce66" | 
			
		
	
		
			
				
					|  |  |  |           inactive-color="#ff4949" | 
			
		
	
		
			
				
					|  |  |  |           active-text="已连接" | 
			
		
	
		
			
				
					|  |  |  |           inactive-text="已断开" | 
			
		
	
		
			
				
					|  |  |  |         /> | 
			
		
	
		
			
				
					|  |  |  |       </div> | 
			
		
	
		
			
				
					|  |  |  |       <div> | 
			
		
	
		
			
				
					|  |  |  |         <el-button v-print="print" size="small" @click="handleSaveTable">打印</el-button> | 
			
		
	
		
			
				
					|  |  |  |         <el-button type="primary" size="small" @click="handleSaveTable">保存</el-button> | 
			
		
	
		
			
				
					|  |  |  |         <el-button type="danger" size="small" @click="handleDelete">删除</el-button> | 
			
		
	
		
			
				
					|  |  |  |       </div> | 
			
		
	
		
			
				
					|  |  |  |     </div> | 
			
		
	
		
			
				
					|  |  |  |     <div id="optomeFunc" style="width: 840px;padding-right: 8px" class="printBox"> | 
			
		
	
		
			
				
					|  |  |  |       <div class="flex j-c" style="padding-bottom: 8px"> | 
			
		
	
	
		
			
				
					|  |  | @ -381,6 +393,7 @@ export default { | 
			
		
	
		
			
				
					|  |  |  |   }, | 
			
		
	
		
			
				
					|  |  |  |   data() { | 
			
		
	
		
			
				
					|  |  |  |     return { | 
			
		
	
		
			
				
					|  |  |  |       connectFlag: false, // 连接 | 
			
		
	
		
			
				
					|  |  |  |       ws: null, // 建立的连接 | 
			
		
	
		
			
				
					|  |  |  |       lockReconnect: false, // 是否真正建立连接 | 
			
		
	
		
			
				
					|  |  |  |       timeout: 28 * 1000, // 30秒一次心跳 | 
			
		
	
	
		
			
				
					|  |  | @ -548,6 +561,7 @@ export default { | 
			
		
	
		
			
				
					|  |  |  |   }, | 
			
		
	
		
			
				
					|  |  |  |   destroyed() { | 
			
		
	
		
			
				
					|  |  |  |     if (this.isSearch === '3') { | 
			
		
	
		
			
				
					|  |  |  |       this.connectFlag = false | 
			
		
	
		
			
				
					|  |  |  |       clearTimeout(this.timeoutnum) | 
			
		
	
		
			
				
					|  |  |  |       clearTimeout(this.timeoutObj) | 
			
		
	
		
			
				
					|  |  |  |       clearTimeout(this.serverTimeoutObj) | 
			
		
	
	
		
			
				
					|  |  | @ -721,25 +735,28 @@ export default { | 
			
		
	
		
			
				
					|  |  |  |     initWebSoket() { | 
			
		
	
		
			
				
					|  |  |  |       // wss://127.0.0.1:8030/data | 
			
		
	
		
			
				
					|  |  |  |       // const url = 'ws://47.110.224.240:8036/xiangan-crf/websocket/0071' | 
			
		
	
		
			
				
					|  |  |  |       // const url = 'ws://192.168.0.167:8036/xiangan-crf/websocket/0071'/ | 
			
		
	
		
			
				
					|  |  |  |       // const url = 'ws://192.168.0.167:8036/xiangan-crf/websocket/0071' | 
			
		
	
		
			
				
					|  |  |  |       try { | 
			
		
	
		
			
				
					|  |  |  |         const url = 'ws://127.0.0.1:8030/data' | 
			
		
	
		
			
				
					|  |  |  |         const self = this | 
			
		
	
		
			
				
					|  |  |  |         this.ws = new WebSocket(url) | 
			
		
	
		
			
				
					|  |  |  |         this.ws.onopen = function() { | 
			
		
	
		
			
				
					|  |  |  |           console.log('连接成功') | 
			
		
	
		
			
				
					|  |  |  |           self.connectFlag = true | 
			
		
	
		
			
				
					|  |  |  |           self.start() | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         this.ws.onclose = function() { | 
			
		
	
		
			
				
					|  |  |  |           self.connectFlag = false | 
			
		
	
		
			
				
					|  |  |  |           self.reconnect() | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         this.ws.onerror = function() { | 
			
		
	
		
			
				
					|  |  |  |           self.connectFlag = false | 
			
		
	
		
			
				
					|  |  |  |           self.reconnect() | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         this.ws.onmessage = function(msg) { | 
			
		
	
		
			
				
					|  |  |  |           const message = JSON.parse(msg.data) | 
			
		
	
		
			
				
					|  |  |  |           // const data = JSON.parse(msg.data) | 
			
		
	
		
			
				
					|  |  |  |           // const message = JSON.parse(data.msgTxt) | 
			
		
	
		
			
				
					|  |  |  |           console.log(message) | 
			
		
	
		
			
				
					|  |  |  |           self.dataForm.ygjcDsOd = message.RData.DS | 
			
		
	
		
			
				
					|  |  |  |           self.dataForm.ygjcDcOd = message.RData.DC | 
			
		
	
		
			
				
					|  |  |  |           self.dataForm.ygjcAOd = message.RData.AXIS | 
			
		
	
	
		
			
				
					|  |  | 
 |