CRM:优化【客户统计】的代码实现
This commit is contained in:
parent
23150fcfc3
commit
b51397fe19
@ -14,21 +14,21 @@ export interface CrmStatisticsCustomerSummaryByUserRespVO {
|
|||||||
receivablePrice: number
|
receivablePrice: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CrmStatisticsFollowupSummaryByDateRespVO {
|
export interface CrmStatisticsFollowUpSummaryByDateRespVO {
|
||||||
time: string
|
time: string
|
||||||
followupRecordCount: number
|
followUpRecordCount: number
|
||||||
followupCustomerCount: number
|
followUpCustomerCount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CrmStatisticsFollowupSummaryByUserRespVO {
|
export interface CrmStatisticsFollowUpSummaryByUserRespVO {
|
||||||
ownerUserName: string
|
ownerUserName: string
|
||||||
followupRecordCount: number
|
followupRecordCount: number
|
||||||
followupCustomerCount: number
|
followupCustomerCount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CrmStatisticsFollowupSummaryByTypeRespVO {
|
export interface CrmStatisticsFollowUpSummaryByTypeRespVO {
|
||||||
followupType: string
|
followUpType: string
|
||||||
followupRecordCount: number
|
followUpRecordCount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CrmStatisticsCustomerContractSummaryRespVO {
|
export interface CrmStatisticsCustomerContractSummaryRespVO {
|
||||||
@ -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 = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 2.1 客户跟进次数分析(按日期)
|
// 2.1 客户跟进次数分析(按日期)
|
||||||
getFollowupSummaryByDate: (params: any) => {
|
getFollowUpSummaryByDate: (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 客户跟进次数分析(按用户)
|
||||||
getFollowupSummaryByUser: (params: any) => {
|
getFollowUpSummaryByUser: (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 获取客户跟进方式统计数
|
||||||
getFollowupSummaryByType: (params: any) => {
|
getFollowUpSummaryByType: (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
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -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',
|
||||||
|
@ -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 @@
|
|||||||
label="下单日期"
|
label="下单日期"
|
||||||
align="center"
|
align="center"
|
||||||
prop="orderDate"
|
prop="orderDate"
|
||||||
:formatter="dateFormatter2"
|
:formatter="dateFormatter"
|
||||||
min-width="200"
|
min-width="200"
|
||||||
|
fixed="right"
|
||||||
/>
|
/>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -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>({
|
|||||||
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 数据
|
||||||
|
@ -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="followupRecordCount" min-width="200" />
|
<el-table-column label="跟进次数" align="right" prop="followUpRecordCount" min-width="200" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="跟进客户数"
|
label="跟进客户数"
|
||||||
align="right"
|
align="right"
|
||||||
prop="followupCustomerCount"
|
prop="followUpCustomerCount"
|
||||||
min-width="200"
|
min-width="200"
|
||||||
/>
|
/>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -25,8 +25,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import {
|
||||||
StatisticsCustomerApi,
|
StatisticsCustomerApi,
|
||||||
CrmStatisticsFollowupSummaryByDateRespVO,
|
CrmStatisticsFollowUpSummaryByDateRespVO,
|
||||||
CrmStatisticsFollowupSummaryByUserRespVO
|
CrmStatisticsFollowUpSummaryByUserRespVO
|
||||||
} 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' })
|
|||||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||||
|
|
||||||
const loading = ref(false) // 加载中
|
const loading = ref(false) // 加载中
|
||||||
const list = ref<CrmStatisticsFollowupSummaryByUserRespVO[]>([]) // 列表的数据
|
const list = ref<CrmStatisticsFollowUpSummaryByUserRespVO[]>([]) // 列表的数据
|
||||||
|
|
||||||
/** 柱状图配置:纵向 */
|
/** 柱状图配置:纵向 */
|
||||||
const echartsOption = reactive<EChartsOption>({
|
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 followupSummaryByDate = await StatisticsCustomerApi.getFollowupSummaryByDate(
|
const followUpSummaryByDate = await StatisticsCustomerApi.getFollowUpSummaryByDate(
|
||||||
props.queryParams
|
props.queryParams
|
||||||
)
|
)
|
||||||
const followupSummaryByUser = await StatisticsCustomerApi.getFollowupSummaryByUser(
|
const followUpSummaryByUser = await StatisticsCustomerApi.getFollowUpSummaryByUser(
|
||||||
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'] = followupSummaryByDate.map(
|
echartsOption.xAxis['data'] = followUpSummaryByDate.map(
|
||||||
(s: CrmStatisticsFollowupSummaryByDateRespVO) => s.time
|
(s: CrmStatisticsFollowUpSummaryByDateRespVO) => 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'] = followupSummaryByDate.map(
|
echartsOption.series[0]['data'] = followUpSummaryByDate.map(
|
||||||
(s: CrmStatisticsFollowupSummaryByDateRespVO) => s.followupCustomerCount
|
(s: CrmStatisticsFollowUpSummaryByDateRespVO) => s.followUpCustomerCount
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (echartsOption.series && echartsOption.series[1] && echartsOption.series[1]['data']) {
|
if (echartsOption.series && echartsOption.series[1] && echartsOption.series[1]['data']) {
|
||||||
echartsOption.series[1]['data'] = followupSummaryByDate.map(
|
echartsOption.series[1]['data'] = followUpSummaryByDate.map(
|
||||||
(s: CrmStatisticsFollowupSummaryByDateRespVO) => s.followupRecordCount
|
(s: CrmStatisticsFollowUpSummaryByDateRespVO) => s.followUpRecordCount
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// 2.2 更新列表数据
|
// 2.2 更新列表数据
|
||||||
list.value = followupSummaryByUser
|
list.value = followUpSummaryByUser
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
defineExpose({ loadData })
|
defineExpose({ loadData })
|
@ -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 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import {
|
||||||
StatisticsCustomerApi,
|
StatisticsCustomerApi,
|
||||||
CrmStatisticsFollowupSummaryByTypeRespVO
|
CrmStatisticsFollowUpSummaryByTypeRespVO
|
||||||
} 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<CrmStatisticsFollowupSummaryByTypeRespVO[]>([]) // 列表的数据
|
const list = ref<CrmStatisticsFollowUpSummaryByTypeRespVO[]>([]) // 列表的数据
|
||||||
|
|
||||||
/** 饼图配置 */
|
/** 饼图配置 */
|
||||||
const echartsOption = reactive<EChartsOption>({
|
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 followupSummaryByType = await StatisticsCustomerApi.getFollowupSummaryByType(
|
const followUpSummaryByType = await StatisticsCustomerApi.getFollowUpSummaryByType(
|
||||||
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'] = followupSummaryByType.map(
|
echartsOption.series[0]['data'] = followUpSummaryByType.map(
|
||||||
(r: CrmStatisticsFollowupSummaryByTypeRespVO) => {
|
(row: CrmStatisticsFollowUpSummaryByTypeRespVO) => {
|
||||||
return {
|
return {
|
||||||
name: r.followupType,
|
name: getDictLabel(DICT_TYPE.CRM_FOLLOW_UP_TYPE, row.followUpType),
|
||||||
value: r.followupRecordCount
|
value: row.followUpRecordCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// 2.2 更新列表数据
|
// 2.2 更新列表数据
|
||||||
const totalCount = sumBy(followupSummaryByType, 'followupRecordCount')
|
const totalCount = sumBy(followUpSummaryByType, 'followUpRecordCount')
|
||||||
list.value = followupSummaryByType.map((r: CrmStatisticsFollowupSummaryByTypeRespVO) => {
|
list.value = followUpSummaryByType.map((row: CrmStatisticsFollowUpSummaryByTypeRespVO) => {
|
||||||
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
|
@ -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 @@
|
|||||||
: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 @@
|
|||||||
<CustomerSummary :query-params="queryParams" ref="customerSummaryRef" />
|
<CustomerSummary :query-params="queryParams" ref="customerSummaryRef" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<!-- 客户跟进次数分析 -->
|
<!-- 客户跟进次数分析 -->
|
||||||
<el-tab-pane label="客户跟进次数分析" name="followupSummary" lazy>
|
<el-tab-pane label="客户跟进次数分析" name="followUpSummary" lazy>
|
||||||
<CustomerFollowupSummary :query-params="queryParams" ref="followupSummaryRef" />
|
<CustomerFollowUpSummary :query-params="queryParams" ref="followUpSummaryRef" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<!-- 客户跟进方式分析 -->
|
<!-- 客户跟进方式分析 -->
|
||||||
<el-tab-pane label="客户跟进方式分析" name="followupType" lazy>
|
<el-tab-pane label="客户跟进方式分析" name="followUpType" lazy>
|
||||||
<CustomerFollowupType :query-params="queryParams" ref="followupTypeRef" />
|
<CustomerFollowUpType :query-params="queryParams" ref="followUpTypeRef" />
|
||||||
</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'
|
|||||||
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 CustomerFollowupSummary from './components/CustomerFollowupSummary.vue'
|
import CustomerFollowUpSummary from './components/CustomerFollowUpSummary.vue'
|
||||||
import CustomerFollowupType from './components/CustomerFollowupType.vue'
|
import CustomerFollowUpType from './components/CustomerFollowUpType.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 { DATE_INTERVAL_OPTIONS, CUSTOMER_INTERVAL } from '@/api/crm/statistics/customer'
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
|
|
||||||
defineOptions({ name: 'CrmStatisticsCustomer' })
|
defineOptions({ name: 'CrmStatisticsCustomer' })
|
||||||
|
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
intervalType: 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({
|
|||||||
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 = () => {
|
|||||||
case 'customerSummary':
|
case 'customerSummary':
|
||||||
customerSummaryRef.value?.loadData?.()
|
customerSummaryRef.value?.loadData?.()
|
||||||
break
|
break
|
||||||
case 'followupSummary':
|
case 'followUpSummary':
|
||||||
followupSummaryRef.value?.loadData?.()
|
followUpSummaryRef.value?.loadData?.()
|
||||||
break
|
break
|
||||||
case 'followupType':
|
case 'followUpType':
|
||||||
followupTypeRef.value?.loadData?.()
|
followUpTypeRef.value?.loadData?.()
|
||||||
break
|
break
|
||||||
case 'conversionStat':
|
case 'conversionStat':
|
||||||
conversionStatRef.value?.loadData?.()
|
conversionStatRef.value?.loadData?.()
|
||||||
@ -159,7 +155,7 @@ const handleQuery = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当 activeTab 改变时,刷新当前活动的 tab
|
/** 当 activeTab 改变时,刷新当前活动的 tab */
|
||||||
watch(activeTab, () => {
|
watch(activeTab, () => {
|
||||||
handleQuery()
|
handleQuery()
|
||||||
})
|
})
|
||||||
@ -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())
|
||||||
|
Loading…
Reference in New Issue
Block a user