ProcessPalette.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <div class="my-process-palette">
  3. <div class="test-button" @click="addTask" @mousedown="addTask">测试任务</div>
  4. <div class="test-container" id="palette-container">1</div>
  5. </div>
  6. </template>
  7. <script setup lang="ts" name="MyProcessPalette">
  8. import { assign } from 'min-dash'
  9. const addTask = (event, options = {}) => {
  10. const ElementFactory = window.bpmnInstances.elementFactory
  11. const create = window.bpmnInstances.modeler.get('create')
  12. console.log(ElementFactory, create)
  13. const shape = ElementFactory.createShape(assign({ type: 'bpmn:UserTask' }, options))
  14. if (options) {
  15. shape.businessObject.di.isExpanded = options.isExpanded
  16. }
  17. console.log(event, 'event')
  18. console.log(shape, 'shape')
  19. create.start(event, shape)
  20. }
  21. </script>
  22. <style scoped lang="scss">
  23. .my-process-palette {
  24. box-sizing: border-box;
  25. padding: 80px 20px 20px 20px;
  26. .test-button {
  27. box-sizing: border-box;
  28. padding: 8px 16px;
  29. border-radius: 4px;
  30. border: 1px solid rgba(24, 144, 255, 0.8);
  31. cursor: pointer;
  32. }
  33. }
  34. </style>