<template>
|
<div id="centerRight1">
|
<div class="bg-color-black">
|
<div class="d-flex pt-2 pl-2">
|
<span>
|
<icon name="chart-line" class="text-icon"></icon>
|
</span>
|
<div class="d-flex">
|
<span >机加工加工数量</span>
|
</div>
|
</div>
|
<div class="d-flex jc-center body-box">
|
<dv-scroll-board class="dv-scr-board" :config="config" />
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import axios from 'axios';
|
|
export default {
|
data() {
|
return {
|
config: {
|
header: ['编号','班组', '开始时间', '结束时间'],
|
data: [],
|
rowNum: 7, //表格行数
|
headerHeight: 35,
|
headerBGC: '#0f1325', //表头
|
oddRowBGC: '#0f1325', //奇数行
|
evenRowBGC: '#171c33', //偶数行
|
index: true,
|
columnWidth: [70,70,80,100],
|
align: ['center']
|
}
|
}
|
},
|
components: {},
|
mounted() {
|
},
|
methods: {
|
setData() {
|
this.GetLocationData();
|
this.dataInterval = setInterval(() => {
|
this.GetLocationData();
|
}, 600000); // 间隔10分钟
|
},
|
formatDate(dateString) {
|
const date = new Date(dateString);
|
const year = date.getFullYear();
|
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始
|
const day = String(date.getDate()).padStart(2, '0');
|
return `${year}-${month}-${day}`;
|
},
|
GetLocationData() {
|
axios.post("http://192.168.12.101:8099/api/Readplc/dt_Wheel_feedback_list")
|
.then((response) => {
|
let GetAGVTaskData = [];
|
console.log(response);
|
|
if (response.data <= 0) {
|
let data = [
|
"<span class='colorRed'>无</span>",
|
"<span class='colorRed'>暂无数据</span>",
|
"<span class='colorRed'>暂无数据</span>",
|
"<span class='colorRed'>暂无数据</span>",
|
"<span class='colorRed'>暂无数据</span>",
|
"<span class='colorRed'>暂无数据</span>"
|
];
|
GetAGVTaskData.push(data);
|
} else {
|
response.data.forEach(element => {
|
let data = [
|
this.formatDate(element.today), // 使用 this.formatDate
|
element.machineID,
|
element.shifts,
|
`<span class='colorGrass'>${element.counts}</span>`,
|
`<span class='colorGrass'>${element.qualifiedCount}</span>`,
|
`<span class='colorRed'>${element.unqualifiedCount}</span>`
|
];
|
GetAGVTaskData.push(data);
|
});
|
}
|
|
this.config = {
|
header: ['开始时间', '机床编号', '班组', '数量', '合格量', '不合格量'],
|
data: GetAGVTaskData,
|
rowNum: 6, // 表格行数
|
headerHeight: 35,
|
headerBGC: '#0f1325', // 表头
|
oddRowBGC: '#0f1325', // 奇数行
|
evenRowBGC: '#171c33', // 偶数行
|
index: true,
|
columnWidth: [50, 100, 90, 80, 80],
|
align: ['center'],
|
};
|
})
|
.catch((error) => {
|
console.log(error);
|
});
|
},
|
// 组件销毁时清理定时器
|
beforeDestroy() {
|
if (this.dataInterval) {
|
clearInterval(this.dataInterval);
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
$box-height: 410px;
|
$box-width: 630px;
|
#centerRight1 {
|
padding: 10px;
|
padding-top: 20px;
|
|
height: $box-height;
|
width: $box-width;
|
border-radius: 5px;
|
.bg-color-black {
|
height: $box-height - 30px;
|
border-radius: 10px;
|
}
|
.text {
|
color: #c3cbde;
|
}
|
|
.body-box {
|
border-radius: 10px;
|
overflow: hidden;
|
.dv-scr-board {
|
width: 100%;
|
height: 340px;
|
}
|
}
|
}
|
|
</style>
|