<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="list" stripe border>
      <el-table-column label="隐患名称" align="center" prop="hiddName" min-width="160" :show-overflow-tooltip="true" />
      <el-table-column label="隐患级别" align="center" width="100">
        <template #default="scope">
          {{ scope.row.hiddGrad === '2' ? '重大隐患' : '一般隐患' }}
        </template>
      </el-table-column>
      <el-table-column label="隐患分类" align="center" width="120">
        <template #default="scope">
          <dict-tag :options="hidd_clas" :value="scope.row.hiddClas" />
        </template>
      </el-table-column>
      <el-table-column label="工程名称" align="center" prop="engName" min-width="140" :show-overflow-tooltip="true" />
      <el-table-column label="隐患状态" align="center" width="100">
        <template #default="scope">
          <dict-tag :options="hidd_stat" :value="scope.row.hiddStat" />
        </template>
      </el-table-column>
      <el-table-column label="采集时间" align="center" width="110">
        <template #default="scope">
          {{ scope.row.collTime ? scope.row.collTime.substring(0, 10) : '--' }}
        </template>
      </el-table-column>
      <el-table-column label="要求完成时间" align="center" width="110">
        <template #default="scope">
          {{ scope.row.requCompDate ? scope.row.requCompDate.substring(0, 10) : '--' }}
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
  </div>
</template>

<script setup name="DetailCount">
import { listObjHidd } from "@/api/slaj/hidd"

const { proxy } = getCurrentInstance()
const { hidd_clas, hidd_stat } = proxy.useDict("hidd_clas", "hidd_stat")

const loading = ref(false)
const list = ref([])
const total = ref(0)

const queryParams = reactive({
  pageNum: 1,
  pageSize: 10,
  orgGuid: ''
})

function getList() {
  loading.value = true
  listObjHidd(queryParams).then(res => {
    list.value = res.rows || []
    total.value = res.total || 0
    loading.value = false
  }).catch(() => { loading.value = false })
}

defineExpose({ queryParams, getList })
</script>
