<template>
  <div class="app-container">
    <div class="Pd20">
      <el-form :model="form" :inline="true" size="mini">
        <el-form-item>
          <el-select v-model="form.cameraName" placeholder="监控点位" clearable>
            <el-option
              v-for="(item, index) in cameraAdderss"
              :key="index"
              :value="item.address"
              :label="item.name"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select
            v-model="form.algorithmLevel"
            placeholder="算法报警等级"
            clearable
          >
            <el-option
              v-for="(item, index) in dict.type.algorithm_level"
              :key="index"
              :value="item.value"
              :label="item.label"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select
            v-model="form.alarmStatus"
            placeholder="报警处理状态"
            clearable
          >
            <el-option :value="3" label="待处理"></el-option>
            <el-option :value="1" label="正确报警"></el-option>
            <el-option :value="0" label="错误报警"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-input
            v-model="form.algorithmName"
            placeholder="算法名称"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="mini" @click="search">
            <i class="el-icon-search el-icon--left"></i>
            搜索
          </el-button>
        </el-form-item>
      </el-form>
      <el-table :data="tableList">
        <el-table-column
          label="摄像头ID"
          prop="id"
          align="center"
        ></el-table-column>
        <el-table-column
          label="视频分析任务名称"
          prop="videoAnlysisTasksName"
          align="center"
        ></el-table-column>
        <el-table-column
          label="摄像头名称"
          prop="cameraName"
          align="center"
        ></el-table-column>
        <el-table-column
          label="报警图片"
          prop="alarmImg"
          align="center"
        ></el-table-column>
        <el-table-column
          label="报警时间"
          prop="alarmTime"
          align="center"
        ></el-table-column>
        <el-table-column
          label="算法名称"
          prop="algorithmName"
          align="center"
        ></el-table-column>
        <el-table-column
          label="算法报警等级"
          prop="algorithmLevel"
          align="center"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.algorithm_level"
              :value="scope.row.algorithmLevel"
            />
          </template>
        </el-table-column>
        <el-table-column label="报警处理状态" align="center">
          <template slot-scope="scope">
            {{ scope.row.alarmStatus === 0 ? "错误报警" : "正确报警" }}
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="200px">
          <template slot-scope="scope">
            <el-button type="text" size="mini" @click="editBut(scope.row)">
              正确报警
            </el-button>
            <el-button type="text" size="mini" @click="editBut(scope.row)">
              错误报警
            </el-button>
            <el-button type="text" size="mini" @click="deleteBut(scope.row)">
              <i class="el-icon-delete el-icon--left"></i>
              删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </div>
</template>

<script>
export default {
  dicts: ["algorithm_level"],
  name: "Alarmlog",
  props: {},
  components: {},
  data() {
    return {
      form: {
        id: 1, // 摄像头ID
        videoAnlysisTasksName: "", // 视频分析任务名称
        cameraName: "", // 摄像头名称
        alarmImg: "", // 报警图片
        alarmTime: "", // 报警时间
        algorithmName: "", // 算法名称
        algorithmLevel: 1, // 算法报警等级
        alarmStatus: 0, // 报警处理状态
      },
      tableList: [
        {
          id: 1, // 摄像头ID
          videoAnlysisTasksName: "yi", // 视频分析任务名称
          cameraName: "er", // 摄像头名称
          alarmImg: "1121", // 报警图片
          alarmTime: "1212", // 报警时间
          algorithmName: "1212", // 算法名称
          algorithmLevel: 1, // 算法报警等级
          alarmStatus: 0, // 报警处理状态
        },
      ],
      cameraAdderss: [
        {
          name: "摄像头1", // 摄像头名称

          address: "地址一", // 摄像头地址
        },
      ], // 摄像头地址
      total: 0, // 总数量
      queryParams: {
        pageNum: 1, // 当前页码
        pageSize: 10, // 每页显示的数量
      },
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    // 搜索
    search() {},
    // 删除
    deleteBut(row) {
      this.$confirm("确认删除吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      });
    },
    // 编辑
    editBut(row) {},
    // 获取数据列表
    getList() {},
  },
};
</script>

<style scoped lang="scss"></style>
