<template>
  <div>
    <el-card>
      <el-form
        :model="searchForm"
        label-width="60px"
        @submit.prevent="fnResetPagination"
      >
        <el-row>
          <el-col :span="6">
            <el-form-item label="关键字" prop="KEYWORDS">
              <el-input v-model="searchForm.KEYWORDS" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label-width="10px">
              <el-button type="primary" native-type="submit">搜索</el-button>
              <el-button native-type="reset" @click="fnResetPagination">
                重置
              </el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <layout-card>
      <layout-table
        ref="tableRef"
        :data="list"
        @get-data="fnGetData"
        v-model:pagination="pagination"
        row-key="RISKWARNING_ID"
      >
        <el-table-column reserve-selection type="selection" width="55" />
        <el-table-column label="序号" width="60">
          <template #default="{ $index }">
            {{ serialNumber(pagination, $index) }}
          </template>
        </el-table-column>
        <el-table-column prop="RISKUNITNAME" label="风险点（单元）" />
        <el-table-column prop="PARTSNAME" label="辨识部位名称" />
        <el-table-column label="图片">
          <template #default="{ row }">
            <layout-tooltip-img :imgs="row.imgs" />
          </template>
        </el-table-column>
      </layout-table>
    </layout-card>
  </div>
</template>

<script setup>
import { serialNumber } from "@/assets/js/utils";
import useListData from "@/assets/js/useListData.js";
import LayoutTooltipImg from "@/components/tooltip_img/index.vue";
import { getRiskNotificationCardList } from "@/request/risk_statement.js";

const { list, pagination, searchForm, fnGetData, fnResetPagination, tableRef } =
  useListData(getRiskNotificationCardList);
</script>

<style scoped></style>
