You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< template >
< div ref = "container" class = "w-full h-[calc(100vh-88px)]" >
< iframe ref = "iframe" :src ="iframeUrl" frameborder = "0" height = "100%" style = "height: 100%; width: inherit" > < / iframe >
< / div >
< / template >
< script setup name = "WarmFlow" lang = "ts" >
const { proxy } = getCurrentInstance ( ) ;
import { onMounted } from 'vue' ;
import { getToken } from '@/utils/auth' ;
// definitionId为需要查询的流程定义id,
// disabled为是否可编辑, 例如:查看的时候不可编辑,不可保存
const iframeUrl = ref ( '' ) ;
const baseUrl = import . meta . env . VITE _APP _BASE _API ;
const iframeLoaded = ( ) => {
// iframe监听组件内设计器保存事件
window . onmessage = ( event ) => {
switch ( event . data . method ) {
case 'close' :
close ( ) ;
break ;
}
} ;
} ;
const open = async ( definitionId , disabled ) => {
const url = baseUrl + ` /warm-flow-ui/index.html?id= ${ definitionId } &disabled= ${ disabled } ` ;
iframeUrl . value = url + '&Authorization=Bearer ' + getToken ( ) + '&clientid=' + import . meta . env . VITE _APP _CLIENT _ID ;
} ;
/** 关闭按钮 */
function close ( ) {
const obj = { path : '/workflow/processDefinition' , query : { activeName : proxy . $route . query . activeName } } ;
proxy . $tab . closeOpenPage ( obj ) ;
}
onMounted ( ( ) => {
iframeLoaded ( ) ;
open ( proxy . $route . query . definitionId , proxy . $route . query . disabled ) ;
} ) ;
/**
* 对外暴露子组件方法
*/
defineExpose ( {
open
} ) ;
< / script >