Merge remote-tracking branch 'origin/master'

master
mengjiao 3 months ago
commit dc05211211

@ -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) {
return request({

@ -193,16 +193,18 @@
import {getDailyReportNew} from "../../api/mes/reportWork";
import moment from 'moment';
import { getCsRepairlist } from "@/api/device/faultReport";
export default {
data() {
return {
url: "ws://192.168.202.34:9208/websocket/message",
url:"ws://localhost:9208/websocket/message",
message: "",
text_content: "",
scrollText: "",
repairOrders:[],
ws: null,
timer: null,
//
queryParams: {
timeArray: [],
@ -397,6 +399,15 @@ export default {
]
}
},
mounted() {
this.getDate();
this.timer = setInterval(() => {
this.getlistFaultReport();
}, 10000);
this.startAutoScroll();
},
methods: {
Fungetdate(num) {
var dd = new Date();
@ -463,90 +474,59 @@ export default {
tableBody.scrollTop = scrollTop
}
}, 50) //
}, 3000) //
},
stopAutoScroll() {
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)) {
//
this.repairOrders = receivedData.map(item => ({
...item,
}))
const descList = receivedData.map(item =>
`${item.params?.equipmentName || '未知'} ${item.orderDesc || '无故障描述'} 维修人:${item.orderRepairmanName}`
);
this.scrollText = descList.join('★★★★★★★★'); //
//
getlistFaultReport(){
const _this = this;
const param ={
pageNum: 1,
pageSize: 20
}
getCsRepairlist(param).then((response) => {
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(
receivedData
.map(item => item.params?.equipmentName)
.filter(name => name)
);
const activeEquipmentNames = new Set(
response.map(item => item.params?.equipmentName)
.filter(name => name)
);
// infoData
this.infoData.forEach((item, index) => {
if (activeEquipmentNames.has(item.equipmentName)) {
// alpha
this.$set(this.infoData[index], 'alpha', '#CB4C4C80');
} else {
// alpha
if (this.infoData[index].hasOwnProperty('alpha')) {
this.$delete(this.infoData[index], 'alpha');
}
// infoData
this.infoData.forEach((item, index) => {
if (activeEquipmentNames.has(item.equipmentName)) {
// alpha
this.$set(this.infoData[index], 'alpha', '#CB4C4C80');
} else {
// alpha
if (this.infoData[index].hasOwnProperty('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(){
this.join();
},
mounted() {
this.getDate();
this.startAutoScroll();
},
beforeDestroy() {
this.stopAutoScroll()
},
@ -999,7 +979,7 @@ export default {
.scroll-title-content {
position: absolute;
white-space: nowrap;
animation: scroll 15s linear infinite;
animation: scroll 15s linear infinite; /* 将15s改为30s使速度减半 */
font-size: 18px;
color: #00f7ff;
line-height: 30px;

@ -38,63 +38,7 @@ export default {
data () {
return {
cards: [
{
title: "点检",
desc: "今日",
total: {
number: [],
content: '{nt}',
textAlign: 'right',
style: {
fill: '#ea6027',
fontWeight: 'bold'
}
},
num: {
number: [],
content: '{nt}',
textAlign: 'right',
style: {
fill: '#26fcd8',
fontWeight: 'bold'
}
},
ring: {
series: [
{
type: 'gauge',
startAngle: -Math.PI / 2,
endAngle: Math.PI * 1.5,
arcLineWidth: 13,
radius: '80%',
data: [],
axisLabel: {
show: false
},
axisTick: {
show: false
},
pointer: {
show: false
},
backgroundArc: {
style: {
stroke: '#224590'
}
},
details: {
show: true,
formatter: '完成占比{value}%',
style: {
fill: '#1ed3e5',
fontSize: 20
}
}
}
],
color: ['#03d3ec']
}
},
],
equipmentinfo: {},
}
@ -116,16 +60,14 @@ export default {
}).then((response) => {
if (response.data) {
_this.equipmentinfo = response.data;
this.cards = titles.map(title => {
const [totalKey, finishKey] = dataMap[title];
const total = this.equipmentinfo[totalKey] || 0; //
const finish = this.equipmentinfo[finishKey] || 0;
const ratio = Number((finish / total).toFixed(2));
const ratio = Number((finish / total).toFixed(2)) * 100;
return {
title: title,
desc: title === '保养' || '巡检' ? '本月' : '今日',
desc: (title === '保养' || title === '巡检') ? '本月' : '今日',
total: {
number: [total],
content: '{nt}',

@ -63,7 +63,7 @@
value-format="yyyy-MM-dd HH:mm:ss"
:placeholder="getDatePickerPlaceholder"
style="width: 240px"
@change="handleQuery"
@change="handleEndTimeChange"
/>
</el-form-item>
<el-form-item label="时间范围" prop="status">
@ -418,9 +418,8 @@ export default {
const now = new Date();
const startTime = new Date(now.setHours(0, 0, 0, 0));
const endTime = new Date(now.setHours(23, 59, 59, 999));
this.queryParams.startTime = this.formatDateTime(startTime, this.queryParams.type);
this.queryParams.endTime = this.formatDateTime(endTime, this.queryParams.type);
this.queryParams.endTime = this.getEndDateTime(endTime, this.queryParams.type);
},
initCharts() {
@ -480,13 +479,21 @@ export default {
handleTimeRangeChange(type) {
const now = new Date();
const startTime = new Date(now.setHours(0, 0, 0, 0));
const endTime = new Date(now.setHours(23, 59, 59, 999));
const endTime = new Date(now);
this.queryParams.startTime = this.formatDateTime(startTime, type);
this.queryParams.endTime = this.getEndDateTime(endTime, type);
this.handleQuery();
},
//
handleEndTimeChange(time) {
if (time) {
const date = new Date(time);
this.queryParams.endTime = this.getEndDateTime(date, this.queryParams.type);
this.handleQuery();
}
},
//
tranListToTreeData(list) {
//

@ -63,7 +63,7 @@
value-format="yyyy-MM-dd HH:mm:ss"
:placeholder="getDatePickerPlaceholder"
style="width: 240px"
@change="handleQuery"
@change="handleEndTimeChange"
/>
</el-form-item>
<el-form-item label="时间范围" prop="status">
@ -322,7 +322,7 @@ export default {
const endTime = new Date(now.setHours(23, 59, 59, 999));
this.queryParams.startTime = this.formatDateTime(startTime, this.queryParams.type);
this.queryParams.endTime = this.formatDateTime(endTime, this.queryParams.type);
this.queryParams.endTime = this.getEndDateTime(endTime, this.queryParams.type);
},
initCharts() {
@ -386,6 +386,15 @@ export default {
this.handleQuery();
},
//
handleEndTimeChange(time) {
if (time) {
const date = new Date(time);
this.queryParams.endTime = this.getEndDateTime(date, this.queryParams.type);
this.handleQuery();
}
},
//
tranListToTreeData(list) {
//

@ -444,7 +444,9 @@ export default {
actProduction: [],
ceshitable: [{}, {}, {}, {}, {}, {}],
pollTimer: null,
timer: null
timer: null,
currentIndex: 0,
rotationTimer: null
};
},
created() {},
@ -462,11 +464,24 @@ export default {
this.timer = setInterval(() => {
this.getProductionNumberPLC();
}, 10000);
this.startRotation()
},
beforeDestroy() {
clearInterval(this.rotationTimer)
clearInterval(this.timer)
},
methods: {
startRotation() {
this.rotationTimer = setInterval(() => {
if(this.dictDatatype?.length > 0) {
this.currentIndex = (this.currentIndex + 1) % this.dictDatatype.length
console.log(this.currentIndex + 1);
// console.log(this.dictDatatype);
this.selectxtclasses = this.dictDatatype[this.currentIndex].equCode
this.selectline2(this.selectxtclasses) // change
}
}, 60000)
},
back() {
this.$router.push({ path: "/index" });
},

Loading…
Cancel
Save