From 308f4447a4bc189d8fc8faef9996f7244e190ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E4=BB=99=E9=83=BD=E6=B2=A1=E7=94=A8?= <615206459@qq.com> Date: Tue, 11 Jun 2024 12:57:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/view/components/group.vue | 32 ++++++++++++++++++++++++--- src/plugins/view/types/index.d.ts | 1 + 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/plugins/view/components/group.vue b/src/plugins/view/components/group.vue index 9e40c8f..83517c5 100644 --- a/src/plugins/view/components/group.vue +++ b/src/plugins/view/components/group.vue @@ -24,6 +24,19 @@ + +
@@ -173,6 +186,7 @@ const config = reactive( service: {}, enableContextMenu: true, enableRefresh: true, + enableKeySearch: true, enableAdd: true, custom: false }, @@ -190,6 +204,9 @@ if (isEmpty(config.service) && !isCustom) { // 加载中 const loading = ref(false); +// 搜索关键字 +const keyWord = ref(""); + // 列表 const list = ref([]); @@ -331,10 +348,11 @@ async function refresh(params?: any) { const data = { ...reqParams, - ...config.data + ...config.data, + keyWord: keyWord.value }; - let req; + let req: Promise; if (tree.visible) { // 树形数据 @@ -478,6 +496,8 @@ defineExpose({ } .scope { + display: flex; + flex-direction: column; height: 100%; width: 100%; box-sizing: border-box; @@ -509,8 +529,14 @@ defineExpose({ } } + .search { + height: 40px; + padding: 0 10px; + } + .data { - height: calc(100% - 40px); + flex: 1; + overflow: hidden; box-sizing: border-box; :deep(.el-tree-node__content) { diff --git a/src/plugins/view/types/index.d.ts b/src/plugins/view/types/index.d.ts index 12a33d4..ea61651 100644 --- a/src/plugins/view/types/index.d.ts +++ b/src/plugins/view/types/index.d.ts @@ -59,6 +59,7 @@ export declare namespace ClViewGroup { enableContextMenu?: boolean; enableAdd?: boolean; enableRefresh?: boolean; + enableKeySearch?: boolean; custom?: boolean; onSelect?(item: M): void; onEdit?(item?: M): DeepPartial;