| | |
| | | |
| | | import type { BpmModelApi } from '#/api/bpm/model'; |
| | | |
| | | import { inject, onBeforeUnmount, provide, ref, shallowRef, watch } from 'vue'; |
| | | import { inject, nextTick, onBeforeUnmount, provide, ref, shallowRef, watch } from 'vue'; |
| | | |
| | | import { ContentWrap } from '@vben/common-ui'; |
| | | import { BpmModelFormType } from '@vben/constants'; |
| | |
| | | |
| | | defineOptions({ name: 'BpmModelEditor' }); |
| | | |
| | | defineProps<{ |
| | | const props = defineProps<{ |
| | | active: boolean; |
| | | modelId?: string; |
| | | modelKey: string; |
| | | modelName: string; |
| | |
| | | const modelData = inject('modelData') as Ref; // 注入模型数据 |
| | | |
| | | const modeler = shallowRef(); // BPMN Modeler |
| | | let fitted = false; |
| | | watch(() => [props.active, modeler.value] as const, async ([active, instance]) => { |
| | | if (!active || !instance) return; |
| | | await nextTick(); |
| | | const canvas = instance.get('canvas'); |
| | | canvas.resized(); |
| | | if (!fitted) { |
| | | canvas.zoom('fit-viewport', 'auto'); |
| | | fitted = true; |
| | | } |
| | | }); |
| | | const controlForm = ref({ |
| | | simulation: true, |
| | | labelEditing: false, |