【问题标题】:New custom property in properties panel extension not reflect in bpmn diagram xml属性面板扩展中的新自定义属性未反映在 bpmn 图 xml 中
【发布时间】:2021-03-19 07:55:38
【问题描述】:

我在属性面板中添加了一些自定义属性,如下所示, 我在 General 选项卡中禁用 Id 属性。添加 2 个新选项卡 Input 和 Output。

<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
  <bpmn2:process id="Process_1" isExecutable="false">
    <bpmn2:startEvent id="StartEvent_1">
      <bpmn2:outgoing>Flow_0n4p9tk</bpmn2:outgoing>
    </bpmn2:startEvent>
    <bpmn2:task id="Activity_0d872w2">
      <bpmn2:incoming>Flow_0n4p9tk</bpmn2:incoming>
    </bpmn2:task>
    <bpmn2:sequenceFlow id="Flow_0n4p9tk" sourceRef="StartEvent_1" targetRef="Activity_0d872w2" />
  </bpmn2:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNEdge id="Flow_0n4p9tk_di" bpmnElement="Flow_0n4p9tk">
        <di:waypoint x="448" y="258" />
        <di:waypoint x="500" y="258" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="412" y="240" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0d872w2_di" bpmnElement="Activity_0d872w2">
        <dc:Bounds x="500" y="218" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn2:definitions>

查看 2 个屏幕截图,我在属性面板中添加了新控件,但如果我下载图表,XML 不会显示。我在其中缺少什么? 注意:我的代码是BPMN自定义属性面板example的同一个副本

【问题讨论】:

    标签: bpmn bpmn.io


    【解决方案1】:

    我解决了这个问题。我可以使用以下代码在 BPMN 图中设置输入输出参数,

    set: function setValue(element, values, node) {
    
              var b_obj = getBusinessObject(element);
              var selectedValues = {};
              selectedValues = values;
              prop[_id] = selectedValues[_id];
              var selectedName = dropdownOptions[parseInt(prop[_id])].name;
              var bo = cmdHelper.updateBusinessObject(element, b_obj, prop);
    
              var selectedInputParameter = bpmnFactory.create('camunda:InputParameter', {
                name: selectedName,
                value: prop[_id]
              });      
      
              var inputOutput = bpmnFactory.create('camunda:InputOutput', {
                inputParameters: [selectedInputParameter]
              });  
              b_obj.extensionElements = b_obj.extensionElements || bpmnFactory.create('bpmn:ExtensionElements');
              b_obj.extensionElements.get('values').push(inputOutput);
             
              return bo;
            }
    

    我得到了here的提示

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-03-27
      • 2013-08-09
      • 2020-10-19
      • 2017-05-31
      • 1970-01-01
      • 2011-06-25
      • 1970-01-01
      相关资源
      最近更新 更多