2025-05-06 22:32:09 +08:00
|
|
|
|
<!-- add by puhui999:vxe table 工具栏二次封装,提供给 vxe 原生列表使用 -->
|
2025-04-27 18:13:08 +08:00
|
|
|
|
<script setup lang="ts">
|
2025-05-09 13:09:24 +08:00
|
|
|
|
import type { VxeToolbarInstance } from '#/adapter/vxe-table';
|
2025-04-27 18:13:08 +08:00
|
|
|
|
|
|
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
|
|
|
|
|
|
import { useContentMaximize, useRefresh } from '@vben/hooks';
|
|
|
|
|
|
import { Fullscreen, RefreshCw, Search } from '@vben/icons';
|
|
|
|
|
|
|
|
|
|
|
|
import { Button } from 'ant-design-vue';
|
2025-05-09 13:09:24 +08:00
|
|
|
|
|
|
|
|
|
|
import { VxeToolbar } from '#/adapter/vxe-table';
|
2025-04-27 18:13:08 +08:00
|
|
|
|
|
|
|
|
|
|
/** 列表工具栏封装 */
|
|
|
|
|
|
defineOptions({ name: 'TableToolbar' });
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
|
hiddenSearch: boolean;
|
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
|
|
const emits = defineEmits(['update:hiddenSearch']);
|
|
|
|
|
|
|
|
|
|
|
|
const toolbarRef = ref<VxeToolbarInstance>();
|
|
|
|
|
|
const { toggleMaximizeAndTabbarHidden } = useContentMaximize();
|
|
|
|
|
|
const { refresh } = useRefresh();
|
|
|
|
|
|
|
|
|
|
|
|
/** 隐藏搜索栏 */
|
|
|
|
|
|
function onHiddenSearchBar() {
|
|
|
|
|
|
emits('update:hiddenSearch', !props.hiddenSearch);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
|
getToolbarRef: () => toolbarRef.value,
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<VxeToolbar ref="toolbarRef" custom>
|
|
|
|
|
|
<template #toolPrefix>
|
|
|
|
|
|
<slot></slot>
|
2025-05-06 22:32:09 +08:00
|
|
|
|
<!-- TODO @puhui999:貌似 icon 没和 vxe 对上。可以考虑用 /Users/yunai/Java/yudao-ui-admin-vben-v5/packages/icons/src/iconify -->
|
2025-04-27 18:13:08 +08:00
|
|
|
|
<Button class="ml-2 font-[8px]" shape="circle" @click="onHiddenSearchBar">
|
|
|
|
|
|
<Search :size="15" />
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Button class="ml-2 font-[8px]" shape="circle" @click="refresh">
|
|
|
|
|
|
<RefreshCw :size="15" />
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
class="ml-2 font-[8px]"
|
|
|
|
|
|
shape="circle"
|
|
|
|
|
|
@click="toggleMaximizeAndTabbarHidden"
|
|
|
|
|
|
>
|
|
|
|
|
|
<Fullscreen :size="15" />
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</VxeToolbar>
|
|
|
|
|
|
</template>
|