From e8a3745b5ef48b75b30e888ee1d123accd69f1c5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 7 Apr 2024 21:27:29 +0800 Subject: [PATCH] =?UTF-8?q?crm=EF=BC=9Acode=20review=20=E5=85=AC=E6=B5=B7?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CustomerConversionStat.vue | 7 ++-- .../customer/components/CustomerDealCycle.vue | 21 ++++++------ .../components/CustomerFollowUpSummary.vue | 15 ++++---- .../components/CustomerFollowUpType.vue | 5 ++- ...oolSummary.vue => CustomerPoolSummary.vue} | 34 +++++++++++-------- .../customer/components/CustomerSummary.vue | 10 +++--- src/views/crm/statistics/customer/index.vue | 11 +++--- 7 files changed, 52 insertions(+), 51 deletions(-) rename src/views/crm/statistics/customer/components/{PoolSummary.vue => CustomerPoolSummary.vue} (85%) diff --git a/src/views/crm/statistics/customer/components/CustomerConversionStat.vue b/src/views/crm/statistics/customer/components/CustomerConversionStat.vue index 7dd0d6bb..4f5c50cf 100644 --- a/src/views/crm/statistics/customer/components/CustomerConversionStat.vue +++ b/src/views/crm/statistics/customer/components/CustomerConversionStat.vue @@ -84,7 +84,7 @@ const list = ref([]) // 列表的数 const echartsOption = reactive({ grid: { left: 20, - right: 40, // 让X轴右侧显示完整 + right: 40, // 让 X 轴右侧显示完整 bottom: 20, containLabel: true }, @@ -155,9 +155,8 @@ const fetchAndFill = async () => { const loadData = async () => { loading.value = true try { - fetchAndFill() - } - finally { + await fetchAndFill() + } finally { loading.value = false } } diff --git a/src/views/crm/statistics/customer/components/CustomerDealCycle.vue b/src/views/crm/statistics/customer/components/CustomerDealCycle.vue index a3ac2bfd..23ce1448 100644 --- a/src/views/crm/statistics/customer/components/CustomerDealCycle.vue +++ b/src/views/crm/statistics/customer/components/CustomerDealCycle.vue @@ -26,7 +26,7 @@ import { StatisticsCustomerApi, CrmStatisticsCustomerDealCycleByDateRespVO, - CrmStatisticsCustomerSummaryByDateRespVO, + CrmStatisticsCustomerSummaryByDateRespVO } from '@/api/crm/statistics/customer' import { EChartsOption } from 'echarts' @@ -41,7 +41,7 @@ const list = ref([]) // 列表的 const echartsOption = reactive({ grid: { left: 20, - right: 40, // 让X轴右侧显示完整 + right: 40, // 让 X 轴右侧显示完整 bottom: 20, containLabel: true }, @@ -51,13 +51,13 @@ const echartsOption = reactive({ name: '成交周期(天)', type: 'bar', data: [], - yAxisIndex: 0, + yAxisIndex: 0 }, { name: '成交客户数', type: 'bar', data: [], - yAxisIndex: 1, + yAxisIndex: 1 } ], toolbox: { @@ -82,7 +82,7 @@ const echartsOption = reactive({ type: 'value', name: '成交周期(天)', min: 0, - minInterval: 1, // 显示整数刻度 + minInterval: 1 // 显示整数刻度 }, { type: 'value', @@ -92,10 +92,10 @@ const echartsOption = reactive({ splitLine: { lineStyle: { type: 'dotted', // 右侧网格线虚化, 减少混乱 - opacity: 0.7, + opacity: 0.7 } } - }, + } ], xAxis: { type: 'category', @@ -110,7 +110,7 @@ const fetchAndFill = async () => { const customerDealCycleByDate = await StatisticsCustomerApi.getCustomerDealCycleByDate( props.queryParams ) - const customerSummaryByDate = await StatisticsCustomerApi.getCustomerSummaryByDate( + const customerSummaryByDate = await StatisticsCustomerApi.getCustomerSummaryByDate( props.queryParams ) const customerDealCycleByUser = await StatisticsCustomerApi.getCustomerDealCycleByUser( @@ -140,9 +140,8 @@ const fetchAndFill = async () => { const loadData = async () => { loading.value = true try { - fetchAndFill() - } - finally { + await fetchAndFill() + } finally { loading.value = false } } diff --git a/src/views/crm/statistics/customer/components/CustomerFollowUpSummary.vue b/src/views/crm/statistics/customer/components/CustomerFollowUpSummary.vue index 204a821f..eeb0ff01 100644 --- a/src/views/crm/statistics/customer/components/CustomerFollowUpSummary.vue +++ b/src/views/crm/statistics/customer/components/CustomerFollowUpSummary.vue @@ -1,7 +1,7 @@ @@ -25,7 +35,7 @@ import { } from '@/api/crm/statistics/customer' import { EChartsOption } from 'echarts' -defineOptions({ name: 'CustomerSummary' }) +defineOptions({ name: 'CustomerPoolSummary' }) const props = defineProps<{ queryParams: any }>() // 搜索参数 @@ -36,7 +46,7 @@ const list = ref([]) // 列表的数据 const echartsOption = reactive({ grid: { left: 20, - right: 40, // 让X轴右侧显示完整 + right: 40, // 让 X 轴右侧显示完整 bottom: 20, containLabel: true }, @@ -77,7 +87,7 @@ const echartsOption = reactive({ type: 'value', name: '进入公海客户数', min: 0, - minInterval: 1, // 显示整数刻度 + minInterval: 1 // 显示整数刻度 }, { type: 'value', @@ -87,7 +97,7 @@ const echartsOption = reactive({ splitLine: { lineStyle: { type: 'dotted', // 右侧网格线虚化, 减少混乱 - opacity: 0.7, + opacity: 0.7 } } } @@ -95,19 +105,15 @@ const echartsOption = reactive({ xAxis: { type: 'category', name: '日期', - data: [], + data: [] } }) as EChartsOption /** 获取数据并填充图表 */ const fetchAndFill = async () => { // 1. 加载统计数据 - const poolSummaryByDate = await StatisticsCustomerApi.getPoolSummaryByDate( - props.queryParams - ) - const poolSummaryByUser = await StatisticsCustomerApi.getPoolSummaryByUser( - props.queryParams - ) + const poolSummaryByDate = await StatisticsCustomerApi.getPoolSummaryByDate(props.queryParams) + const poolSummaryByUser = await StatisticsCustomerApi.getPoolSummaryByUser(props.queryParams) // 2.1 更新 Echarts 数据 if (echartsOption.xAxis && echartsOption.xAxis['data']) { echartsOption.xAxis['data'] = poolSummaryByDate.map( @@ -133,7 +139,7 @@ const fetchAndFill = async () => { const loadData = async () => { loading.value = true try { - fetchAndFill() + await fetchAndFill() } finally { loading.value = false } diff --git a/src/views/crm/statistics/customer/components/CustomerSummary.vue b/src/views/crm/statistics/customer/components/CustomerSummary.vue index 7d6c268d..d1429c2a 100644 --- a/src/views/crm/statistics/customer/components/CustomerSummary.vue +++ b/src/views/crm/statistics/customer/components/CustomerSummary.vue @@ -71,7 +71,7 @@ const list = ref([]) // 列表的数 const echartsOption = reactive({ grid: { left: 20, - right: 30, // 让X轴右侧显示完整 + right: 30, // 让 X 轴右侧显示完整 bottom: 20, containLabel: true }, @@ -112,7 +112,7 @@ const echartsOption = reactive({ type: 'value', name: '新增客户数', min: 0, - minInterval: 1, // 显示整数刻度 + minInterval: 1 // 显示整数刻度 }, { type: 'value', @@ -122,7 +122,7 @@ const echartsOption = reactive({ splitLine: { lineStyle: { type: 'dotted', // 右侧网格线虚化, 减少混乱 - opacity: 0.7, + opacity: 0.7 } } } @@ -130,7 +130,7 @@ const echartsOption = reactive({ xAxis: { type: 'category', name: '日期', - data: [], + data: [] } }) as EChartsOption @@ -168,7 +168,7 @@ const fetchAndFill = async () => { const loadData = async () => { loading.value = true try { - fetchAndFill() + await fetchAndFill() } finally { loading.value = false } diff --git a/src/views/crm/statistics/customer/index.vue b/src/views/crm/statistics/customer/index.vue index e84b0850..88a324e5 100644 --- a/src/views/crm/statistics/customer/index.vue +++ b/src/views/crm/statistics/customer/index.vue @@ -46,8 +46,7 @@ class="!w-240px" node-key="id" placeholder="请选择归属部门" - @change="queryParams.userId = undefined;handleQuery() - " + @change="(queryParams.userId = undefined), handleQuery()" /> @@ -100,7 +99,7 @@ - + @@ -122,7 +121,7 @@ import CustomerDealCycle from './components/CustomerDealCycle.vue' import CustomerFollowUpSummary from './components/CustomerFollowUpSummary.vue' import CustomerFollowUpType from './components/CustomerFollowUpType.vue' import CustomerSummary from './components/CustomerSummary.vue' -import PoolSummary from './components/PoolSummary.vue' +import CustomerPoolSummary from './components/CustomerPoolSummary.vue' defineOptions({ name: 'CrmStatisticsCustomer' }) @@ -153,7 +152,7 @@ const customerSummaryRef = ref() // 1. 客户总量分析 const followUpSummaryRef = ref() // 2. 客户跟进次数分析 const followUpTypeRef = ref() // 3. 客户跟进方式分析 const conversionStatRef = ref() // 4. 客户转化率分析 -const poolSummaryRef = ref() // 5. 客户公海分析 +const customerPoolSummaryRef = ref() // 5. 客户公海分析 const dealCycleRef = ref() // 6. 成交周期分析 /** 搜索按钮操作 */ @@ -172,7 +171,7 @@ const handleQuery = () => { conversionStatRef.value?.loadData?.() break case 'poolSummary': // 公海客户分析 - poolSummaryRef.value?.loadData?.() + customerPoolSummaryRef.value?.loadData?.() break case 'dealCycle': // 成交周期分析 dealCycleRef.value?.loadData?.()