xiaoyi
4 天以前 286619b69e4004c6bcaff4cb19a40b77b053453d
src/views/bpm/model/form/modules/bpm-model-editor.vue
@@ -3,7 +3,7 @@
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';
@@ -22,7 +22,8 @@
defineOptions({ name: 'BpmModelEditor' });
defineProps<{
const props = defineProps<{
  active: boolean;
  modelId?: string;
  modelKey: string;
  modelName: string;
@@ -40,6 +41,17 @@
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,