mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
列表浏览bpmn图
This commit is contained in:
parent
b700b316cd
commit
3a954b47bb
@ -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)
|
||||
}
|
||||
)
|
||||
|
@ -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"
|
||||
/>
|
||||
</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 月底完成')
|
||||
}
|
||||
|
||||
// 点击任务分配按钮
|
||||
|
Loading…
Reference in New Issue
Block a user