Add emitter.off cleanup in onBeforeUnmount for 10 components
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -392,7 +392,7 @@
|
|||||||
* check outcomes in a data table with status indicators.
|
* check outcomes in a data table with status indicators.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch, onBeforeUnmount } from "vue";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { useConformanceStore } from "@/stores/conformance";
|
import { useConformanceStore } from "@/stores/conformance";
|
||||||
import iconNA from "@/components/icons/IconNA.vue";
|
import iconNA from "@/components/icons/IconNA.vue";
|
||||||
@@ -504,7 +504,7 @@ const progressWidth = (value) => {
|
|||||||
* @returns {string} The formatted percentage string.
|
* @returns {string} The formatted percentage string.
|
||||||
*/
|
*/
|
||||||
const getPercentLabel = (val) => {
|
const getPercentLabel = (val) => {
|
||||||
if ((val * 100).toFixed(1) >= 100) return 100;
|
if (Number((val * 100).toFixed(1)) >= 100) return 100;
|
||||||
else return parseFloat((val * 100).toFixed(1));
|
else return parseFloat((val * 100).toFixed(1));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -562,7 +562,7 @@ const setConformanceTempReportData = (newData) => {
|
|||||||
Object.values(newData.counts).reduce((acc, val) => acc + val, 0),
|
Object.values(newData.counts).reduce((acc, val) => acc + val, 0),
|
||||||
);
|
);
|
||||||
const sum = newData.counts.conforming + newData.counts.not_conforming;
|
const sum = newData.counts.conforming + newData.counts.not_conforming;
|
||||||
const rate = ((newData.counts.conforming / sum) * 100).toFixed(1);
|
const rate = sum === 0 ? "0.0" : ((newData.counts.conforming / sum) * 100).toFixed(1);
|
||||||
const isNullTime = (value) =>
|
const isNullTime = (value) =>
|
||||||
value === null ? null : getNumberLabel((value / 86400).toFixed(1));
|
value === null ? null : getNumberLabel((value / 86400).toFixed(1));
|
||||||
const isNullCase = (value) =>
|
const isNullCase = (value) =>
|
||||||
@@ -974,6 +974,11 @@ emitter.on(
|
|||||||
"timeRangeMaxMin",
|
"timeRangeMaxMin",
|
||||||
(newData) => (selectDurationTime.value = newData),
|
(newData) => (selectDurationTime.value = newData),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off("coverPlate");
|
||||||
|
emitter.off("timeRangeMaxMin");
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
:deep(.disc) {
|
:deep(.disc) {
|
||||||
|
|||||||
@@ -1725,6 +1725,14 @@ emitter.on("isRadioActSeqFromToChange", (data) => {
|
|||||||
// beforeUnmount
|
// beforeUnmount
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
if (reportWatchTimerId) clearTimeout(reportWatchTimerId);
|
if (reportWatchTimerId) clearTimeout(reportWatchTimerId);
|
||||||
|
emitter.off("actRadioData");
|
||||||
|
emitter.off("getListSequence");
|
||||||
|
emitter.off("actListData");
|
||||||
|
emitter.off("isRadioChange");
|
||||||
|
emitter.off("isRadioSeqChange");
|
||||||
|
emitter.off("isRadioProcessScopeChange");
|
||||||
|
emitter.off("isRadioActSeqMoreChange");
|
||||||
|
emitter.off("isRadioActSeqFromToChange");
|
||||||
isSubmitReset();
|
isSubmitReset();
|
||||||
selectTimeReset();
|
selectTimeReset();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
* Checkbox-based activity list for conformance checking input.
|
* Checkbox-based activity list for conformance checking input.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch, onBeforeUnmount } from "vue";
|
||||||
import { sortNumEngZhtw } from "@/module/sortNumEngZhtw.js";
|
import { sortNumEngZhtw } from "@/module/sortNumEngZhtw.js";
|
||||||
import emitter from "@/utils/emitter";
|
import emitter from "@/utils/emitter";
|
||||||
|
|
||||||
@@ -73,4 +73,8 @@ function actListData() {
|
|||||||
emitter.on("reset", (data) => {
|
emitter.on("reset", (data) => {
|
||||||
actList.value = data;
|
actList.value = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off("reset");
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
* start/end activity input.
|
* start/end activity input.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, computed, watch } from "vue";
|
import { ref, computed, watch, onBeforeUnmount } from "vue";
|
||||||
import { useConformanceInputStore } from "@/stores/conformanceInput";
|
import { useConformanceInputStore } from "@/stores/conformanceInput";
|
||||||
import { sortNumEngZhtw } from "@/module/sortNumEngZhtw.js";
|
import { sortNumEngZhtw } from "@/module/sortNumEngZhtw.js";
|
||||||
import emitter from "@/utils/emitter";
|
import emitter from "@/utils/emitter";
|
||||||
@@ -109,4 +109,8 @@ emitter.on("reset", (data) => {
|
|||||||
selectedRadio.value = data;
|
selectedRadio.value = data;
|
||||||
});
|
});
|
||||||
setGlobalActivityRadioDataState();
|
setGlobalActivityRadioDataState();
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off("reset");
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
* conformance rule configuration.
|
* conformance rule configuration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, computed } from "vue";
|
import { ref, computed, onBeforeUnmount } from "vue";
|
||||||
import { sortNumEngZhtw } from "@/module/sortNumEngZhtw.js";
|
import { sortNumEngZhtw } from "@/module/sortNumEngZhtw.js";
|
||||||
import emitter from "@/utils/emitter";
|
import emitter from "@/utils/emitter";
|
||||||
|
|
||||||
@@ -200,6 +200,10 @@ listSequence.value = props.isSubmit ? newlist : [];
|
|||||||
emitter.on("reset", (data) => {
|
emitter.on("reset", (data) => {
|
||||||
listSequence.value = [];
|
listSequence.value = [];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off("reset");
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@reference "../../../../assets/tailwind.css";
|
@reference "../../../../assets/tailwind.css";
|
||||||
|
|||||||
@@ -356,7 +356,7 @@
|
|||||||
* check result statistics.
|
* check result statistics.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, computed, watch } from "vue";
|
import { ref, computed, watch, onBeforeUnmount } from "vue";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { useLoadingStore } from "@/stores/loading";
|
import { useLoadingStore } from "@/stores/loading";
|
||||||
import { useConformanceStore } from "@/stores/conformance";
|
import { useConformanceStore } from "@/stores/conformance";
|
||||||
@@ -755,4 +755,13 @@ emitter.on("isRadioActSeqFromToChange", (data) => {
|
|||||||
emitter.on("reset", (data) => {
|
emitter.on("reset", (data) => {
|
||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off("isRadioChange");
|
||||||
|
emitter.off("isRadioSeqChange");
|
||||||
|
emitter.off("isRadioProcessScopeChange");
|
||||||
|
emitter.off("isRadioActSeqMoreChange");
|
||||||
|
emitter.off("isRadioActSeqFromToChange");
|
||||||
|
emitter.off("reset");
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -235,7 +235,7 @@
|
|||||||
* configuration with calendar inputs.
|
* configuration with calendar inputs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { reactive } from "vue";
|
import { reactive, onBeforeUnmount } from "vue";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { useConformanceStore } from "@/stores/conformance";
|
import { useConformanceStore } from "@/stores/conformance";
|
||||||
import emitter from "@/utils/emitter";
|
import emitter from "@/utils/emitter";
|
||||||
@@ -672,4 +672,13 @@ emitter.on("isRadioActSeqFromToChange", (data) => {
|
|||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off("actRadioData");
|
||||||
|
emitter.off("reset");
|
||||||
|
emitter.off("isRadioChange");
|
||||||
|
emitter.off("isRadioProcessScopeChange");
|
||||||
|
emitter.off("isRadioActSeqMoreChange");
|
||||||
|
emitter.off("isRadioActSeqFromToChange");
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
* matched activities.
|
* matched activities.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch, onBeforeUnmount } from "vue";
|
||||||
import emitter from "@/utils/emitter";
|
import emitter from "@/utils/emitter";
|
||||||
|
|
||||||
const props = defineProps(["data", "select"]);
|
const props = defineProps(["data", "select"]);
|
||||||
@@ -51,4 +51,8 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
emitter.on("reset", (val) => (displayData.value = val));
|
emitter.on("reset", (val) => (displayData.value = val));
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off("reset");
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
* and task pairs.
|
* and task pairs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch, onBeforeUnmount } from "vue";
|
||||||
import emitter from "@/utils/emitter";
|
import emitter from "@/utils/emitter";
|
||||||
|
|
||||||
const props = defineProps(["timeResultData", "select"]);
|
const props = defineProps(["timeResultData", "select"]);
|
||||||
@@ -45,4 +45,8 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
emitter.on("reset", (val) => (data.value = val));
|
emitter.on("reset", (val) => (data.value = val));
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off("reset");
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
* fields and bounded min/max validation.
|
* fields and bounded min/max validation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, computed, watch, onMounted } from "vue";
|
import { ref, computed, watch, onMounted, onBeforeUnmount } from "vue";
|
||||||
import emitter from "@/utils/emitter";
|
import emitter from "@/utils/emitter";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -397,6 +397,10 @@ emitter.on("reset", () => {
|
|||||||
createData();
|
createData();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
emitter.off("reset");
|
||||||
|
});
|
||||||
|
|
||||||
// mounted
|
// mounted
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
inputTypes.value = display.value.split("");
|
inputTypes.value = display.value.split("");
|
||||||
|
|||||||
Reference in New Issue
Block a user