Explorar el Código

添加流程类型和启动事件流程保存字段

lph hace 1 año
padre
commit
85a84bfd2a

+ 20 - 1
ruoyi-ui/src/views/system/bpmnPro/components/Toolbar/tools/Save.vue

@@ -63,12 +63,22 @@ export default {
     },
     getProcessAsXml() {
       let process = this.getProcess("xml");
-      console.log(process);
     },
     getProcessAsSvg() {
       let process = this.getProcess("svg");
       console.log(process);
     },
+    xmlStr2XmlObj(xmlStr) {
+      var xmlObj = {};
+      if (document.all) {
+        var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
+        xmlDom.loadXML(xmlStr);
+        xmlObj = xmlDom;
+      } else {
+        xmlObj = new DOMParser().parseFromString(xmlStr, "text/xml");
+      }
+      return xmlObj;
+    },
     async getProcessJson() {
       try {
         if (!this.getModeler)
@@ -114,6 +124,15 @@ export default {
       formData.processType = "0"; //流程类型
       // 获取xml标签内容标签内容
       let xmlPro = await this.getProcess("xml");
+      let xmlObj = this.xmlStr2XmlObj(xmlPro);
+      formData.startEventType =
+        xmlObj
+          .getElementsByTagName("bpmn:process")[0]
+          .getAttribute("camunda:startEventType") || 0;
+      formData.processType =
+        xmlObj
+          .getElementsByTagName("bpmn:process")[0]
+          .getAttribute("camunda:bpmType") || 0;
       // 将asill码数组转换成文件格式
       formData.fileXML = new File([xmlPro], formData.processKey + ".bpmn", {
         type: "text/bpmn",