|
|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
<template>
|
|
|
|
|
<el-dialog v-model="data.visible" title="预览" width="70%" append-to-body>
|
|
|
|
|
<div v-if="data.type === 'png'" style="align: center">
|
|
|
|
|
<el-image v-if="data.type === 'png'" :src="data.url[0]">
|
|
|
|
|
<div>流程图加载中 <i class="el-icon-loading"></i></div>
|
|
|
|
|
</el-image>
|
|
|
|
|
<div v-if="data.type === 'png' && data.xmlStr" style="align: center">
|
|
|
|
|
<BpmnViewer ref="bpmnViewerRef"></BpmnViewer>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="data.type === 'xml'" class="xml-data">
|
|
|
|
|
<div v-for="(xml, index) in data.url" :key="index">
|
|
|
|
|
@ -17,16 +15,29 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import BpmnViewer from '@/components/BpmnView/index.vue';
|
|
|
|
|
|
|
|
|
|
const data = reactive({
|
|
|
|
|
visible: false,
|
|
|
|
|
url: new Array<string>(),
|
|
|
|
|
type: ''
|
|
|
|
|
type: '',
|
|
|
|
|
xmlStr: ''
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const bpmnViewerRef = ref<InstanceType<typeof BpmnViewer>>();
|
|
|
|
|
//打开
|
|
|
|
|
const openDialog = (url: string[], type: string) => {
|
|
|
|
|
data.visible = true;
|
|
|
|
|
data.url = url;
|
|
|
|
|
data.type = type;
|
|
|
|
|
/** 流程图 */
|
|
|
|
|
if (type === 'png') {
|
|
|
|
|
data.xmlStr = url.join('\n');
|
|
|
|
|
/** 必须放在nextTick 否则第一次打开为空 */
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
bpmnViewerRef.value?.initXml(data.xmlStr);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* 对外暴露子组件方法
|
|
|
|
|
|