<!-- 编辑弹窗 -->
<template>
  <ele-modal
    form
    :width="760"
    v-model="visible"
    title="扫描记录详情"
    @open="handleOpen"
  >
    <common-table
      :body-style="{ padding: '0px' }"
      ref="pageRef"
      :pageConfig="pageConfig"
      :columns="columns"
      :tools="false"
    >
    </common-table>
    <template #footer>
      <el-button @click="handleCancel">关闭</el-button>
    </template>
  </ele-modal>
</template>

<script setup>
  import { ref, reactive, nextTick } from 'vue';
  import request from '@/utils/request';
  import CommonTable from '@/components/CommonPage/CommonTable.vue';

  const pageRef = ref(null);

  /** 弹窗是否打开 */
  const visible = defineModel({ type: Boolean });

  /** 关闭弹窗 */
  const handleCancel = () => {
    visible.value = false;
  };

  /** 弹窗打开事件 */
  const handleOpen = () => {
    visible.value = true;
  };

  /** 表格列配置 */
  const columns = ref([
    { label: '用户名', prop: 'createName', align: 'center', width: 180 },
    { label: '扫描次数', prop: 'downloadNum', align: 'center', width: 120 },
    { label: '最后一次扫描时间', prop: 'downloadTime', align: 'center' }
  ]);

  const pageConfig = reactive({
    pageUrl: '/common/exportrecord/pagelist',
    fileName: '扫描记录',
    cacheKey: 'scanLogList'
  });

  defineExpose({
    handleOpen
  });
</script>
