Skip to content

Commit 6772568

Browse files
committed
crm:code review 客户画像
1 parent 8926dd1 commit 6772568

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

src/views/crm/statistics/portrait/components/CustomerAddress.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
StatisticsPortraitApi
2626
} from '@/api/crm/statistics/portrait'
2727
28+
// TODO @puhui999:address 换成 area 会更合适哈,
2829
defineOptions({ name: 'CustomerAddress' })
2930
const props = defineProps<{ queryParams: any }>() // 搜索参数
3031
@@ -34,7 +35,7 @@ echarts?.registerMap('china', china as any)
3435
const loading = ref(false) // 加载中
3536
const areaStatisticsList = ref<CrmStatisticCustomerAreaRespVO[]>([]) // 列表的数据
3637
37-
/** 地图配置 */
38+
/** 地图配置(全部客户) */
3839
const echartsOption = reactive<EChartsOption>({
3940
title: {
4041
text: '全部客户',
@@ -66,7 +67,7 @@ const echartsOption = reactive<EChartsOption>({
6667
]
6768
}) as EChartsOption
6869
69-
/** 地图配置 */
70+
/** 地图配置(成交客户) */
7071
const echartsOption2 = reactive<EChartsOption>({
7172
title: {
7273
text: '成交客户',
@@ -106,7 +107,7 @@ const loadData = async () => {
106107
areaStatisticsList.value = areaList.map((item: CrmStatisticCustomerAreaRespVO) => {
107108
return {
108109
...item,
109-
areaName: item.areaName
110+
areaName: item.areaName // TODO @puhui999:这里最好注释下原因哈
110111
.replace('维吾尔自治区', '')
111112
.replace('壮族自治区', '')
112113
.replace('回族自治区', '')
@@ -120,6 +121,7 @@ const loadData = async () => {
120121
}
121122
defineExpose({ loadData })
122123
124+
// TODO @puhui999:builder 改成 build 更合理哈
123125
const builderLeftMap = () => {
124126
let min = 0
125127
let max = 0
@@ -143,6 +145,7 @@ const builderRightMap = () => {
143145
echartsOption2.visualMap!['min'] = min
144146
echartsOption2.visualMap!['max'] = max
145147
}
148+
146149
/** 初始化 */
147150
onMounted(() => {
148151
loadData()

src/views/crm/statistics/portrait/components/CustomerIndustry.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const props = defineProps<{ queryParams: any }>() // 搜索参数
4848
const loading = ref(false) // 加载中
4949
const list = ref<CrmStatisticCustomerIndustryRespVO[]>([]) // 列表的数据
5050
51-
/** 饼图配置 */
51+
/** 饼图配置(全部客户) */
5252
const echartsOption = reactive<EChartsOption>({
5353
title: {
5454
text: '全部客户',
@@ -95,7 +95,8 @@ const echartsOption = reactive<EChartsOption>({
9595
}
9696
]
9797
}) as EChartsOption
98-
/** 饼图配置 */
98+
99+
/** 饼图配置(成交客户) */
99100
const echartsOption2 = reactive<EChartsOption>({
100101
title: {
101102
text: '成交客户',
@@ -172,9 +173,8 @@ const loadData = async () => {
172173
loading.value = false
173174
}
174175
defineExpose({ loadData })
175-
/**
176-
* 计算比例
177-
*/
176+
177+
/** 计算比例 */
178178
const calculateProportion = (sourceList: CrmStatisticCustomerIndustryRespVO[]) => {
179179
if (isEmpty(sourceList)) {
180180
return

src/views/crm/statistics/portrait/components/CustomerLevel.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const props = defineProps<{ queryParams: any }>() // 搜索参数
4848
const loading = ref(false) // 加载中
4949
const list = ref<CrmStatisticCustomerLevelRespVO[]>([]) // 列表的数据
5050
51-
/** 饼图配置 */
51+
/** 饼图配置(全部客户) */
5252
const echartsOption = reactive<EChartsOption>({
5353
title: {
5454
text: '全部客户',
@@ -95,7 +95,8 @@ const echartsOption = reactive<EChartsOption>({
9595
}
9696
]
9797
}) as EChartsOption
98-
/** 饼图配置 */
98+
99+
/** 饼图配置(成交客户) */
99100
const echartsOption2 = reactive<EChartsOption>({
100101
title: {
101102
text: '成交客户',
@@ -172,9 +173,8 @@ const loadData = async () => {
172173
loading.value = false
173174
}
174175
defineExpose({ loadData })
175-
/**
176-
* 计算比例
177-
*/
176+
177+
/** 计算比例 */
178178
const calculateProportion = (levelList: CrmStatisticCustomerLevelRespVO[]) => {
179179
if (isEmpty(levelList)) {
180180
return
@@ -184,6 +184,7 @@ const calculateProportion = (levelList: CrmStatisticCustomerLevelRespVO[]) => {
184184
const sumCustomerCount = getSumValue(list.map((item) => item.customerCount))
185185
const sumDealCount = getSumValue(list.map((item) => item.dealCount))
186186
list.forEach((item) => {
187+
// TODO @puhui999:可以使用 erpCalculatePercentage 方法
187188
item.levelPortion =
188189
item.customerCount === 0 ? 0 : ((item.customerCount / sumCustomerCount) * 100).toFixed(2)
189190
item.dealPortion = item.dealCount === 0 ? 0 : ((item.dealCount / sumDealCount) * 100).toFixed(2)

src/views/crm/statistics/portrait/components/CustomerSource.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const props = defineProps<{ queryParams: any }>() // 搜索参数
4848
const loading = ref(false) // 加载中
4949
const list = ref<CrmStatisticCustomerSourceRespVO[]>([]) // 列表的数据
5050
51-
/** 饼图配置 */
51+
/** 饼图配置(全部客户) */
5252
const echartsOption = reactive<EChartsOption>({
5353
title: {
5454
text: '全部客户',
@@ -95,7 +95,8 @@ const echartsOption = reactive<EChartsOption>({
9595
}
9696
]
9797
}) as EChartsOption
98-
/** 饼图配置 */
98+
99+
/** 饼图配置(成交客户) */
99100
const echartsOption2 = reactive<EChartsOption>({
100101
title: {
101102
text: '成交客户',
@@ -173,9 +174,7 @@ const loadData = async () => {
173174
}
174175
defineExpose({ loadData })
175176
176-
/**
177-
* 计算比例
178-
*/
177+
/** 计算比例 */
179178
const calculateProportion = (sourceList: CrmStatisticCustomerSourceRespVO[]) => {
180179
if (isEmpty(sourceList)) {
181180
return

src/views/crm/statistics/portrait/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ import * as UserApi from '@/api/system/user'
8585
import { useUserStore } from '@/store/modules/user'
8686
import { beginOfDay, defaultShortcuts, endOfDay, formatDate } from '@/utils/formatTime'
8787
import { defaultProps, handleTree } from '@/utils/tree'
88+
// TODO @puhui999:最好命名带上模块名,如:CrmStatisticsPortrait
8889
import CustomerAddress from './components/CustomerAddress.vue'
8990
import CustomerIndustry from './components/CustomerIndustry.vue'
9091
import CustomerSource from './components/CustomerSource.vue'

0 commit comments

Comments
 (0)