<template>
  <PageWrapper>
    <el-card :bordered="false" class="mb-3 proCard">
      <el-space align="center">
        <el-input
          :style="{ width: '320px' }"
          v-model="params.operator"
          clearable
          placeholder="请输入操作人"
          @keyup.enter="reloadTable"
        />
        <el-button type="primary" @click="reloadTable">
          <template #icon>
            <el-icon>
              <SearchOutlined />
            </el-icon>
          </template>
          查询
        </el-button>
      </el-space>
    </el-card>
    <el-card :bordered="false" class="proCard">
      <BasicTable
        :columns="columns"
        :request="loadDataTable"
        :row-key="(row) => row.id"
        ref="basicTableRef"
      />
    </el-card>
  </PageWrapper>
</template>

<script lang="ts" setup>
  import { reactive, ref } from 'vue';
  import { BasicTable } from '@/components/Table';
  import { operlogList } from '@/api/system/logs';
  import { SearchOutlined } from '@vicons/antd';
  import { columns } from './columns';

  const basicTableRef = ref();
  const tableData = ref();

  const params = reactive({
    operator: '',
  });

  const loadDataTable = async (res) => {
    const result = await operlogList({ ...params, ...res });
    tableData.value = result.list;
    return result;
  };

  function reloadTable() {
    basicTableRef.value.reload();
  }
</script>

<style lang="scss" scoped></style>
