兰宝车间质量管理系统-前端
gssong
2024-05-17 b2e47f3938cfbd6cdf65db20aa9dcf381a17ce54
src/components/BpmnView/index.vue
@@ -76,6 +76,28 @@
  });
};
const initXml = (xmlStr: string) => {
  loading.value = true;
  bpmnVisible.value = true;
  nextTick(async () => {
    if (modeler.value) modeler.value.destroy();
    modeler.value = new BpmnViewer({
      container: canvas.value,
      additionalModules: [
        {
          //禁止滚轮滚动
          zoomScroll: ['value', '']
        },
        ZoomScrollModule,
        MoveCanvasModule
      ] as ModuleDeclaration[]
    });
    xml.value = xmlStr;
    await createDiagram(xml.value);
    loading.value = false;
  });
};
const createDiagram = async (data) => {
  try {
    await modeler.value.importXML(data);
@@ -238,7 +260,8 @@
  }
};
defineExpose({
  init
  init,
  initXml
});
</script>
@@ -289,7 +312,7 @@
  }
}
.bpmn-el-container {
  height: 500px;
  height: calc(100vh - 350px);
}
.flow-containers {
  width: 100%;
@@ -338,16 +361,35 @@
  :deep(.highlight.djs-connection > .djs-visual > path) {
    stroke: green !important;
  }
  :deep(.highlight-todo.djs-connection > .djs-visual > path) {
    stroke: orange !important;
    stroke-dasharray: 4px !important;
    fill-opacity: 0.2 !important;
    marker-end: url(#sequenceflow-end-_E7DFDF-_E7DFDF-803g1kf6zwzmcig1y2ulm5egr);
  // 边框滚动动画
  @keyframes path-animation {
    from {
      stroke-dashoffset: 100%;
    }
    to {
      stroke-dashoffset: 0%;
    }
  }
  :deep(.highlight-todo.djs-shape .djs-visual > :nth-child(1)) {
    fill: orange !important;
    stroke: orange !important;
  :deep(.highlight-todo.djs-connection > .djs-visual > path) {
    animation: path-animation 60s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    stroke-dasharray: 4px !important;
    stroke: orange !important;
    fill-opacity: 0.2 !important;
    marker-end: url('#sequenceflow-end-_E7DFDF-_E7DFDF-803g1kf6zwzmcig1y2ulm5egr');
  }
  :deep(.highlight-todo.djs-shape .djs-visual > :nth-child(1)) {
    animation: path-animation 60s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    stroke-dasharray: 4px !important;
    stroke: orange !important;
    fill: orange !important;
    fill-opacity: 0.2 !important;
  }
}
@@ -363,5 +405,6 @@
    margin: 0;
    padding: 0;
  }
  cursor: pointer;
}
</style>