// 无人机反制记录
<template>
  <div>
    <div class="head">
      <span>无人机反制记录</span>
      <el-button
        type="primary"
        size="small"
        style="margin-left: 20px"
        @click="back"
        >返回</el-button
      >
    </div>
    <div class="addmodel-main">
      <el-form :inline="true" :model="page.data">
        <el-form-item class="margin-left input">
          <el-input
            clearable
            v-model="page.data.carNumber"
            placeholder="请输入地点"
          ></el-input>
        </el-form-item>
        <el-form-item class="margin-left">
          <el-date-picker
            v-model="page.data.startTime"
            type="datetime"
            placeholder="选择开始时间"
            value-format="yyyy-MM-dd HH:mm:ss"
            style="width: 150px"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item class="margin-left">
          <el-date-picker
            v-model="page.data.endTime"
            type="datetime"
            placeholder="选择结束时间"
            value-format="yyyy-MM-dd HH:mm:ss"
            style="width: 150px"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item class="margin-left input">
          <el-select
            v-model="page.data.carType"
            filterable
            clearable
            placeholder="请选择地点反制状态"
          >
            <el-option label="成功" :value="true"></el-option>
            <el-option label="失败" :value="false"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item class="margin-left">
          <el-button type="primary" @click="fetchData" icon="el-icon-search"
            >搜索</el-button
          >
        </el-form-item>
      </el-form>
      <!-- 主体表格 -->
      <el-table
        :data="tableData"
        v-loading="listLoading"
        border
        fit
        highlight-current-row
        class="table"
      >
        <el-table-column align="center" width="80" label="序号">
          <template slot-scope="scope">
            {{ indexMethod(scope.$index) }}
          </template>
        </el-table-column>

        <el-table-column align="center" prop="carNumber" label="地点">
        </el-table-column>
        <el-table-column align="center" prop="warningTime" label="发现时间">
        </el-table-column>
        <el-table-column align="center" prop="warningAddress" label="反制时间">
        </el-table-column>
        <el-table-column align="center" prop="warningHitType" label="状态">
          <template v-slot="{ row }">
            <el-tag v-if="row.warningHitType == 2">成功</el-tag>
            <el-tag type="danger" v-else>失败</el-tag>
          </template>
        </el-table-column>
        <!--分页栏-->
      </el-table>
      <pagination
        :total="total"
        :page.sync="page.pageNum"
        :limit.sync="page.pageSize"
        @pagination="fetchData"
      />
    </div>
  </div>
</template>
<script>
import Pagination from "@/components/Pagination";
import {
  getwarningPersonCheckPageList,
  getwarninPersonStepList,
  getwarninPersonCheck,
} from "@/api/personnelWarning";
export default {
  components: { Pagination },
  props: {
    isShowUpdate: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      listLoading: false,
      // 页面
      page: {
        // 搜索表单
        data: {
          name: "",
          documentType: "",
          idNumber: "",
          warningType: "",
          warningPersonCheckId: "",
        },
        pageNum: 1,
        pageSize: 10,
      },
      tableData: [],
      total: 0,
    };
  },
  mounted() {},

  methods: {
    async fetchData() {
      this.listLoading = true;
      const res = await getwarningPersonCheckPageList(this.page);
      this.tableData = res.data.records;
      this.total = res.data.total;
      this.listLoading = false;
    },
    back() {
      this.$emit("back");
    },
    indexMethod(index) {
      return (this.page.pageNum - 1) * this.page.pageSize + index + 1;
    },
  },
};
</script>

<style lang="scss" scoped>
.margin-left {
  margin: 10px 0 0 10px;
}
.input {
  width: 190px;
}
.head {
  margin-bottom: 32px;
  span {
    color: #333;
    font-size: 18px;
    font-weight: 500;
  }
}
.addmodel-main {
}
</style>
