4
4
<el-card shadow =" never" >
5
5
<el-row >
6
6
<el-col :span =" 24" >
7
+ <el-button-group class =" mb-10px" >
8
+ <el-button type =" primary" @click =" handleActive(true)" >客户视角</el-button >
9
+ <el-button type =" primary" @click =" handleActive(false)" >动态视角</el-button >
10
+ </el-button-group >
7
11
<el-skeleton :loading =" loading" animated >
8
12
<Echart :height =" 500" :options =" echartsOption" />
9
13
</el-skeleton >
@@ -35,6 +39,7 @@ import { FunnelChart } from 'echarts/charts'
35
39
defineOptions ({ name: ' FunnelBusiness' })
36
40
const props = defineProps <{ queryParams: any }>() // 搜索参数
37
41
42
+ const active = ref (true )
38
43
const loading = ref (false ) // 加载中
39
44
const list = ref <CrmStatisticFunnelRespVO []>([]) // 列表的数据
40
45
@@ -101,6 +106,11 @@ const echartsOption = reactive<EChartsOption>({
101
106
]
102
107
}) as EChartsOption
103
108
109
+ const handleActive = async (val : boolean ) => {
110
+ active .value = val
111
+ await loadData ()
112
+ }
113
+
104
114
/** 获取统计数据 */
105
115
const loadData = async () => {
106
116
loading .value = true
@@ -117,13 +127,20 @@ const loadData = async () => {
117
127
) {
118
128
// tips:写死 value 值是为了保持漏斗顺序不变
119
129
const list: { value: number ; name: string }[] = []
120
- list .push ({ value: 60 , name: ` 客户-${data .customerCount || 0 }个 ` })
121
- list .push ({ value: 40 , name: ` 商机-${data .businessCount || 0 }个 ` })
122
- list .push ({ value: 20 , name: ` 赢单-${data .winCount || 0 }个 ` })
130
+ if (active .value ) {
131
+ list .push ({ value: 60 , name: ` 客户-${data .customerCount || 0 }个 ` })
132
+ list .push ({ value: 40 , name: ` 商机-${data .businessCount || 0 }个 ` })
133
+ list .push ({ value: 20 , name: ` 赢单-${data .businessWinCount || 0 }个 ` })
134
+ } else {
135
+ list .push ({ value: data .customerCount || 0 , name: ` 客户-${data .customerCount || 0 }个 ` })
136
+ list .push ({ value: data .businessCount || 0 , name: ` 商机-${data .businessCount || 0 }个 ` })
137
+ list .push ({ value: data .businessWinCount || 0 , name: ` 赢单-${data .businessWinCount || 0 }个 ` })
138
+ }
139
+
123
140
echartsOption .series [0 ][' data' ] = list
124
141
}
125
142
// 2.2 获取商机结束状态统计
126
- list .value = await StatisticFunnelApi .getBusinessEndStatusSummary (props .queryParams )
143
+ list .value = await StatisticFunnelApi .getBusinessSummaryByEndStatus (props .queryParams )
127
144
loading .value = false
128
145
}
129
146
defineExpose ({ loadData })
0 commit comments