From c2197b0088b87110804ae370cb37972741330b95 Mon Sep 17 00:00:00 2001 From: xlsea Date: Fri, 21 Jun 2024 16:46:01 +0800 Subject: [PATCH] =?UTF-8?q?style(sj=5Fmap=5Freduce):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E6=89=B9=E6=AC=A1=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=B1=95=E7=A4=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 3 ++ src/components/common/code-mirror.vue | 8 ++- .../workflow/modules/common/detail-card.vue | 53 ++++++++++++++++--- .../batch/modules/job-batch-detail-drawer.vue | 50 +++++++++++++++-- 5 files changed, 103 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 81c9e24..c4e42a7 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "clipboard": "2.0.11", "dayjs": "1.11.11", "echarts": "5.5.0", + "highlight.js": "^11.9.0", "lodash-es": "4.17.21", "naive-ui": "2.38.2", "nprogress": "0.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b473283..a1395ab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,6 +53,9 @@ importers: echarts: specifier: 5.5.0 version: 5.5.0 + highlight.js: + specifier: ^11.9.0 + version: 11.9.0 lodash-es: specifier: 4.17.21 version: 4.17.21 diff --git a/src/components/common/code-mirror.vue b/src/components/common/code-mirror.vue index 38b7921..a20946d 100644 --- a/src/components/common/code-mirror.vue +++ b/src/components/common/code-mirror.vue @@ -103,7 +103,13 @@ const theme = computed(() => { watch( () => nodeExpression.value, val => { - emit('update:modelValue', val); + let value = val; + if (props.lang === 'json') { + try { + value = JSON.stringify(JSON.parse(val)); + } catch {} + } + emit('update:modelValue', value); } ); diff --git a/src/components/workflow/modules/common/detail-card.vue b/src/components/workflow/modules/common/detail-card.vue index 50034b7..01b392e 100644 --- a/src/components/workflow/modules/common/detail-card.vue +++ b/src/components/workflow/modules/common/detail-card.vue @@ -1,7 +1,9 @@