bpmnjs创建子元素

helei 2022-3-26 746 3/26

//创建coustomProperties.josn文件

{
  "name": "hlself",
  "uri": "https://hlself",
  "prefix": "flowable",
  "xml": {
    "tagAlias": "lowerCase"
  },
  "types": [
    {
      "name": "ExecutionListener",//首字母必须大写否则无法读取自定义节点
      "superClass": [
        "Element"
      ],
      "properties": [
        {
          "name": "class",
          "type": "String",
          "isAttr": "true"
        },
        {
          "name": "event",
          "type": "String",
          "isAttr": "true"
        },
        {
          "name": "values",
          "type": "executionListenerProp",
          "isMany": true
        }
      ]
    }
  ]
}

 

//引入自定义节点文件

  import coustomEleProperties from "./coustomProperties.json"

//流程初始化加载进去

moddleExtensions: {
          //camunda右边工具栏
          // camunda: camundaModdleDescriptor
          coustomEleProperties
        }
      })

//

const modeling = this.bpmnModeler.get('modeling');
        const moddle = this.bpmnModeler.get('moddle');
        var that = this;
        console.log(that.shape)
        //xml新增流转条件节点
        const propItem = moddle.create("flowable:executionListener", {
          calss: this.zxdata,
          event: this.zxtype
        });
 
        var extensionElements = moddle.create('bpmn:ExtensionElements', {
          values: []
        });
        extensionElements.values.push(propItem)
 
        modeling.updateProperties(that.shape, {
          extensionElements: extensionElements
        });

 

- THE END -

helei

3月26日17:47

最后修改:2022年3月26日
0

非特殊说明,本博所有文章均为博主原创。