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