Replace async IIFE with onMounted for page initialization (S7785)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 08:47:34 +08:00
parent e9e588385b
commit bbca475bbe
5 changed files with 13 additions and 25 deletions

View File

@@ -1458,8 +1458,7 @@ function getAvgProcessTimeHorizontalBarChart(
return [primeVueSetData, primeVueSetOption];
}
// Created logic
(async () => {
onMounted(async () => {
isLoading.value = true;
try {
const routeParams = route.params;
@@ -1548,12 +1547,9 @@ function getAvgProcessTimeHorizontalBarChart(
);
} catch (error) {
console.error("Failed to initialize compare dashboard:", error);
} finally {
isLoading.value = false;
}
})();
// Mounted
onMounted(() => {
isLoading.value = false;
});
</script>
<style scoped>

View File

@@ -146,7 +146,7 @@ export default {
</script>
<script setup>
import { ref, computed, watch, onBeforeMount, onBeforeUnmount } from "vue";
import { ref, computed, watch, onMounted, onBeforeMount, onBeforeUnmount } from "vue";
import { useRoute } from "vue-router";
import { storeToRefs } from "pinia";
import { useLoadingStore } from "@/stores/loading";
@@ -578,8 +578,7 @@ function setActivityBgImage(mapData) {
}
}
// Created logic
(async () => {
onMounted(async () => {
try {
const routeParams = route.params;
const file = route.meta.file;
@@ -635,7 +634,7 @@ function setActivityBgImage(mapData) {
} finally {
isLoading.value = false;
}
})();
});
onBeforeUnmount(() => {
emitter.off("saveModal");

View File

@@ -77,8 +77,7 @@ const {
let loadingTimerId = null;
// Created logic
(async () => {
onMounted(async () => {
isLoading.value = true;
try {
const params = route.params;
@@ -113,10 +112,6 @@ let loadingTimerId = null;
} finally {
loadingTimerId = setTimeout(() => (isLoading.value = false), 500);
}
})();
// Mounted
onMounted(() => {
selectedRuleType.value = "Have activity";
selectedActivitySequence.value = "Start & End";
selectedMode.value = "Directly follows";

View File

@@ -145,7 +145,7 @@ export default {
</script>
<script setup>
import { ref, computed, watch, onBeforeMount, onBeforeUnmount } from "vue";
import { ref, computed, watch, onMounted, onBeforeMount, onBeforeUnmount } from "vue";
import { useRoute } from "vue-router";
import { storeToRefs } from "pinia";
import { useLoadingStore } from "@/stores/loading";
@@ -567,8 +567,7 @@ function setActivityBgImage(mapData) {
}
}
// Created logic
(async () => {
onMounted(async () => {
try {
const routeParams = route.params;
const file = route.meta.file;
@@ -624,7 +623,7 @@ function setActivityBgImage(mapData) {
} finally {
isLoading.value = false;
}
})();
});
onBeforeUnmount(() => {
emitter.off("saveModal");

View File

@@ -270,7 +270,7 @@ export default {
};
</script>
<script setup>
import { ref } from "vue";
import { ref, onMounted } from "vue";
import { useRoute } from "vue-router";
import { storeToRefs } from "pinia";
import moment from "moment";
@@ -1049,8 +1049,7 @@ function getAvgWaitingTimeLineChart(chartData, content, yUnit) {
return [primeVueSetData, primeVueSetOption];
}
// Created logic
(async () => {
onMounted(async () => {
isLoading.value = true;
try {
const routeParams = route.params;
@@ -1138,7 +1137,7 @@ function getAvgWaitingTimeLineChart(chartData, content, yUnit) {
} finally {
isLoading.value = false;
}
})();
});
</script>
<style scoped>
@reference "../../../assets/tailwind.css";