Commit d6a4dc7d11d2711cb61017e67e7d0059cc92c040
1 parent
252ef55a
bug
Showing
2 changed files
with
22 additions
and
6 deletions
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue
| @@ -8,13 +8,16 @@ | @@ -8,13 +8,16 @@ | ||
| 8 | <el-tooltip effect="light" placement="bottom"> | 8 | <el-tooltip effect="light" placement="bottom"> |
| 9 | <template #content> | 9 | <template #content> |
| 10 | <div style="color: #409eff"> | 10 | <div style="color: #409eff"> |
| 11 | - <el-button link @click="downloadProcessAsXml()">下载为XML文件</el-button> | 11 | + <!-- <el-button link @click="downloadProcessAsXml()">下载为XML文件</el-button> --> |
| 12 | + <XTextButton title="下载为XML文件" @click="downloadProcessAsXml()" /> | ||
| 12 | <br /> | 13 | <br /> |
| 13 | 14 | ||
| 14 | - <el-button link @click="downloadProcessAsSvg()">下载为SVG文件</el-button> | 15 | + <!-- <el-button link @click="downloadProcessAsSvg()">下载为SVG文件</el-button> --> |
| 16 | + <XTextButton title="下载为SVG文件" @click="downloadProcessAsSvg()" /> | ||
| 15 | <br /> | 17 | <br /> |
| 16 | 18 | ||
| 17 | - <el-button link @click="downloadProcessAsBpmn()">下载为BPMN文件</el-button> | 19 | + <!-- <el-button link @click="downloadProcessAsBpmn()">下载为BPMN文件</el-button> --> |
| 20 | + <XTextButton title="下载为BPMN文件" @click="downloadProcessAsBpmn()" /> | ||
| 18 | </div> | 21 | </div> |
| 19 | </template> | 22 | </template> |
| 20 | <XButton title="下载文件" preIcon="ep:download" /> | 23 | <XButton title="下载文件" preIcon="ep:download" /> |
| @@ -22,9 +25,11 @@ | @@ -22,9 +25,11 @@ | ||
| 22 | <el-tooltip effect="light"> | 25 | <el-tooltip effect="light"> |
| 23 | <XButton preIcon="ep:view" title="浏览" /> | 26 | <XButton preIcon="ep:view" title="浏览" /> |
| 24 | <template #content> | 27 | <template #content> |
| 25 | - <el-button link @click="previewProcessXML">预览XML</el-button> | 28 | + <!-- <el-button link @click="previewProcessXML">预览XML</el-button> --> |
| 29 | + <XTextButton title="预览XML" @click="previewProcessXML" /> | ||
| 26 | <br /> | 30 | <br /> |
| 27 | - <el-button link @click="previewProcessJson">预览JSON</el-button> | 31 | + <!-- <el-button link @click="previewProcessJson">预览JSON</el-button> --> |
| 32 | + <XTextButton title="预览JSON" @click="previewProcessJson" /> | ||
| 28 | </template> | 33 | </template> |
| 29 | </el-tooltip> | 34 | </el-tooltip> |
| 30 | <el-tooltip | 35 | <el-tooltip |
| @@ -236,7 +241,7 @@ import flowableModdleExtension from './plugins/extension-moddle/flowable' | @@ -236,7 +241,7 @@ import flowableModdleExtension from './plugins/extension-moddle/flowable' | ||
| 236 | // 引入json转换与高亮 | 241 | // 引入json转换与高亮 |
| 237 | // import xml2js from 'xml-js' | 242 | // import xml2js from 'xml-js' |
| 238 | import xml2js from 'fast-xml-parser' | 243 | import xml2js from 'fast-xml-parser' |
| 239 | - | 244 | +import { XmlNode, XmlNodeType, parseXmlString } from 'steady-xml' |
| 240 | // 代码高亮插件 | 245 | // 代码高亮插件 |
| 241 | // import hljs from 'highlight.js/lib/highlight' | 246 | // import hljs from 'highlight.js/lib/highlight' |
| 242 | // import 'highlight.js/styles/github-gist.css' | 247 | // import 'highlight.js/styles/github-gist.css' |
| @@ -630,6 +635,13 @@ const previewProcessXML = () => { | @@ -630,6 +635,13 @@ const previewProcessXML = () => { | ||
| 630 | const previewProcessJson = () => { | 635 | const previewProcessJson = () => { |
| 631 | bpmnModeler.saveXML({ format: true }).then(({ xml }) => { | 636 | bpmnModeler.saveXML({ format: true }).then(({ xml }) => { |
| 632 | console.log(xml, 'xml') | 637 | console.log(xml, 'xml') |
| 638 | + | ||
| 639 | + const rootNode = parseXmlString(xml) | ||
| 640 | + console.log(rootNode, 'rootNoderootNode') | ||
| 641 | + const rootNodes = new XmlNode(XmlNodeType.Root) | ||
| 642 | + rootNodes.toJsObject() | ||
| 643 | + console.log(JSON.stringify(rootNodes), ';;;;;;;;;;;;;;;') | ||
| 644 | + | ||
| 633 | const parser = new xml2js.XMLParser() | 645 | const parser = new xml2js.XMLParser() |
| 634 | let jObj = parser.parse(xml) | 646 | let jObj = parser.parse(xml) |
| 635 | // console.log(jObj, 'jObjjObjjObjjObjjObj') | 647 | // console.log(jObj, 'jObjjObjjObjjObjjObj') |
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue
| @@ -39,6 +39,10 @@ const props = defineProps({ | @@ -39,6 +39,10 @@ const props = defineProps({ | ||
| 39 | 39 | ||
| 40 | provide('configGlobal', props) | 40 | provide('configGlobal', props) |
| 41 | 41 | ||
| 42 | +const emit = defineEmits(['destroy']) | ||
| 43 | + | ||
| 44 | +let bpmnModeler | ||
| 45 | + | ||
| 42 | const xml = ref('') | 46 | const xml = ref('') |
| 43 | const activityList = ref([]) | 47 | const activityList = ref([]) |
| 44 | const processInstance = ref(undefined) | 48 | const processInstance = ref(undefined) |