fix page transition
This commit is contained in:
@@ -399,7 +399,10 @@ async function submit(): Promise<void> {
|
|||||||
emitListDataChanged(listDataEventKeys.productStockChanged);
|
emitListDataChanged(listDataEventKeys.productStockChanged);
|
||||||
Message.success("批量入库已提交");
|
Message.success("批量入库已提交");
|
||||||
productStockBatchStore.reset();
|
productStockBatchStore.reset();
|
||||||
await router.replace({ name: "ProductStockList" });
|
await router.replace({
|
||||||
|
name: "ProductStockRecordList",
|
||||||
|
query: { returnTo: "ProductTab" }
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Message.error(getErrorMessage(error, "批量入库失败,请确认请求号后重试"));
|
Message.error(getErrorMessage(error, "批量入库失败,请确认请求号后重试"));
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -174,6 +174,7 @@
|
|||||||
import { type DropdownValue } from "tdesign-mobile-vue";
|
import { type DropdownValue } from "tdesign-mobile-vue";
|
||||||
import { PassTimeLabel, Time } from "timi-web";
|
import { PassTimeLabel, Time } from "timi-web";
|
||||||
import { UserAPI } from "timi-web-api";
|
import { UserAPI } from "timi-web-api";
|
||||||
|
import { onBeforeRouteLeave } from "vue-router";
|
||||||
import ProductAPI from "@/api/ProductAPI";
|
import ProductAPI from "@/api/ProductAPI";
|
||||||
import { useNavBarStore } from "@/store/navBarStore";
|
import { useNavBarStore } from "@/store/navBarStore";
|
||||||
import type { Product, ProductSku, StockOperationType, StockRecord, StockRecordDirection } from "@/types/Product";
|
import type { Product, ProductSku, StockOperationType, StockRecord, StockRecordDirection } from "@/types/Product";
|
||||||
@@ -203,6 +204,7 @@ const isRefreshing = ref(false);
|
|||||||
const noMore = ref(false);
|
const noMore = ref(false);
|
||||||
const productId = computed(() => getQueryText("productId"));
|
const productId = computed(() => getQueryText("productId"));
|
||||||
const skuId = computed(() => getQueryText("skuId"));
|
const skuId = computed(() => getQueryText("skuId"));
|
||||||
|
const returnToProductTab = getQueryText("returnTo") === "ProductTab";
|
||||||
const filteredProduct = ref<Product>();
|
const filteredProduct = ref<Product>();
|
||||||
const filteredSku = ref<ProductSku>();
|
const filteredSku = ref<ProductSku>();
|
||||||
const filteredSkuUnitId = ref("");
|
const filteredSkuUnitId = ref("");
|
||||||
@@ -484,6 +486,7 @@ function buildFilterQuery(transitionDepth = getQueryText("transitionDepth")): Re
|
|||||||
const query = {
|
const query = {
|
||||||
productId: productId.value,
|
productId: productId.value,
|
||||||
skuId: skuId.value,
|
skuId: skuId.value,
|
||||||
|
returnTo: returnToProductTab ? "ProductTab" : "",
|
||||||
keyword: keyword.value.trim(),
|
keyword: keyword.value.trim(),
|
||||||
operationType: operationType.value === "ALL" ? "" : operationType.value,
|
operationType: operationType.value === "ALL" ? "" : operationType.value,
|
||||||
direction: direction.value === "ALL" ? "" : direction.value,
|
direction: direction.value === "ALL" ? "" : direction.value,
|
||||||
@@ -539,6 +542,7 @@ async function refresh(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
navBarStore.setBackTo(returnToProductTab ? "/product" : undefined);
|
||||||
navBarStore.clearRight();
|
navBarStore.clearRight();
|
||||||
try {
|
try {
|
||||||
await Promise.all([loadSkuFilter(), reload()]);
|
await Promise.all([loadSkuFilter(), reload()]);
|
||||||
@@ -547,6 +551,8 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeRouteLeave(() => navBarStore.setBackTo(undefined));
|
||||||
|
|
||||||
watch(keyword, () => {
|
watch(keyword, () => {
|
||||||
window.clearTimeout(keywordTimer);
|
window.clearTimeout(keywordTimer);
|
||||||
keywordTimer = window.setTimeout(async () => {
|
keywordTimer = window.setTimeout(async () => {
|
||||||
@@ -559,6 +565,7 @@ watch(keyword, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
navBarStore.setBackTo(undefined);
|
||||||
navBarStore.clearRight();
|
navBarStore.clearRight();
|
||||||
window.clearTimeout(keywordTimer);
|
window.clearTimeout(keywordTimer);
|
||||||
requestToken += 1;
|
requestToken += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user