<!-- 快捷增删改查按钮 -->
<template>
    <div class="fast-btn">
        <el-button type="primary" icon="el-icon-Plus" @click="$emit('add')" v-if="showBtns.indexOf('add') !== -1">新增</el-button>
<!--        <el-button type="success" icon="el-icon-View" @click="$parent.getBySelect()" v-if="showBtns.indexOf('get') !== -1">查看</el-button>-->
        <el-button type="primary" icon="el-icon-Download" @click="sa.exportExcel()" v-if="showBtns.indexOf('export') !== -1">导出</el-button>
        <el-button type="danger" plain icon="el-icon-Delete" @click="$emit('deleteByIds')" v-if="showBtns.indexOf('delete') !== -1">删除</el-button>
        <el-button type="default" plain icon="el-icon-Refresh"  @click="appStore.f5NativeTab()" v-if="showBtns.indexOf('reset') !== -1">重置</el-button>
        <slot></slot>
    </div>
</template>

<script setup name="com-fast-btn">
import {getCurrentInstance, onMounted, ref} from "vue";
import {useAppStore} from "../../../store/app";
const {proxy} = getCurrentInstance();
const appStore = useAppStore();

defineProps({
    // 快捷按钮显示列表，形如：add,get,delete,export,reset 
    show: {},
})

// 快捷按钮显示按钮列表 
const showBtns = ref([]);

// 解析
onMounted(function (){
    let arr = proxy.show.split(',');
    for (var i = 0; i < arr.length; i++) {
        arr[i] = arr[i].trim();
    }
    showBtns.value = arr;
})

const ddd = () => {
    console.log('dddd')
    console.log(proxy.$parent)
    proxy.$parent.deleteByIds();
}

</script>

<style scoped>

</style>
