Skip to content

Commit 64af029

Browse files
author
puhui999
committed
CRM: 完善用户画像数据统计
1 parent f6e4753 commit 64af029

File tree

8 files changed

+34
-36
lines changed

8 files changed

+34
-36
lines changed
File renamed without changes.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"private": false,
77
"scripts": {
88
"i": "pnpm install",
9-
"dev": "vite --mode local-dev",
9+
"local-server": "vite --mode local-dev",
1010
"dev-server": "vite --mode dev",
1111
"ts:check": "vue-tsc --noEmit",
12-
"build:local-dev": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode local-dev",
13-
"build:dev": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode local-dev",
12+
"build:local": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode local-dev",
13+
"build:dev": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode dev",
1414
"build:test": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode test",
1515
"build:stage": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode stage",
1616
"build:prod": "node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build --mode prod",

src/components/DictSelect/src/DictSelect.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import { getBoolDictOptions, getIntDictOptions, getStrDictOptions } from '@/util
3333
3434
// 接受父组件参数
3535
interface Props {
36-
modelValue?: any //
3736
dictType: string // 字典类型
3837
valueType: string // 字典值类型
3938
}

src/views/crm/statistics/portrait/components/CustomerAddress.vue renamed to src/views/crm/statistics/portrait/components/CrmStatisticsPortraitCustomerArea.vue

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ import {
2525
StatisticsPortraitApi
2626
} from '@/api/crm/statistics/portrait'
2727
28-
// TODO @puhui999:address 换成 area 会更合适哈,
29-
defineOptions({ name: 'CustomerAddress' })
28+
defineOptions({ name: 'CustomerArea' })
3029
const props = defineProps<{ queryParams: any }>() // 搜索参数
3130
3231
// 注册地图
@@ -107,22 +106,21 @@ const loadData = async () => {
107106
areaStatisticsList.value = areaList.map((item: CrmStatisticCustomerAreaRespVO) => {
108107
return {
109108
...item,
110-
areaName: item.areaName // TODO @puhui999:这里最好注释下原因哈
111-
.replace('维吾尔自治区', '')
112-
.replace('壮族自治区', '')
113-
.replace('回族自治区', '')
114-
.replace('自治区', '')
115-
.replace('', '')
109+
areaName: item.areaName // TODO @puhui999:这里最好注释下原因哈, 🤣 我从 mall copy 过来的
110+
// .replace('维吾尔自治区', '')
111+
// .replace('壮族自治区', '')
112+
// .replace('回族自治区', '')
113+
// .replace('自治区', '')
114+
// .replace('省', '')
116115
}
117116
})
118-
builderLeftMap()
119-
builderRightMap()
117+
buildLeftMap()
118+
buildRightMap()
120119
loading.value = false
121120
}
122121
defineExpose({ loadData })
123122
124-
// TODO @puhui999:builder 改成 build 更合理哈
125-
const builderLeftMap = () => {
123+
const buildLeftMap = () => {
126124
let min = 0
127125
let max = 0
128126
echartsOption.series![0].data = areaStatisticsList.value.map((item) => {
@@ -134,7 +132,7 @@ const builderLeftMap = () => {
134132
echartsOption.visualMap!['max'] = max
135133
}
136134
137-
const builderRightMap = () => {
135+
const buildRightMap = () => {
138136
let min = 0
139137
let max = 0
140138
echartsOption2.series![0].data = areaStatisticsList.value.map((item) => {

src/views/crm/statistics/portrait/components/CustomerIndustry.vue renamed to src/views/crm/statistics/portrait/components/CrmStatisticsPortraitCustomerIndustry.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
} from '@/api/crm/statistics/portrait'
4040
import { EChartsOption } from 'echarts'
4141
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
42-
import { getSumValue } from '@/utils'
42+
import { erpCalculatePercentage, getSumValue } from '@/utils'
4343
import { isEmpty } from '@/utils/is'
4444
4545
defineOptions({ name: 'CustomerIndustry' })
@@ -185,8 +185,9 @@ const calculateProportion = (sourceList: CrmStatisticCustomerIndustryRespVO[]) =
185185
const sumDealCount = getSumValue(list.map((item) => item.dealCount))
186186
list.forEach((item) => {
187187
item.industryPortion =
188-
item.customerCount === 0 ? 0 : ((item.customerCount / sumCustomerCount) * 100).toFixed(2)
189-
item.dealPortion = item.dealCount === 0 ? 0 : ((item.dealCount / sumDealCount) * 100).toFixed(2)
188+
item.customerCount === 0 ? 0 : erpCalculatePercentage(item.customerCount, sumCustomerCount)
189+
item.dealPortion =
190+
item.dealCount === 0 ? 0 : erpCalculatePercentage(item.dealCount, sumDealCount)
190191
})
191192
}
192193

src/views/crm/statistics/portrait/components/CustomerLevel.vue renamed to src/views/crm/statistics/portrait/components/CrmStatisticsPortraitCustomerLevel.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
} from '@/api/crm/statistics/portrait'
4040
import { EChartsOption } from 'echarts'
4141
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
42-
import { getSumValue } from '@/utils'
42+
import { erpCalculatePercentage, getSumValue } from '@/utils'
4343
import { isEmpty } from '@/utils/is'
4444
4545
defineOptions({ name: 'CustomerSource' })
@@ -184,10 +184,10 @@ 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 方法
188187
item.levelPortion =
189-
item.customerCount === 0 ? 0 : ((item.customerCount / sumCustomerCount) * 100).toFixed(2)
190-
item.dealPortion = item.dealCount === 0 ? 0 : ((item.dealCount / sumDealCount) * 100).toFixed(2)
188+
item.customerCount === 0 ? 0 : erpCalculatePercentage(item.customerCount, sumCustomerCount)
189+
item.dealPortion =
190+
item.dealCount === 0 ? 0 : erpCalculatePercentage(item.dealCount, sumDealCount)
191191
})
192192
}
193193

src/views/crm/statistics/portrait/components/CustomerSource.vue renamed to src/views/crm/statistics/portrait/components/CrmStatisticsPortraitCustomerSource.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
import { EChartsOption } from 'echarts'
4141
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
4242
import { isEmpty } from '@/utils/is'
43-
import { getSumValue } from '@/utils'
43+
import { erpCalculatePercentage, getSumValue } from '@/utils'
4444
4545
defineOptions({ name: 'CustomerSource' })
4646
const props = defineProps<{ queryParams: any }>() // 搜索参数
@@ -185,8 +185,9 @@ const calculateProportion = (sourceList: CrmStatisticCustomerSourceRespVO[]) =>
185185
const sumDealCount = getSumValue(list.map((item) => item.dealCount))
186186
list.forEach((item) => {
187187
item.sourcePortion =
188-
item.customerCount === 0 ? 0 : ((item.customerCount / sumCustomerCount) * 100).toFixed(2)
189-
item.dealPortion = item.dealCount === 0 ? 0 : ((item.dealCount / sumDealCount) * 100).toFixed(2)
188+
item.customerCount === 0 ? 0 : erpCalculatePercentage(item.customerCount, sumCustomerCount)
189+
item.dealPortion =
190+
item.dealCount === 0 ? 0 : erpCalculatePercentage(item.dealCount, sumDealCount)
190191
})
191192
}
192193

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@
6161
<el-tabs v-model="activeTab">
6262
<!-- 城市分布分析 -->
6363
<el-tab-pane label="城市分布分析" lazy name="addressRef">
64-
<CustomerAddress ref="addressRef" :query-params="queryParams" />
64+
<CrmStatisticsPortraitCustomerArea ref="addressRef" :query-params="queryParams" />
6565
</el-tab-pane>
6666
<!-- 客户级别分析 -->
6767
<el-tab-pane label="客户级别分析" lazy name="levelRef">
68-
<CustomerLevel ref="levelRef" :query-params="queryParams" />
68+
<CrmStatisticsPortraitCustomerLevel ref="levelRef" :query-params="queryParams" />
6969
</el-tab-pane>
7070
<!-- 客户来源分析 -->
7171
<el-tab-pane label="客户来源分析" lazy name="sourceRef">
72-
<CustomerSource ref="sourceRef" :query-params="queryParams" />
72+
<CrmStatisticsPortraitCustomerSource ref="sourceRef" :query-params="queryParams" />
7373
</el-tab-pane>
7474
<!-- 客户行业分析 -->
7575
<el-tab-pane label="客户行业分析" lazy name="industryRef">
76-
<CustomerIndustry ref="industryRef" :query-params="queryParams" />
76+
<CrmStatisticsPortraitCustomerIndustry ref="industryRef" :query-params="queryParams" />
7777
</el-tab-pane>
7878
</el-tabs>
7979
</el-col>
@@ -85,11 +85,10 @@ 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
89-
import CustomerAddress from './components/CustomerAddress.vue'
90-
import CustomerIndustry from './components/CustomerIndustry.vue'
91-
import CustomerSource from './components/CustomerSource.vue'
92-
import CustomerLevel from './components/CustomerLevel.vue'
88+
import CrmStatisticsPortraitCustomerArea from './components/CrmStatisticsPortraitCustomerArea.vue'
89+
import CrmStatisticsPortraitCustomerIndustry from './components/CrmStatisticsPortraitCustomerIndustry.vue'
90+
import CrmStatisticsPortraitCustomerSource from './components/CrmStatisticsPortraitCustomerSource.vue'
91+
import CrmStatisticsPortraitCustomerLevel from './components/CrmStatisticsPortraitCustomerLevel.vue'
9392
9493
defineOptions({ name: 'CrmStatisticsPortrait' })
9594

0 commit comments

Comments
 (0)