|
@@ -302,12 +302,12 @@
|
|
|
}}</span>
|
|
}}</span>
|
|
|
</template>
|
|
</template>
|
|
|
<template #calls="{ record }">
|
|
<template #calls="{ record }">
|
|
|
- <span class="number-cell">{{
|
|
|
|
|
|
|
+ <span v-if="!record.isAccountRow" class="number-cell">{{
|
|
|
formatNumber(record.calls)
|
|
formatNumber(record.calls)
|
|
|
}}</span>
|
|
}}</span>
|
|
|
</template>
|
|
</template>
|
|
|
<template #success="{ record }">
|
|
<template #success="{ record }">
|
|
|
- <span class="number-cell">{{
|
|
|
|
|
|
|
+ <span v-if="!record.isAccountRow" class="number-cell">{{
|
|
|
formatNumber(record.success)
|
|
formatNumber(record.success)
|
|
|
}}</span>
|
|
}}</span>
|
|
|
</template>
|
|
</template>
|
|
@@ -355,6 +355,10 @@
|
|
|
<span class="hourly-unique">{{ selectedRow.unique_id }}</span>
|
|
<span class="hourly-unique">{{ selectedRow.unique_id }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="hourly-metrics">
|
|
<div class="hourly-metrics">
|
|
|
|
|
+ <div class="hourly-metric">
|
|
|
|
|
+ <span>调用</span>
|
|
|
|
|
+ <strong>{{ formatNumber(hourlySummary.calls) }}</strong>
|
|
|
|
|
+ </div>
|
|
|
<div class="hourly-metric">
|
|
<div class="hourly-metric">
|
|
|
<span>曝光</span>
|
|
<span>曝光</span>
|
|
|
<strong>{{ formatNumber(hourlySummary.expose) }}</strong>
|
|
<strong>{{ formatNumber(hourlySummary.expose) }}</strong>
|
|
@@ -665,6 +669,7 @@
|
|
|
const hourlyLoading = ref(false);
|
|
const hourlyLoading = ref(false);
|
|
|
const selectedRow = ref<DimensionRow | null>(null);
|
|
const selectedRow = ref<DimensionRow | null>(null);
|
|
|
const hourlyXAxis = ref<string[]>([]);
|
|
const hourlyXAxis = ref<string[]>([]);
|
|
|
|
|
+ const hourlyCalls = ref<number[]>([]);
|
|
|
const hourlyExpose = ref<number[]>([]);
|
|
const hourlyExpose = ref<number[]>([]);
|
|
|
const hourlyClick = ref<number[]>([]);
|
|
const hourlyClick = ref<number[]>([]);
|
|
|
const hourlyChartKey = ref(0);
|
|
const hourlyChartKey = ref(0);
|
|
@@ -1251,6 +1256,7 @@
|
|
|
);
|
|
);
|
|
|
const click = hourlyClick.value.reduce((sum, value) => sum + value, 0);
|
|
const click = hourlyClick.value.reduce((sum, value) => sum + value, 0);
|
|
|
return {
|
|
return {
|
|
|
|
|
+ calls: selectedRow.value?.calls || 0,
|
|
|
expose,
|
|
expose,
|
|
|
click,
|
|
click,
|
|
|
ctr: expose > 0 ? (click / expose) * 100 : null,
|
|
ctr: expose > 0 ? (click / expose) * 100 : null,
|
|
@@ -1259,6 +1265,14 @@
|
|
|
|
|
|
|
|
const hourlyChartOption = computed(() => {
|
|
const hourlyChartOption = computed(() => {
|
|
|
const series = [];
|
|
const series = [];
|
|
|
|
|
+ series.push({
|
|
|
|
|
+ name: '调用',
|
|
|
|
|
+ type: 'bar',
|
|
|
|
|
+ data: hourlyCalls.value,
|
|
|
|
|
+ barMaxWidth: 18,
|
|
|
|
|
+ itemStyle: { color: 'rgba(22, 93, 255, 0.45)' },
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
if (!selectedRow.value || selectedRow.value.exposeTrackIds.length > 0) {
|
|
if (!selectedRow.value || selectedRow.value.exposeTrackIds.length > 0) {
|
|
|
series.push({
|
|
series.push({
|
|
|
name: '曝光',
|
|
name: '曝光',
|
|
@@ -1280,7 +1294,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
- color: ['#165dff', '#00b42a'],
|
|
|
|
|
|
|
+ color: ['rgba(22, 93, 255, 0.45)', '#165dff', '#00b42a'],
|
|
|
tooltip: { trigger: 'axis' },
|
|
tooltip: { trigger: 'axis' },
|
|
|
legend: { right: 0, top: 0 },
|
|
legend: { right: 0, top: 0 },
|
|
|
grid: {
|
|
grid: {
|
|
@@ -1545,11 +1559,12 @@
|
|
|
{ length: 24 },
|
|
{ length: 24 },
|
|
|
(_, hour) => `${hour.toString().padStart(2, '0')}:00`
|
|
(_, hour) => `${hour.toString().padStart(2, '0')}:00`
|
|
|
);
|
|
);
|
|
|
|
|
+ hourlyCalls.value = Array(24).fill(0);
|
|
|
hourlyExpose.value = Array(24).fill(0);
|
|
hourlyExpose.value = Array(24).fill(0);
|
|
|
hourlyClick.value = Array(24).fill(0);
|
|
hourlyClick.value = Array(24).fill(0);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const [exposeList, clickList] = await Promise.all([
|
|
|
|
|
|
|
+ const [exposeHourlyData, clickHourlyData] = await Promise.all([
|
|
|
fetchHourlyCounts(
|
|
fetchHourlyCounts(
|
|
|
reportRow.exposeTrackIds,
|
|
reportRow.exposeTrackIds,
|
|
|
reportRow.date,
|
|
reportRow.date,
|
|
@@ -1561,8 +1576,9 @@
|
|
|
reportRow.scene
|
|
reportRow.scene
|
|
|
),
|
|
),
|
|
|
]);
|
|
]);
|
|
|
- hourlyExpose.value = exposeList;
|
|
|
|
|
- hourlyClick.value = clickList;
|
|
|
|
|
|
|
+ hourlyExpose.value = exposeHourlyData.eventCounts;
|
|
|
|
|
+ hourlyClick.value = clickHourlyData.eventCounts;
|
|
|
|
|
+ hourlyCalls.value = await fetchHourlyAccountCallCounts(reportRow);
|
|
|
hourlyChartKey.value += 1;
|
|
hourlyChartKey.value += 1;
|
|
|
} catch {
|
|
} catch {
|
|
|
Message.error('小时数据加载失败');
|
|
Message.error('小时数据加载失败');
|
|
@@ -1576,8 +1592,8 @@
|
|
|
date: string,
|
|
date: string,
|
|
|
scene: string
|
|
scene: string
|
|
|
) => {
|
|
) => {
|
|
|
- const totals = Array(24).fill(0) as number[];
|
|
|
|
|
- if (!trackIds.length) return totals;
|
|
|
|
|
|
|
+ const eventCounts = Array(24).fill(0) as number[];
|
|
|
|
|
+ if (!trackIds.length) return { eventCounts };
|
|
|
|
|
|
|
|
const results = await Promise.all(
|
|
const results = await Promise.all(
|
|
|
trackIds.map((trackId) =>
|
|
trackIds.map((trackId) =>
|
|
@@ -1593,7 +1609,40 @@
|
|
|
const list: TrackHourlyReportRecord[] = res?.data?.list || [];
|
|
const list: TrackHourlyReportRecord[] = res?.data?.list || [];
|
|
|
list.forEach((item) => {
|
|
list.forEach((item) => {
|
|
|
if (item.hour >= 0 && item.hour < 24) {
|
|
if (item.hour >= 0 && item.hour < 24) {
|
|
|
- totals[item.hour] += Number(item.event_count || 0);
|
|
|
|
|
|
|
+ eventCounts[item.hour] += Number(item.event_count || 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ return { eventCounts };
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const fetchHourlyAccountCallCounts = async (reportRow: DimensionRow) => {
|
|
|
|
|
+ const totals = Array(24).fill(0) as number[];
|
|
|
|
|
+ const accountRows = getAccountRows(reportRow);
|
|
|
|
|
+ const trackId = [
|
|
|
|
|
+ ...reportRow.exposeTrackIds,
|
|
|
|
|
+ ...reportRow.clickTrackIds,
|
|
|
|
|
+ ][0];
|
|
|
|
|
+
|
|
|
|
|
+ if (!trackId || !accountRows.length) return totals;
|
|
|
|
|
+
|
|
|
|
|
+ const results = await Promise.all(
|
|
|
|
|
+ accountRows.map((accountRow) =>
|
|
|
|
|
+ queryTrackHourlyReport({
|
|
|
|
|
+ track_link_id: trackId,
|
|
|
|
|
+ date: reportRow.date,
|
|
|
|
|
+ scene: reportRow.scene,
|
|
|
|
|
+ account_id: accountRow.accountId,
|
|
|
|
|
+ })
|
|
|
|
|
+ )
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ results.forEach((res: any) => {
|
|
|
|
|
+ const list: TrackHourlyReportRecord[] = res?.data?.list || [];
|
|
|
|
|
+ list.forEach((item) => {
|
|
|
|
|
+ if (item.hour >= 0 && item.hour < 24) {
|
|
|
|
|
+ totals[item.hour] += Number(item.call_count || 0);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|