diff --git a/src/utils/index.ts b/src/utils/index.ts index 412a8b62..274ab7ca 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,4 @@ -import { toNumber } from 'lodash-es' +import {toNumber} from 'lodash-es' /** * @@ -418,3 +418,20 @@ export const erpCalculatePercentage = (value: number, total: number) => { if (total === 0) return 0 return ((value / total) * 100).toFixed(2) } + +/** + * 适配 echarts map 的地名 + * + * @param areaName 地区名称 + */ +export const areaReplace = (areaName: string) => { + if (!areaName) { + return areaName + } + return areaName + .replace('维吾尔自治区', '') + .replace('壮族自治区', '') + .replace('回族自治区', '') + .replace('自治区', '') + .replace('省', '') +} diff --git a/src/views/crm/statistics/portrait/components/PortraitCustomerArea.vue b/src/views/crm/statistics/portrait/components/PortraitCustomerArea.vue index 84b43ac4..513936c9 100644 --- a/src/views/crm/statistics/portrait/components/PortraitCustomerArea.vue +++ b/src/views/crm/statistics/portrait/components/PortraitCustomerArea.vue @@ -24,6 +24,7 @@ import { CrmStatisticCustomerAreaRespVO, StatisticsPortraitApi } from '@/api/crm/statistics/portrait' +import { areaReplace } from '@/utils' defineOptions({ name: 'PortraitCustomerArea' }) const props = defineProps<{ queryParams: any }>() // 搜索参数 @@ -106,12 +107,7 @@ const loadData = async () => { areaStatisticsList.value = areaList.map((item: CrmStatisticCustomerAreaRespVO) => { return { ...item, - areaName: item.areaName // TODO @puhui999:这里最好注释下原因哈, 🤣 我从 mall copy 过来的;这块看着是适合 ercharts 的地名,要不抽个小的 js 方法,然后把涉及到的地方都替换掉。 - // .replace('维吾尔自治区', '') - // .replace('壮族自治区', '') - // .replace('回族自治区', '') - // .replace('自治区', '') - // .replace('省', '') + areaName: areaReplace(item.areaName) } }) buildLeftMap() diff --git a/src/views/mall/statistics/member/index.vue b/src/views/mall/statistics/member/index.vue index a075810d..0e1bbaf6 100644 --- a/src/views/mall/statistics/member/index.vue +++ b/src/views/mall/statistics/member/index.vue @@ -3,44 +3,44 @@
- + - + - + - + @@ -67,42 +67,42 @@ @@ -110,7 +110,7 @@ - + @@ -122,16 +122,16 @@