footerRight.vue
3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<template>
<div class="dv-content-body-bottom-list-right">
<div class="dv-content-body-bottom-list-right-title">库存任务信息</div>
<div class="dv-content-body-bottom-list-right-table">
<dv-scroll-board :config="pickup" style="width: 100%;" />
</div>
</div>
</template>
<script>
export default {
data() {
return {
getList: null,
sysData: {},
pickup: {},
}
},
methods: {
getData(data) {
// console.log('getData', data)
try {
if (!data || !Array.isArray(data)) {
// 使用对象展开语法创建新对象,避免引用问题
this.pickup = {
header: ['任务号', '任务类型', '任务状态', '任务起点', '任务终点', '开始时间'],
data: [],
align: ['center', 'left', 'center', 'center', 'center', 'center'],
columnWidth: [90, 120, 110, 100, 100, 100],
headerHeight: 30,
rowNum: 4,
}
return
}
if (data.length === 0) {
this.pickup = {
header: ['任务号', '任务类型', '任务状态', '任务起点', '任务终点', '开始时间'],
data: [],
align: ['center', 'left', 'center', 'center', 'center', 'center'],
columnWidth: [90, 120, 110, 100, 100, 100],
headerHeight: 30,
rowNum: 4,
}
return
}
// 确保pickup对象结构完整
if (!this.pickup || !this.pickup.data) {
this.pickup = {
header: ['任务号', '任务类型', '任务状态', '任务起点', '任务终点', '开始时间'],
data: [],
align: ['center', 'left', 'center', 'center', 'center', 'center'],
columnWidth: [90, 120, 110, 100, 100, 100],
headerHeight: 30,
rowNum: 4,
}
} else {
// console.log(444)
// // 清空数组,避免内存泄漏
// this.pickup.data.length = 0
}
// 限制数据量,避免过多数据导致性能问题
const processedData = data.slice(0, 10) // 最多显示10条数据
let tableData = []
processedData.forEach((item) => {
try {
var eleIsstackdata = `<span style="display: block;width:40px;height:15px;border:1px solid #00c860;text-align:center;line-height:15px;margin-top:7px;color:#00c860">执行中</span>`
if (item.taskStatus == '待执行') {
eleIsstackdata = `<span style="display: block;width:40px;height:15px;text-align:center;line-height:15px;margin-top:7px;">待执行</span>`
}
const startTimes = item.created ? this.$moment(item.created).format(' HH:mm') : ''
tableData.push([item.taskId, item.taskType, eleIsstackdata, item.from, item.to, startTimes])
} catch (error) {
console.error('处理任务数据时出错:', error)
}
})
this.pickup = {
header: ['任务号', '任务类型', '任务状态', '任务起点', '任务终点', '开始时间'],
data: tableData,
align: ['center', 'left', 'center', 'center', 'center', 'center'],
columnWidth: [90, 120, 110, 100, 100, 100],
headerHeight: 30,
rowNum: 4,
}
} catch (error) {
console.error('getData方法执行出错:', error)
// 出错时重置数据结构
this.pickup = {
header: ['任务号', '任务类型', '任务状态', '任务起点', '任务终点', '开始时间'],
data: [],
align: ['center', 'left', 'center', 'center', 'center', 'center'],
columnWidth: [90, 120, 110, 100, 100, 100],
headerHeight: 30,
rowNum: 4,
}
}
},
},
}
</script>
<style lang="less" scoped>
.dv-content-body-bottom-list-right {
width: 49%;
height: 95%;
border: 1.5px solid hsl(208.57deg 51.22% 40.2%);
}
.dv-content-body-bottom-list-right-title {
width: 97%;
height: 23px;
margin: auto;
display: flex;
font-size: 14px;
color: #fff;
flex-direction: column;
justify-content: center;
}
.dv-content-body-bottom-list-right-table {
width: 97%;
height: 80%;
margin: auto;
}
</style>
<style>
.dv-scroll-board .header .header-item {
font-size: 1.8vh !important;
}
.dv-scroll-board .rows div.ceil {
font-size: 11px !important;
}
</style>