leftView.vue
2.77 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
138
139
140
141
142
143
144
145
146
147
148
149
<template>
<div class="left-container">
<div class="data-view">
<div v-for="item in submitArr"
:key="item.name"
class="item">
<div class="name">
{{ item.name }}
</div>
<div class="value">
{{ item.value(dataView) }}
</div>
</div>
</div>
<div class="examination-result">
<div class="title">
考试结果等级分布
</div>
<EchartBar id="resultRef"
class="echart"
:x-data="xData"
:y-data="yData">
</EchartBar>
<div class="hint">
<div v-for="(item, index) in queryData.examLevelDTOS"
:key="index"
class="item">
<span>{{ item.levelName }}:</span>
<span>{{ `${item.minScore}-${item.maxScore}` }}</span>
</div>
</div>
</div>
</div>
</template>
<script>
import echartBar from "./echartBar.vue";
export default {
components: { EchartBar: echartBar },
props: {
dataView: {
type: Object,
default: () => {},
},
queryData: {
type: Object,
default: () => {},
},
},
data() {
return {
submitArr: [
{
name: "已提交人数",
value: (obj) => {
console.log(obj);
return obj.submitted || obj.submitted === 0 ? obj.submitted : "-";
},
},
{
name: "已提交人均得分",
value: (obj) => {
return obj.avg || obj.avg === 0 ? obj.avg : "-";
},
},
],
xData: [],
yData: [],
};
},
watch: {
dataView: {
handler(newValue, oldValue) {
this.initEchartData(newValue);
},
deep: true,
immediate: true,
},
},
methods: {
initEchartData(data) {
console.log(data);
let xData = [];
data.scoreDistributions.forEach((item) => {
xData.push(item.levelName);
});
this.xData = xData;
this.yData = data.scoreDistributions;
},
},
};
</script>
<style lang="scss" scoped>
.left-container {
// min-width: 800px;
.data-view {
display: flex;
align-items: center;
.item {
flex: 1;
height: 100px;
border-radius: 4px;
background: #f8faff;
margin-right: 16px;
padding: 16px 20px;
box-sizing: border-box;
margin-bottom: 16px;
.name {
color: #333333;
font-size: 14px;
font-weight: 400;
margin-bottom: 8px;
}
.value {
color: #1d1d1d;
font-size: 32px;
font-weight: 500;
}
}
}
.examination-result {
position: relative;
.title {
color: #333333;
font-size: 14px;
font-weight: 400;
}
.hint {
display: flex;
flex-direction: column;
align-items: flex-start;
position: absolute;
top: 52px;
right: 45px;
.item {
display: flex;
align-items: center;
color: #000000a6;
font-size: 11px;
font-weight: 400;
margin-bottom: 7px;
}
}
}
}
</style>