黑蚊香车间生产监控看板修改

Signed-off-by: Yangwl <1726150332@qq.com>
master
Yangwl 1 month ago
parent 5c80d802b6
commit bb0c265853

@ -9,6 +9,16 @@ export function listFaultReport(query) {
}); });
} }
// 查询故障报修列表
export function getCsRepairlist(query) {
return request({
url: '/device/faultReport/getCsRepairlist',
method: 'get',
params: query
});
}
// 查询故障报修详细 // 查询故障报修详细
export function getFaultReport(orderId) { export function getFaultReport(orderId) {
return request({ return request({

@ -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;

Loading…
Cancel
Save