<template>
    <div class="default-main">
        <TableHeader date-picker showCustomColumn>
            <template v-slot:select>
                <!-- <el-form-item label="用户名">
                    <el-select v-model.trim="value" class="m-2" 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>
                <el-form-item label="操作类型">
                    <el-input maxlength="32" show-word-limit    v-model.trim="tableStore.table.params.loginName" placeholder="Please input" />
                </el-form-item> -->
            </template>
            <template v-slot:operation>
                <el-button :icon="Plus" type="primary" @click="addMenu">添加</el-button>
            </template>
        </TableHeader>
        <Table ref="tableRef" />
    </div>
</template>
<script setup lang="ts">
import { Plus } from '@element-plus/icons-vue'
import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { saveLogParam } from '@/api/common'

defineOptions({
    name: 'comptroller/list'
})
const tableStore: any = new TableStore({
    url: '/system-boot/audit/getAuditLog',
    method: 'POST',
    column: [
        {
            title: '序号',
            width: 80,
            formatter: (row: any) => {
                return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
            }
        },
        { title: '操作时间', field: 'time', align: 'center', minWidth: 200 , sortable: true},
        { title: '操作人员', field: 'userName', align: 'center', minWidth: 120 },
        { title: '操作类型', field: 'operate', align: 'center', minWidth: 220 },
        { title: '事件描述', field: 'describe', align: 'center', showOverflow: true, minWidth: 200 },
        { title: '事件类型', field: 'type', align: 'center', minWidth: 160 },
        { title: '操作结果', field: 'type', align: 'center', minWidth: 100 },
        { title: '操作IP', field: 'ip', align: 'center', minWidth: 160 },
        { title: '事件等级', field: 'level', align: 'center', minWidth: 100 }
    ]
})
tableStore.table.params.loginName = ''
tableStore.table.params.operateType = ''
tableStore.table.params.type = ''
tableStore.table.params.pageSize = 100
provide('tableStore', tableStore)

// saveLogParam().then(res => {
//     console.log(res)
// })

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

const addMenu = () => { }
</script>
