support tablet
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="page-layout navbar">
|
||||
<div class="tui-page-layout tui-navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="登记事件详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
@left-click="goBack"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
@@ -18,7 +18,7 @@
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main class="page-content scroll column">
|
||||
<main class="tui-page-content scroll column">
|
||||
<div
|
||||
v-can="permissionCodes.event.read"
|
||||
class="registration-event-detail"
|
||||
@@ -143,7 +143,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { BottomPopup } from "timi-tdesign-mobile";
|
||||
import { BottomPopup, useExpandToMaster, usePane } from "timi-tdesign-mobile";
|
||||
import { Time, Text } from "timi-web";
|
||||
import { type ModuleCode, type Role, RoleAPI, useUserStore } from "timi-web-api";
|
||||
import EventAPI from "@/api/EventAPI";
|
||||
@@ -165,6 +165,18 @@ defineOptions({
|
||||
name: "EventDetail"
|
||||
});
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 指定事件 ID 时忽略路由参数,用于平板主从分栏的内联渲染。 */
|
||||
eventId?: string;
|
||||
}>(), {
|
||||
eventId: ""
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
/** 内联在右栏时请求切换到编辑视图 */
|
||||
edit: [];
|
||||
}>();
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
@@ -172,6 +184,18 @@ const currentStoreStore = useCurrentStoreStore();
|
||||
const moduleCode: ModuleCode = "GAO";
|
||||
const defaultColor = "#2f88ff";
|
||||
|
||||
function resolveId(): string {
|
||||
return props.eventId || String(route.params.id || "");
|
||||
}
|
||||
|
||||
// 竖屏整页进来后转成横屏:回到列表页并恢复右栏选中,而不是继续停在整页详情
|
||||
useExpandToMaster({
|
||||
path: "/management/registration-events",
|
||||
id: () => resolveId()
|
||||
});
|
||||
/** 非空说明当前被内联在主从分栏的右栏里 */
|
||||
const pane = usePane();
|
||||
|
||||
// ---------- 权限与门店 ----------
|
||||
|
||||
const isDeletedEvent = computed(() => event.value?.status === "DELETED");
|
||||
@@ -224,7 +248,7 @@ async function loadRoleOptions(): Promise<void> {
|
||||
}
|
||||
|
||||
async function loadEvent(): Promise<void> {
|
||||
const eventId = String(route.params.id || "");
|
||||
const eventId = resolveId();
|
||||
if (!eventId) {
|
||||
event.value = undefined;
|
||||
return;
|
||||
@@ -374,10 +398,17 @@ function getCurrentRouteDepth(): number {
|
||||
}
|
||||
|
||||
async function toEdit(): Promise<void> {
|
||||
const eventId = String(route.params.id || "");
|
||||
const eventId = resolveId();
|
||||
if (!canUpdate.value || !eventId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 分栏时右栏直接切到编辑视图,不跳路由,列表上下文保留
|
||||
if (pane) {
|
||||
emit("edit");
|
||||
return;
|
||||
}
|
||||
|
||||
await router.push({
|
||||
name: "EventEdit",
|
||||
params: { id: eventId },
|
||||
@@ -385,7 +416,16 @@ async function toEdit(): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
watch(() => route.params.id, async () => {
|
||||
function goBack(): void {
|
||||
if (pane) {
|
||||
pane.close();
|
||||
return;
|
||||
}
|
||||
|
||||
void router.back();
|
||||
}
|
||||
|
||||
watch(() => [props.eventId, route.params.id], async () => {
|
||||
await loadEvent();
|
||||
}, { immediate: true });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user