|
73 | 73 | {{ t('common.inProgress') }} |
74 | 74 | </div> |
75 | 75 | <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' })" |
78 | 80 | > |
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> |
80 | 85 | </div> |
81 | 86 | </div> |
82 | 87 | </div> |
|
226 | 231 | title: t('workbench.dataOverview.followingOrder'), |
227 | 232 | value: hasOptPermission.value ? 0 : '-', |
228 | 233 | priorPeriodCompareRate: hasOptPermission.value ? 0 : '-', |
| 234 | + underway: hasOptPermission.value ? 0 : '-', |
229 | 235 | routeName: AppRouteEnum.OPPORTUNITY_OPT, |
230 | 236 | hasPermission: hasOptPermission.value, |
231 | 237 | unit: t('workbench.dataOverview.countUnit'), |
|
234 | 240 | title: t('workbench.dataOverview.amount'), |
235 | 241 | value: hasOptPermission.value ? 0 : '-', |
236 | 242 | priorPeriodCompareRate: hasOptPermission.value ? 0 : '-', |
| 243 | + underway: hasOptPermission.value ? 0 : '-', |
237 | 244 | routeName: AppRouteEnum.OPPORTUNITY_OPT, |
238 | 245 | hasPermission: hasOptPermission.value, |
239 | 246 | unit: t('workbench.dataOverview.amountUnit'), |
240 | 247 | }, |
241 | 248 | }); |
242 | 249 |
|
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 | | -
|
252 | 250 | const defaultWinOrderData = ref<Record<string, any>>({}); |
253 | 251 | const createWinOrderBlock = () => ({ |
254 | 252 | successOpportunity: { |
|
322 | 320 | return acc; |
323 | 321 | }, {} as Record<string, any>); |
324 | 322 |
|
325 | | - defaultOpportunityUnderwayData.value = dateKey.value.reduce((acc, key) => { |
326 | | - acc[key] = createOpportunityUnderwayBlock(); |
327 | | - return acc; |
328 | | - }, {} as Record<string, any>); |
329 | | -
|
330 | 323 | defaultOpportunityData.value = dateKey.value.reduce((acc, key) => { |
331 | 324 | acc[key] = createOpportunityBlock(); |
332 | 325 | return acc; |
|
365 | 358 | } |
366 | 359 | } |
367 | 360 |
|
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 | | -
|
389 | 361 | async function initOptDetail(params: GetHomeStatisticParams) { |
390 | 362 | if (!hasAnyPermission(['OPPORTUNITY_MANAGEMENT:READ'])) return; |
391 | 363 | try { |
392 | 364 | const result = await getHomeFollowOpportunity(params); |
| 365 | + const underway = await getHomeOpportunityUnderwayStatistic(params); |
393 | 366 | Object.keys(defaultOpportunityData.value).forEach((k) => { |
394 | 367 | const resultArr: string[] = Object.keys(result); |
395 | 368 | const optKeys: string[] = resultArr.filter((e) => e.toLocaleUpperCase().includes(k.toLocaleUpperCase())); |
|
399 | 372 | newOpportunity: { |
400 | 373 | ...defaultOpportunityData.value[k].newOpportunity, |
401 | 374 | ...result[newKey as keyof FollowOptStatisticDetail], |
| 375 | + underway: underway[newKey as keyof FollowOptStatisticDetail].value, |
402 | 376 | }, |
403 | 377 | newOpportunityAmount: { |
404 | 378 | ...defaultOpportunityData.value[k].newOpportunityAmount, |
405 | 379 | ...result[amountKey as keyof FollowOptStatisticDetail], |
| 380 | + underway: underway[amountKey as keyof FollowOptStatisticDetail].value, |
406 | 381 | }, |
407 | 382 | }; |
408 | 383 | } |
|
450 | 425 | initDefaultData(); |
451 | 426 | try { |
452 | 427 | 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)]); |
459 | 429 | } catch (error) { |
460 | 430 | // eslint-disable-next-line no-console |
461 | 431 | console.log(error); |
|
0 commit comments