| | |
| | | <!-- |
| | | * @Date: 2024-04-09 22:11:21 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-09-06 14:13:16 |
| | | * @LastEditTime: 2024-10-07 21:48:45 |
| | | * @FilePath: /mdc/Users/mache/Documents/demo/cps-web/src/views/mdc/realtime-status/index.vue |
| | | 实时看板 |
| | | --> |
| | |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.deviceStatus = [...this.$route.query.currentTag]; |
| | | this.deviceStatus = this.$route.query.currentTag?[...this.$route.query.currentTag]:[]; |
| | | this.getstationlabelList(); //获取标签视图下的list |
| | | this.setIntervalTime(); //十秒增加时间 |
| | | this.getprocess(); //获取颜色==》获取顶部title==》设置几行几列==》ws |
| | |
| | | this.$HTTP.get("/api/blade-cps/group/get-mdc-group").then(res => { |
| | | if (res.code == 200) { |
| | | this.stationlabelList = res.data; |
| | | this.stationlabel = res.data[0].groupName; |
| | | if(res.data.length != 0) { |
| | | this.stationlabel = res.data[0].groupName; |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | changestatus(name) { |
| | | if(this.stationlabelList.length == 0) { |
| | | this.station = "状态视图"; |
| | | //this.$message.error("不能点击"); |
| | | return; |
| | | } |
| | | this.station = name; |
| | | if (this.station == '状态视图') { |
| | | this.workStationGroupIdList = []; |
| | |
| | | } |
| | | }, |
| | | goSet() { |
| | | this.$router.push('/mdc/configuration'); |
| | | //console.log(this.$TOOL.data.get("MENU"));name == "配置中心" |
| | | this.$router.push('/mdc/configuration'); //分析设置 |
| | | }, |
| | | gostatus(item) { |
| | | this.$router.push('/mdc/station-live?code=' + item.id); |
| | |
| | | workStationGroupIdList: this.workStationGroupIdList |
| | | } |
| | | this.timestatus = []; |
| | | this.$HTTP.post(`/api/blade-cps/workstation/real-time-status?current=${this.current || 0}&size=${this.size || 0}`, obj).then(res => { |
| | | this.$HTTP.post(`/api/blade-cps/workstation/real-time-status?current=${this.current || 0}&size=${this.size || 6}`, obj).then(res => { |
| | | if (res.code == 200) { |
| | | var ids = []; |
| | | console.log(this.allwcs, res.data) |
| | | res.data.records.forEach(item => { |
| | | ids.push(item.id); |
| | | if (item.properties != null && item.properties.length != 0) { |
| | |
| | | that.$TOOL.socket.sendDataToWebSocket(obj); //发送 |
| | | } |
| | | }, 500); |
| | | var num = 0; |
| | | //var num = 0; |
| | | var intervalId; |
| | | this.$TOOL.socket.websocket.onmessage = function (event) { |
| | | num++; |
| | | //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) { |
| | |
| | | } |
| | | item.properties.forEach((item1, index1) => { |
| | | if (item1.key == "DeviceStatus") { //机器状态 |
| | | if (item1.value == "2") { |
| | | that.allwcs.forEach(item2 => { |
| | | if (item2.code == item1.value) { |
| | | item1.color = item2.color; |
| | | item1.code = item2.name; |
| | | } |
| | | }) |
| | | } else { |
| | | item1.color = "#75C0C0"; |
| | | } |
| | | that.allwcs.forEach(item2 => { |
| | | if (item2.code == item1.value) { |
| | | item1.color = item2.color; |
| | | item1.code = item2.name; |
| | | } |
| | | }) |
| | | } else { |
| | | if (item1.key == 'Alarm') { //报警 |
| | | if (eventData.data[item1.key]) { |
| | |
| | | } else { |
| | | item1.name = v[0].code; |
| | | item1.code = v[0].msg; |
| | | that.allwcs.forEach(item2 => { |
| | | if (item2.name == "报警") { |
| | | item1.color = item2.color; |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | item1.name = v.code; |
| | | item1.code = v.msg; |
| | | that.allwcs.forEach(item2 => { |
| | | if (item2.name == "报警") { |
| | | item1.color = item2.color; |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | if (eventData.data[item1.key]) { |
| | | item1.code = eventData.data[item1.key].v; |
| | | item1.color = "#75C0C0"; |
| | | } |
| | | } |
| | | that.allwcs.forEach(item2 => { |
| | | if (item2.name == "报警") { |
| | | item1.color = item2.color; |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | item.color = item1.color; |
| | | } |
| | | }) |
| | | if(this.$route.query.currentTag == item.status) { |
| | | if (this.$route.query.currentTag == item.status) { |
| | | item.active = true; |
| | | } |
| | | }) |
| | |
| | | font-weight: 700; |
| | | font-size: 16px; |
| | | color: #333; |
| | | width: 33%; |
| | | width: 26%; |
| | | overflow: hidden; |
| | | white-space: nowrap; |
| | | text-overflow: ellipsis; |