@@ -134,81 +134,109 @@ watch(
134
134
)
135
135
/** 柱状图配置:纵向 */
136
136
const echartsOption = reactive <EChartsOption >({
137
+ color: [' #6ca2ff' , ' #6ac9d7' , ' #ff7474' ],
138
+ tooltip: {
139
+ trigger: ' axis' ,
140
+ axisPointer: {
141
+ // 坐标轴指示器,坐标轴触发有效
142
+ type: ' shadow' // 默认为直线,可选为:'line' | 'shadow'
143
+ }
144
+ },
145
+ legend: {
146
+ data: [' 赢单转化率' , ' 商机总数' , ' 赢单商机数' ],
147
+ bottom: ' 0px' ,
148
+ itemWidth: 14
149
+ },
137
150
grid: {
138
- left: 30 ,
139
- right: 30 , // 让 X 轴右侧显示完整
140
- bottom: 20 ,
141
- containLabel: true
151
+ top: ' 40px' ,
152
+ left: ' 40px' ,
153
+ right: ' 40px' ,
154
+ bottom: ' 40px' ,
155
+ containLabel: true ,
156
+ borderColor: ' #fff'
142
157
},
143
- legend: {},
144
- series: [
145
- {
146
- name: ' 商机总数' ,
147
- type: ' bar' ,
148
- yAxisIndex: 0 ,
149
- data: []
150
- },
151
- {
152
- name: ' 赢单商机数' ,
153
- type: ' bar' ,
154
- yAxisIndex: 1 ,
155
- data: []
156
- },
158
+ xAxis: [
157
159
{
158
- name: ' 赢单转化率' ,
159
- type: ' bar' ,
160
- yAxisIndex: 2 ,
161
- data: []
162
- }
163
- ],
164
- toolbox: {
165
- feature: {
166
- dataZoom: {
167
- xAxisIndex: false // 数据区域缩放:Y 轴不缩放
160
+ type: ' category' ,
161
+ data: [],
162
+ axisTick: {
163
+ alignWithLabel: true ,
164
+ lineStyle: { width: 0 }
168
165
},
169
- brush : {
170
- type: [ ' lineX ' , ' clear ' ] // 区域缩放按钮、还原按钮
166
+ axisLabel : {
167
+ color: ' #BDBDBD '
171
168
},
172
- saveAsImage: { show: true , name: ' 商机转化率分析 ' } // 保存为图片
173
- }
174
- },
175
- tooltip: {
176
- trigger: ' axis ' ,
177
- axisPointer: {
178
- type: ' shadow '
169
+ /** 坐标轴轴线相关设置 */
170
+ axisLine: {
171
+ lineStyle: { color: ' #BDBDBD ' }
172
+ },
173
+ splitLine: {
174
+ show: false
175
+ }
179
176
}
180
- } ,
177
+ ] ,
181
178
yAxis: [
182
179
{
183
180
type: ' value' ,
184
- name: ' 商机总数' ,
185
- min: 0 ,
186
- minInterval: 1 // 显示整数刻度
187
- },
188
- {
189
- type: ' value' ,
190
- name: ' 赢单商机数' ,
191
- min: 0 ,
192
- minInterval: 1 // 显示整数刻度
181
+ name: ' 赢单转化率' ,
182
+ axisTick: {
183
+ alignWithLabel: true ,
184
+ lineStyle: { width: 0 }
185
+ },
186
+ axisLabel: {
187
+ color: ' #BDBDBD' ,
188
+ formatter: ' {value}%'
189
+ },
190
+ /** 坐标轴轴线相关设置 */
191
+ axisLine: {
192
+ lineStyle: { color: ' #BDBDBD' }
193
+ },
194
+ splitLine: {
195
+ show: false
196
+ }
193
197
},
194
198
{
195
199
type: ' value' ,
196
- name: ' 赢单转化率' ,
197
- min: 0 ,
198
- minInterval: 1 , // 显示整数刻度
200
+ name: ' 商机数' ,
201
+ axisTick: {
202
+ alignWithLabel: true ,
203
+ lineStyle: { width: 0 }
204
+ },
205
+ axisLabel: {
206
+ color: ' #BDBDBD' ,
207
+ formatter: ' {value}个'
208
+ },
209
+ /** 坐标轴轴线相关设置 */
210
+ axisLine: {
211
+ lineStyle: { color: ' #BDBDBD' }
212
+ },
199
213
splitLine: {
200
- lineStyle: {
201
- type: ' dotted' , // 右侧网格线虚化, 减少混乱
202
- opacity: 0.7
203
- }
214
+ show: false
204
215
}
205
216
}
206
217
],
207
- xAxis: {
208
- type: ' category' ,
209
- name: ' 日期' ,
210
- data: []
211
- }
218
+ series: [
219
+ {
220
+ name: ' 赢单转化率' ,
221
+ type: ' line' ,
222
+ yAxisIndex: 0 ,
223
+ data: []
224
+ },
225
+ {
226
+ name: ' 商机总数' ,
227
+ type: ' bar' ,
228
+ yAxisIndex: 1 ,
229
+ barWidth: 15 ,
230
+ data: []
231
+ },
232
+ {
233
+ name: ' 赢单商机数' ,
234
+ type: ' bar' ,
235
+ yAxisIndex: 1 ,
236
+ barWidth: 15 ,
237
+ data: []
238
+ }
239
+ ]
212
240
}) as EChartsOption
213
241
214
242
/** 获取数据并填充图表 */
@@ -218,27 +246,28 @@ const fetchAndFill = async () => {
218
246
props .queryParams
219
247
)
220
248
// 2.1 更新 Echarts 数据
221
- if (echartsOption .xAxis && echartsOption .xAxis [' data' ]) {
222
- echartsOption .xAxis [' data' ] = businessSummaryByDate .map (
249
+ if (echartsOption .xAxis && echartsOption .xAxis [0 ] && echartsOption . xAxis [ 0 ][ ' data' ]) {
250
+ echartsOption .xAxis [0 ][ ' data' ] = businessSummaryByDate .map (
223
251
(s : CrmStatisticsBusinessInversionRateSummaryByDateRespVO ) => s .time
224
252
)
225
253
}
226
254
if (echartsOption .series && echartsOption .series [0 ] && echartsOption .series [0 ][' data' ]) {
227
255
echartsOption .series [0 ][' data' ] = businessSummaryByDate .map (
228
- (s : CrmStatisticsBusinessInversionRateSummaryByDateRespVO ) => s .businessCount
256
+ (s : CrmStatisticsBusinessInversionRateSummaryByDateRespVO ) =>
257
+ erpCalculatePercentage (s .businessWinCount , s .businessCount )
229
258
)
230
259
}
231
260
if (echartsOption .series && echartsOption .series [1 ] && echartsOption .series [1 ][' data' ]) {
232
261
echartsOption .series [1 ][' data' ] = businessSummaryByDate .map (
233
- (s : CrmStatisticsBusinessInversionRateSummaryByDateRespVO ) => s .businessWinCount
262
+ (s : CrmStatisticsBusinessInversionRateSummaryByDateRespVO ) => s .businessCount
234
263
)
235
264
}
236
265
if (echartsOption .series && echartsOption .series [2 ] && echartsOption .series [2 ][' data' ]) {
237
266
echartsOption .series [2 ][' data' ] = businessSummaryByDate .map (
238
- (s : CrmStatisticsBusinessInversionRateSummaryByDateRespVO ) =>
239
- erpCalculatePercentage (s .businessWinCount , s .businessCount )
267
+ (s : CrmStatisticsBusinessInversionRateSummaryByDateRespVO ) => s .businessWinCount
240
268
)
241
269
}
270
+
242
271
// 2.2 更新列表数据
243
272
await getList ()
244
273
}
0 commit comments