ElementCustomConfig.vue 977 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <div class="panel-tab__content">
  3. <component :is="customConfigComponent" v-bind="$props" />
  4. </div>
  5. </template>
  6. <script lang="ts" setup>
  7. import { CustomConfigMap } from './data'
  8. defineOptions({ name: 'ElementCustomConfig' })
  9. const props = defineProps({
  10. id: String,
  11. type: String
  12. })
  13. const bpmnInstances = () => (window as any)?.bpmnInstances
  14. const customConfigComponent = ref<any>(null)
  15. watch(
  16. () => props.type,
  17. () => {
  18. if (props.type) {
  19. const element = bpmnInstances().bpmnElement.businessObject
  20. let elementType = props.type
  21. if (element.eventDefinitions) {
  22. // 处理类似共用BoundaryEvent类型的TimerEvent
  23. elementType += element.eventDefinitions[0].$type.split(':')[1]
  24. }
  25. const config = CustomConfigMap[elementType]
  26. if (config) {
  27. customConfigComponent.value = config.componet
  28. return
  29. }
  30. }
  31. },
  32. { immediate: true }
  33. )
  34. </script>
  35. <style lang="scss" scoped></style>