flowable-bpmn-modeler
Version:
基于 `vue` `ant design vue`和 `bpmn.io@7.0` ,实现 flowable 的 modeler 模型设计器
59 lines (57 loc) • 1.53 kB
JavaScript
import showConfig from '../flowable/showConfig'
export default {
props: {
modeler: {
type: Object,
required: true
},
element: {
type: Object,
required: true
},
xForm: {
type: Object,
default: () => {
}
}
},
watch: {
'formData.id': function(val) {
this.updateProperties({ id: val })
},
'formData.name': function(val) {
this.updateProperties({ name: val })
},
'formData.color': function(val) {
this.setColor({ stroke: val })
this.updateProperties({ color: val })
},
'formData.documentation': function(val) {
if (!val) {
this.updateProperties({ documentation: [] })
return
}
const documentationElement = this.modeler.get('moddle').create('bpmn:Documentation', { text: val })
this.updateProperties({ documentation: [documentationElement] })
}
},
methods: {
updateProperties(properties) {
const modeling = this.modeler.get('modeling')
modeling.updateProperties(this.element, properties)
},
setColor(properties) {
const modeling = this.modeler.get('modeling')
modeling.setColor(this.element, properties)
}
},
computed: {
elementType() {
const bizObj = this.element.businessObject
return bizObj.eventDefinitions ? bizObj.eventDefinitions[0].$type : bizObj.$type
},
showConfig() {
return showConfig[this.elementType] || {}
}
}
}