Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b51397fe
authored
Mar 30, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CRM:优化【客户统计】的代码实现
parent
23150fcf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
102 deletions
+119
-102
src/api/crm/statistics/customer.ts
+13
-29
src/utils/dict.ts
+1
-0
src/views/crm/statistics/customer/components/CustomerConversionStat.vue
+38
-6
src/views/crm/statistics/customer/components/CustomerFollowUpSummary.vue
+14
-14
src/views/crm/statistics/customer/components/CustomerFollowUpType.vue
+18
-14
src/views/crm/statistics/customer/index.vue
+35
-39
No files found.
src/api/crm/statistics/customer.ts
View file @
b51397fe
...
@@ -14,21 +14,21 @@ export interface CrmStatisticsCustomerSummaryByUserRespVO {
...
@@ -14,21 +14,21 @@ export interface CrmStatisticsCustomerSummaryByUserRespVO {
receivablePrice
:
number
receivablePrice
:
number
}
}
export
interface
CrmStatisticsFollow
u
pSummaryByDateRespVO
{
export
interface
CrmStatisticsFollow
U
pSummaryByDateRespVO
{
time
:
string
time
:
string
follow
u
pRecordCount
:
number
follow
U
pRecordCount
:
number
follow
u
pCustomerCount
:
number
follow
U
pCustomerCount
:
number
}
}
export
interface
CrmStatisticsFollow
u
pSummaryByUserRespVO
{
export
interface
CrmStatisticsFollow
U
pSummaryByUserRespVO
{
ownerUserName
:
string
ownerUserName
:
string
followupRecordCount
:
number
followupRecordCount
:
number
followupCustomerCount
:
number
followupCustomerCount
:
number
}
}
export
interface
CrmStatisticsFollow
u
pSummaryByTypeRespVO
{
export
interface
CrmStatisticsFollow
U
pSummaryByTypeRespVO
{
follow
u
pType
:
string
follow
U
pType
:
string
follow
u
pRecordCount
:
number
follow
U
pRecordCount
:
number
}
}
export
interface
CrmStatisticsCustomerContractSummaryRespVO
{
export
interface
CrmStatisticsCustomerContractSummaryRespVO
{
...
@@ -55,22 +55,6 @@ export interface CrmStatisticsCustomerDealCycleByUserRespVO {
...
@@ -55,22 +55,6 @@ export interface CrmStatisticsCustomerDealCycleByUserRespVO {
customerDealCount
:
number
customerDealCount
:
number
}
}
export
const
DATE_INTERVAL_OPTIONS
=
[
{
value
:
1
,
name
:
'今天'
},
{
value
:
2
,
name
:
'昨天'
},
{
value
:
3
,
name
:
'本周'
},
{
value
:
4
,
name
:
'上周'
},
{
value
:
5
,
name
:
'本月'
},
{
value
:
6
,
name
:
'上月'
},
{
value
:
7
,
name
:
'本季度'
},
{
value
:
8
,
name
:
'上季度'
},
{
value
:
9
,
name
:
'本年'
},
{
value
:
10
,
name
:
'去年'
},
{
value
:
11
,
name
:
'自定义'
}
]
export
const
CUSTOMER_INTERVAL
=
11
// 客户分析 API
// 客户分析 API
export
const
StatisticsCustomerApi
=
{
export
const
StatisticsCustomerApi
=
{
// 1.1 客户总量分析(按日期)
// 1.1 客户总量分析(按日期)
...
@@ -88,23 +72,23 @@ export const StatisticsCustomerApi = {
...
@@ -88,23 +72,23 @@ export const StatisticsCustomerApi = {
})
})
},
},
// 2.1 客户跟进次数分析(按日期)
// 2.1 客户跟进次数分析(按日期)
getFollow
u
pSummaryByDate
:
(
params
:
any
)
=>
{
getFollow
U
pSummaryByDate
:
(
params
:
any
)
=>
{
return
request
.
get
({
return
request
.
get
({
url
:
'/crm/statistics-customer/get-followup-summary-by-date'
,
url
:
'/crm/statistics-customer/get-follow
-
up-summary-by-date'
,
params
params
})
})
},
},
// 2.2 客户跟进次数分析(按用户)
// 2.2 客户跟进次数分析(按用户)
getFollow
u
pSummaryByUser
:
(
params
:
any
)
=>
{
getFollow
U
pSummaryByUser
:
(
params
:
any
)
=>
{
return
request
.
get
({
return
request
.
get
({
url
:
'/crm/statistics-customer/get-followup-summary-by-user'
,
url
:
'/crm/statistics-customer/get-follow
-
up-summary-by-user'
,
params
params
})
})
},
},
// 3.1 获取客户跟进方式统计数
// 3.1 获取客户跟进方式统计数
getFollow
u
pSummaryByType
:
(
params
:
any
)
=>
{
getFollow
U
pSummaryByType
:
(
params
:
any
)
=>
{
return
request
.
get
({
return
request
.
get
({
url
:
'/crm/statistics-customer/get-followup-summary-by-type'
,
url
:
'/crm/statistics-customer/get-follow
-
up-summary-by-type'
,
params
params
})
})
},
},
...
...
src/utils/dict.ts
View file @
b51397fe
...
@@ -104,6 +104,7 @@ export enum DICT_TYPE {
...
@@ -104,6 +104,7 @@ export enum DICT_TYPE {
USER_TYPE
=
'user_type'
,
USER_TYPE
=
'user_type'
,
COMMON_STATUS
=
'common_status'
,
COMMON_STATUS
=
'common_status'
,
TERMINAL
=
'terminal'
,
// 终端
TERMINAL
=
'terminal'
,
// 终端
DATE_INTERVAL
=
'date_interval'
,
// 数据间隔
// ========== SYSTEM 模块 ==========
// ========== SYSTEM 模块 ==========
SYSTEM_USER_SEX
=
'system_user_sex'
,
SYSTEM_USER_SEX
=
'system_user_sex'
,
...
...
src/views/crm/statistics/customer/components/CustomerConversionStat.vue
View file @
b51397fe
...
@@ -10,11 +10,39 @@
...
@@ -10,11 +10,39 @@
<!-- 统计列表 -->
<!-- 统计列表 -->
<el-card
shadow=
"never"
class=
"mt-16px"
>
<el-card
shadow=
"never"
class=
"mt-16px"
>
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
label=
"序号"
align=
"center"
type=
"index"
width=
"80"
/>
<el-table-column
label=
"序号"
align=
"center"
type=
"index"
width=
"80"
fixed=
"left"
/>
<el-table-column
label=
"客户名称"
align=
"center"
prop=
"customerName"
min-width=
"200"
/>
<el-table-column
label=
"客户名称"
align=
"center"
prop=
"customerName"
min-width=
"200"
fixed=
"left"
/>
<el-table-column
label=
"合同名称"
align=
"center"
prop=
"contractName"
min-width=
"200"
/>
<el-table-column
label=
"合同名称"
align=
"center"
prop=
"contractName"
min-width=
"200"
/>
<el-table-column
label=
"合同总金额"
align=
"center"
prop=
"totalPrice"
min-width=
"200"
/>
<el-table-column
<el-table-column
label=
"回款金额"
align=
"center"
prop=
"receivablePrice"
min-width=
"200"
/>
label=
"合同总金额"
align=
"center"
prop=
"totalPrice"
min-width=
"200"
:formatter=
"erpPriceTableColumnFormatter"
/>
<el-table-column
label=
"回款金额"
align=
"center"
prop=
"receivablePrice"
min-width=
"200"
:formatter=
"erpPriceTableColumnFormatter"
/>
<el-table-column
align=
"center"
label=
"客户来源"
prop=
"source"
width=
"100"
>
<template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.CRM_CUSTOMER_SOURCE"
:value=
"scope.row.source"
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"客户行业"
prop=
"industryId"
width=
"100"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.CRM_CUSTOMER_INDUSTRY"
:value=
"scope.row.industryId"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"负责人"
align=
"center"
prop=
"ownerUserName"
min-width=
"200"
/>
<el-table-column
label=
"负责人"
align=
"center"
prop=
"ownerUserName"
min-width=
"200"
/>
<el-table-column
label=
"创建人"
align=
"center"
prop=
"creatorUserName"
min-width=
"200"
/>
<el-table-column
label=
"创建人"
align=
"center"
prop=
"creatorUserName"
min-width=
"200"
/>
<el-table-column
<el-table-column
...
@@ -28,8 +56,9 @@
...
@@ -28,8 +56,9 @@
label=
"下单日期"
label=
"下单日期"
align=
"center"
align=
"center"
prop=
"orderDate"
prop=
"orderDate"
:formatter=
"dateFormatter
2
"
:formatter=
"dateFormatter"
min-width=
"200"
min-width=
"200"
fixed=
"right"
/>
/>
</el-table>
</el-table>
</el-card>
</el-card>
...
@@ -41,7 +70,9 @@ import {
...
@@ -41,7 +70,9 @@ import {
}
from
'@/api/crm/statistics/customer'
}
from
'@/api/crm/statistics/customer'
import
{
EChartsOption
}
from
'echarts'
import
{
EChartsOption
}
from
'echarts'
import
{
round
}
from
'lodash-es'
import
{
round
}
from
'lodash-es'
import
{
dateFormatter
,
dateFormatter2
}
from
'@/utils/formatTime'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
erpPriceTableColumnFormatter
}
from
'@/utils'
import
{
DICT_TYPE
}
from
'@/utils/dict'
defineOptions
({
name
:
'CustomerConversionStat'
})
defineOptions
({
name
:
'CustomerConversionStat'
})
const
props
=
defineProps
<
{
queryParams
:
any
}
>
()
// 搜索参数
const
props
=
defineProps
<
{
queryParams
:
any
}
>
()
// 搜索参数
...
@@ -97,6 +128,7 @@ const echartsOption = reactive<EChartsOption>({
...
@@ -97,6 +128,7 @@ const echartsOption = reactive<EChartsOption>({
const
loadData
=
async
()
=>
{
const
loadData
=
async
()
=>
{
// 1. 加载统计数据
// 1. 加载统计数据
loading
.
value
=
true
loading
.
value
=
true
// TODO @ddhb52:这里调用 StatisticsCustomerApi.getCustomerSummaryByDate 好像不太对???
const
customerCount
=
await
StatisticsCustomerApi
.
getCustomerSummaryByDate
(
props
.
queryParams
)
const
customerCount
=
await
StatisticsCustomerApi
.
getCustomerSummaryByDate
(
props
.
queryParams
)
const
contractSummary
=
await
StatisticsCustomerApi
.
getContractSummary
(
props
.
queryParams
)
const
contractSummary
=
await
StatisticsCustomerApi
.
getContractSummary
(
props
.
queryParams
)
// 2.1 更新 Echarts 数据
// 2.1 更新 Echarts 数据
...
...
src/views/crm/statistics/customer/components/CustomerFollow
u
pSummary.vue
→
src/views/crm/statistics/customer/components/CustomerFollow
U
pSummary.vue
View file @
b51397fe
...
@@ -12,11 +12,11 @@
...
@@ -12,11 +12,11 @@
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
label=
"序号"
align=
"center"
type=
"index"
width=
"80"
/>
<el-table-column
label=
"序号"
align=
"center"
type=
"index"
width=
"80"
/>
<el-table-column
label=
"员工姓名"
align=
"center"
prop=
"ownerUserName"
min-width=
"200"
/>
<el-table-column
label=
"员工姓名"
align=
"center"
prop=
"ownerUserName"
min-width=
"200"
/>
<el-table-column
label=
"跟进次数"
align=
"right"
prop=
"follow
u
pRecordCount"
min-width=
"200"
/>
<el-table-column
label=
"跟进次数"
align=
"right"
prop=
"follow
U
pRecordCount"
min-width=
"200"
/>
<el-table-column
<el-table-column
label=
"跟进客户数"
label=
"跟进客户数"
align=
"right"
align=
"right"
prop=
"follow
u
pCustomerCount"
prop=
"follow
U
pCustomerCount"
min-width=
"200"
min-width=
"200"
/>
/>
</el-table>
</el-table>
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
import
{
StatisticsCustomerApi
,
StatisticsCustomerApi
,
CrmStatisticsFollow
u
pSummaryByDateRespVO
,
CrmStatisticsFollow
U
pSummaryByDateRespVO
,
CrmStatisticsFollow
u
pSummaryByUserRespVO
CrmStatisticsFollow
U
pSummaryByUserRespVO
}
from
'@/api/crm/statistics/customer'
}
from
'@/api/crm/statistics/customer'
import
{
EChartsOption
}
from
'echarts'
import
{
EChartsOption
}
from
'echarts'
...
@@ -34,7 +34,7 @@ defineOptions({ name: 'CustomerFollowupSummary' })
...
@@ -34,7 +34,7 @@ defineOptions({ name: 'CustomerFollowupSummary' })
const
props
=
defineProps
<
{
queryParams
:
any
}
>
()
// 搜索参数
const
props
=
defineProps
<
{
queryParams
:
any
}
>
()
// 搜索参数
const
loading
=
ref
(
false
)
// 加载中
const
loading
=
ref
(
false
)
// 加载中
const
list
=
ref
<
CrmStatisticsFollow
u
pSummaryByUserRespVO
[]
>
([])
// 列表的数据
const
list
=
ref
<
CrmStatisticsFollow
U
pSummaryByUserRespVO
[]
>
([])
// 列表的数据
/** 柱状图配置:纵向 */
/** 柱状图配置:纵向 */
const
echartsOption
=
reactive
<
EChartsOption
>
({
const
echartsOption
=
reactive
<
EChartsOption
>
({
...
@@ -89,30 +89,30 @@ const echartsOption = reactive<EChartsOption>({
...
@@ -89,30 +89,30 @@ const echartsOption = reactive<EChartsOption>({
const
loadData
=
async
()
=>
{
const
loadData
=
async
()
=>
{
// 1. 加载统计数据
// 1. 加载统计数据
loading
.
value
=
true
loading
.
value
=
true
const
follow
upSummaryByDate
=
await
StatisticsCustomerApi
.
getFollowu
pSummaryByDate
(
const
follow
UpSummaryByDate
=
await
StatisticsCustomerApi
.
getFollowU
pSummaryByDate
(
props
.
queryParams
props
.
queryParams
)
)
const
follow
upSummaryByUser
=
await
StatisticsCustomerApi
.
getFollowu
pSummaryByUser
(
const
follow
UpSummaryByUser
=
await
StatisticsCustomerApi
.
getFollowU
pSummaryByUser
(
props
.
queryParams
props
.
queryParams
)
)
// 2.1 更新 Echarts 数据
// 2.1 更新 Echarts 数据
if
(
echartsOption
.
xAxis
&&
echartsOption
.
xAxis
[
'data'
])
{
if
(
echartsOption
.
xAxis
&&
echartsOption
.
xAxis
[
'data'
])
{
echartsOption
.
xAxis
[
'data'
]
=
follow
u
pSummaryByDate
.
map
(
echartsOption
.
xAxis
[
'data'
]
=
follow
U
pSummaryByDate
.
map
(
(
s
:
CrmStatisticsFollow
u
pSummaryByDateRespVO
)
=>
s
.
time
(
s
:
CrmStatisticsFollow
U
pSummaryByDateRespVO
)
=>
s
.
time
)
)
}
}
if
(
echartsOption
.
series
&&
echartsOption
.
series
[
0
]
&&
echartsOption
.
series
[
0
][
'data'
])
{
if
(
echartsOption
.
series
&&
echartsOption
.
series
[
0
]
&&
echartsOption
.
series
[
0
][
'data'
])
{
echartsOption
.
series
[
0
][
'data'
]
=
follow
u
pSummaryByDate
.
map
(
echartsOption
.
series
[
0
][
'data'
]
=
follow
U
pSummaryByDate
.
map
(
(
s
:
CrmStatisticsFollow
upSummaryByDateRespVO
)
=>
s
.
followu
pCustomerCount
(
s
:
CrmStatisticsFollow
UpSummaryByDateRespVO
)
=>
s
.
followU
pCustomerCount
)
)
}
}
if
(
echartsOption
.
series
&&
echartsOption
.
series
[
1
]
&&
echartsOption
.
series
[
1
][
'data'
])
{
if
(
echartsOption
.
series
&&
echartsOption
.
series
[
1
]
&&
echartsOption
.
series
[
1
][
'data'
])
{
echartsOption
.
series
[
1
][
'data'
]
=
follow
u
pSummaryByDate
.
map
(
echartsOption
.
series
[
1
][
'data'
]
=
follow
U
pSummaryByDate
.
map
(
(
s
:
CrmStatisticsFollow
upSummaryByDateRespVO
)
=>
s
.
followu
pRecordCount
(
s
:
CrmStatisticsFollow
UpSummaryByDateRespVO
)
=>
s
.
followU
pRecordCount
)
)
}
}
// 2.2 更新列表数据
// 2.2 更新列表数据
list
.
value
=
follow
u
pSummaryByUser
list
.
value
=
follow
U
pSummaryByUser
loading
.
value
=
false
loading
.
value
=
false
}
}
defineExpose
({
loadData
})
defineExpose
({
loadData
})
...
...
src/views/crm/statistics/customer/components/CustomerFollow
u
pType.vue
→
src/views/crm/statistics/customer/components/CustomerFollow
U
pType.vue
View file @
b51397fe
...
@@ -11,8 +11,12 @@
...
@@ -11,8 +11,12 @@
<el-card
shadow=
"never"
class=
"mt-16px"
>
<el-card
shadow=
"never"
class=
"mt-16px"
>
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
label=
"序号"
align=
"center"
type=
"index"
width=
"80"
/>
<el-table-column
label=
"序号"
align=
"center"
type=
"index"
width=
"80"
/>
<el-table-column
label=
"跟进方式"
align=
"center"
prop=
"followupType"
min-width=
"200"
/>
<el-table-column
label=
"跟进方式"
align=
"center"
prop=
"followUpType"
min-width=
"200"
>
<el-table-column
label=
"个数"
align=
"center"
prop=
"followupRecordCount"
min-width=
"200"
/>
<template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.CRM_FOLLOW_UP_TYPE"
:value=
"scope.row.followUpType"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"个数"
align=
"center"
prop=
"followUpRecordCount"
min-width=
"200"
/>
<el-table-column
label=
"占比(%)"
align=
"center"
prop=
"portion"
min-width=
"200"
/>
<el-table-column
label=
"占比(%)"
align=
"center"
prop=
"portion"
min-width=
"200"
/>
</el-table>
</el-table>
</el-card>
</el-card>
...
@@ -20,16 +24,17 @@
...
@@ -20,16 +24,17 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
import
{
StatisticsCustomerApi
,
StatisticsCustomerApi
,
CrmStatisticsFollow
u
pSummaryByTypeRespVO
CrmStatisticsFollow
U
pSummaryByTypeRespVO
}
from
'@/api/crm/statistics/customer'
}
from
'@/api/crm/statistics/customer'
import
{
EChartsOption
}
from
'echarts'
import
{
EChartsOption
}
from
'echarts'
import
{
round
,
sumBy
}
from
'lodash-es'
import
{
round
,
sumBy
}
from
'lodash-es'
import
{
DICT_TYPE
,
getDictLabel
}
from
'@/utils/dict'
defineOptions
({
name
:
'CustomerFollowupType'
})
defineOptions
({
name
:
'CustomerFollowupType'
})
const
props
=
defineProps
<
{
queryParams
:
any
}
>
()
// 搜索参数
const
props
=
defineProps
<
{
queryParams
:
any
}
>
()
// 搜索参数
const
loading
=
ref
(
false
)
// 加载中
const
loading
=
ref
(
false
)
// 加载中
const
list
=
ref
<
CrmStatisticsFollow
u
pSummaryByTypeRespVO
[]
>
([])
// 列表的数据
const
list
=
ref
<
CrmStatisticsFollow
U
pSummaryByTypeRespVO
[]
>
([])
// 列表的数据
/** 饼图配置 */
/** 饼图配置 */
const
echartsOption
=
reactive
<
EChartsOption
>
({
const
echartsOption
=
reactive
<
EChartsOption
>
({
...
@@ -71,27 +76,26 @@ const echartsOption = reactive<EChartsOption>({
...
@@ -71,27 +76,26 @@ const echartsOption = reactive<EChartsOption>({
const
loadData
=
async
()
=>
{
const
loadData
=
async
()
=>
{
// 1. 加载统计数据
// 1. 加载统计数据
loading
.
value
=
true
loading
.
value
=
true
const
follow
upSummaryByType
=
await
StatisticsCustomerApi
.
getFollowu
pSummaryByType
(
const
follow
UpSummaryByType
=
await
StatisticsCustomerApi
.
getFollowU
pSummaryByType
(
props
.
queryParams
props
.
queryParams
)
)
// 2.1 更新 Echarts 数据
// 2.1 更新 Echarts 数据
if
(
echartsOption
.
series
&&
echartsOption
.
series
[
0
]
&&
echartsOption
.
series
[
0
][
'data'
])
{
if
(
echartsOption
.
series
&&
echartsOption
.
series
[
0
]
&&
echartsOption
.
series
[
0
][
'data'
])
{
echartsOption
.
series
[
0
][
'data'
]
=
follow
u
pSummaryByType
.
map
(
echartsOption
.
series
[
0
][
'data'
]
=
follow
U
pSummaryByType
.
map
(
(
r
:
CrmStatisticsFollowu
pSummaryByTypeRespVO
)
=>
{
(
r
ow
:
CrmStatisticsFollowU
pSummaryByTypeRespVO
)
=>
{
return
{
return
{
name
:
r
.
followupType
,
name
:
getDictLabel
(
DICT_TYPE
.
CRM_FOLLOW_UP_TYPE
,
row
.
followUpType
)
,
value
:
r
.
followu
pRecordCount
value
:
r
ow
.
followU
pRecordCount
}
}
}
}
)
)
}
}
// 2.2 更新列表数据
// 2.2 更新列表数据
const
totalCount
=
sumBy
(
follow
upSummaryByType
,
'followu
pRecordCount'
)
const
totalCount
=
sumBy
(
follow
UpSummaryByType
,
'followU
pRecordCount'
)
list
.
value
=
follow
upSummaryByType
.
map
((
r
:
CrmStatisticsFollowu
pSummaryByTypeRespVO
)
=>
{
list
.
value
=
follow
UpSummaryByType
.
map
((
row
:
CrmStatisticsFollowU
pSummaryByTypeRespVO
)
=>
{
return
{
return
{
followupType
:
r
.
followupType
,
...
row
,
followupRecordCount
:
r
.
followupRecordCount
,
portion
:
round
((
row
.
followUpRecordCount
/
totalCount
)
*
100
,
2
)
portion
:
round
((
r
.
followupRecordCount
/
totalCount
)
*
100
,
2
)
}
}
})
})
loading
.
value
=
false
loading
.
value
=
false
...
...
src/views/crm/statistics/customer/index.vue
View file @
b51397fe
...
@@ -9,17 +9,7 @@
...
@@ -9,17 +9,7 @@
:inline=
"true"
:inline=
"true"
label-width=
"68px"
label-width=
"68px"
>
>
<el-form-item
label=
"间隔类型"
prop=
"intervalType"
>
<el-form-item
label=
"时间范围"
prop=
"orderDate"
>
<el-select
v-model=
"queryParams.intervalType"
class=
"!w-240px"
placeholder=
"间隔类型"
>
<el-option
v-for=
"(intervalType, index) in DATE_INTERVAL_OPTIONS"
:label=
"intervalType.name"
:value=
"intervalType.value"
:key=
"index"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"时间范围"
prop=
"orderDate"
v-show=
"queryParams.intervalType === CUSTOMER_INTERVAL"
>
<el-date-picker
<el-date-picker
v-model=
"queryParams.times"
v-model=
"queryParams.times"
:shortcuts=
"defaultShortcuts"
:shortcuts=
"defaultShortcuts"
...
@@ -31,6 +21,16 @@
...
@@ -31,6 +21,16 @@
:default-time=
"[new Date('1 00:00:00'), new Date('1 23:59:59')]"
:default-time=
"[new Date('1 00:00:00'), new Date('1 23:59:59')]"
/>
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"时间间隔"
prop=
"interval"
>
<el-select
v-model=
"queryParams.interval"
class=
"!w-240px"
placeholder=
"间隔类型"
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.DATE_INTERVAL)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"归属部门"
prop=
"deptId"
>
<el-form-item
label=
"归属部门"
prop=
"deptId"
>
<el-tree-select
<el-tree-select
v-model=
"queryParams.deptId"
v-model=
"queryParams.deptId"
...
@@ -68,12 +68,12 @@
...
@@ -68,12 +68,12 @@
<CustomerSummary
:query-params=
"queryParams"
ref=
"customerSummaryRef"
/>
<CustomerSummary
:query-params=
"queryParams"
ref=
"customerSummaryRef"
/>
</el-tab-pane>
</el-tab-pane>
<!-- 客户跟进次数分析 -->
<!-- 客户跟进次数分析 -->
<el-tab-pane
label=
"客户跟进次数分析"
name=
"follow
u
pSummary"
lazy
>
<el-tab-pane
label=
"客户跟进次数分析"
name=
"follow
U
pSummary"
lazy
>
<CustomerFollow
upSummary
:query-params=
"queryParams"
ref=
"followu
pSummaryRef"
/>
<CustomerFollow
UpSummary
:query-params=
"queryParams"
ref=
"followU
pSummaryRef"
/>
</el-tab-pane>
</el-tab-pane>
<!-- 客户跟进方式分析 -->
<!-- 客户跟进方式分析 -->
<el-tab-pane
label=
"客户跟进方式分析"
name=
"follow
u
pType"
lazy
>
<el-tab-pane
label=
"客户跟进方式分析"
name=
"follow
U
pType"
lazy
>
<CustomerFollow
upType
:query-params=
"queryParams"
ref=
"followu
pTypeRef"
/>
<CustomerFollow
UpType
:query-params=
"queryParams"
ref=
"followU
pTypeRef"
/>
</el-tab-pane>
</el-tab-pane>
<!-- 客户转化率分析 -->
<!-- 客户转化率分析 -->
<el-tab-pane
label=
"客户转化率分析"
name=
"conversionStat"
lazy
>
<el-tab-pane
label=
"客户转化率分析"
name=
"conversionStat"
lazy
>
...
@@ -94,16 +94,16 @@ import { useUserStore } from '@/store/modules/user'
...
@@ -94,16 +94,16 @@ import { useUserStore } from '@/store/modules/user'
import
{
beginOfDay
,
defaultShortcuts
,
endOfDay
,
formatDate
}
from
'@/utils/formatTime'
import
{
beginOfDay
,
defaultShortcuts
,
endOfDay
,
formatDate
}
from
'@/utils/formatTime'
import
{
defaultProps
,
handleTree
}
from
'@/utils/tree'
import
{
defaultProps
,
handleTree
}
from
'@/utils/tree'
import
CustomerSummary
from
'./components/CustomerSummary.vue'
import
CustomerSummary
from
'./components/CustomerSummary.vue'
import
CustomerFollow
upSummary
from
'./components/CustomerFollowu
pSummary.vue'
import
CustomerFollow
UpSummary
from
'./components/CustomerFollowU
pSummary.vue'
import
CustomerFollow
upType
from
'./components/CustomerFollowu
pType.vue'
import
CustomerFollow
UpType
from
'./components/CustomerFollowU
pType.vue'
import
CustomerConversionStat
from
'./components/CustomerConversionStat.vue'
import
CustomerConversionStat
from
'./components/CustomerConversionStat.vue'
import
CustomerDealCycle
from
'./components/CustomerDealCycle.vue'
import
CustomerDealCycle
from
'./components/CustomerDealCycle.vue'
import
{
D
ATE_INTERVAL_OPTIONS
,
CUSTOMER_INTERVAL
}
from
'@/api/crm/statistics/customer
'
import
{
D
ICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict
'
defineOptions
({
name
:
'CrmStatisticsCustomer'
})
defineOptions
({
name
:
'CrmStatisticsCustomer'
})
const
queryParams
=
reactive
({
const
queryParams
=
reactive
({
interval
Type
:
CUSTOMER_INTERVAL
,
interval
:
1
,
deptId
:
useUserStore
().
getUser
.
deptId
,
deptId
:
useUserStore
().
getUser
.
deptId
,
userId
:
undefined
,
userId
:
undefined
,
times
:
[
times
:
[
...
@@ -116,27 +116,23 @@ const queryParams = reactive({
...
@@ -116,27 +116,23 @@ const queryParams = reactive({
const
queryFormRef
=
ref
()
// 搜索的表单
const
queryFormRef
=
ref
()
// 搜索的表单
const
deptList
=
ref
<
Tree
[]
>
([])
// 部门树形结构
const
deptList
=
ref
<
Tree
[]
>
([])
// 部门树形结构
const
userList
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 全量用户清单
const
userList
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 全量用户清单
// 根据选择的部门筛选员工清单
/** 根据选择的部门筛选员工清单 */
const
userListByDeptId
=
computed
(()
=>
const
userListByDeptId
=
computed
(()
=>
queryParams
.
deptId
queryParams
.
deptId
?
userList
.
value
.
filter
((
u
:
UserApi
.
UserVO
)
=>
u
.
deptId
===
queryParams
.
deptId
)
?
userList
.
value
.
filter
((
u
:
UserApi
.
UserVO
)
=>
u
.
deptId
===
queryParams
.
deptId
)
:
[]
:
[]
)
)
// 活跃标签
//
const
activeTab
=
ref
(
'customerSummary'
)
const
activeTab
=
ref
(
'customerSummary'
)
// 活跃标签
// 1.客户总量分析
const
customerSummaryRef
=
ref
()
// 1. 客户总量分析
const
customerSummaryRef
=
ref
()
const
followUpSummaryRef
=
ref
()
// 2. 客户跟进次数分析
// 2.客户跟进次数分析
const
followUpTypeRef
=
ref
()
// 3. 客户跟进方式分析
const
followupSummaryRef
=
ref
()
const
conversionStatRef
=
ref
()
// 4. 客户转化率分析
// 3.客户跟进方式分析
// 5. TODO 公海客户分析
const
followupTypeRef
=
ref
()
// 4.客户转化率分析
const
conversionStatRef
=
ref
()
// 5.公海客户分析
// 缺 crm_owner_record 表
// 缺 crm_owner_record 表
// 6.成交周期分析
const
dealCycleRef
=
ref
()
// 6. 成交周期分析
const
dealCycleRef
=
ref
()
/** 搜索按钮操作 */
/** 搜索按钮操作 */
const
handleQuery
=
()
=>
{
const
handleQuery
=
()
=>
{
...
@@ -144,11 +140,11 @@ const handleQuery = () => {
...
@@ -144,11 +140,11 @@ const handleQuery = () => {
case
'customerSummary'
:
case
'customerSummary'
:
customerSummaryRef
.
value
?.
loadData
?.()
customerSummaryRef
.
value
?.
loadData
?.()
break
break
case
'follow
u
pSummary'
:
case
'follow
U
pSummary'
:
follow
u
pSummaryRef
.
value
?.
loadData
?.()
follow
U
pSummaryRef
.
value
?.
loadData
?.()
break
break
case
'follow
u
pType'
:
case
'follow
U
pType'
:
follow
u
pTypeRef
.
value
?.
loadData
?.()
follow
U
pTypeRef
.
value
?.
loadData
?.()
break
break
case
'conversionStat'
:
case
'conversionStat'
:
conversionStatRef
.
value
?.
loadData
?.()
conversionStatRef
.
value
?.
loadData
?.()
...
@@ -159,7 +155,7 @@ const handleQuery = () => {
...
@@ -159,7 +155,7 @@ const handleQuery = () => {
}
}
}
}
/
/ 当 activeTab 改变时,刷新当前活动的 tab
/
** 当 activeTab 改变时,刷新当前活动的 tab */
watch
(
activeTab
,
()
=>
{
watch
(
activeTab
,
()
=>
{
handleQuery
()
handleQuery
()
})
})
...
@@ -170,7 +166,7 @@ const resetQuery = () => {
...
@@ -170,7 +166,7 @@ const resetQuery = () => {
handleQuery
()
handleQuery
()
}
}
/
/ 加载部门树
/
** 初始化 */
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
deptList
.
value
=
handleTree
(
await
DeptApi
.
getSimpleDeptList
())
deptList
.
value
=
handleTree
(
await
DeptApi
.
getSimpleDeptList
())
userList
.
value
=
handleTree
(
await
UserApi
.
getSimpleUserList
())
userList
.
value
=
handleTree
(
await
UserApi
.
getSimpleUserList
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment