ProcessPalette.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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>
  8. import { assign } from "min-dash";
  9. export default {
  10. name: "MyProcessPalette",
  11. data() {
  12. return {};
  13. },
  14. mounted() {},
  15. methods: {
  16. addTask(event, options = {}) {
  17. const ElementFactory = window.bpmnInstances.elementFactory;
  18. const create = window.bpmnInstances.modeler.get("create");
  19. console.log(ElementFactory, create);
  20. const shape = ElementFactory.createShape(assign({ type: "bpmn:UserTask" }, options));
  21. if (options) {
  22. shape.businessObject.di.isExpanded = options.isExpanded;
  23. }
  24. create.start(event, shape);
  25. }
  26. }
  27. };
  28. </script>
  29. <style scoped lang="scss">
  30. .my-process-palette {
  31. box-sizing: border-box;
  32. padding: 80px 20px 20px 20px;
  33. .test-button {
  34. box-sizing: border-box;
  35. padding: 8px 16px;
  36. border-radius: 4px;
  37. border: 1px solid rgba(24, 144, 255, 0.8);
  38. cursor: pointer;
  39. }
  40. }
  41. </style>