|
|
@ -193,16 +193,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
import {getDailyReportNew} from "../../api/mes/reportWork";
|
|
|
|
import {getDailyReportNew} from "../../api/mes/reportWork";
|
|
|
|
import moment from 'moment';
|
|
|
|
import moment from 'moment';
|
|
|
|
|
|
|
|
import { getCsRepairlist } from "@/api/device/faultReport";
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
url: "ws://192.168.202.34:9208/websocket/message",
|
|
|
|
url:"ws://localhost:9208/websocket/message",
|
|
|
|
message: "",
|
|
|
|
message: "",
|
|
|
|
text_content: "",
|
|
|
|
text_content: "",
|
|
|
|
scrollText: "",
|
|
|
|
scrollText: "",
|
|
|
|
repairOrders:[],
|
|
|
|
repairOrders:[],
|
|
|
|
ws: null,
|
|
|
|
ws: null,
|
|
|
|
|
|
|
|
timer: null,
|
|
|
|
// 查询参数
|
|
|
|
// 查询参数
|
|
|
|
queryParams: {
|
|
|
|
queryParams: {
|
|
|
|
timeArray: [],
|
|
|
|
timeArray: [],
|
|
|
@ -397,6 +399,15 @@ export default {
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
this.getDate();
|
|
|
|
|
|
|
|
this.timer = setInterval(() => {
|
|
|
|
|
|
|
|
this.getlistFaultReport();
|
|
|
|
|
|
|
|
}, 10000);
|
|
|
|
|
|
|
|
this.startAutoScroll();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
Fungetdate(num) {
|
|
|
|
Fungetdate(num) {
|
|
|
|
var dd = new Date();
|
|
|
|
var dd = new Date();
|
|
|
@ -463,90 +474,59 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
tableBody.scrollTop = scrollTop
|
|
|
|
tableBody.scrollTop = scrollTop
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 50) // 调整时间间隔控制滚动速度
|
|
|
|
}, 3000) // 调整时间间隔控制滚动速度
|
|
|
|
},
|
|
|
|
},
|
|
|
|
stopAutoScroll() {
|
|
|
|
stopAutoScroll() {
|
|
|
|
clearInterval(this.scrollInterval)
|
|
|
|
clearInterval(this.scrollInterval)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
join() {
|
|
|
|
|
|
|
|
const wsuri = this.url;
|
|
|
|
|
|
|
|
this.ws = new WebSocket(wsuri);
|
|
|
|
|
|
|
|
const self = this;
|
|
|
|
|
|
|
|
this.ws.onopen = function (event) {
|
|
|
|
|
|
|
|
self.text_content = self.text_content + "已经打开连接!" + "\n";
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
this.ws.onmessage = function (event) {
|
|
|
|
|
|
|
|
self.text_content = event.data + "\n";
|
|
|
|
|
|
|
|
console.log(self.text_content);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
// 解析JSON数据
|
|
|
|
|
|
|
|
const receivedData = JSON.parse(event.data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Array.isArray(receivedData)) {
|
|
|
|
//设备故障信息
|
|
|
|
// 更新响应式数据
|
|
|
|
getlistFaultReport(){
|
|
|
|
this.repairOrders = receivedData.map(item => ({
|
|
|
|
const _this = this;
|
|
|
|
...item,
|
|
|
|
const param ={
|
|
|
|
}))
|
|
|
|
pageNum: 1,
|
|
|
|
const descList = receivedData.map(item =>
|
|
|
|
pageSize: 20
|
|
|
|
`${item.params?.equipmentName || '未知'} ${item.orderDesc || '无故障描述'} 维修人:${item.orderRepairmanName}`
|
|
|
|
}
|
|
|
|
);
|
|
|
|
getCsRepairlist(param).then((response) => {
|
|
|
|
this.scrollText = descList.join('★★★★★★★★'); // 用两个全角空格分隔
|
|
|
|
if (response) {
|
|
|
|
|
|
|
|
console.log(response)
|
|
|
|
|
|
|
|
// 更新响应式数据
|
|
|
|
|
|
|
|
this.repairOrders = response.map(item => ({
|
|
|
|
|
|
|
|
...item,
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
const descList = response.map(item =>
|
|
|
|
|
|
|
|
`${item.params?.equipmentName || '未知'} ${item.params?.auxiliaryequipmentName || '未知'} ${item.orderDesc || '无故障描述'}`
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
this.scrollText = descList.join('★★★★★★★★'); // 用两个全角空格分隔
|
|
|
|
|
|
|
|
|
|
|
|
// 提取所有有效的设备名称
|
|
|
|
// 提取所有有效的设备名称
|
|
|
|
const activeEquipmentNames = new Set(
|
|
|
|
const activeEquipmentNames = new Set(
|
|
|
|
receivedData
|
|
|
|
response.map(item => item.params?.equipmentName)
|
|
|
|
.map(item => item.params?.equipmentName)
|
|
|
|
.filter(name => name)
|
|
|
|
.filter(name => name)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更新infoData的高亮状态
|
|
|
|
// 更新infoData的高亮状态
|
|
|
|
this.infoData.forEach((item, index) => {
|
|
|
|
this.infoData.forEach((item, index) => {
|
|
|
|
if (activeEquipmentNames.has(item.equipmentName)) {
|
|
|
|
if (activeEquipmentNames.has(item.equipmentName)) {
|
|
|
|
// 响应式设置alpha
|
|
|
|
// 响应式设置alpha
|
|
|
|
this.$set(this.infoData[index], 'alpha', '#CB4C4C80');
|
|
|
|
this.$set(this.infoData[index], 'alpha', '#CB4C4C80');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 移除alpha属性
|
|
|
|
// 移除alpha属性
|
|
|
|
if (this.infoData[index].hasOwnProperty('alpha')) {
|
|
|
|
if (this.infoData[index].hasOwnProperty('alpha')) {
|
|
|
|
this.$delete(this.infoData[index], 'alpha');
|
|
|
|
this.$delete(this.infoData[index], 'alpha');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
|
|
|
|
console.warn('收到非数组格式数据:', receivedData)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
console.error("JSON parsing failed:", error)
|
|
|
|
|
|
|
|
this.$notify.error({ title: '数据错误', message: '接收数据格式异常' })
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.bind(this);;
|
|
|
|
})
|
|
|
|
this.ws.onclose = function (event) {
|
|
|
|
|
|
|
|
self.text_content = self.text_content + "已经关闭连接!" + "\n";
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
exit() {
|
|
|
|
|
|
|
|
if (this.ws) {
|
|
|
|
|
|
|
|
this.ws.close();
|
|
|
|
|
|
|
|
this.ws = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
send() {
|
|
|
|
|
|
|
|
if (this.ws) {
|
|
|
|
|
|
|
|
this.ws.send(this.message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
alert("未连接到服务器");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created(){
|
|
|
|
created(){
|
|
|
|
this.join();
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
this.getDate();
|
|
|
|
|
|
|
|
this.startAutoScroll();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
beforeDestroy() {
|
|
|
|
this.stopAutoScroll()
|
|
|
|
this.stopAutoScroll()
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -999,7 +979,7 @@ export default {
|
|
|
|
.scroll-title-content {
|
|
|
|
.scroll-title-content {
|
|
|
|
position: absolute;
|
|
|
|
position: absolute;
|
|
|
|
white-space: nowrap;
|
|
|
|
white-space: nowrap;
|
|
|
|
animation: scroll 15s linear infinite;
|
|
|
|
animation: scroll 15s linear infinite; /* 将15s改为30s使速度减半 */
|
|
|
|
font-size: 18px;
|
|
|
|
font-size: 18px;
|
|
|
|
color: #00f7ff;
|
|
|
|
color: #00f7ff;
|
|
|
|
line-height: 30px;
|
|
|
|
line-height: 30px;
|
|
|
|