chore: 保存的事件
This commit is contained in:
parent
395b45fa48
commit
f735e8e536
@ -1,7 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRoute } from 'vue-router';
|
import { onMounted, onUnmounted } from 'vue';
|
||||||
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { useAppConfig } from '@vben/hooks';
|
import { useAppConfig, useTabs } from '@vben/hooks';
|
||||||
import { stringify } from '@vben/request';
|
import { stringify } from '@vben/request';
|
||||||
import { useAccessStore } from '@vben/stores';
|
import { useAccessStore } from '@vben/stores';
|
||||||
|
|
||||||
@ -21,7 +22,29 @@ const params = {
|
|||||||
disabled,
|
disabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iframe设计器的地址
|
||||||
|
*/
|
||||||
const url = `${import.meta.env.VITE_GLOB_API_URL}/warm-flow-ui/index.html?${stringify(params)}`;
|
const url = `${import.meta.env.VITE_GLOB_API_URL}/warm-flow-ui/index.html?${stringify(params)}`;
|
||||||
|
|
||||||
|
const { closeCurrentTab } = useTabs();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
function messageHandler(event: MessageEvent) {
|
||||||
|
switch (event.data.method) {
|
||||||
|
case 'close': {
|
||||||
|
// 关闭当前tab
|
||||||
|
closeCurrentTab();
|
||||||
|
// 跳转到流程定义列表
|
||||||
|
router.push('/workflow/processDefinition');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// iframe监听组件内设计器保存事件
|
||||||
|
onMounted(() => window.addEventListener('message', messageHandler));
|
||||||
|
onUnmounted(() => window.removeEventListener('message', messageHandler));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
Loading…
Reference in New Issue
Block a user