2023-01-28 09:53:43 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="panel-tab__content">
|
|
|
|
|
<div class="element-property input-property">
|
|
|
|
|
<div class="element-property__label">元素文档:</div>
|
|
|
|
|
<div class="element-property__value">
|
|
|
|
|
<el-input
|
|
|
|
|
type="textarea"
|
|
|
|
|
v-model="documentation"
|
|
|
|
|
resize="vertical"
|
|
|
|
|
:autosize="{ minRows: 2, maxRows: 4 }"
|
|
|
|
|
@input="updateDocumentation"
|
|
|
|
|
@blur="updateDocumentation"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts" name="ElementOtherConfig">
|
|
|
|
|
import { ref, watch, nextTick, onBeforeUnmount } from 'vue'
|
|
|
|
|
import { ElInput } from 'element-plus'
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
id: String
|
|
|
|
|
})
|
|
|
|
|
const documentation = ref('')
|
|
|
|
|
const bpmnElement = ref()
|
|
|
|
|
const updateDocumentation = () => {
|
2023-01-28 15:30:52 +08:00
|
|
|
|
if (bpmnElement.value && bpmnElement.value.id === props.id) {
|
|
|
|
|
bpmnElement.value = window.bpmnInstances.elementRegistry.get(props.id)
|
|
|
|
|
}
|
|
|
|
|
// (bpmnElement.value && bpmnElement.value.id === props.id) ||
|
|
|
|
|
// (bpmnElement.value = window.bpmnInstances.elementRegistry.get(props.id))
|
|
|
|
|
const documentations = window.bpmnInstances.bpmnFactory.create('bpmn:Documentation', {
|
2023-01-28 09:53:43 +08:00
|
|
|
|
text: documentation.value
|
|
|
|
|
})
|
|
|
|
|
window.bpmnInstances.modeling.updateProperties(bpmnElement.value, {
|
2023-01-28 15:30:52 +08:00
|
|
|
|
documentation: [documentations]
|
2023-01-28 09:53:43 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
bpmnElement.value = null
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => props.id,
|
|
|
|
|
(id) => {
|
|
|
|
|
if (id && id.length) {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
const documentations = window.bpmnInstances.bpmnElement.businessObject?.documentation
|
|
|
|
|
documentation.value = documentations && documentations.length ? documentations[0].text : ''
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
documentation.value = ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
)
|
|
|
|
|
</script>
|