Blame view

yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/other/ElementOtherConfig.vue 1.56 KB
167692b0   YunaiV   引入 bpmnProcessDes...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  <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"
            size="mini"
            resize="vertical"
            :autosize="{ minRows: 2, maxRows: 4 }"
            @input="updateDocumentation"
            @blur="updateDocumentation"
          />
        </div>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    name: "ElementOtherConfig",
    props: {
      id: String
    },
    data() {
      return {
        documentation: ""
      };
    },
    watch: {
      id: {
        immediate: true,
        handler: function(id) {
          if (id && id.length) {
            this.$nextTick(() => {
              const documentations = window.bpmnInstances.bpmnElement.businessObject?.documentation;
              this.documentation = documentations && documentations.length ? documentations[0].text : "";
            });
          } else {
            this.documentation = "";
          }
        }
      }
    },
    methods: {
      updateDocumentation() {
        (this.bpmnElement && this.bpmnElement.id === this.id) || (this.bpmnElement = window.bpmnInstances.elementRegistry.get(this.id));
        const documentation = window.bpmnInstances.bpmnFactory.create("bpmn:Documentation", { text: this.documentation });
        window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
          documentation: [documentation]
        });
      }
    },
    beforeDestroy() {
      this.bpmnElement = null;
    }
  };
  </script>