pull/2/head
gexinzhineng/gxzn27 2023-01-30 10:18:49 +08:00
parent 252ef55a6c
commit d6a4dc7d11
2 changed files with 22 additions and 6 deletions

View File

@ -8,13 +8,16 @@
<el-tooltip effect="light" placement="bottom"> <el-tooltip effect="light" placement="bottom">
<template #content> <template #content>
<div style="color: #409eff"> <div style="color: #409eff">
<el-button link @click="downloadProcessAsXml()">XML</el-button> <!-- <el-button link @click="downloadProcessAsXml()">XML</el-button> -->
<XTextButton title="下载为XML文件" @click="downloadProcessAsXml()" />
<br /> <br />
<el-button link @click="downloadProcessAsSvg()">SVG</el-button> <!-- <el-button link @click="downloadProcessAsSvg()">SVG</el-button> -->
<XTextButton title="下载为SVG文件" @click="downloadProcessAsSvg()" />
<br /> <br />
<el-button link @click="downloadProcessAsBpmn()">BPMN</el-button> <!-- <el-button link @click="downloadProcessAsBpmn()">BPMN</el-button> -->
<XTextButton title="下载为BPMN文件" @click="downloadProcessAsBpmn()" />
</div> </div>
</template> </template>
<XButton title="下载文件" preIcon="ep:download" /> <XButton title="下载文件" preIcon="ep:download" />
@ -22,9 +25,11 @@
<el-tooltip effect="light"> <el-tooltip effect="light">
<XButton preIcon="ep:view" title="浏览" /> <XButton preIcon="ep:view" title="浏览" />
<template #content> <template #content>
<el-button link @click="previewProcessXML">XML</el-button> <!-- <el-button link @click="previewProcessXML">XML</el-button> -->
<XTextButton title="预览XML" @click="previewProcessXML" />
<br /> <br />
<el-button link @click="previewProcessJson">JSON</el-button> <!-- <el-button link @click="previewProcessJson">JSON</el-button> -->
<XTextButton title="预览JSON" @click="previewProcessJson" />
</template> </template>
</el-tooltip> </el-tooltip>
<el-tooltip <el-tooltip
@ -236,7 +241,7 @@ import flowableModdleExtension from './plugins/extension-moddle/flowable'
// json // json
// import xml2js from 'xml-js' // import xml2js from 'xml-js'
import xml2js from 'fast-xml-parser' import xml2js from 'fast-xml-parser'
import { XmlNode, XmlNodeType, parseXmlString } from 'steady-xml'
// //
// import hljs from 'highlight.js/lib/highlight' // import hljs from 'highlight.js/lib/highlight'
// import 'highlight.js/styles/github-gist.css' // import 'highlight.js/styles/github-gist.css'
@ -630,6 +635,13 @@ const previewProcessXML = () => {
const previewProcessJson = () => { const previewProcessJson = () => {
bpmnModeler.saveXML({ format: true }).then(({ xml }) => { bpmnModeler.saveXML({ format: true }).then(({ xml }) => {
console.log(xml, 'xml') console.log(xml, 'xml')
const rootNode = parseXmlString(xml)
console.log(rootNode, 'rootNoderootNode')
const rootNodes = new XmlNode(XmlNodeType.Root)
rootNodes.toJsObject()
console.log(JSON.stringify(rootNodes), ';;;;;;;;;;;;;;;')
const parser = new xml2js.XMLParser() const parser = new xml2js.XMLParser()
let jObj = parser.parse(xml) let jObj = parser.parse(xml)
// console.log(jObj, 'jObjjObjjObjjObjjObj') // console.log(jObj, 'jObjjObjjObjjObjjObj')

View File

@ -39,6 +39,10 @@ const props = defineProps({
provide('configGlobal', props) provide('configGlobal', props)
const emit = defineEmits(['destroy'])
let bpmnModeler
const xml = ref('') const xml = ref('')
const activityList = ref([]) const activityList = ref([])
const processInstance = ref(undefined) const processInstance = ref(undefined)