Skip to content

Commit fd7989a

Browse files
committed
fix: statistics of ongoing business opportunity amounts
1 parent ec99956 commit fd7989a

File tree

1 file changed

+14
-44
lines changed
  • frontend/packages/web/src/views/workbench/components

1 file changed

+14
-44
lines changed

frontend/packages/web/src/views/workbench/components/overview.vue

Lines changed: 14 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,15 @@
7373
{{ t('common.inProgress') }}
7474
</div>
7575
<div
76-
:class="`${hasOptPermission ? 'cursor-pointer text-[var(--info-blue)]' : 'text-[var(--text-n4)]'}`"
77-
@click="goDetail(dim, defaultOpportunityUnderwayData[dim])"
76+
:class="`flex items-center ${
77+
hasOptPermission ? 'cursor-pointer text-[var(--info-blue)]' : 'text-[var(--text-n4)]'
78+
}`"
79+
@click="goDetail(dim, { ...item, status: 'AFOOT' })"
7880
>
79-
{{ defaultOpportunityUnderwayData[dim].value ?? 0 }}
81+
<div class="number">
82+
{{ abbreviateNumber(item.underway, item.unit).value }}
83+
</div>
84+
<div class="unit">{{ abbreviateNumber(item.underway, item.unit).unit }}</div>
8085
</div>
8186
</div>
8287
</div>
@@ -226,6 +231,7 @@
226231
title: t('workbench.dataOverview.followingOrder'),
227232
value: hasOptPermission.value ? 0 : '-',
228233
priorPeriodCompareRate: hasOptPermission.value ? 0 : '-',
234+
underway: hasOptPermission.value ? 0 : '-',
229235
routeName: AppRouteEnum.OPPORTUNITY_OPT,
230236
hasPermission: hasOptPermission.value,
231237
unit: t('workbench.dataOverview.countUnit'),
@@ -234,21 +240,13 @@
234240
title: t('workbench.dataOverview.amount'),
235241
value: hasOptPermission.value ? 0 : '-',
236242
priorPeriodCompareRate: hasOptPermission.value ? 0 : '-',
243+
underway: hasOptPermission.value ? 0 : '-',
237244
routeName: AppRouteEnum.OPPORTUNITY_OPT,
238245
hasPermission: hasOptPermission.value,
239246
unit: t('workbench.dataOverview.amountUnit'),
240247
},
241248
});
242249
243-
const defaultOpportunityUnderwayData = ref<Record<string, Record<string, any>>>({});
244-
const createOpportunityUnderwayBlock = () => ({
245-
value: hasOptPermission.value ? 0 : '-',
246-
routeName: AppRouteEnum.OPPORTUNITY_OPT,
247-
hasPermission: hasOptPermission.value,
248-
unit: t('workbench.dataOverview.countUnit'),
249-
status: 'AFOOT',
250-
});
251-
252250
const defaultWinOrderData = ref<Record<string, any>>({});
253251
const createWinOrderBlock = () => ({
254252
successOpportunity: {
@@ -322,11 +320,6 @@
322320
return acc;
323321
}, {} as Record<string, any>);
324322
325-
defaultOpportunityUnderwayData.value = dateKey.value.reduce((acc, key) => {
326-
acc[key] = createOpportunityUnderwayBlock();
327-
return acc;
328-
}, {} as Record<string, any>);
329-
330323
defaultOpportunityData.value = dateKey.value.reduce((acc, key) => {
331324
acc[key] = createOpportunityBlock();
332325
return acc;
@@ -365,31 +358,11 @@
365358
}
366359
}
367360
368-
async function initOptUnderwayDetail(params: GetHomeStatisticParams) {
369-
if (!hasAnyPermission(['OPPORTUNITY_MANAGEMENT:READ'])) return;
370-
try {
371-
const result = await getHomeOpportunityUnderwayStatistic(params);
372-
Object.keys(defaultOpportunityUnderwayData.value).forEach((k) => {
373-
const resultArr: string[] = Object.keys(result);
374-
const optKeys: string[] = resultArr.filter((e) => e.toLocaleUpperCase().includes(k.toLocaleUpperCase()));
375-
if (optKeys?.length) {
376-
const [newKey] = optKeys;
377-
defaultOpportunityUnderwayData.value[k] = {
378-
...defaultOpportunityUnderwayData.value[k],
379-
...result[newKey as keyof FollowOptStatisticDetail],
380-
};
381-
}
382-
});
383-
} catch (error) {
384-
// eslint-disable-next-line no-console
385-
console.log(error);
386-
}
387-
}
388-
389361
async function initOptDetail(params: GetHomeStatisticParams) {
390362
if (!hasAnyPermission(['OPPORTUNITY_MANAGEMENT:READ'])) return;
391363
try {
392364
const result = await getHomeFollowOpportunity(params);
365+
const underway = await getHomeOpportunityUnderwayStatistic(params);
393366
Object.keys(defaultOpportunityData.value).forEach((k) => {
394367
const resultArr: string[] = Object.keys(result);
395368
const optKeys: string[] = resultArr.filter((e) => e.toLocaleUpperCase().includes(k.toLocaleUpperCase()));
@@ -399,10 +372,12 @@
399372
newOpportunity: {
400373
...defaultOpportunityData.value[k].newOpportunity,
401374
...result[newKey as keyof FollowOptStatisticDetail],
375+
underway: underway[newKey as keyof FollowOptStatisticDetail].value,
402376
},
403377
newOpportunityAmount: {
404378
...defaultOpportunityData.value[k].newOpportunityAmount,
405379
...result[amountKey as keyof FollowOptStatisticDetail],
380+
underway: underway[amountKey as keyof FollowOptStatisticDetail].value,
406381
},
407382
};
408383
}
@@ -450,12 +425,7 @@
450425
initDefaultData();
451426
try {
452427
loading.value = true;
453-
await Promise.all([
454-
initLeadDetail(params),
455-
initOptDetail(params),
456-
initSuccessOptDetail(params),
457-
initOptUnderwayDetail(params),
458-
]);
428+
await Promise.all([initLeadDetail(params), initOptDetail(params), initSuccessOptDetail(params)]);
459429
} catch (error) {
460430
// eslint-disable-next-line no-console
461431
console.log(error);

0 commit comments

Comments
 (0)