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
| <template>
| <b-card no-body class="p10" style="height: 100%;">
| <h5 class="mb-0">
| 当日签到
| </h5>
| <vue-echart :options="pieOptions" :theme="polarTheme" :auto-resize="true"></vue-echart>
| </b-card>
| </template>
| <style>
| .echarts {
| height: 100% !important;
| width: 100% !important;
| }
| </style>
| <script>
| import ECharts from 'vue-echarts/components/ECharts.vue'
| import 'echarts/lib/chart/pie'
| import 'echarts/theme/shine'
| import { getTeacherSignCountData } from '@/server/home.js'
| let pieOption = {
| tooltip: {
| trigger: 'item',
| formatter: '{a} <br/>{b} : {d}% ({c})'
| },
| legend: {
| orient: 'vertical',
| x: 'right',
| y: 'top',
| type: 'scroll',
| data: ['未签到', '已签到']
| },
| series: [
| {
| name: '签到统计',
| type: 'pie',
| // radius: ['40%', '60%'],
| radius: '80%', // 50%
| center: ['50%', '55%'],
| avoidLabelOverlap: true,
| selectedMode: 'single',
| position: 'top',
| label: {
| // show:false
| position: 'inside',
| formatter: '{d}%'
| },
| data: []
| }
| ]
| }
| export default {
| name: 'HomePieChart',
| props: {},
| data() {
| return {
| userInfo: this.$store.getters.basicUserInfo,
| /* 图表 */
| pieOptions: pieOption,
| polarTheme: 'shine',
| mapList: [],
| tabMap: '',
| /* 地图组件使用 */
| mapInfo: null,
| deviceArr: [],
| deviceInfo: null,
| mapDeviceType: []
| }
| },
| methods: {
| /* 查询图表数据 */
| async getTeacherSignCountData() {
| let res = await getTeacherSignCountData({
| orgId: this.userInfo.orgId,
| type: 'teacher',
| signDate: this.$moment().format('YYYY-MM-DD')
| })
| if (
| res &&
| !isNaN(parseInt(res.unsigned)) &&
| !isNaN(parseInt(res.signed))
| ) {
| const countNum = parseInt(res.unsigned) + parseInt(res.signed)
| this.pieOptions.series[0].data = [
| { value: res.unsigned, name: '未签到', countNum },
| { value: res.signed, name: '已签到', countNum }
| ]
| }
| }
| },
| created() {
| this.getTeacherSignCountData()
| },
| components: {
| 'vue-echart': ECharts
| }
| }
| </script>
|
| <style lang="scss" scoped>
| .btn-content {
| display: flex;
| justify-content: flex-end;
| }
| .alarm-box {
| position: absolute;
| top: 10px;
| right: 10px;
| z-index: 9;
| .badge-default {
| background: #ccc;
| }
| }
| div,
| ul,
| li,
| img,
| span,
| a,
| p {
| /* 抑制选中 */
| -moz-user-select: none;
| -webkit-user-select: none;
| user-select: none;
| }
| .mapDeviceType-box {
| position: absolute;
| top: 10px;
| left: 10px;
| z-index: 9;
| background: rgba(255, 255, 255, 0.8);
| }
| .mapDeviceType-box .mapDeviceType-item {
| /* .icon{} */
| .content {
| line-height: 20px;
| }
| }
| </style>
|
|