Commit 3b9fe770361f9082e4df3a20a4457c4c9057a65d
1 parent
2be0ea5f
高亮
Showing
3 changed files
with
27 additions
and
21 deletions
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue
| ... | ... | @@ -183,18 +183,26 @@ |
| 183 | 183 | <!-- <div id="js-properties-panel" class="panel"></div> --> |
| 184 | 184 | <!-- <div class="my-process-designer__canvas" ref="bpmn-canvas"></div> --> |
| 185 | 185 | </div> |
| 186 | - <el-dialog | |
| 186 | + <XModal | |
| 187 | 187 | title="预览" |
| 188 | 188 | width="80%" |
| 189 | + height="90%" | |
| 189 | 190 | v-model="previewModelVisible" |
| 190 | 191 | append-to-body |
| 191 | 192 | destroy-on-close |
| 192 | 193 | > |
| 193 | - <pre> | |
| 194 | - <!-- <code class="hljs" v-html="highlightedCode(previewType, previewResult)"></code> --> | |
| 195 | - {{ previewResult }} | |
| 196 | - </pre> | |
| 197 | - </el-dialog> | |
| 194 | + <div v-highlight> | |
| 195 | + <pre> | |
| 196 | + <code> | |
| 197 | + <!-- 高亮代码块 --> | |
| 198 | + {{ previewResult }} | |
| 199 | + </code> | |
| 200 | + </pre> | |
| 201 | + </div> | |
| 202 | + <!-- <pre> | |
| 203 | + <code class="hljs" v-html="highlightedCode(previewType, previewResult)"></code> | |
| 204 | + </pre> --> | |
| 205 | + </XModal> | |
| 198 | 206 | </div> |
| 199 | 207 | </template> |
| 200 | 208 | |
| ... | ... | @@ -204,7 +212,7 @@ |
| 204 | 212 | // import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css' |
| 205 | 213 | // import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css' |
| 206 | 214 | // import 'bpmn-js-properties-panel/dist/assets/bpmn-js-properties-panel.css' // 右侧框样式 |
| 207 | -import { ElTooltip, ElButtonGroup, ElDialog, ElButton, ElMessage, ElMessageBox } from 'element-plus' | |
| 215 | +import { ElTooltip, ElButtonGroup, ElButton, ElMessage, ElMessageBox } from 'element-plus' | |
| 208 | 216 | import { computed, onBeforeMount, onBeforeUnmount, onMounted, provide, ref } from 'vue' |
| 209 | 217 | import BpmnModeler from 'bpmn-js/lib/Modeler' |
| 210 | 218 | import DefaultEmptyXML from './plugins/defaultEmpty' | ... | ... |
yudao-ui-admin-vue3/src/components/bpmnProcessDesigner/package/penal/listeners/ElementListeners.vue
| ... | ... | @@ -246,7 +246,7 @@ |
| 246 | 246 | </div> |
| 247 | 247 | </template> |
| 248 | 248 | <script setup lang="ts" name="ElementListeners"> |
| 249 | -import { ref, inject, watch, nextTick, toRaw } from 'vue' | |
| 249 | +import { ref, inject, watch, nextTick } from 'vue' | |
| 250 | 250 | import { |
| 251 | 251 | ElMessageBox, |
| 252 | 252 | ElTable, |
| ... | ... | @@ -285,10 +285,8 @@ const listenerFormRef = ref() |
| 285 | 285 | const listenerFieldFormRef = ref() |
| 286 | 286 | |
| 287 | 287 | const resetListenersList = () => { |
| 288 | - console.log(window, 'window') | |
| 289 | 288 | bpmnElement.value = window.bpmnInstances.bpmnElement |
| 290 | 289 | otherExtensionList.value = [] |
| 291 | - console.log(bpmnElement.value, 'bpmnElement.value') | |
| 292 | 290 | bpmnElementListeners.value = |
| 293 | 291 | bpmnElement.value.businessObject?.extensionElements?.values?.filter( |
| 294 | 292 | (ex) => ex.$type === `${prefix}:ExecutionListener` |
| ... | ... | @@ -348,7 +346,6 @@ const saveListenerFiled = async () => { |
| 348 | 346 | } |
| 349 | 347 | // 移除监听器字段 |
| 350 | 348 | const removeListenerField = (field, index) => { |
| 351 | - console.log(field, 'field') | |
| 352 | 349 | ElMessageBox.confirm('确认移除该字段吗?', '提示', { |
| 353 | 350 | confirmButtonText: '确 认', |
| 354 | 351 | cancelButtonText: '取 消' |
| ... | ... | @@ -361,7 +358,6 @@ const removeListenerField = (field, index) => { |
| 361 | 358 | } |
| 362 | 359 | // 移除监听器 |
| 363 | 360 | const removeListener = (listener, index) => { |
| 364 | - console.log(listener, 'listener') | |
| 365 | 361 | ElMessageBox.confirm('确认移除该监听器吗?', '提示', { |
| 366 | 362 | confirmButtonText: '确 认', |
| 367 | 363 | cancelButtonText: '取 消' |
| ... | ... | @@ -389,18 +385,10 @@ const saveListenerConfig = async () => { |
| 389 | 385 | elementListenersList.value.splice(editingListenerIndex.value, 1, listenerForm.value) |
| 390 | 386 | } |
| 391 | 387 | // 保存其他配置 |
| 392 | - console.log(bpmnElement.value, 'bpmnElement.value') | |
| 393 | 388 | otherExtensionList.value = |
| 394 | - // bpmnElement.value.businessObject?.extensionElements?.filter( | |
| 395 | 389 | bpmnElement.value.businessObject?.extensionElements?.values?.filter( |
| 396 | 390 | (ex) => ex.$type !== `${prefix}:ExecutionListener` |
| 397 | 391 | ) ?? [] |
| 398 | - console.log(bpmnElement.value, 'bpmnElement.value') | |
| 399 | - console.log(toRaw(bpmnElement.value), 'toRawtoRawtoRawtoRawtoRaw') | |
| 400 | - console.log( | |
| 401 | - otherExtensionList.value.concat(bpmnElementListeners.value), | |
| 402 | - 'otherExtensionList.value.concat(bpmnElementListeners.value).value' | |
| 403 | - ) | |
| 404 | 392 | updateElementExtensions( |
| 405 | 393 | bpmnElement.value, |
| 406 | 394 | otherExtensionList.value.concat(bpmnElementListeners.value) |
| ... | ... | @@ -413,7 +401,6 @@ const saveListenerConfig = async () => { |
| 413 | 401 | watch( |
| 414 | 402 | () => props.id, |
| 415 | 403 | (val) => { |
| 416 | - console.log(val, 'propsId变化') | |
| 417 | 404 | val && |
| 418 | 405 | val.length && |
| 419 | 406 | nextTick(() => { | ... | ... |
yudao-ui-admin-vue3/src/main.ts
| ... | ... | @@ -49,6 +49,9 @@ import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css' |
| 49 | 49 | import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css' |
| 50 | 50 | import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css' |
| 51 | 51 | |
| 52 | +import hljs from 'highlight.js' //导入代码高亮文件 | |
| 53 | +import 'highlight.js/styles/github-gist.css' //导入代码高亮样式 | |
| 54 | + | |
| 52 | 55 | // 本地开发模式 全局引入 element-plus 样式,加快第一次进入速度 |
| 53 | 56 | if (isDevMode()) { |
| 54 | 57 | console.info(isDevMode()) |
| ... | ... | @@ -59,6 +62,14 @@ if (isDevMode()) { |
| 59 | 62 | const setupAll = async () => { |
| 60 | 63 | const app = createApp(App) |
| 61 | 64 | |
| 65 | + //自定义一个代码高亮指令 | |
| 66 | + app.directive('highlight', function (el) { | |
| 67 | + const blocks = el.querySelectorAll('code') | |
| 68 | + blocks.forEach((block: any) => { | |
| 69 | + hljs.highlightBlock(block) | |
| 70 | + }) | |
| 71 | + }) | |
| 72 | + | |
| 62 | 73 | await setupI18n(app) |
| 63 | 74 | |
| 64 | 75 | MyPD(app) | ... | ... |