数据大屏修改
This commit is contained in:
parent
0730d0609a
commit
5045256d72
@ -78,7 +78,7 @@ const arpuDashboards = ref<{
|
||||
});
|
||||
const initialDate = dayjs().tz(DEFAULT_STAT_TIMEZONE);
|
||||
const dateRange = ref<[string, string] | null>([
|
||||
initialDate.subtract(6, 'day').format('YYYY-MM-DD'),
|
||||
initialDate.format('YYYY-MM-DD'),
|
||||
initialDate.format('YYYY-MM-DD'),
|
||||
]);
|
||||
const selectedCountryCodes = ref<string[]>([]);
|
||||
@ -117,8 +117,6 @@ const gameQuery = reactive<{
|
||||
});
|
||||
|
||||
const query = reactive({
|
||||
periodType: 'DAY',
|
||||
statTimezone: DEFAULT_STAT_TIMEZONE,
|
||||
sysOrigin: '',
|
||||
});
|
||||
|
||||
@ -148,19 +146,6 @@ const permissionsSysOriginCode = computed(() =>
|
||||
sysOriginOptions.value.map((item) => String(item.value || '')),
|
||||
);
|
||||
|
||||
const periodTypeOptions = [
|
||||
{ label: '日', value: 'DAY' },
|
||||
{ label: '周', value: 'WEEK' },
|
||||
{ label: '月', value: 'MONTH' },
|
||||
{ label: '全部', value: 'ALL' },
|
||||
];
|
||||
|
||||
const statTimezoneOptions = [
|
||||
{ label: '利雅得(服务器)', value: 'Asia/Riyadh' },
|
||||
{ label: 'UTC', value: 'UTC' },
|
||||
{ label: '北京', value: 'Asia/Shanghai' },
|
||||
];
|
||||
|
||||
const gameProviderOptions = [
|
||||
{ label: '全部游戏厂商', value: '' },
|
||||
{ label: '站内游戏', value: 'INTERNAL' },
|
||||
@ -478,9 +463,7 @@ function hasPermission(code: string) {
|
||||
|
||||
const canQuery = computed(() => hasPermission('datav:query'));
|
||||
const canPaidPreview = computed(() => hasPermission('datav:paid:preview'));
|
||||
const currentTimezoneLabel = computed(() => {
|
||||
return statTimezoneOptions.find((item) => item.value === query.statTimezone)?.label || query.statTimezone;
|
||||
});
|
||||
const currentTimezoneLabel = '利雅得(服务器)';
|
||||
|
||||
function syncFullscreenState() {
|
||||
fullscreen.value = document.fullscreenElement === datavFullscreen.value;
|
||||
@ -506,35 +489,10 @@ async function toggleVisualMode() {
|
||||
await renderVisualCharts();
|
||||
}
|
||||
|
||||
function defaultRange(periodType: string): [string, string] | null {
|
||||
const now = dayjs().tz(query.statTimezone || DEFAULT_STAT_TIMEZONE);
|
||||
if (periodType === 'ALL') {
|
||||
return null;
|
||||
}
|
||||
if (periodType === 'MONTH') {
|
||||
return [now.startOf('month').format('YYYY-MM-DD'), now.format('YYYY-MM-DD')];
|
||||
}
|
||||
if (periodType === 'WEEK') {
|
||||
const daysSinceMonday = now.day() === 0 ? 6 : now.day() - 1;
|
||||
return [now.subtract(daysSinceMonday, 'day').format('YYYY-MM-DD'), now.format('YYYY-MM-DD')];
|
||||
}
|
||||
return [now.subtract(6, 'day').format('YYYY-MM-DD'), now.format('YYYY-MM-DD')];
|
||||
}
|
||||
|
||||
function handlePeriodChange(value: string) {
|
||||
dateRange.value = defaultRange(value);
|
||||
loadDashboard();
|
||||
}
|
||||
|
||||
function handleTimezoneChange() {
|
||||
dateRange.value = defaultRange(query.periodType);
|
||||
loadDashboard();
|
||||
}
|
||||
|
||||
function buildParams() {
|
||||
const params: Record<string, any> = {
|
||||
periodType: query.periodType,
|
||||
statTimezone: query.statTimezone || DEFAULT_STAT_TIMEZONE,
|
||||
periodType: 'DAY',
|
||||
statTimezone: DEFAULT_STAT_TIMEZONE,
|
||||
sysOrigin: query.sysOrigin || undefined,
|
||||
};
|
||||
if (dateRange.value?.[0] && dateRange.value?.[1]) {
|
||||
@ -545,13 +503,13 @@ function buildParams() {
|
||||
}
|
||||
|
||||
function buildRecentDayParams(dayCount: number) {
|
||||
const end = dayjs().tz(query.statTimezone || DEFAULT_STAT_TIMEZONE);
|
||||
const end = dayjs().tz(DEFAULT_STAT_TIMEZONE);
|
||||
const start = end.subtract(dayCount - 1, 'day');
|
||||
return {
|
||||
periodType: 'DAY',
|
||||
startDate: start.format('YYYY-MM-DD'),
|
||||
endDate: end.format('YYYY-MM-DD'),
|
||||
statTimezone: query.statTimezone || DEFAULT_STAT_TIMEZONE,
|
||||
statTimezone: DEFAULT_STAT_TIMEZONE,
|
||||
sysOrigin: query.sysOrigin || undefined,
|
||||
};
|
||||
}
|
||||
@ -1221,18 +1179,6 @@ onBeforeUnmount(() => {
|
||||
style="width: 150px"
|
||||
@change="loadDashboard"
|
||||
/>
|
||||
<Select
|
||||
v-model:value="query.statTimezone"
|
||||
:options="statTimezoneOptions"
|
||||
style="width: 170px"
|
||||
@change="handleTimezoneChange"
|
||||
/>
|
||||
<Select
|
||||
v-model:value="query.periodType"
|
||||
:options="periodTypeOptions"
|
||||
style="width: 110px"
|
||||
@change="handlePeriodChange"
|
||||
/>
|
||||
<DateRangePicker
|
||||
v-model:value="dateRange"
|
||||
allow-clear
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user