xiangpei
2025-01-07 8779375b26e23113ebfa5940e4e5dbe696980f53
src/components/Process/designer.vue
@@ -66,7 +66,7 @@
import TaskListener from './panel/taskListener'
import MultiInstance from './panel/multiInstance'
import CommonPanel from './panel/commonPanel'
import UserTaskPanel from './panel/taskPanel'
import UserTaskPanel from './panel/TaskConfPanel'
import ConditionPanel from './panel/conditionPanel'
import FormPanel from './panel/formPanel'
import OtherPanel from './panel/otherPanel'
@@ -139,11 +139,9 @@
      });
      // 监听选择事件,修改当前激活的元素以及表单
      this.modelerStore.modeler.on("selection.changed", ({newSelection}) => {
        console.log("数据改变1", newSelection)
        this.initFormOnChanged(newSelection[0] || null);
      });
      this.modelerStore.modeler.on("element.changed", ({element}) => {
        console.log("数据改变2")
        // 保证 修改 "默认流转路径" 类似需要修改多个元素的事件发生的时候,更新表单的元素与原选中元素不一致。
        if (element && element.id === this.elementId) {
          this.initFormOnChanged(element);
@@ -153,24 +151,19 @@
    // 初始化数据
    initFormOnChanged(element) {
      console.log(element, "节点数据")
      let activatedElement = element;
      if (!activatedElement) {
        console.log(1)
        activatedElement =
          this.modelerStore.elRegistry.find(el => el.type === "bpmn:Process") ??
          this.modelerStore.elRegistry.find(el => el.type === "bpmn:Collaboration");
      }
      if (!activatedElement) return;
      console.log(2, activatedElement)
      this.modelerStore.element = activatedElement;
      this.elementId = activatedElement.id;
      // 确保elementId值没变也要更新form组件选中的值
      if (this.formVisible) {
        console.log(this.modelerStore.element.businessObject.formKey, "新的值")
        this.$refs.formSelect.init()
      }
      console.log(3, this.elementId)
      this.elementType = activatedElement.type.split(":")[1] || "";
      this.conditionVisible = !!(
        this.elementType === "SequenceFlow" &&