InformationDisplay.vue
2.7 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
<template>
<div class="result-wrapper">
<div class="result-header">结果展示</div>
<div id="showDiv" class="scrollbar-wrapper" style="padding: 20px">
</div>
</div>
</template>
<script>
import $ from 'jquery'
import {computed, onMounted, onUpdated, watch} from 'vue'
export default {
props: ['data'],
setup(props, {emit}) {
const data = props.data
const informationList = computed(() => {
return data
})
// function
const renderResultToHtml = function(data, hasSccessDetail) {
let text = "本次共执行job " +
data.total +
" 个,成功 " +
data.success +
" 个,失败 " +
data.failed +
" 个.</br>"
if (data.failedJob && data.failedJob.length > 0)
{
text += "-----失败job详情-----</br>"
text += data.failedJob.join("</br>")
if (data.data)
{
text += "</br>" + data.data
}
}
if (data.successJob && data.successJob.length > 0)
{
text += "-----成功job详情-----</br>"
text += data.successJob.join("</br>")
if (hasSccessDetail)
{
if (data.data)
{
console.log(data.data)
data.data.forEach(item => {
text +=
"</br>" +
" 设备序列号: " +
item.deviceSerialnum +
" 时间: " +
item.counttime +
" 进客流: " +
item.innum +
" 出客流: " +
item.outnum
})
}
}
}
text += "</br>-----------------------------------------------"
text += "</br>"
text += "</br>"
text += "</br>"
$("#showDiv").append(text)
}
watch(
() => {
return informationList.value.toString()
},
(newData) => {
$("#showDiv").empty()
for (const item of informationList.value)
{
renderResultToHtml(item)
}
}
)
return {
informationList
}
}
}
</script>
<style lang="less" scoped>
@import "./InformationDisplay.less";
</style>