Skip to content

Commit 4e640ba

Browse files
author
puhui999
committed
CRM: 新增商机赢单转化率分析
1 parent 014d1f8 commit 4e640ba

File tree

1 file changed

+94
-65
lines changed

1 file changed

+94
-65
lines changed

src/views/crm/statistics/funnel/components/BusinessInversionRateSummary.vue

Lines changed: 94 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -134,81 +134,109 @@ watch(
134134
)
135135
/** 柱状图配置:纵向 */
136136
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+
},
137150
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'
142157
},
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: [
157159
{
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 }
168165
},
169-
brush: {
170-
type: ['lineX', 'clear'] // 区域缩放按钮、还原按钮
166+
axisLabel: {
167+
color: '#BDBDBD'
171168
},
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+
}
179176
}
180-
},
177+
],
181178
yAxis: [
182179
{
183180
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+
}
193197
},
194198
{
195199
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+
},
199213
splitLine: {
200-
lineStyle: {
201-
type: 'dotted', // 右侧网格线虚化, 减少混乱
202-
opacity: 0.7
203-
}
214+
show: false
204215
}
205216
}
206217
],
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+
]
212240
}) as EChartsOption
213241
214242
/** 获取数据并填充图表 */
@@ -218,27 +246,28 @@ const fetchAndFill = async () => {
218246
props.queryParams
219247
)
220248
// 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(
223251
(s: CrmStatisticsBusinessInversionRateSummaryByDateRespVO) => s.time
224252
)
225253
}
226254
if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) {
227255
echartsOption.series[0]['data'] = businessSummaryByDate.map(
228-
(s: CrmStatisticsBusinessInversionRateSummaryByDateRespVO) => s.businessCount
256+
(s: CrmStatisticsBusinessInversionRateSummaryByDateRespVO) =>
257+
erpCalculatePercentage(s.businessWinCount, s.businessCount)
229258
)
230259
}
231260
if (echartsOption.series && echartsOption.series[1] && echartsOption.series[1]['data']) {
232261
echartsOption.series[1]['data'] = businessSummaryByDate.map(
233-
(s: CrmStatisticsBusinessInversionRateSummaryByDateRespVO) => s.businessWinCount
262+
(s: CrmStatisticsBusinessInversionRateSummaryByDateRespVO) => s.businessCount
234263
)
235264
}
236265
if (echartsOption.series && echartsOption.series[2] && echartsOption.series[2]['data']) {
237266
echartsOption.series[2]['data'] = businessSummaryByDate.map(
238-
(s: CrmStatisticsBusinessInversionRateSummaryByDateRespVO) =>
239-
erpCalculatePercentage(s.businessWinCount, s.businessCount)
267+
(s: CrmStatisticsBusinessInversionRateSummaryByDateRespVO) => s.businessWinCount
240268
)
241269
}
270+
242271
// 2.2 更新列表数据
243272
await getList()
244273
}

0 commit comments

Comments
 (0)