|
@@ -69,12 +69,12 @@ import {
|
|
CrmStatisticsCustomerSummaryByDateRespVO
|
|
CrmStatisticsCustomerSummaryByDateRespVO
|
|
} from '@/api/crm/statistics/customer'
|
|
} from '@/api/crm/statistics/customer'
|
|
import { EChartsOption } from 'echarts'
|
|
import { EChartsOption } from 'echarts'
|
|
-import { round } from 'lodash-es'
|
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
import { erpPriceTableColumnFormatter } from '@/utils'
|
|
import { erpPriceTableColumnFormatter } from '@/utils'
|
|
import { DICT_TYPE } from '@/utils/dict'
|
|
import { DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
|
defineOptions({ name: 'CustomerConversionStat' })
|
|
defineOptions({ name: 'CustomerConversionStat' })
|
|
|
|
+
|
|
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
|
const props = defineProps<{ queryParams: any }>() // 搜索参数
|
|
|
|
|
|
const loading = ref(false) // 加载中
|
|
const loading = ref(false) // 加载中
|
|
@@ -84,7 +84,7 @@ const list = ref<CrmStatisticsCustomerSummaryByDateRespVO[]>([]) // 列表的数
|
|
const echartsOption = reactive<EChartsOption>({
|
|
const echartsOption = reactive<EChartsOption>({
|
|
grid: {
|
|
grid: {
|
|
left: 20,
|
|
left: 20,
|
|
- right: 20,
|
|
|
|
|
|
+ right: 40, // 让X轴右侧显示完整
|
|
bottom: 20,
|
|
bottom: 20,
|
|
containLabel: true
|
|
containLabel: true
|
|
},
|
|
},
|
|
@@ -124,11 +124,9 @@ const echartsOption = reactive<EChartsOption>({
|
|
}
|
|
}
|
|
}) as EChartsOption
|
|
}) as EChartsOption
|
|
|
|
|
|
-/** 获取统计数据 */
|
|
|
|
-const loadData = async () => {
|
|
|
|
|
|
+/** 获取数据并填充图表 */
|
|
|
|
+const fetchAndFill = async () => {
|
|
// 1. 加载统计数据
|
|
// 1. 加载统计数据
|
|
- loading.value = true
|
|
|
|
- // TODO @ddhb52:这里调用 StatisticsCustomerApi.getCustomerSummaryByDate 好像不太对???
|
|
|
|
const customerCount = await StatisticsCustomerApi.getCustomerSummaryByDate(props.queryParams)
|
|
const customerCount = await StatisticsCustomerApi.getCustomerSummaryByDate(props.queryParams)
|
|
const contractSummary = await StatisticsCustomerApi.getContractSummary(props.queryParams)
|
|
const contractSummary = await StatisticsCustomerApi.getContractSummary(props.queryParams)
|
|
// 2.1 更新 Echarts 数据
|
|
// 2.1 更新 Echarts 数据
|
|
@@ -143,7 +141,7 @@ const loadData = async () => {
|
|
return {
|
|
return {
|
|
name: item.time,
|
|
name: item.time,
|
|
value: item.customerCreateCount
|
|
value: item.customerCreateCount
|
|
- ? round((item.customerDealCount / item.customerCreateCount) * 100, 2)
|
|
|
|
|
|
+ ? ((item.customerDealCount / item.customerCreateCount) * 100).toFixed(2)
|
|
: 0
|
|
: 0
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -151,8 +149,19 @@ const loadData = async () => {
|
|
}
|
|
}
|
|
// 2.2 更新列表数据
|
|
// 2.2 更新列表数据
|
|
list.value = contractSummary
|
|
list.value = contractSummary
|
|
- loading.value = false
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/** 获取统计数据 */
|
|
|
|
+const loadData = async () => {
|
|
|
|
+ loading.value = true
|
|
|
|
+ try {
|
|
|
|
+ fetchAndFill()
|
|
|
|
+ }
|
|
|
|
+ finally {
|
|
|
|
+ loading.value = false
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
defineExpose({ loadData })
|
|
defineExpose({ loadData })
|
|
|
|
|
|
/** 初始化 */
|
|
/** 初始化 */
|