From dd51482a48a03ea9ff8dbfffca3f4045ac9556af Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 28 Nov 2023 12:06:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=A8=A1=E7=89=88=E7=AE=A1?= =?UTF-8?q?=E7=90=86UI=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/component/DeTemplateList.vue | 35 +++++++++++++------ .../src/views/template/index.vue | 34 +++++++++++++++--- 2 files changed, 54 insertions(+), 15 deletions(-) diff --git a/core/core-frontend/src/views/template/component/DeTemplateList.vue b/core/core-frontend/src/views/template/component/DeTemplateList.vue index 05fcbacd7d..d43ba69808 100644 --- a/core/core-frontend/src/views/template/component/DeTemplateList.vue +++ b/core/core-frontend/src/views/template/component/DeTemplateList.vue @@ -11,6 +11,16 @@ :description="'没有找到相关内容'" /> - - {{ t('visualization.add_category') }} - @@ -92,8 +99,7 @@ const state = reactive({ }) const templateListComputed = computed(() => { - if (!state.templateFilterText) return [...props.templateList] - return props.templateList.filter(ele => ele['name']?.includes(state.templateFilterText)) + return props.templateList.filter(ele => ele['id'] !== '1') }) const clickMore = (type, data) => { @@ -247,4 +253,11 @@ defineExpose({ width: 20px; height: 20px; } + +.custom-line { + margin: 4px; + background: rgba(31, 35, 41, 0.15); + border: 0; + height: 1px; +} diff --git a/core/core-frontend/src/views/template/index.vue b/core/core-frontend/src/views/template/index.vue index dbb7c96a03..f869455626 100644 --- a/core/core-frontend/src/views/template/index.vue +++ b/core/core-frontend/src/views/template/index.vue @@ -36,9 +36,15 @@
- {{ state.currentTemplateLabel }}  ({{ - state.currentTemplateShowList.length - }}) + {{ state.currentTemplateLabel }}  ({{ + state.currentTemplateShowList.length + }}) + + {{ state.currentTemplateLabel }}   + 的搜索结果 {{ currentTemplateShowListComputed.length }} 个 +
{ + if (!state.templateFilterText) return [...state.currentTemplateShowList] + return state.currentTemplateShowList.filter(ele => + ele['name']?.includes(state.templateFilterText) + ) +}) + const nameList = computed(() => { const { nodeType } = state.templateEditForm || {} if (nodeType === 'template') { @@ -186,6 +199,18 @@ const nameList = computed(() => { return [] }) +const initStyle = () => { + nextTick(() => { + const tree = document.querySelector('.ed-tree') + // 创建横线元素 + const line = document.createElement('hr') + line.classList.add('custom-line') + + // 将横线元素插入到第一个选项后面 + tree.firstElementChild.appendChild(line) + }) +} + const nameRepeat = value => { if (!nameList.value) { return false @@ -357,6 +382,7 @@ onMounted(() => { state.templateCurWidth = Math.trunc(offsetWidth / curSeparator) - 24 - curSeparator }) }) + initStyle() })