diff --git a/ruoyi-ui/src/components/Process/index.vue b/ruoyi-ui/src/components/Process/index.vue index 607b5426..b79af00a 100644 --- a/ruoyi-ui/src/components/Process/index.vue +++ b/ruoyi-ui/src/components/Process/index.vue @@ -321,8 +321,7 @@ export default { }, async showXML() { try { - const { xml } = await this.modeler.saveXML({ format: true }) - debugger + const xml = await this.saveXML() this.$emit('showXML',xml) } catch (err) { console.log(err) diff --git a/ruoyi-ui/src/views/flowable/definition/model.vue b/ruoyi-ui/src/views/flowable/definition/model.vue index 16c931f9..c5684531 100644 --- a/ruoyi-ui/src/views/flowable/definition/model.vue +++ b/ruoyi-ui/src/views/flowable/definition/model.vue @@ -15,11 +15,7 @@ -
-               
-                    {{xmlData}}
-               
-            
+
@@ -28,7 +24,7 @@ import {readXml, roleList, saveXml, userList,expList} from "@/api/flowable/definition"; import bpmnModeler from '@/components/Process/index' import vkBeautify from 'vkbeautify' -import highlight from 'highlight.js' +import hljs from 'highlight.js' import 'highlight.js/styles/atelier-savanna-dark.css' export default { @@ -39,11 +35,33 @@ export default { }, // 自定义指令 directives: { - highlight:(el) => { - let blocks = el.querySelectorAll('pre code'); - blocks.forEach((block) => { - highlight.highlightBlock(block) - }) + deep: true, + highlight:{ + deep: true, + bind: function bind(el, binding) { + const targets = el.querySelectorAll('code'); + let target; + let i; + for (i = 0; i < targets.length; i += 1) { + target = targets[i]; + if (typeof binding.value === 'string') { + target.textContent = binding.value; + } + hljs.highlightBlock(target); + } + }, + componentUpdated: function componentUpdated(el, binding) { + const targets = el.querySelectorAll('code'); + let target; + let i; + for (i = 0; i < targets.length; i += 1) { + target = targets[i]; + if (typeof binding.value === 'string') { + target.textContent = binding.value; + hljs.highlightBlock(target); + } + } + }, } }, data() { @@ -88,7 +106,7 @@ export default { xml: data.xml } saveXml(params).then(res => { - this.$message(res.msg) + this.$modal.msgSuccess(res.msg) // 关闭当前标签页并返回上个页面 this.$store.dispatch("tagsView/delView", this.$route); this.$router.go(-1) @@ -105,8 +123,8 @@ export default { val.userId = val.userId.toString(); }) this.users = res.data; - let arr = {nickName: "流程发起人", userId: "${INITIATOR}"} - this.users.push(arr) + // let arr = {nickName: "流程发起人", userId: "${INITIATOR}"} + // this.users.push(arr) }); roleList().then(res =>{ res.data.forEach(val =>{ @@ -119,10 +137,10 @@ export default { }); }, /** 展示xml */ - showXML(data){ + showXML(xmlData){ this.xmlTitle = 'xml查看'; this.xmlOpen = true; - this.xmlData = vkBeautify.xml(data); + this.xmlData = vkBeautify.xml(xmlData); }, // /** 获取数据类型 */ // dataType(data){