fix page transition
This commit is contained in:
@@ -508,7 +508,13 @@ async function toEdit(): Promise<void> {
|
||||
if (!customer.value?.id) {
|
||||
return;
|
||||
}
|
||||
await router.push(`/management/customers/${customer.value.id}/edit`);
|
||||
const queryDepth = Array.isArray(route.query.transitionDepth) ? route.query.transitionDepth[0] : route.query.transitionDepth;
|
||||
const depth = Number(queryDepth);
|
||||
await router.push({
|
||||
name: "CustomerEdit",
|
||||
params: { id: customer.value.id },
|
||||
query: queryDepth && Number.isInteger(depth) && 0 <= depth ? { transitionDepth: String(depth + 1) } : {}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- 积分账户 ----------
|
||||
|
||||
@@ -669,16 +669,21 @@ async function doSubmit(): Promise<void> {
|
||||
const redirect = String(route.query.redirect || "");
|
||||
await router.replace(redirect || "/management/customers");
|
||||
return;
|
||||
} else {
|
||||
await CustomerAPI.update(payload);
|
||||
Message.success("保存成功");
|
||||
const redirect = String(route.query.redirect || "");
|
||||
if (redirect) {
|
||||
await router.replace(redirect);
|
||||
return;
|
||||
}
|
||||
}
|
||||
await router.replace("/management/customers");
|
||||
await CustomerAPI.update(payload);
|
||||
Message.success("保存成功");
|
||||
const redirect = String(route.query.redirect || "");
|
||||
if (redirect) {
|
||||
await router.replace(redirect);
|
||||
return;
|
||||
}
|
||||
const previousPath = window.history.state?.back;
|
||||
const previousRoute = typeof previousPath === "string" ? router.resolve(previousPath) : undefined;
|
||||
if (previousRoute?.name === "CustomerDetail" && previousRoute.params.id === route.params.id) {
|
||||
await router.back();
|
||||
return;
|
||||
}
|
||||
await router.replace({ name: "CustomerDetail", params: { id: route.params.id } });
|
||||
} finally {
|
||||
isSubmitting.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user