1
- <!-- 客户总量统计 -->
1
+ <!-- 员工业绩统计 -->
2
2
<template >
3
3
<!-- Echarts图 -->
4
4
<el-card shadow =" never" >
7
7
</el-skeleton >
8
8
</el-card >
9
9
10
- <!-- 统计列表 TODO @scholar:统计列表的展示不对 -->
10
+ <!-- 统计列表 -->
11
11
<el-card shadow =" never" class =" mt-16px" >
12
12
<el-table v-loading =" loading" :data =" tableData" >
13
- <el-table-column
14
- v-for =" item in columnsData"
15
- :key =" item.prop"
16
- :label =" item.label"
17
- :prop =" item.prop"
18
- align =" center"
19
- >
13
+ <el-table-column v-for =" item in columnsData" :key =" item.prop" :label =" item.label" :prop =" item.prop" align =" center" >
20
14
<template #default =" scope " >
21
- {{ scope.row[item.prop] }}
15
+ {{scope.row[item.prop]}}
22
16
</template >
23
17
</el-table-column >
24
18
</el-table >
@@ -29,7 +23,7 @@ import { EChartsOption } from 'echarts'
29
23
import {
30
24
StatisticsPerformanceApi ,
31
25
StatisticsPerformanceRespVO
32
- } from ' @/api/crm/statistics/performance'
26
+ } from " @/api/crm/statistics/performance"
33
27
34
28
defineOptions ({ name: ' ContractCountPerformance' })
35
29
const props = defineProps <{ queryParams: any }>() // 搜索参数
@@ -92,30 +86,29 @@ const echartsOption = reactive<EChartsOption>({
92
86
type: ' shadow'
93
87
}
94
88
},
95
- yAxis: [
96
- {
97
- type: ' value' ,
98
- name: ' 数量(个)' ,
99
- axisTick: {
100
- show: false
101
- },
102
- axisLabel: {
103
- color: ' #BDBDBD' ,
104
- formatter: ' {value}'
105
- },
106
- /** 坐标轴轴线相关设置 */
107
- axisLine: {
108
- lineStyle: {
109
- color: ' #BDBDBD'
110
- }
111
- },
112
- splitLine: {
113
- show: true ,
114
- lineStyle: {
115
- color: ' #e6e6e6'
116
- }
89
+ yAxis: [{
90
+ type: ' value' ,
91
+ name: ' 数量(个)' ,
92
+ axisTick: {
93
+ show: false
94
+ },
95
+ axisLabel: {
96
+ color: ' #BDBDBD' ,
97
+ formatter: ' {value}'
98
+ },
99
+ /** 坐标轴轴线相关设置 */
100
+ axisLine: {
101
+ lineStyle: {
102
+ color: ' #BDBDBD'
117
103
}
118
104
},
105
+ splitLine: {
106
+ show: true ,
107
+ lineStyle: {
108
+ color: ' #e6e6e6'
109
+ }
110
+ }
111
+ },
119
112
{
120
113
type: ' value' ,
121
114
name: ' ' ,
@@ -141,8 +134,7 @@ const echartsOption = reactive<EChartsOption>({
141
134
color: ' #e6e6e6'
142
135
}
143
136
}
144
- }
145
- ],
137
+ }],
146
138
xAxis: {
147
139
type: ' category' ,
148
140
name: ' 日期' ,
@@ -160,7 +152,9 @@ const loadData = async () => {
160
152
161
153
// 2.1 更新 Echarts 数据
162
154
if (echartsOption .xAxis && echartsOption .xAxis [' data' ]) {
163
- echartsOption .xAxis [' data' ] = performanceList .map ((s : StatisticsPerformanceRespVO ) => s .time )
155
+ echartsOption .xAxis [' data' ] = performanceList .map (
156
+ (s : StatisticsPerformanceRespVO ) => s .time
157
+ )
164
158
}
165
159
if (echartsOption .series && echartsOption .series [0 ] && echartsOption .series [0 ][' data' ]) {
166
160
echartsOption .series [0 ][' data' ] = performanceList .map (
@@ -171,49 +165,45 @@ const loadData = async () => {
171
165
echartsOption .series [1 ][' data' ] = performanceList .map (
172
166
(s : StatisticsPerformanceRespVO ) => s .lastMonthCount
173
167
)
174
- echartsOption .series [3 ][' data' ] = performanceList .map (( s : StatisticsPerformanceRespVO ) =>
175
- s .lastMonthCount !== 0 ? (( s .currentMonthCount / s .lastMonthCount ) * 100 ).toFixed (2 ) : ' NULL'
168
+ echartsOption .series [3 ][' data' ] = performanceList .map (
169
+ ( s : StatisticsPerformanceRespVO ) => s .lastMonthCount !== 0 ? (s .currentMonthCount / s .lastMonthCount * 100 ).toFixed (2 ) : ' NULL'
176
170
)
177
171
}
178
172
if (echartsOption .series && echartsOption .series [2 ] && echartsOption .series [2 ][' data' ]) {
179
173
echartsOption .series [2 ][' data' ] = performanceList .map (
180
174
(s : StatisticsPerformanceRespVO ) => s .lastYearCount
181
175
)
182
- echartsOption .series [4 ][' data' ] = performanceList .map (( s : StatisticsPerformanceRespVO ) =>
183
- s .lastYearCount !== 0 ? (( s .currentMonthCount / s .lastYearCount ) * 100 ).toFixed (2 ) : ' NULL'
176
+ echartsOption .series [4 ][' data' ] = performanceList .map (
177
+ ( s : StatisticsPerformanceRespVO ) => s .lastYearCount !== 0 ? (s .currentMonthCount / s .lastYearCount * 100 ).toFixed (2 ) : ' NULL'
184
178
)
185
179
}
186
180
187
181
// 2.2 更新列表数据
188
182
list .value = performanceList
183
+ convertListData ()
189
184
loading .value = false
185
+
190
186
}
191
187
192
188
// 初始化数据
193
- const columnsData = reactive ([])
194
- const tableData = reactive ([
195
- { title: ' 当月合同数量统计(个)' },
196
- { title: ' 上月合同数量统计(个)' },
197
- { title: ' 去年当月合同数量统计(个)' },
198
- { title: ' 同比增长率(%)' },
199
- { title: ' 环比增长率(%)' }
200
- ])
189
+ const columnsData = reactive ([]);
190
+ const tableData = reactive ([{title: ' 当月合同数量统计(个)' }, {title: ' 上月合同数量统计(个)' },
191
+ {title: ' 去年当月合同数量统计(个)' }, {title: ' 同比增长率(%)' }, {title: ' 环比增长率(%)' }])
201
192
202
- // 定义 init 方法
203
- const init = () => {
204
- const columnObj = { label: ' 日期' , prop: ' title' }
193
+ // 定义 convertListData 方法,数据行列转置,展示每月数据
194
+ const convertListData = () => {
195
+ const columnObj = {label: ' 日期' , prop: ' title' }
196
+ columnsData .splice (0 , columnsData .length );// 清空数组
205
197
columnsData .push (columnObj )
206
198
207
199
list .value .forEach ((item , index ) => {
208
- const columnObj = { label: item .time , prop: ' prop' + index }
200
+ const columnObj = {label: item .time , prop: ' prop' + index }
209
201
columnsData .push (columnObj )
210
202
tableData [0 ][' prop' + index ] = item .currentMonthCount
211
203
tableData [1 ][' prop' + index ] = item .lastMonthCount
212
204
tableData [2 ][' prop' + index ] = item .lastYearCount
213
- tableData [3 ][' prop' + index ] =
214
- item .lastYearCount !== 0 ? (item .currentMonthCount / item .lastYearCount ).toFixed (2 ) : ' NULL'
215
- tableData [4 ][' prop' + index ] =
216
- item .lastMonthCount !== 0 ? (item .currentMonthCount / item .lastMonthCount ).toFixed (2 ) : ' NULL'
205
+ tableData [3 ][' prop' + index ] = item .lastMonthCount !== 0 ? (item .currentMonthCount / item .lastMonthCount ).toFixed (2 ) : ' NULL'
206
+ tableData [4 ][' prop' + index ] = item .lastYearCount !== 0 ? (item .currentMonthCount / item .lastYearCount ).toFixed (2 ) : ' NULL'
217
207
})
218
208
}
219
209
@@ -222,6 +212,5 @@ defineExpose({ loadData })
222
212
/** 初始化 */
223
213
onMounted (async () => {
224
214
await loadData ()
225
- init ()
226
215
})
227
216
</script >
0 commit comments