|
@@ -549,11 +549,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="orderAccept">
|
|
|
-import { computed, defineAsyncComponent, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
|
|
|
+import { computed, defineAsyncComponent, onActivated, onBeforeUnmount, onDeactivated, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
|
|
import type { FormInstance } from 'element-plus';
|
|
|
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus';
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
-import { useRoute, useRouter } from 'vue-router';
|
|
|
+import { onBeforeRouteLeave, useRoute, useRouter } from 'vue-router';
|
|
|
import { useTelStatus } from '@/stores/telStatus';
|
|
|
import { useAppConfig } from '@/stores/appConfig';
|
|
|
import { throttle, transformFile } from '@/utils/tools';
|
|
@@ -1337,12 +1337,20 @@ const getCurrentData = (val: any) => {
|
|
|
loadBaseData();
|
|
|
loadAddress();
|
|
|
loadExtra();
|
|
|
+const handleBeforeUnload = (event) => {
|
|
|
+ event.preventDefault();
|
|
|
+ event.returnValue = ''; // 对于某些浏览器,设置 returnValue
|
|
|
+};
|
|
|
onMounted(async () => {
|
|
|
await loadForm();
|
|
|
state.tagsViewList = await Session.get('tagsViewList');
|
|
|
+ window.addEventListener('beforeunload', handleBeforeUnload);
|
|
|
+});
|
|
|
+onUnmounted(() => {
|
|
|
+ window.removeEventListener('beforeunload', handleBeforeUnload);
|
|
|
});
|
|
|
-onBeforeUnmount(() => {
|
|
|
- if (route.query.createBy && route.query.createBy === 'transfer') {
|
|
|
+onBeforeRouteLeave(() => {
|
|
|
+ if (route.query.createBy && route.query.createBy === 'transfer') { // 移除缓存
|
|
|
Local.remove(`${route.query.callId}`);
|
|
|
}
|
|
|
});
|