提交 | 用户 | 时间
|
820397
|
1 |
<template> |
H |
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 |
|
|
8 |
<script lang="ts" setup> |
|
9 |
import { assign } from 'min-dash' |
|
10 |
|
|
11 |
defineOptions({ name: 'MyProcessPalette' }) |
|
12 |
|
|
13 |
const bpmnInstances = () => (window as any).bpmnInstances |
|
14 |
const addTask = (event, options: any = {}) => { |
|
15 |
const ElementFactory = bpmnInstances().elementFactory |
|
16 |
const create = bpmnInstances().modeler.get('create') |
|
17 |
|
|
18 |
console.log(ElementFactory, create) |
|
19 |
|
|
20 |
const shape = ElementFactory.createShape(assign({ type: 'bpmn:UserTask' }, options)) |
|
21 |
|
|
22 |
if (options) { |
|
23 |
shape.businessObject.di.isExpanded = options.isExpanded |
|
24 |
} |
|
25 |
|
|
26 |
console.log(event, 'event') |
|
27 |
console.log(shape, 'shape') |
|
28 |
create.start(event, shape) |
|
29 |
} |
|
30 |
</script> |
|
31 |
|
|
32 |
<style scoped lang="scss"> |
|
33 |
.my-process-palette { |
|
34 |
padding: 80px 20px 20px; |
|
35 |
box-sizing: border-box; |
|
36 |
|
|
37 |
.test-button { |
|
38 |
padding: 8px 16px; |
|
39 |
cursor: pointer; |
|
40 |
border: 1px solid rgb(24 144 255 / 80%); |
|
41 |
border-radius: 4px; |
|
42 |
box-sizing: border-box; |
|
43 |
} |
|
44 |
} |
|
45 |
</style> |