提交 | 用户 | 时间
|
820397
|
1 |
<template> |
H |
2 |
<div class="panel-tab__content"> |
|
3 |
<div class="element-property input-property"> |
|
4 |
<div class="element-property__label">元素文档:</div> |
|
5 |
<div class="element-property__value"> |
|
6 |
<el-input |
|
7 |
type="textarea" |
|
8 |
v-model="documentation" |
|
9 |
resize="vertical" |
|
10 |
:autosize="{ minRows: 2, maxRows: 4 }" |
|
11 |
@input="updateDocumentation" |
|
12 |
@blur="updateDocumentation" |
|
13 |
/> |
|
14 |
</div> |
|
15 |
</div> |
|
16 |
</div> |
|
17 |
</template> |
|
18 |
|
|
19 |
<script lang="ts" setup> |
|
20 |
defineOptions({ name: 'ElementOtherConfig' }) |
|
21 |
const props = defineProps({ |
|
22 |
id: String |
|
23 |
}) |
|
24 |
const documentation = ref('') |
|
25 |
const bpmnElement = ref() |
|
26 |
const bpmnInstances = () => (window as any).bpmnInstances |
|
27 |
const updateDocumentation = () => { |
|
28 |
;(bpmnElement.value && bpmnElement.value.id === props.id) || |
|
29 |
(bpmnElement.value = bpmnInstances().elementRegistry.get(props.id)) |
|
30 |
const documentations = bpmnInstances().bpmnFactory.create('bpmn:Documentation', { |
|
31 |
text: documentation.value |
|
32 |
}) |
|
33 |
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), { |
|
34 |
documentation: [documentations] |
|
35 |
}) |
|
36 |
} |
|
37 |
onBeforeUnmount(() => { |
|
38 |
bpmnElement.value = null |
|
39 |
}) |
|
40 |
|
|
41 |
watch( |
|
42 |
() => props.id, |
|
43 |
(id) => { |
|
44 |
if (id && id.length) { |
|
45 |
nextTick(() => { |
|
46 |
const documentations = bpmnInstances().bpmnElement.businessObject?.documentation |
|
47 |
documentation.value = documentations && documentations.length ? documentations[0].text : '' |
|
48 |
}) |
|
49 |
} else { |
|
50 |
documentation.value = '' |
|
51 |
} |
|
52 |
}, |
|
53 |
{ immediate: true } |
|
54 |
) |
|
55 |
</script> |