<template>
    <div class="default-main">

        <TableHeader ref="TableHeaderRef">
            <template v-slot:select>
                <el-form-item label="模板类型">
                 
                    <el-select v-model="tableStore.table.params.type" placeholder="Select" size="large">
                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
                    </el-select>
                </el-form-item>
            </template>
            <template #operation>
                <el-button icon="el-icon-Memo" type="primary" @click="add">报告字典管理</el-button>
                <el-button icon="el-icon-Plus" type="primary" @click="add">新增模版</el-button>
            </template>
        </TableHeader>
        <Table ref="tableRef" />

    </div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, nextTick } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { delTemplate } from '@/api/harmonic-boot/luckyexcel'
import { useDictData } from '@/stores/dictData'
import { ElMessage } from 'element-plus'
defineOptions({
    name: 'BusinessAdministrator/ReportTemplate/ReportConfiguration'
})
const options = ([
    { value: '0', label: '监测点报告' },
    { value: '1', label: '区域报告' },

])



const tableStore: any = new TableStore({
    url: '/system-boot/EventTemplate/getList',
    method: 'POST',
    column: [
        { field: 'name', title: '模板名称' },
        { field: 'code', title: '模板描述' },

        {
            title: '操作',
            width: '220',
            render: 'buttons',
            buttons: [
               
                {
                    name: 'edit',
                    title: '编辑',
                    type: 'primary',
                    icon: 'el-icon-Plus',
                    render: 'basicButton',
                    click: row => {

                    }
                },

                {
                    name: 'del',
                    text: '删除',
                    type: 'danger',
                    icon: 'el-icon-Delete',
                    render: 'confirmButton',
                    popconfirm: {
                        confirmButtonText: '确认',
                        cancelButtonText: '取消',
                        confirmButtonType: 'danger',
                        title: '确定删除？'
                    },
                    click: row => {
                        delTemplate({ tempId: row.id, deptId: row.deptId }).then(res => {
                            ElMessage.success('删除成功')
                            tableStore.index()
                        })
                    }
                }
            ]
        }
    ],

    loadCallback: () => { }
})
tableStore.table.params = {}

tableStore.table.params.type = '0'
provide('tableStore', tableStore)

const add = () => {

}
onMounted(() => {
    tableStore.index()
})
</script>
