<template>
    <my-table url="/api/v1/logger/login" rowKey="logId" ref="table">
        <template #search="{query}">
            <my-form-item label="开始时间">
                <a-date-picker
                    class="tw-w-full"
                    show-time
                    v-model="query.startTime"
                    valueFormat="YYYY-MM-DD HH:mm:ss"
                />
            </my-form-item>
            <my-form-item label="结束时间">
                <a-date-picker
                    class="tw-w-full"
                    show-time
                    v-model="query.endTime"
                    valueFormat="YYYY-MM-DD HH:mm:ss"
                />
            </my-form-item>
            <my-form-item label="登录用户">
                <a-input v-model="query.userId" />
            </my-form-item>
            <my-form-item label="登录IP">
                <a-input v-model="query.loginIp" />
            </my-form-item>
            <my-form-item label="事件类型">
                <a-select v-model="query.loginType" allowClear>
                    <a-select-option value="LOGIN">登录系统</a-select-option>
                    <a-select-option value="LOGOUT">退出系统</a-select-option>
                </a-select>
            </my-form-item>
            <my-form-item label="事件状态">
                <a-select v-model="query.isSuccess" allowClear>
                    <a-select-option value="0">失败</a-select-option>
                    <a-select-option value="1">成功</a-select-option>
                </a-select>
            </my-form-item>
        </template>
        <a-table-column title="用户Id" data-index="userId" />
        <a-table-column title="登录用户" data-index="userName" />
        <a-table-column title="登录IP" data-index="loginIp" />
        <a-table-column title="事件类型" data-index="loginTypeName" />
        <a-table-column title="事件状态" data-index="isSuccessName" />
        <a-table-column title="登录时间" data-index="loginTime" />
        <a-table-column title="说明" data-index="logResultContent" />
    </my-table>
</template>

<script>
export default {
    data() {
        return {};
    },
    methods: {
        refreshTable() {
            this.$refs.table.getData();
        },
        showDrawer(type, noFooter) {
            this.$refs['table'].show({ type, noFooter });
        },
    },
};
</script>
