refactor: 统一处理null数据为'未知'
This commit is contained in:
parent
0e15d6c9d2
commit
5358863fc6
@ -11,13 +11,7 @@
|
|||||||
<el-card shadow="never" class="mt-16px">
|
<el-card shadow="never" class="mt-16px">
|
||||||
<el-table v-loading="loading" :data="list">
|
<el-table v-loading="loading" :data="list">
|
||||||
<el-table-column label="序号" align="center" type="index" width="80" />
|
<el-table-column label="序号" align="center" type="index" width="80" />
|
||||||
<el-table-column
|
<el-table-column label="区域" align="center" prop="areaName" min-width="200" />
|
||||||
label="区域"
|
|
||||||
align="center"
|
|
||||||
prop="areaName"
|
|
||||||
min-width="200"
|
|
||||||
:formatter="(_, __, val: any) => val ?? '未知'"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="成交周期(天)"
|
label="成交周期(天)"
|
||||||
align="center"
|
align="center"
|
||||||
@ -112,13 +106,19 @@ const echartsOption = reactive<EChartsOption>({
|
|||||||
/** 获取数据并填充图表 */
|
/** 获取数据并填充图表 */
|
||||||
const fetchAndFill = async () => {
|
const fetchAndFill = async () => {
|
||||||
// 1. 加载统计数据
|
// 1. 加载统计数据
|
||||||
const customerDealCycleByArea = await StatisticsCustomerApi.getCustomerDealCycleByArea(
|
const customerDealCycleByArea = (
|
||||||
props.queryParams
|
await StatisticsCustomerApi.getCustomerDealCycleByArea(props.queryParams)
|
||||||
)
|
).map((s: CrmStatisticsCustomerDealCycleByAreaRespVO) => {
|
||||||
|
return {
|
||||||
|
areaName: s.areaName,
|
||||||
|
customerDealCycle: s.customerDealCycle,
|
||||||
|
customerDealCount: s.customerDealCount
|
||||||
|
}
|
||||||
|
})
|
||||||
// 2.1 更新 Echarts 数据
|
// 2.1 更新 Echarts 数据
|
||||||
if (echartsOption.xAxis && echartsOption.xAxis['data']) {
|
if (echartsOption.xAxis && echartsOption.xAxis['data']) {
|
||||||
echartsOption.xAxis['data'] = customerDealCycleByArea.map(
|
echartsOption.xAxis['data'] = customerDealCycleByArea.map(
|
||||||
(s: CrmStatisticsCustomerDealCycleByAreaRespVO) => s.areaName ?? '未知'
|
(s: CrmStatisticsCustomerDealCycleByAreaRespVO) => s.areaName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) {
|
if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) {
|
||||||
|
@ -11,13 +11,7 @@
|
|||||||
<el-card shadow="never" class="mt-16px">
|
<el-card shadow="never" class="mt-16px">
|
||||||
<el-table v-loading="loading" :data="list">
|
<el-table v-loading="loading" :data="list">
|
||||||
<el-table-column label="序号" align="center" type="index" width="80" />
|
<el-table-column label="序号" align="center" type="index" width="80" />
|
||||||
<el-table-column
|
<el-table-column label="产品名称" align="center" prop="productName" min-width="200" />
|
||||||
label="产品名称"
|
|
||||||
align="center"
|
|
||||||
prop="productName"
|
|
||||||
min-width="200"
|
|
||||||
:formatter="(_, __, val: any) => val ?? '未知'"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="成交周期(天)"
|
label="成交周期(天)"
|
||||||
align="center"
|
align="center"
|
||||||
@ -112,13 +106,19 @@ const echartsOption = reactive<EChartsOption>({
|
|||||||
/** 获取数据并填充图表 */
|
/** 获取数据并填充图表 */
|
||||||
const fetchAndFill = async () => {
|
const fetchAndFill = async () => {
|
||||||
// 1. 加载统计数据
|
// 1. 加载统计数据
|
||||||
const customerDealCycleByProduct = await StatisticsCustomerApi.getCustomerDealCycleByProduct(
|
const customerDealCycleByProduct = (
|
||||||
props.queryParams
|
await StatisticsCustomerApi.getCustomerDealCycleByProduct(props.queryParams)
|
||||||
)
|
).map((s: CrmStatisticsCustomerDealCycleByProductRespVO) => {
|
||||||
|
return {
|
||||||
|
productName: s.productName ?? '未知',
|
||||||
|
customerDealCycle: s.customerDealCount,
|
||||||
|
customerDealCount: s.customerDealCount
|
||||||
|
}
|
||||||
|
})
|
||||||
// 2.1 更新 Echarts 数据
|
// 2.1 更新 Echarts 数据
|
||||||
if (echartsOption.xAxis && echartsOption.xAxis['data']) {
|
if (echartsOption.xAxis && echartsOption.xAxis['data']) {
|
||||||
echartsOption.xAxis['data'] = customerDealCycleByProduct.map(
|
echartsOption.xAxis['data'] = customerDealCycleByProduct.map(
|
||||||
(s: CrmStatisticsCustomerDealCycleByProductRespVO) => s.productName ?? '未知'
|
(s: CrmStatisticsCustomerDealCycleByProductRespVO) => s.productName
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) {
|
if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) {
|
||||||
|
Loading…
Reference in New Issue
Block a user