|
|
@@ -266,9 +266,6 @@
|
|
|
<span class="account-name">
|
|
|
{{ record.name }}
|
|
|
</span>
|
|
|
- <a-tag color="green" size="small">
|
|
|
- 调用 {{ formatNumber(record.calls) }}
|
|
|
- </a-tag>
|
|
|
<a-tag
|
|
|
v-for="tag in record.tags"
|
|
|
:key="tag.key"
|
|
|
@@ -304,6 +301,16 @@
|
|
|
formatNumber(record.expose)
|
|
|
}}</span>
|
|
|
</template>
|
|
|
+ <template #calls="{ record }">
|
|
|
+ <span class="number-cell">{{
|
|
|
+ formatNumber(record.calls)
|
|
|
+ }}</span>
|
|
|
+ </template>
|
|
|
+ <template #success="{ record }">
|
|
|
+ <span class="number-cell">{{
|
|
|
+ formatNumber(record.success)
|
|
|
+ }}</span>
|
|
|
+ </template>
|
|
|
<template #click="{ record }">
|
|
|
<span class="number-cell">{{
|
|
|
formatNumber(record.click)
|
|
|
@@ -419,6 +426,8 @@
|
|
|
typename: string;
|
|
|
scene: string;
|
|
|
unique_id: string;
|
|
|
+ calls: number;
|
|
|
+ success: number;
|
|
|
expose: number;
|
|
|
click: number;
|
|
|
total: number;
|
|
|
@@ -458,6 +467,7 @@
|
|
|
company: string;
|
|
|
tags: AccountTag[];
|
|
|
calls: number;
|
|
|
+ success: number;
|
|
|
expose: number;
|
|
|
click: number;
|
|
|
total: number;
|
|
|
@@ -476,6 +486,11 @@
|
|
|
clickTrackIds: number[];
|
|
|
}
|
|
|
|
|
|
+ interface AccountMetric {
|
|
|
+ calls: number;
|
|
|
+ success: number;
|
|
|
+ }
|
|
|
+
|
|
|
type DimensionTableRow = DimensionRow & {
|
|
|
isAccountRow?: false;
|
|
|
children?: AccountTableRow[];
|
|
|
@@ -626,6 +641,17 @@
|
|
|
return Number(record.parse_total_count || 0);
|
|
|
};
|
|
|
|
|
|
+ const getSuccessCount = (record: DailyLogRecord) => {
|
|
|
+ const channel = Number(record.channel);
|
|
|
+ if (channel === CHANNEL_JD) {
|
|
|
+ return Number(record.jd_parse_success_count || 0);
|
|
|
+ }
|
|
|
+ if (channel === CHANNEL_PDD) {
|
|
|
+ return Number(record.pdd_parse_success_count || 0);
|
|
|
+ }
|
|
|
+ return Number(record.parse_success_count || 0);
|
|
|
+ };
|
|
|
+
|
|
|
const { loading, setLoading } = useLoading(false);
|
|
|
const rawRecords = ref<TrackReportRecord[]>([]);
|
|
|
const accountRecords = ref<TrackReportRecord[]>([]);
|
|
|
@@ -669,6 +695,8 @@
|
|
|
const columns = computed<TableColumnData[]>(() => [
|
|
|
{ title: '日期', dataIndex: 'date', slotName: 'date', width: 120 },
|
|
|
{ title: '业务维度', slotName: 'dimension', width: 360 },
|
|
|
+ { title: '调用', slotName: 'calls', width: 120, align: 'right' },
|
|
|
+ { title: '转链成功', slotName: 'success', width: 120, align: 'right' },
|
|
|
{ title: '曝光', slotName: 'expose', width: 120, align: 'right' },
|
|
|
{ title: '点击', slotName: 'click', width: 120, align: 'right' },
|
|
|
{ title: '点击率', slotName: 'ctr', width: 120, align: 'right' },
|
|
|
@@ -684,15 +712,18 @@
|
|
|
return map;
|
|
|
});
|
|
|
|
|
|
- const dailyCallMap = computed(() => {
|
|
|
- const map = new Map<string, number>();
|
|
|
+ const dailyAccountMetricMap = computed(() => {
|
|
|
+ const map = new Map<string, AccountMetric>();
|
|
|
dailyLogs.value.forEach((record) => {
|
|
|
const date = dayjs(record.log_date).format('YYYY-MM-DD');
|
|
|
const channel = Number(record.channel);
|
|
|
const accountId = Number(record.accountId);
|
|
|
if (channel < 0 || accountId <= 0) return;
|
|
|
const key = [date, channel, accountId].join('|');
|
|
|
- map.set(key, (map.get(key) || 0) + getCallCount(record));
|
|
|
+ const item = map.get(key) || { calls: 0, success: 0 };
|
|
|
+ item.calls += getCallCount(record);
|
|
|
+ item.success += getSuccessCount(record);
|
|
|
+ map.set(key, item);
|
|
|
});
|
|
|
return map;
|
|
|
});
|
|
|
@@ -815,6 +846,44 @@
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ const dimensionAccountMetricMap = computed(() => {
|
|
|
+ const map = new Map<string, AccountMetric>();
|
|
|
+ const accountKeysByDimension = new Map<string, Set<string>>();
|
|
|
+
|
|
|
+ normalizedAccountRecords.value.forEach((record) => {
|
|
|
+ const date = dayjs(record.report_date).format('YYYY-MM-DD');
|
|
|
+ const source = getSourceLabel(record);
|
|
|
+ const channel = getChannelBySource(source);
|
|
|
+ const accountId = Number(record.account_id || 0);
|
|
|
+ if (channel < 0 || accountId <= 0) return;
|
|
|
+
|
|
|
+ const typename = getTypeLabel(record);
|
|
|
+ const scene = getSceneLabel(record);
|
|
|
+ const uniqueId = getUniqueLabel(record);
|
|
|
+ const dimensionKey = [date, source, typename, scene, uniqueId].join(
|
|
|
+ '|'
|
|
|
+ );
|
|
|
+ const accountMetricKey = [date, channel, accountId].join('|');
|
|
|
+
|
|
|
+ if (!accountKeysByDimension.has(dimensionKey)) {
|
|
|
+ accountKeysByDimension.set(dimensionKey, new Set<string>());
|
|
|
+ }
|
|
|
+ const accountKeys = accountKeysByDimension.get(dimensionKey);
|
|
|
+ if (!accountKeys || accountKeys.has(accountMetricKey)) return;
|
|
|
+
|
|
|
+ accountKeys.add(accountMetricKey);
|
|
|
+ const metric = dailyAccountMetricMap.value.get(accountMetricKey);
|
|
|
+ if (!metric) return;
|
|
|
+
|
|
|
+ const item = map.get(dimensionKey) || { calls: 0, success: 0 };
|
|
|
+ item.calls += metric.calls;
|
|
|
+ item.success += metric.success;
|
|
|
+ map.set(dimensionKey, item);
|
|
|
+ });
|
|
|
+
|
|
|
+ return map;
|
|
|
+ });
|
|
|
+
|
|
|
const dimensionRows = computed<DimensionRow[]>(() => {
|
|
|
const map = new Map<string, DimensionRow>();
|
|
|
normalizedRecords.value.forEach((record) => {
|
|
|
@@ -835,6 +904,8 @@
|
|
|
typename,
|
|
|
scene,
|
|
|
unique_id: uniqueId,
|
|
|
+ calls: 0,
|
|
|
+ success: 0,
|
|
|
expose: 0,
|
|
|
click: 0,
|
|
|
total: 0,
|
|
|
@@ -857,10 +928,18 @@
|
|
|
});
|
|
|
|
|
|
return Array.from(map.values())
|
|
|
- .map((item) => ({
|
|
|
- ...item,
|
|
|
- ctr: item.expose > 0 ? (item.click / item.expose) * 100 : null,
|
|
|
- }))
|
|
|
+ .map((item) => {
|
|
|
+ const metric = dimensionAccountMetricMap.value.get(item.key);
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ calls: metric?.calls || 0,
|
|
|
+ success: metric?.success || 0,
|
|
|
+ ctr:
|
|
|
+ item.expose > 0
|
|
|
+ ? (item.click / item.expose) * 100
|
|
|
+ : null,
|
|
|
+ };
|
|
|
+ })
|
|
|
.sort((a, b) => {
|
|
|
if (a.date !== b.date) return b.date.localeCompare(a.date);
|
|
|
return b.total - a.total;
|
|
|
@@ -895,6 +974,7 @@
|
|
|
].join('|');
|
|
|
const meta = getAccountMeta(channel, accountId);
|
|
|
const callKey = [date, channel, accountId].join('|');
|
|
|
+ const metric = dailyAccountMetricMap.value.get(callKey);
|
|
|
|
|
|
if (!rowMap.has(accountKey)) {
|
|
|
rowMap.set(accountKey, {
|
|
|
@@ -907,7 +987,8 @@
|
|
|
`账号 ${accountId}`,
|
|
|
company: meta?.company || '',
|
|
|
tags: getAccountTags(meta),
|
|
|
- calls: dailyCallMap.value.get(callKey) || 0,
|
|
|
+ calls: metric?.calls || 0,
|
|
|
+ success: metric?.success || 0,
|
|
|
expose: 0,
|
|
|
click: 0,
|
|
|
total: 0,
|
|
|
@@ -937,6 +1018,9 @@
|
|
|
});
|
|
|
rows.sort((left, right) => {
|
|
|
if (right.calls !== left.calls) return right.calls - left.calls;
|
|
|
+ if (right.success !== left.success) {
|
|
|
+ return right.success - left.success;
|
|
|
+ }
|
|
|
return right.total - left.total;
|
|
|
});
|
|
|
});
|