<template>
	<a-row :gutter="16" style="margin-bottom: 16px;">
		<a-col v-if="needAdd">
			<a-button type="primary" @click="showModal">
				<template #icon>
					<PlusOutlined />
				</template>
				新建
			</a-button>
		</a-col>
		<a-col>
			<a-button type="primary" @click="refreshTable">
				<template #icon>
					<SyncOutlined />
				</template>
				刷新
			</a-button>
		</a-col>
		<a-col>
			<a-button type="primary" @click="showSearch">
				<template #icon>
					<SearchOutlined />
				</template>
				搜索
			</a-button>
		</a-col>
		<slot></slot>
	</a-row>
</template>

<script setup lang="ts">
	import { ref, defineProps, computed, watch, defineEmits } from 'vue';
	import { SyncOutlined, PlusOutlined, SearchOutlined } from '@ant-design/icons-vue';
	import { useCommon } from '@/hooks/useCommon';
	let { showModal, showSearch } = useCommon();
	let props = defineProps({
		need_add: {
			type: Boolean,
			default: true
		}
	});
	let needAdd = ref<Boolean>(props.need_add)
	const emit = defineEmits();
	const refreshTable = () => {
		emit('refresh');
	}
</script>

<style>
</style>