From 6772568a5850c2f5dcb4e9204d80d581afc0279d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 5 Apr 2024 14:43:55 +0800 Subject: [PATCH] =?UTF-8?q?crm=EF=BC=9Acode=20review=20=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=94=BB=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../portrait/components/CustomerAddress.vue | 9 ++++++--- .../portrait/components/CustomerIndustry.vue | 10 +++++----- .../statistics/portrait/components/CustomerLevel.vue | 11 ++++++----- .../statistics/portrait/components/CustomerSource.vue | 9 ++++----- src/views/crm/statistics/portrait/index.vue | 1 + 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/views/crm/statistics/portrait/components/CustomerAddress.vue b/src/views/crm/statistics/portrait/components/CustomerAddress.vue index 7c23a338..f31c7963 100644 --- a/src/views/crm/statistics/portrait/components/CustomerAddress.vue +++ b/src/views/crm/statistics/portrait/components/CustomerAddress.vue @@ -25,6 +25,7 @@ import { StatisticsPortraitApi } from '@/api/crm/statistics/portrait' +// TODO @puhui999:address 换成 area 会更合适哈, defineOptions({ name: 'CustomerAddress' }) const props = defineProps<{ queryParams: any }>() // 搜索参数 @@ -34,7 +35,7 @@ echarts?.registerMap('china', china as any) const loading = ref(false) // 加载中 const areaStatisticsList = ref([]) // 列表的数据 -/** 地图配置 */ +/** 地图配置(全部客户) */ const echartsOption = reactive({ title: { text: '全部客户', @@ -66,7 +67,7 @@ const echartsOption = reactive({ ] }) as EChartsOption -/** 地图配置 */ +/** 地图配置(成交客户) */ const echartsOption2 = reactive({ title: { text: '成交客户', @@ -106,7 +107,7 @@ const loadData = async () => { areaStatisticsList.value = areaList.map((item: CrmStatisticCustomerAreaRespVO) => { return { ...item, - areaName: item.areaName + areaName: item.areaName // TODO @puhui999:这里最好注释下原因哈 .replace('维吾尔自治区', '') .replace('壮族自治区', '') .replace('回族自治区', '') @@ -120,6 +121,7 @@ const loadData = async () => { } defineExpose({ loadData }) +// TODO @puhui999:builder 改成 build 更合理哈 const builderLeftMap = () => { let min = 0 let max = 0 @@ -143,6 +145,7 @@ const builderRightMap = () => { echartsOption2.visualMap!['min'] = min echartsOption2.visualMap!['max'] = max } + /** 初始化 */ onMounted(() => { loadData() diff --git a/src/views/crm/statistics/portrait/components/CustomerIndustry.vue b/src/views/crm/statistics/portrait/components/CustomerIndustry.vue index 269c7ce3..d1f3c173 100644 --- a/src/views/crm/statistics/portrait/components/CustomerIndustry.vue +++ b/src/views/crm/statistics/portrait/components/CustomerIndustry.vue @@ -48,7 +48,7 @@ const props = defineProps<{ queryParams: any }>() // 搜索参数 const loading = ref(false) // 加载中 const list = ref([]) // 列表的数据 -/** 饼图配置 */ +/** 饼图配置(全部客户) */ const echartsOption = reactive({ title: { text: '全部客户', @@ -95,7 +95,8 @@ const echartsOption = reactive({ } ] }) as EChartsOption -/** 饼图配置 */ + +/** 饼图配置(成交客户) */ const echartsOption2 = reactive({ title: { text: '成交客户', @@ -172,9 +173,8 @@ const loadData = async () => { loading.value = false } defineExpose({ loadData }) -/** - * 计算比例 - */ + +/** 计算比例 */ const calculateProportion = (sourceList: CrmStatisticCustomerIndustryRespVO[]) => { if (isEmpty(sourceList)) { return diff --git a/src/views/crm/statistics/portrait/components/CustomerLevel.vue b/src/views/crm/statistics/portrait/components/CustomerLevel.vue index f3d9857e..2f81c0fc 100644 --- a/src/views/crm/statistics/portrait/components/CustomerLevel.vue +++ b/src/views/crm/statistics/portrait/components/CustomerLevel.vue @@ -48,7 +48,7 @@ const props = defineProps<{ queryParams: any }>() // 搜索参数 const loading = ref(false) // 加载中 const list = ref([]) // 列表的数据 -/** 饼图配置 */ +/** 饼图配置(全部客户) */ const echartsOption = reactive({ title: { text: '全部客户', @@ -95,7 +95,8 @@ const echartsOption = reactive({ } ] }) as EChartsOption -/** 饼图配置 */ + +/** 饼图配置(成交客户) */ const echartsOption2 = reactive({ title: { text: '成交客户', @@ -172,9 +173,8 @@ const loadData = async () => { loading.value = false } defineExpose({ loadData }) -/** - * 计算比例 - */ + +/** 计算比例 */ const calculateProportion = (levelList: CrmStatisticCustomerLevelRespVO[]) => { if (isEmpty(levelList)) { return @@ -184,6 +184,7 @@ const calculateProportion = (levelList: CrmStatisticCustomerLevelRespVO[]) => { const sumCustomerCount = getSumValue(list.map((item) => item.customerCount)) const sumDealCount = getSumValue(list.map((item) => item.dealCount)) list.forEach((item) => { + // TODO @puhui999:可以使用 erpCalculatePercentage 方法 item.levelPortion = item.customerCount === 0 ? 0 : ((item.customerCount / sumCustomerCount) * 100).toFixed(2) item.dealPortion = item.dealCount === 0 ? 0 : ((item.dealCount / sumDealCount) * 100).toFixed(2) diff --git a/src/views/crm/statistics/portrait/components/CustomerSource.vue b/src/views/crm/statistics/portrait/components/CustomerSource.vue index 1f7321cc..af1708fc 100644 --- a/src/views/crm/statistics/portrait/components/CustomerSource.vue +++ b/src/views/crm/statistics/portrait/components/CustomerSource.vue @@ -48,7 +48,7 @@ const props = defineProps<{ queryParams: any }>() // 搜索参数 const loading = ref(false) // 加载中 const list = ref([]) // 列表的数据 -/** 饼图配置 */ +/** 饼图配置(全部客户) */ const echartsOption = reactive({ title: { text: '全部客户', @@ -95,7 +95,8 @@ const echartsOption = reactive({ } ] }) as EChartsOption -/** 饼图配置 */ + +/** 饼图配置(成交客户) */ const echartsOption2 = reactive({ title: { text: '成交客户', @@ -173,9 +174,7 @@ const loadData = async () => { } defineExpose({ loadData }) -/** - * 计算比例 - */ +/** 计算比例 */ const calculateProportion = (sourceList: CrmStatisticCustomerSourceRespVO[]) => { if (isEmpty(sourceList)) { return diff --git a/src/views/crm/statistics/portrait/index.vue b/src/views/crm/statistics/portrait/index.vue index c7fc8437..88793837 100644 --- a/src/views/crm/statistics/portrait/index.vue +++ b/src/views/crm/statistics/portrait/index.vue @@ -85,6 +85,7 @@ import * as UserApi from '@/api/system/user' import { useUserStore } from '@/store/modules/user' import { beginOfDay, defaultShortcuts, endOfDay, formatDate } from '@/utils/formatTime' import { defaultProps, handleTree } from '@/utils/tree' +// TODO @puhui999:最好命名带上模块名,如:CrmStatisticsPortrait import CustomerAddress from './components/CustomerAddress.vue' import CustomerIndustry from './components/CustomerIndustry.vue' import CustomerSource from './components/CustomerSource.vue'