2024-10-26 17:44:36 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div ref="container" class="container">
|
|
|
|
|
<iframe ref="iframe" :src="iframeUrl" frameborder="0" width="100%" height="100%"></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup name="WarmFlow">
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
import { onMounted } from 'vue';
|
|
|
|
|
// definitionId为需要查询的流程定义id,
|
|
|
|
|
// disabled为是否可编辑, 例如:查看的时候不可编辑,不可保存
|
|
|
|
|
const iframeUrl = ref('');
|
2024-11-16 00:34:30 +08:00
|
|
|
|
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
2024-10-26 17:44:36 +08:00
|
|
|
|
const iframeLoaded = () => {
|
|
|
|
|
// iframe监听组件内设计器保存事件
|
|
|
|
|
window.onmessage = (event) => {
|
|
|
|
|
switch (event.data.method) {
|
|
|
|
|
case 'close':
|
|
|
|
|
close();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
const open = async (definitionId) => {
|
2024-11-16 00:34:30 +08:00
|
|
|
|
iframeUrl.value = baseUrl + `/warm-flow-ui/index.html?id=${definitionId}&disabled=false`;
|
2024-10-26 17:44:36 +08:00
|
|
|
|
};
|
|
|
|
|
/** 关闭按钮 */
|
|
|
|
|
function close() {
|
|
|
|
|
const obj = { path: '/workflow/processDefinition' };
|
|
|
|
|
proxy.$tab.closeOpenPage(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
iframeLoaded();
|
|
|
|
|
open(proxy.$route.query.definitionId);
|
|
|
|
|
});
|
|
|
|
|
/**
|
|
|
|
|
* 对外暴露子组件方法
|
|
|
|
|
*/
|
|
|
|
|
defineExpose({
|
|
|
|
|
open
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: calc(100vh - 84px);
|
|
|
|
|
}
|
|
|
|
|
</style>
|