| | |
| | | * @Author: lzhe lzhe@example.com |
| | | * @Date: 2024-03-26 10:28:33 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-10-06 23:03:58 |
| | | * @LastEditTime: 2024-10-07 00:49:07 |
| | | * @FilePath: /smart-web/src/views/master/person/main/index.vue |
| | | * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
| | | --> |
| | |
| | | if(this.$TOOL.socket.websocket == null) { //没有建立先建立 |
| | | this.$TOOL.socket.connectToWebSocket(this.$TOOL.cookie.get("TOKEN")); |
| | | } |
| | | console.log(obj,222333) |
| | | this.$TOOL.socket.sendDataToWebSocket(obj); //发送 |
| | | this.$TOOL.socket.websocket.onmessage = function(event) { |
| | | var JSONData = JSON.parse(res.data.dpConfig); |
| | | var eventData = JSON.parse(event.data); |
| | | if(Object.keys(eventData.data).length == 0) return; |
| | | JSONData.forEach((item,index)=> { //第一步把v放到code里 |
| | | var eventData = JSON.parse(event.data); |
| | | if(item.dpName == "DeviceStatus") { //机器状态 |
| | | if(eventData.data[item.dpName]) { |
| | | item.code = eventData.data[item.dpName].v; |
| | |
| | | that.allwcs.forEach((item1)=> { |
| | | if(item.code == item1.code) { |
| | | item.codeName = item1.name; //第二步把v的code和运行对应 |
| | | if(item.code == "2") { |
| | | item.color = "#73D13D"; |
| | | }else { |
| | | item.color = "#75C0C0"; |
| | | } |
| | | item.color = item1.color; |
| | | } |
| | | }) |
| | | item.description = item.dpLabel; |
| | | }else { |
| | | if(item.dpName == 'Alarm') { //报警 |
| | | if(eventData.data[item.dpName]) { |
| | |
| | | }else { |
| | | item.description = v[0].code; |
| | | item.codeName = v[0].msg; |
| | | item.color = "#370C0D"; |
| | | } |
| | | }else { |
| | | item.description = v.code; |
| | | item.codeName = v.msg; |
| | | item.color = "#370C0D"; |
| | | } |
| | | } |
| | | }else { |
| | | if(eventData.data[item.dpName]) { |
| | | item.description = item.dpLabel; |
| | | item.codeName = eventData.data[item.dpName].v; |
| | | } |
| | | item.color = "#75C0C0"; |
| | | } |
| | | that.allwcs.forEach((item1)=> { |
| | | if(item.code == item1.code) { |
| | | item.color = item1.color; |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | that.dmpList = JSONData; |