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
| <template>
| <div style="background-color: #fff">
| <h2 style="line-height:40px;text-align: center;padding: 20px 0;">目标完成情况统计</h2>
| <el-row style="padding:20px 0">
| <el-col :span="4" :offset="17">
| <el-select v-model="form.targetType" placeholder="" @change="listApi" style="width:100%">
| <el-option label="年指标" :value="1" />
| <el-option label="月指标" :value="2" />
| <el-option label="半年" :value="3" />
| <el-option label="季度" :value="4" />
| </el-select>
| </el-col>
| </el-row>
| <div ref="main" style="width: 100%; height: 450px;"></div>
| </div>
| </template>
| <script lang="ts">
| import { defineComponent, onMounted, ref } from 'vue';
| import * as echarts from 'echarts';
| import { ElMessage } from 'element-plus';
| import { goalManagementApi } from '/@/api/goalManagement';
| export default defineComponent({
| setup() {
| const form = ref({
| qName: '',
| indexNum: '',
| targetType: 1,
| divideStatus: '',
| });
| onMounted(() => {
| listApi();
| });
| const listApi = () => {
| goalManagementApi()
| .gettargetstatistics(form.value.targetType)
| .then((res) => {
| let arr = [];
| arr.push({
| value: res.data.data.noComplete,
| name: `未完成 ${res.data.data.noComplete}`,
| });
| arr.push({
| value: res.data.data.complete,
| name: `已完成 ${res.data.data.complete}`,
| });
| init(arr);
| });
| };
| const main = ref();
| const init = (data: any) => {
| var myChart = echarts.init(main.value);
| var option = {
| // title: {
| // text: 'Referer of a Website',
| // subtext: 'Fake Data',
| // left: 'center',
| // },
| tooltip: {
| trigger: 'item',
| },
| legend: {
| orient: 'vertical',
| left: '30%',
| },
| series: [
| {
| // name: 'Access From',
| type: 'pie',
| radius: '90%',
| data: data,
| emphasis: {
| itemStyle: {
| shadowBlur: 10,
| shadowOffsetX: 0,
| shadowColor: 'rgba(0, 0, 0, 0.5)',
| },
| },
| },
| ],
| };
|
| myChart.setOption(option);
| };
| return {
| form,
| main,
| init,
| listApi,
| };
| },
| });
| </script>
|
|