This commit is contained in:
神仙都没用 2024-06-11 12:57:43 +08:00
parent 460e88dbae
commit 308f4447a4
2 changed files with 30 additions and 3 deletions

View File

@ -24,6 +24,19 @@
</el-tooltip> </el-tooltip>
</div> </div>
<div class="search" v-if="config.enableKeySearch">
<el-input
placeholder="搜索关键字"
v-model="keyWord"
clearable
@change="
refresh({
page: 1
})
"
/>
</div>
<div class="data" v-loading="loading"> <div class="data" v-loading="loading">
<el-scrollbar> <el-scrollbar>
<!-- 树类型 --> <!-- 树类型 -->
@ -173,6 +186,7 @@ const config = reactive(
service: {}, service: {},
enableContextMenu: true, enableContextMenu: true,
enableRefresh: true, enableRefresh: true,
enableKeySearch: true,
enableAdd: true, enableAdd: true,
custom: false custom: false
}, },
@ -190,6 +204,9 @@ if (isEmpty(config.service) && !isCustom) {
// //
const loading = ref(false); const loading = ref(false);
//
const keyWord = ref("");
// //
const list = ref<ClViewGroup.Item[]>([]); const list = ref<ClViewGroup.Item[]>([]);
@ -331,10 +348,11 @@ async function refresh(params?: any) {
const data = { const data = {
...reqParams, ...reqParams,
...config.data ...config.data,
keyWord: keyWord.value
}; };
let req; let req: Promise<void>;
if (tree.visible) { if (tree.visible) {
// //
@ -478,6 +496,8 @@ defineExpose({
} }
.scope { .scope {
display: flex;
flex-direction: column;
height: 100%; height: 100%;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
@ -509,8 +529,14 @@ defineExpose({
} }
} }
.search {
height: 40px;
padding: 0 10px;
}
.data { .data {
height: calc(100% - 40px); flex: 1;
overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
:deep(.el-tree-node__content) { :deep(.el-tree-node__content) {

View File

@ -59,6 +59,7 @@ export declare namespace ClViewGroup {
enableContextMenu?: boolean; enableContextMenu?: boolean;
enableAdd?: boolean; enableAdd?: boolean;
enableRefresh?: boolean; enableRefresh?: boolean;
enableKeySearch?: boolean;
custom?: boolean; custom?: boolean;
onSelect?(item: M<T>): void; onSelect?(item: M<T>): void;
onEdit?(item?: M<T>): DeepPartial<ClForm.Options>; onEdit?(item?: M<T>): DeepPartial<ClForm.Options>;