<script setup>
import { onMounted, reactive } from 'vue'
import { getRecordPage, iuserAdd, IuserUpdate, iuserDelete, iuserGetById } from './api'
import { baseModelOptions, baseFilterOptions, stausList } from './options'

// const { proxy } = getCurrentInstance();

const state = reactive({
  baseModelOptions: baseModelOptions(),
  baseFilterOptions: baseFilterOptions(),
  title: "实名管理",
  baseModelName: '实名信息',
  addBtnName: '新增人员',
  editBtnName: '',
  delBtnName: '',
  primaryKey: 'id',
  getTableFn: getRecordPage,
  addFn: iuserAdd,
  editFn: IuserUpdate,
  deleteFn: iuserDelete,
  detailFn: iuserGetById,
  showEditBtn: false,
  showDeleteBtn: false,
  columnCount: 1,
  hideControl: true,
  showAddBtn: false,
  hideselection: true,
  rowControl: {
    showEditBtn: false,
    showDelBtn: false
  },
  permission: {//菜单管理中添加权限
    add: 'accessControl:page:list',
    edit: 'accessControl:page:list',
    delete: 'accessControl:page:list',
    detail: 'accessControl:page:list',
  },
  pageInfo: { total: 0, base: { limit: 8, current: 1 } },
  tableDataFormatter: function (params, res) {
    res.data.total = res.data.totalRows
    res.data.list = res.data.pageData
    return res.data.list
  },
})
onMounted(() => {

})
</script>

<template>
  <div class="app-container">
    <BaseTablePage :tableOptions="state">
      <template v-slot:column>
        <el-table-column type="index" align="center" label="序号" width="70" />
        <el-table-column label="姓名" align="center" prop="personName" />
        <el-table-column label="进出门类型" align="center" prop="enterOrExit">
          <template #default="scope">
            <span>{{ stausList().find((item) =>
      item.value == scope.row.openType)?.label || '-' }}</span>
          </template>
        </el-table-column>
        <el-table-column label="刷卡时间" align="center" prop="startSwingTime" />
        <el-table-column label="人员类型" align="center" prop="imageType">
          <template #default="scope">
            <span>{{ scope.row.imageType == 1 ? '内部人员' : scope.row.imageType == 2 ? '访客' : '-' }}</span>
          </template>
        </el-table-column>
        <el-table-column label="是否佩戴口罩" align="center" prop="createTime">
          <template #default="scope">
            <span>{{ scope.row.maskState == 3 ? '带口罩' : scope.row.maskState == 2 ? '没带口罩' : '未识别' }}</span>
          </template>
        </el-table-column>
        <el-table-column label="是否超温" align="center" prop="overTemp">
          <span>{{ scope.row.overTemp ? '是' : '否' }}</span>
        </el-table-column>
      </template>
    </BaseTablePage>
  </div>
</template>

<style scoped></style>
