| | |
| | | <!-- |
| | | * @Date: 2024-04-09 22:11:21 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-10-21 15:01:18 |
| | | * @LastEditTime: 2024-10-22 19:46:11 |
| | | * @FilePath: /cps-web/src/views/mdc/realtime-status/index.vue |
| | | 实时看板 |
| | | --> |
| | |
| | | this.gettimestatus(); //查询列表 |
| | | }, |
| | | showvisible(item, index) { |
| | | //clickIndex |
| | | if(item.properties.length == 0) { |
| | | this.$message({ |
| | | message: '该工位没有配置数据点', |
| | | type: 'warning' |
| | | }); |
| | | return; |
| | | } |
| | | this.clickIndex = index; |
| | | // if (item.properties == null || item.properties.length == 0) { |
| | | // this.$message({ |
| | | // message: '请配置采集项', |
| | | // type: 'warning' |
| | | // }); |
| | | // return; |
| | | // } |
| | | // var visibleList = JSON.parse(JSON.stringify(item.properties)); |
| | | // this.titleMap = "实时数据(" + item.code + ")"; |
| | | // this.visibleList = visibleList; |
| | | this.visible = true; |
| | | }, |
| | | searchstatus(item, index) { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | changeTime(time) { |
| | | changeTime(time,diffTime) { |
| | | // 使用Moment.js解析这两个日期字符串 |
| | | var date1 = moment(time); |
| | | var date2 = moment(moment().format('YYYY-MM-DD HH:mm:ss')); |
| | | var date2 = moment(diffTime); |
| | | // 计算两个日期之间的差异(毫秒) |
| | | var differenceInMilliseconds = date2.diff(date1); // 注意:date2 - date1 给出正数差异 |
| | | var differenceInMilliseconds = date1.diff(date2); // 注意:date1 - date2 给出正数差异 |
| | | // 使用duration对象将差异转换为更易于处理的单位 |
| | | var duration = moment.duration(differenceInMilliseconds); |
| | | // 提取天数、小时数、分钟数和秒数 |
| | |
| | | this.$TOOL.socket.websocket.onmessage = function (event) { |
| | | //num++; |
| | | var eventData = JSON.parse(event.data); |
| | | if (Object.keys(eventData.data).length == 0) return; |
| | | if (that.timestatus.length == 0) return; //没值不用循环 |
| | | that.timestatus.forEach((item, index) => { //第一步把v放到code里 |
| | | if (eventData.id == item.id) { |
| | |
| | | } |
| | | if (eventData.data.DeviceStatus) { |
| | | var time = moment(eventData.data.DeviceStatus.t).format('YYYY-MM-DD HH:mm:ss'); |
| | | var diffTime = that.changeTime(time); //转换成差值(时分秒) |
| | | var preT = moment(eventData.data.DeviceStatus.preT).format('YYYY-MM-DD HH:mm:ss'); |
| | | var diffTime = that.changeTime(time,preT); //转换成差值(时分秒) |
| | | //that.setIntervalTime(); //十秒增加时间 |
| | | var diffTime = diffTime; |
| | | item.time = diffTime; |
| | | that.allwcs.forEach(item1 => { |
| | | if (item1.code == eventData.data.DeviceStatus.v) { |
| | |
| | | item1.code = item2.name; |
| | | } |
| | | }) |
| | | if (Object.keys(eventData.data).length == 0) { //ws没有data数据,给默认值 |
| | | item1.code = ""; |
| | | item1.color = "#E4A512"; |
| | | }; |
| | | } else { |
| | | if (item1.key == 'Alarm') { //报警 |
| | | if (eventData.data[item1.key]) { |
| | |
| | | if (v.length == 0) { |
| | | res.data.records[index].properties.splice(index1, 1); |
| | | } else { |
| | | item1.name = v[0].alarmNo; |
| | | item1.code = v[0].alarmNo; |
| | | } |
| | | } else { |
| | |
| | | width: 12px; |
| | | height: 12px; |
| | | border-radius: 6px; |
| | | margin-right: 8px; |
| | | margin-right: 2px; |
| | | } |
| | | |
| | | .status-card-detail-time { |
| | | line-height: 12px; |
| | | margin-left: 8px; |
| | | margin-left: 2px; |
| | | } |
| | | |
| | | .status-card-machine { |