列表浏览bpmn图

This commit is contained in:
gexinzhineng/gxzn27 2023-01-31 14:12:29 +08:00
parent b700b316cd
commit 3a954b47bb
6 changed files with 46 additions and 25 deletions

View File

@ -1,7 +1,7 @@
<template>
<div class="my-process-designer">
<div class="my-process-designer__container">
<div class="my-process-designer__canvas" ref="bpmn-canvas"></div>
<div class="my-process-designer__canvas" style="height: 760px" ref="bpmnCanvas"></div>
</div>
</div>
</template>
@ -9,8 +9,7 @@
<script setup lang="ts" name="MyProcessViewer">
import BpmnViewer from 'bpmn-js/lib/Viewer'
import DefaultEmptyXML from './plugins/defaultEmpty'
import { onMounted } from 'vue'
import { onBeforeUnmount, provide, ref, watch } from 'vue'
import { onMounted, onBeforeUnmount, provide, ref, watch } from 'vue'
const props = defineProps({
value: {
// BPMN XML
@ -44,7 +43,7 @@ const emit = defineEmits(['destroy'])
let bpmnModeler
const xml = ref('')
const activityList = ref([])
const activityLists = ref([])
const processInstance = ref(undefined)
const taskList = ref([])
const bpmnCanvas = ref()
@ -84,7 +83,7 @@ const createNewDiagram = async (xml) => {
/* 高亮流程图 */
// TODO endActivity https://www.jdon.com/workflow/multi-events.html
const highlightDiagram = async () => {
const activityList = activityList.value
const activityList = activityLists.value
if (activityList.length === 0) {
return
}
@ -266,7 +265,7 @@ const elementHover = (element) => {
!elementOverlayIds.value && (elementOverlayIds.value = {})
!overlays.value && (overlays.value = bpmnModeler.get('overlays'))
//
const activity = activityList.value.find((m) => m.key === element.value.id)
const activity = activityLists.value.find((m) => m.key === element.value.id)
if (!activity) {
return
}
@ -329,7 +328,7 @@ const elementOut = (element) => {
onMounted(() => {
xml.value = props.value
activityList.value = props.activityData
activityLists.value = props.activityData
//
initBpmnModeler()
createNewDiagram(xml.value)
@ -355,7 +354,7 @@ watch(
watch(
() => props.activityData,
(newActivityData) => {
activityList.value = newActivityData
activityLists.value = newActivityData
createNewDiagram(xml.value)
}
)

View File

@ -1,8 +0,0 @@
import MyProcessDesigner from "./ProcessDesigner.vue";
MyProcessDesigner.install = function(Vue) {
Vue.component(MyProcessDesigner.name, MyProcessDesigner);
};
// 流程图的设计器,可编辑
export default MyProcessDesigner;

View File

@ -0,0 +1,8 @@
import MyProcessDesigner from './ProcessDesigner.vue'
MyProcessDesigner.install = function (Vue) {
Vue.component(MyProcessDesigner.name, MyProcessDesigner)
}
// 流程图的设计器,可编辑
export default MyProcessDesigner

View File

@ -1,8 +0,0 @@
import MyProcessViewer from "./ProcessViewer.vue";
MyProcessViewer.install = function(Vue) {
Vue.component(MyProcessViewer.name, MyProcessViewer);
};
// 流程图的查看器,不可编辑
export default MyProcessViewer;

View File

@ -0,0 +1,8 @@
import MyProcessViewer from './ProcessViewer.vue'
MyProcessViewer.install = function (Vue) {
Vue.component(MyProcessViewer.name, MyProcessViewer)
}
// 流程图的查看器,不可编辑
export default MyProcessViewer

View File

@ -298,6 +298,17 @@
v-if="formDetailVisible"
/>
</XModal>
<!-- 流程模型图的预览 -->
<XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%">
<my-process-viewer
key="designer"
v-model="bpmnXML"
:value="bpmnXML"
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/>
</XModal>
</ContentWrap>
</template>
@ -317,6 +328,11 @@ const { t } = useI18n() // 国际化
const message = useMessage() //
const router = useRouter() //
const showBpmnOpen = ref(false)
const bpmnXML = ref(null)
const bpmnControlForm = ref({
prefix: 'flowable'
})
// ========== ==========
const [registerTable, { reload }] = useXTable({
allSchemas: allSchemas,
@ -369,7 +385,13 @@ const handleFormDetail = async (row) => {
const handleBpmnDetail = (row) => {
// TODO
console.log(row)
message.success('流程组件开发中,预计 2 月底完成')
ModelApi.getModelApi(row).then((response) => {
console.log(response, 'response')
bpmnXML.value = response.bpmnXml
//
showBpmnOpen.value = true
})
// message.success(' 2 ')
}
//