|
1
2
|
<template>
<div class="task-compensation">
|
|
3
4
5
|
<el-row :gutter="20">
<!-- 左侧区域 -->
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
|
|
6
|
<div>
|
|
7
8
9
10
|
<el-row :gutter="20">
<!-- 执行线程 -->
<el-col :span="24">
<el-card>
|
|
11
|
<div slot="header" class="zhx">
|
|
12
|
<span class="title-text">{{ $t("main.eALogging.executionThread") }}</span>
|
|
13
|
<div>
|
|
14
15
16
17
18
|
<el-button
type="primary"
size="small"
icon="el-icon-refresh"
@click="getZxxctableData"
|
|
19
|
>{{ $t("main.eALogging.schedulingProgramReset") }}</el-button
|
|
20
21
22
23
24
|
>
</div>
</div>
<el-table
:data="zxxctableData"
|
|
25
|
:empty-text="$t('main.eALogging.noData')"
|
|
26
|
border
|
|
27
|
:height="leftTableHeight"
|
|
28
29
30
31
32
|
style="width: 100%"
:cell-style="{ color: '#000' }"
stripe
highlight-current-row
>
|
|
33
|
<el-table-column prop="code" :label="$t('main.eALogging.threadTagging')" width="220">
|
|
34
|
</el-table-column>
|
|
35
|
<el-table-column prop="status" :label="$t('main.eALogging.executionStatus')">
|
|
36
|
</el-table-column>
|
|
37
|
<el-table-column prop="time" :label="$t('main.eALogging.timeConsuming')">
|
|
38
39
40
41
|
<template slot-scope="scope">
{{ scope.row.time }} ms
</template>
</el-table-column>
|
|
42
|
<el-table-column prop="remark" :label="$t('main.eALogging.notes')">
|
|
43
|
</el-table-column>
|
|
44
45
|
<el-table-column
prop="equipmentCodes"
|
|
46
|
width="2000"
|
|
47
|
:label="$t('main.eALogging.associatedDevices')"
|
|
48
|
>
|
|
49
50
51
52
53
54
|
</el-table-column>
</el-table>
</el-card>
</el-col>
<!-- 诊断 -->
|
|
55
|
<el-col :span="24" style="margin-top: 10px">
|
|
56
|
<el-card>
|
|
57
|
<div slot="header" class="zhx">
|
|
58
|
<span class="title-text">{{ $t("main.eALogging.diagnosis") }}</span>
|
|
59
|
<div>
|
|
60
61
62
63
64
|
<el-button
type="primary"
size="small"
icon="el-icon-refresh-left"
@click="zhengdauntableData"
|
|
65
|
>{{ $t("main.eALogging.schedulingDiagnosis") }}</el-button
|
|
66
67
68
69
70
71
|
>
<el-button
type="primary"
size="small"
icon="el-icon-delete-solid"
@click="clearLog"
|
|
72
|
>{{ $t("main.eALogging.diagnosticLogClearing") }}</el-button
|
|
73
74
75
76
|
>
</div>
</div>
<el-table
|
|
77
|
:empty-text="$t('main.eALogging.noData')"
|
|
78
79
|
:data="eqBjtableData"
border
|
|
80
|
:height="leftTableHeight"
|
|
81
|
style="width: 100%"
|
|
82
|
:cell-style="{ color: '#fff' }"
|
|
83
84
|
:row-class-name="tableZDRowClassName"
fit
|
|
85
86
87
88
89
|
:default-sort="{ prop: 'time', order: 'descending' }"
>
<el-table-column
sortable
prop="time"
|
|
90
|
:label="$t('main.eALogging.diagnosisTime')"
|
|
91
92
93
|
width="180"
>
</el-table-column>
|
|
94
|
<el-table-column prop="level" :label="$t('main.eALogging.logLevel')" width="120">
|
|
95
96
97
|
<template slot-scope="scope">
{{ levelMap[scope.row.level] || "未知" }}
</template>
|
|
98
|
</el-table-column>
|
|
99
100
|
<el-table-column
prop="content"
|
|
101
|
:label="$t('main.eALogging.logContent')"
|
|
102
103
|
min-width="1200"
>
|
|
104
105
106
107
108
|
<template slot-scope="scope">
<div style="white-space: nowrap">
{{ scope.row.content }}
</div>
</template>
|
|
109
110
111
112
113
|
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
|
|
114
|
</div>
|
|
115
116
117
118
119
120
|
</el-col>
<!-- 右侧区域 -->
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
<el-card>
<div slot="header" class="clearfix">
|
|
121
|
<span class="title-text">{{ $t("main.eALogging.dispatchingLog") }}</span>
|
|
122
|
</div>
|
|
123
|
<el-table
|
|
124
|
:data="
|
|
125
|
dDtableData
|
|
126
|
|
|
127
|
/*.slice(
|
|
128
129
|
(currentPage - 1) * pageSize,
currentPage * pageSize
|
|
130
131
|
)
*/
|
|
132
|
"
|
|
133
|
:empty-text="$t('main.eALogging.noData')"
|
|
134
|
:height="rightTableHeight"
|
|
135
|
style="width: 100%"
|
|
136
|
:cell-style="{ color: '#fff' }"
|
|
137
138
|
:row-class-name="tableRowClassName"
:default-sort="{ prop: 'time', order: 'descending' }"
|
|
139
|
fit
|
|
140
|
>
|
|
141
142
143
144
|
<el-table-column
flexd
sortable
prop="time"
|
|
145
|
:label="$t('main.eALogging.time')"
|
|
146
147
|
width="180"
>
|
|
148
|
</el-table-column>
|
|
149
150
|
<el-table-column
prop="type"
|
|
151
|
:label="$t('main.eALogging.classification')"
|
|
152
153
154
155
|
width="180"
sortable
:sort-method="sortByType"
>
|
|
156
|
</el-table-column>
|
|
157
|
<el-table-column prop="bllResultCode" :label="$t('main.eALogging.processingResults')">
|
|
158
159
160
|
<template slot-scope="scope">
{{ bllResultCodeMap[scope.row.bllResultCode] || "未知" }}
</template>
|
|
161
|
</el-table-column>
|
|
162
|
<el-table-column prop="equipmentCode" :label="$t('main.eALogging.device')">
|
|
163
|
</el-table-column>
|
|
164
|
<el-table-column prop="description" :label="$t('main.eALogging.describe')" width="1200">
|
|
165
166
167
168
169
|
<template slot-scope="scope">
<div style="white-space: nowrap">
{{ scope.row.description }}
</div>
</template>
|
|
170
|
</el-table-column>
|
|
171
|
<el-table-column prop="errorCode" :label="$t('main.eALogging.errorCode')">
|
|
172
173
|
</el-table-column>
</el-table>
|
|
174
|
<!-- <el-pagination
|
|
175
|
style="margin-top: 15px"
|
|
176
177
178
179
180
181
182
183
|
align="center"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[1, 5, 10, 20]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="dDtableData.length"
|
|
184
|
/> -->
|
|
185
186
187
|
</el-card>
</el-col>
</el-row>
|
|
188
189
190
191
|
</div>
</template>
<script>
|
|
192
|
import {
|
|
193
194
195
196
|
GetExecuteDetail,
GetExecuteLogs,
GetExecutorDiagnosisInfo,
ResetExecute,
|
|
197
|
} from "@/api/main";
|
|
198
199
|
export default {
name: "TaskCompensation",
|
|
200
|
|
|
201
|
data() {
|
|
202
|
return {
|
|
203
204
205
206
|
zxxctableData: [],
eqBjtableData: [],
dDtableData: [],
timer: null,
|
|
207
208
209
|
currentPage: 1,
total: 100,
pageSize: 10,
|
|
210
|
bllResultCodeMap: {
|
|
211
212
213
214
215
216
|
0: this.$t("main.msg.interactive"),
1: this.$t("main.msg.error"),
2: this.$t("main.msg.callThePolice"),
200: this.$t("main.msg.success"),
201: this.$t("main.msg.abnormal"),
202: this.$t("main.msg.fail"),
|
|
217
218
|
},
levelMap: {
|
|
219
220
221
222
223
224
225
226
|
0: this.$t("main.msg.interactive"),
1: this.$t("main.msg.error"),
2: this.$t("main.msg.callThePolice"),
200: this.$t("main.msg.success"),
201: this.$t("main.msg.abnormal"),
202: this.$t("main.msg.fail"),
401: this.$t("main.msg.unauthorized"),
403: this.$t("main.msg.prohibitAccess"),
|
|
227
|
},
|
|
228
229
230
|
};
},
methods: {
|
|
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
sortByType(a, b) {
// 定义分类优先级
const typePriority = {
失败: 1,
异常: 1,
报警: 2,
成功: 3,
};
// 获取分类的优先级,如果没有定义则默认为4(排在最后)
const priorityA = typePriority[a.type] || 4;
const priorityB = typePriority[b.type] || 4;
// 先按分类优先级排序
if (priorityA !== priorityB) {
return priorityA - priorityB;
}
// 如果优先级相同,则按时间降序排序
return new Date(b.time) - new Date(a.time);
},
|
|
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
tableRowClassName({ row, rowIndex }) {
if (row.bllResultCode === 0) {
return "white-row";
} else if (row.bllResultCode === 1) {
return "red-row";
} else if (row.bllResultCode === 2) {
return "yellow-row";
} else if (row.bllResultCode === 200) {
return "green-row";
} else if (row.bllResultCode === 201) {
return "red-row";
} else if (row.bllResultCode === 202) {
return "red-row";
}
return "";
},
|
|
268
269
270
271
272
273
274
275
276
277
278
279
280
|
tableZDRowClassName({ row, rowIndex }) {
if (row.level === 0) {
return "white-row";
} else if (row.level === 1) {
return "red-row";
} else if (row.level === 2) {
return "yellow-row";
} else if (row.level === 200) {
return "green-row";
} else if (row.level === 201) {
return "red-row";
} else if (row.level === 202) {
return "red-row";
|
|
281
282
283
284
|
} else if (row.level === 401) {
return "white-row";
} else if (row.level === 403) {
return "red-row";
|
|
285
286
287
|
}
return "";
},
|
|
288
|
getZxxctableData() {
|
|
289
|
ResetExecute().then((res) => {
|
|
290
|
console.log(this.$t("main.msg.reset"), res);
|
|
291
292
|
if (res.code == "Success") {
this.$message({
|
|
293
|
message: this.$t("main.msg.schedulerReset"),
|
|
294
295
296
297
298
299
300
301
|
type: "success",
});
this.zxxctableData = [];
this.eqBjtableData = [];
this.dDtableData = [];
this.currentPage = 1;
this.pageSize = 10;
}
|
|
302
303
304
305
|
});
},
GetExecuteDetail() {
|
|
306
|
GetExecuteDetail().then((res) => {
|
|
307
|
console.log(this.$t("main.msg.executionThread"), res); // 确保这里能打印出数据
|
|
308
309
310
311
|
if (res.code == "Success") {
this.zxxctableData = res.data;
}
});
|
|
312
313
314
|
},
GetExecutorDiagnosisInfo() {
GetExecutorDiagnosisInfo().then((res) => {
|
|
315
|
console.log(this.$t("main.msg.diagnosis"), res);
|
|
316
317
318
319
320
321
322
323
324
325
|
if (res.code == "Success") {
this.eqBjtableData = res.data;
}
});
},
clearLog() {
this.eqBjtableData = [];
},
zhengdauntableData() {
this.$message({
|
|
326
|
message: this.$t("main.msg.scheDiagnosis"),
|
|
327
328
329
330
331
332
|
type: "success",
});
this.GetExecutorDiagnosisInfo();
},
GetExecuteLogs() {
GetExecuteLogs().then((res) => {
|
|
333
|
console.log(this.$t("main.msg.dispatLog"), res);
|
|
334
|
if (res.code == "Success") {
|
|
335
336
|
// 截取最新的 100 条数据
this.dDtableData = res.data.slice(-100);
|
|
337
338
|
}
});
|
|
339
|
},
|
|
340
|
|
|
341
342
343
344
|
handleSizeChange(val) {
this.currentPage = 1;
this.pageSize = val;
},
|
|
345
|
|
|
346
347
348
|
handleCurrentChange(val) {
this.currentPage = val;
},
|
|
349
|
start() {
|
|
350
351
|
this.GetExecuteDetail();
this.GetExecuteLogs();
|
|
352
353
354
355
356
357
358
359
|
this.timer = setInterval(() => {
this.GetExecuteDetail();
this.GetExecuteLogs();
}, 3000);
},
stop() {
clearInterval(this.timer);
this.timer = null;
|
|
360
361
|
this.currentPage = 1;
this.pageSize = 10;
|
|
362
|
},
|
|
363
|
},
|
|
364
|
created() {
|
|
365
366
367
|
// this.GetExecuteDetail();
// this.GetExecuteLogs();
// this.start();
|
|
368
|
},
|
|
369
|
mounted() {},
|
|
370
|
beforeDestroy() {
|
|
371
|
clearInterval(this.timer);
|
|
372
|
},
|
|
373
374
375
376
377
378
379
380
|
computed: {
leftTableHeight() {
return `calc((100vh - 410px) / 2)`;
},
rightTableHeight() {
return `calc(100vh - 325px )`;
},
},
|
|
381
382
383
384
385
|
};
</script>
<style lang="scss" scoped>
.task-compensation {
|
|
386
|
box-sizing: border-box !important;
|
|
387
|
}
|
|
388
|
|
|
389
390
|
.title-text {
color: rgb(64, 133, 212);
|
|
391
|
}
|
|
392
|
.el-card {
|
|
393
|
height: 100%;
|
|
394
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
395
396
397
398
399
400
401
|
.el-table {
// flex: 1;
::v-deep .el-table__body-wrapper {
overflow-y: auto !important;
}
}
|
|
402
|
}
|
|
403
|
|
|
404
|
.zhx,
|
|
405
|
.clearfix {
|
|
406
|
height: 30px;
|
|
407
408
409
|
display: flex;
justify-content: space-between;
align-items: center;
|
|
410
411
|
}
|
|
412
|
.title-text {
|
|
413
|
margin-top: 10px;
|
|
414
|
}
|
|
415
|
</style>
|
|
416
|
|
|
417
|
<style lang="scss" scoped>
|
|
418
419
420
421
|
// 禁用表格行悬停效果
::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
background-color: inherit !important;
}
|
|
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
|
// 自定义滚动条样式
::v-deep .el-table__body-wrapper {
overflow: hidden;
}
::v-deep .el-table__body-wrapper:hover {
overflow: auto;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
background-color: #777f87;
border-radius: 4px;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar-track {
background-color: #f5f5f5;
}
</style>
<style lang="scss" scoped>
|
|
447
448
449
450
|
::v-deep.el-table thead {
color: #101010;
font-weight: 600;
}
|
|
451
452
453
|
</style>
<style>
.el-table .white-row {
|
|
454
|
background: rgb(164, 167, 171) !important;
|
|
455
|
}
|
|
456
|
|
|
457
|
.el-table .red-row {
|
|
458
|
background: rgb(245, 108, 108) !important;
|
|
459
|
}
|
|
460
461
|
.el-table .yellow-row {
|
|
462
|
background: rgb(233, 173, 82) !important;
|
|
463
|
}
|
|
464
465
|
.el-table .green-row {
|
|
466
|
background: rgb(103, 194, 58) !important;
|
|
467
468
|
}
</style>
|