<!--
 * @Author: zwq
 * @Date: 2023-01-04 10:29:40
 * @LastEditors: zwq
 * @LastEditTime: 2023-03-03 10:07:37
 * @Description: 
-->
<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sys__user">
      <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
      <base-table
        :table-props="tableProps"
        :page="listQuery.page"
        :limit="listQuery.limit"
        :table-data="tableData"
      />
      <pagination
        :limit.sync="listQuery.limit"
        :page.sync="listQuery.page"
        :total="listQuery.total"
        @pagination="getDataList"
      />
    </div>
  </el-card>
</template>

<script>
import basicPage from "@/mixins/basic-page";
import i18n from "@/i18n";
import codeFilter from '@/filters/code-filter'
const tableProps = [
  {
    prop: "createTime",
    label: "添加时间",
  },
  {
    prop: "alarmCode",
    label: "报警编码",
  },
  {
    prop: "alarmContent",
    label: "报警内容",
  },
  {
    prop: "alarmGrade",
    label: "报警级别",
  },
  {
    prop: "alarmType",
    label: "报警类型",
  },
  {
    prop: "description",
    label: "描述",
  },
];
export default {
  mixins: [basicPage],
  data() {
    return {
      urlOptions: {
        getDataListURL: "/code/mtAlarmLog/page",
        exportUrl: "/code/mtAlarmLog/export",
      },
      tableProps,
      formConfig: [
        {
          type: "input",
          label: "报警内容",
          placeholder: "报警内容",
          param: "alarmContent",
        },
        {
          type: "select",
          label: "报警等级",
          selectOptions: [
            { id: "高", name: "高" },
            { id: "中", name: "中" },
            { id: "低", name: "低" },
          ],
          param: "alarmGrade",
          defaultSelect: "",
          onchange: true,
          width: 200,
        },
        {
          type: "button",
          btnName: "查询",
          name: "search",
          color: "primary",
        },
      ],
    };
  },
  components: {},
  methods:{
    //search-bar点击
    buttonClick(val) {
      switch (val.btnName) {
        case "search":
          this.listQuery.alarmContent = val.alarmContent;
          this.listQuery.alarmGrade = val.alarmGrade
          this.listQuery.page = 1;
          this.getDataList();
          break;
        case "add":
          this.addOrEditTitle = '新增'
          this.addOrUpdateVisible = true;
          this.addOrUpdateHandle()
          break;
        default:
          console.log(val)
       }
    },
  }
};
</script>
