列表浏览bpmn图
parent
b700b316cd
commit
3a954b47bb
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="my-process-designer">
|
<div class="my-process-designer">
|
||||||
<div class="my-process-designer__container">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -9,8 +9,7 @@
|
||||||
<script setup lang="ts" name="MyProcessViewer">
|
<script setup lang="ts" name="MyProcessViewer">
|
||||||
import BpmnViewer from 'bpmn-js/lib/Viewer'
|
import BpmnViewer from 'bpmn-js/lib/Viewer'
|
||||||
import DefaultEmptyXML from './plugins/defaultEmpty'
|
import DefaultEmptyXML from './plugins/defaultEmpty'
|
||||||
import { onMounted } from 'vue'
|
import { onMounted, onBeforeUnmount, provide, ref, watch } from 'vue'
|
||||||
import { onBeforeUnmount, provide, ref, watch } from 'vue'
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
// BPMN XML 字符串
|
// BPMN XML 字符串
|
||||||
|
@ -44,7 +43,7 @@ const emit = defineEmits(['destroy'])
|
||||||
let bpmnModeler
|
let bpmnModeler
|
||||||
|
|
||||||
const xml = ref('')
|
const xml = ref('')
|
||||||
const activityList = ref([])
|
const activityLists = ref([])
|
||||||
const processInstance = ref(undefined)
|
const processInstance = ref(undefined)
|
||||||
const taskList = ref([])
|
const taskList = ref([])
|
||||||
const bpmnCanvas = ref()
|
const bpmnCanvas = ref()
|
||||||
|
@ -84,7 +83,7 @@ const createNewDiagram = async (xml) => {
|
||||||
/* 高亮流程图 */
|
/* 高亮流程图 */
|
||||||
// TODO 芋艿:如果多个 endActivity 的话,目前的逻辑可能有一定的问题。https://www.jdon.com/workflow/multi-events.html
|
// TODO 芋艿:如果多个 endActivity 的话,目前的逻辑可能有一定的问题。https://www.jdon.com/workflow/multi-events.html
|
||||||
const highlightDiagram = async () => {
|
const highlightDiagram = async () => {
|
||||||
const activityList = activityList.value
|
const activityList = activityLists.value
|
||||||
if (activityList.length === 0) {
|
if (activityList.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -266,7 +265,7 @@ const elementHover = (element) => {
|
||||||
!elementOverlayIds.value && (elementOverlayIds.value = {})
|
!elementOverlayIds.value && (elementOverlayIds.value = {})
|
||||||
!overlays.value && (overlays.value = bpmnModeler.get('overlays'))
|
!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) {
|
if (!activity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -329,7 +328,7 @@ const elementOut = (element) => {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
xml.value = props.value
|
xml.value = props.value
|
||||||
activityList.value = props.activityData
|
activityLists.value = props.activityData
|
||||||
// 初始化
|
// 初始化
|
||||||
initBpmnModeler()
|
initBpmnModeler()
|
||||||
createNewDiagram(xml.value)
|
createNewDiagram(xml.value)
|
||||||
|
@ -355,7 +354,7 @@ watch(
|
||||||
watch(
|
watch(
|
||||||
() => props.activityData,
|
() => props.activityData,
|
||||||
(newActivityData) => {
|
(newActivityData) => {
|
||||||
activityList.value = newActivityData
|
activityLists.value = newActivityData
|
||||||
createNewDiagram(xml.value)
|
createNewDiagram(xml.value)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
import MyProcessDesigner from "./ProcessDesigner.vue";
|
|
||||||
|
|
||||||
MyProcessDesigner.install = function(Vue) {
|
|
||||||
Vue.component(MyProcessDesigner.name, MyProcessDesigner);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 流程图的设计器,可编辑
|
|
||||||
export default MyProcessDesigner;
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
import MyProcessDesigner from './ProcessDesigner.vue'
|
||||||
|
|
||||||
|
MyProcessDesigner.install = function (Vue) {
|
||||||
|
Vue.component(MyProcessDesigner.name, MyProcessDesigner)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 流程图的设计器,可编辑
|
||||||
|
export default MyProcessDesigner
|
|
@ -1,8 +0,0 @@
|
||||||
import MyProcessViewer from "./ProcessViewer.vue";
|
|
||||||
|
|
||||||
MyProcessViewer.install = function(Vue) {
|
|
||||||
Vue.component(MyProcessViewer.name, MyProcessViewer);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 流程图的查看器,不可编辑
|
|
||||||
export default MyProcessViewer;
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
import MyProcessViewer from './ProcessViewer.vue'
|
||||||
|
|
||||||
|
MyProcessViewer.install = function (Vue) {
|
||||||
|
Vue.component(MyProcessViewer.name, MyProcessViewer)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 流程图的查看器,不可编辑
|
||||||
|
export default MyProcessViewer
|
|
@ -298,6 +298,17 @@
|
||||||
v-if="formDetailVisible"
|
v-if="formDetailVisible"
|
||||||
/>
|
/>
|
||||||
</XModal>
|
</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>
|
</ContentWrap>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -317,6 +328,11 @@ const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const router = useRouter() // 路由
|
const router = useRouter() // 路由
|
||||||
|
|
||||||
|
const showBpmnOpen = ref(false)
|
||||||
|
const bpmnXML = ref(null)
|
||||||
|
const bpmnControlForm = ref({
|
||||||
|
prefix: 'flowable'
|
||||||
|
})
|
||||||
// ========== 列表相关 ==========
|
// ========== 列表相关 ==========
|
||||||
const [registerTable, { reload }] = useXTable({
|
const [registerTable, { reload }] = useXTable({
|
||||||
allSchemas: allSchemas,
|
allSchemas: allSchemas,
|
||||||
|
@ -369,7 +385,13 @@ const handleFormDetail = async (row) => {
|
||||||
const handleBpmnDetail = (row) => {
|
const handleBpmnDetail = (row) => {
|
||||||
// TODO 芋艿:流程组件开发中
|
// TODO 芋艿:流程组件开发中
|
||||||
console.log(row)
|
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 月底完成')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击任务分配按钮
|
// 点击任务分配按钮
|
||||||
|
|
Loading…
Reference in New Issue