mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-07-25 08:15:07 +08:00
CRM:优化【客户统计】的代码实现
This commit is contained in:
@ -10,11 +10,39 @@
|
||||
<!-- 统计列表 -->
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="序号" align="center" type="index" width="80" />
|
||||
<el-table-column label="客户名称" align="center" prop="customerName" min-width="200" />
|
||||
<el-table-column label="序号" align="center" type="index" width="80" fixed="left" />
|
||||
<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="totalPrice" min-width="200" />
|
||||
<el-table-column label="回款金额" align="center" prop="receivablePrice" min-width="200" />
|
||||
<el-table-column
|
||||
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="creatorUserName" min-width="200" />
|
||||
<el-table-column
|
||||
@ -28,8 +56,9 @@
|
||||
label="下单日期"
|
||||
align="center"
|
||||
prop="orderDate"
|
||||
:formatter="dateFormatter2"
|
||||
:formatter="dateFormatter"
|
||||
min-width="200"
|
||||
fixed="right"
|
||||
/>
|
||||
</el-table>
|
||||
</el-card>
|
||||
@ -41,7 +70,9 @@ import {
|
||||
} from '@/api/crm/statistics/customer'
|
||||
import { EChartsOption } from 'echarts'
|
||||
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' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
@ -97,6 +128,7 @@ const echartsOption = reactive<EChartsOption>({
|
||||
const loadData = async () => {
|
||||
// 1. 加载统计数据
|
||||
loading.value = true
|
||||
// TODO @ddhb52:这里调用 StatisticsCustomerApi.getCustomerSummaryByDate 好像不太对???
|
||||
const customerCount = await StatisticsCustomerApi.getCustomerSummaryByDate(props.queryParams)
|
||||
const contractSummary = await StatisticsCustomerApi.getContractSummary(props.queryParams)
|
||||
// 2.1 更新 Echarts 数据
|
||||
|
@ -12,11 +12,11 @@
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<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="right" prop="followupRecordCount" min-width="200" />
|
||||
<el-table-column label="跟进次数" align="right" prop="followUpRecordCount" min-width="200" />
|
||||
<el-table-column
|
||||
label="跟进客户数"
|
||||
align="right"
|
||||
prop="followupCustomerCount"
|
||||
prop="followUpCustomerCount"
|
||||
min-width="200"
|
||||
/>
|
||||
</el-table>
|
||||
@ -25,8 +25,8 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
StatisticsCustomerApi,
|
||||
CrmStatisticsFollowupSummaryByDateRespVO,
|
||||
CrmStatisticsFollowupSummaryByUserRespVO
|
||||
CrmStatisticsFollowUpSummaryByDateRespVO,
|
||||
CrmStatisticsFollowUpSummaryByUserRespVO
|
||||
} from '@/api/crm/statistics/customer'
|
||||
import { EChartsOption } from 'echarts'
|
||||
|
||||
@ -34,7 +34,7 @@ defineOptions({ name: 'CustomerFollowupSummary' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<CrmStatisticsFollowupSummaryByUserRespVO[]>([]) // 列表的数据
|
||||
const list = ref<CrmStatisticsFollowUpSummaryByUserRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 柱状图配置:纵向 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
@ -89,30 +89,30 @@ const echartsOption = reactive<EChartsOption>({
|
||||
const loadData = async () => {
|
||||
// 1. 加载统计数据
|
||||
loading.value = true
|
||||
const followupSummaryByDate = await StatisticsCustomerApi.getFollowupSummaryByDate(
|
||||
const followUpSummaryByDate = await StatisticsCustomerApi.getFollowUpSummaryByDate(
|
||||
props.queryParams
|
||||
)
|
||||
const followupSummaryByUser = await StatisticsCustomerApi.getFollowupSummaryByUser(
|
||||
const followUpSummaryByUser = await StatisticsCustomerApi.getFollowUpSummaryByUser(
|
||||
props.queryParams
|
||||
)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.xAxis && echartsOption.xAxis['data']) {
|
||||
echartsOption.xAxis['data'] = followupSummaryByDate.map(
|
||||
(s: CrmStatisticsFollowupSummaryByDateRespVO) => s.time
|
||||
echartsOption.xAxis['data'] = followUpSummaryByDate.map(
|
||||
(s: CrmStatisticsFollowUpSummaryByDateRespVO) => s.time
|
||||
)
|
||||
}
|
||||
if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) {
|
||||
echartsOption.series[0]['data'] = followupSummaryByDate.map(
|
||||
(s: CrmStatisticsFollowupSummaryByDateRespVO) => s.followupCustomerCount
|
||||
echartsOption.series[0]['data'] = followUpSummaryByDate.map(
|
||||
(s: CrmStatisticsFollowUpSummaryByDateRespVO) => s.followUpCustomerCount
|
||||
)
|
||||
}
|
||||
if (echartsOption.series && echartsOption.series[1] && echartsOption.series[1]['data']) {
|
||||
echartsOption.series[1]['data'] = followupSummaryByDate.map(
|
||||
(s: CrmStatisticsFollowupSummaryByDateRespVO) => s.followupRecordCount
|
||||
echartsOption.series[1]['data'] = followUpSummaryByDate.map(
|
||||
(s: CrmStatisticsFollowUpSummaryByDateRespVO) => s.followUpRecordCount
|
||||
)
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
list.value = followupSummaryByUser
|
||||
list.value = followUpSummaryByUser
|
||||
loading.value = false
|
||||
}
|
||||
defineExpose({ loadData })
|
@ -11,8 +11,12 @@
|
||||
<el-card shadow="never" class="mt-16px">
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<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="followupRecordCount" min-width="200" />
|
||||
<el-table-column label="跟进方式" align="center" prop="followUpType" 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>
|
||||
</el-card>
|
||||
@ -20,16 +24,17 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
StatisticsCustomerApi,
|
||||
CrmStatisticsFollowupSummaryByTypeRespVO
|
||||
CrmStatisticsFollowUpSummaryByTypeRespVO
|
||||
} from '@/api/crm/statistics/customer'
|
||||
import { EChartsOption } from 'echarts'
|
||||
import { round, sumBy } from 'lodash-es'
|
||||
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
|
||||
|
||||
defineOptions({ name: 'CustomerFollowupType' })
|
||||
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
||||
|
||||
const loading = ref(false) // 加载中
|
||||
const list = ref<CrmStatisticsFollowupSummaryByTypeRespVO[]>([]) // 列表的数据
|
||||
const list = ref<CrmStatisticsFollowUpSummaryByTypeRespVO[]>([]) // 列表的数据
|
||||
|
||||
/** 饼图配置 */
|
||||
const echartsOption = reactive<EChartsOption>({
|
||||
@ -71,27 +76,26 @@ const echartsOption = reactive<EChartsOption>({
|
||||
const loadData = async () => {
|
||||
// 1. 加载统计数据
|
||||
loading.value = true
|
||||
const followupSummaryByType = await StatisticsCustomerApi.getFollowupSummaryByType(
|
||||
const followUpSummaryByType = await StatisticsCustomerApi.getFollowUpSummaryByType(
|
||||
props.queryParams
|
||||
)
|
||||
// 2.1 更新 Echarts 数据
|
||||
if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) {
|
||||
echartsOption.series[0]['data'] = followupSummaryByType.map(
|
||||
(r: CrmStatisticsFollowupSummaryByTypeRespVO) => {
|
||||
echartsOption.series[0]['data'] = followUpSummaryByType.map(
|
||||
(row: CrmStatisticsFollowUpSummaryByTypeRespVO) => {
|
||||
return {
|
||||
name: r.followupType,
|
||||
value: r.followupRecordCount
|
||||
name: getDictLabel(DICT_TYPE.CRM_FOLLOW_UP_TYPE, row.followUpType),
|
||||
value: row.followUpRecordCount
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
// 2.2 更新列表数据
|
||||
const totalCount = sumBy(followupSummaryByType, 'followupRecordCount')
|
||||
list.value = followupSummaryByType.map((r: CrmStatisticsFollowupSummaryByTypeRespVO) => {
|
||||
const totalCount = sumBy(followUpSummaryByType, 'followUpRecordCount')
|
||||
list.value = followUpSummaryByType.map((row: CrmStatisticsFollowUpSummaryByTypeRespVO) => {
|
||||
return {
|
||||
followupType: r.followupType,
|
||||
followupRecordCount: r.followupRecordCount,
|
||||
portion: round((r.followupRecordCount / totalCount) * 100, 2)
|
||||
...row,
|
||||
portion: round((row.followUpRecordCount / totalCount) * 100, 2)
|
||||
}
|
||||
})
|
||||
loading.value = false
|
Reference in New Issue
Block a user