属性面板扩展中的新自定义 属性 未反映在 bpmn 图中 xml

New custom property in properties panel extension not reflect in bpmn diagram xml

我正在 属性 面板中添加一些自定义属性,如下所示, 我在“常规”选项卡中禁用了 Id 属性。添加 2 个新选项卡输入和输出。

<?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 图中设置输入输出参数,

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

那里得到了提示