<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"
      >
      </base-table>
      <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 codeFilter from "@/filters/code-filter";
import { timeFormatter } from "@/filters/code-filter"
import i18n from "@/i18n";

const tableProps = [
  {
    prop: "title",
    label: i18n.t("code.title"),
    align: "center",
  },
  {
    prop: "code",
    label: i18n.t("code.code"),
    align: "center",
  },
  {
    prop: "eightDisciplineType",
    label: i18n.t("code.eightDisciplineType"),
    align: "center",
    filter: codeFilter("eightDisciplineType"),
  },
  {
    prop: "occurrenceDate",
    label: i18n.t("code.occurrenceDate"),
    align: "center",
    filter: timeFormatter,
  },
  // {
  //   prop: 'productName',
  //   label: i18n.t("code.productName"),
  //   align: 'center'
  // },
  // {
  //   prop: 'customName',
  //   label: i18n.t("code.customName"),
  //   align: 'center'
  // },
  {
    prop: "description",
    label: i18n.t("code.description"),
    align: "center",
  },
  {
    prop: "examineStatus",
    label: i18n.t("code.examineStatus"),
    align: "center",
    filter: codeFilter("examineStatus"),
  },
];

const eightDisciplineStatusArr = [
  {
    name: "D0",
    id: 0,
  },
  {
    name: "D1",
    id: 1,
  },
  {
    name: "D2",
    id: 2,
  },
  {
    name: "D3",
    id: 3,
  },
  {
    name: "D4",
    id: 4,
  },
  {
    name: "D5",
    id: 5,
  },
  {
    name: "D6",
    id: 6,
  },
  {
    name: "D7",
    id: 7,
  },
  {
    name: "D8",
    id: 8,
  },
];
export default {
  mixins: [basicPage],
  data() {
    return {
      urlOptions: {
        getDataListURL: "/code/startEightDiscipline/page",
        deleteURL: "/code/startEightDiscipline",
      },
      tableProps,
      eightDisciplineStatusArr,
      tableData: [],
      formConfig: [
        {
          type: "select",
          label: "状态",
          selectOptions: eightDisciplineStatusArr,
          param: "status",
          defaultSelect: "",
        },
        {
          type: "button",
          btnName: "搜索",
          name: "search",
          color: "primary",
        },
      ],
    };
  },
  methods: {
    //search-bar点击
    buttonClick(val) {
      switch (val.btnName) {
        case "search":
          this.listQuery.eightDisciplineStatus = val.status;
          this.listQuery.page = 1;
          this.getDataList();
          break;
        default:
          console.log(val);
      }
    },
  },
};
</script>
