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>
</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">
<el-scrollbar>
<!-- 树类型 -->
@ -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<ClViewGroup.Item[]>([]);
@ -331,10 +348,11 @@ async function refresh(params?: any) {
const data = {
...reqParams,
...config.data
...config.data,
keyWord: keyWord.value
};
let req;
let req: Promise<void>;
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) {

View File

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