<template>
  <div class="page">
    <LayoutTable :data="tableData" :config="tableConfig" notAdd notDel />
  </div>
</template>

<script>
import table from "@/assets/mixins/table";

export default {
  mixins: [table],
  methods: {},
  data() {
    return {
      config: {
        columns: [
          {
            type: "selection",
            width: 60,
          },
          {
            prop: "id",
            label: "ID",
            width: 60,
            formatter: (row) => (row.id ? row.id : "--"),
          },
          {
            prop: "code",
            label: "验证码",
            formatter: (row) => (row.code ? row.code : "--"),
          },
          {
            prop: "url",
            label: "校验地址",
            formatter: (row) => (row.url ? row.url : "--"),
          },
          {
            prop: "mobile",
            label: "手机号码",
            formatter: (row) => (row.mobile ? row.mobile : "--"),
          },
          {
            prop: "email",
            label: "校验邮箱",
            formatter: (row) => (row.email ? row.email : "--"),
          },
          {
            prop: "type",
            label: "校验方式",
            width: 130,
            formatter: this.formatter,
          },
          {
            prop: "sessionId",
            label: "会话ID",
            formatter: (row) => (row.sessionId ? row.sessionId : "--"),
          },
          {
            prop: "ip",
            label: "IP地址",
            formatter: (row) => (row.ip ? row.ip : "--"),
          },
          {
            prop: "createTime",
            label: "创建时间",
            formatter: (row) => (row.createTime ? row.createTime : "--"),
          },
          {
            prop: "lapseTime",
            label: "失效时间",
            formatter: (row) => (row.lapseTime ? row.lapseTime : "--"),
          },
          {
            label: "操作",
            formatter: (row) => {
              return (
                <table-buttons
                  row={row}
                  onEdit={this.toEdit}
                  onDel={this.toDel}
                />
              );
            },
          },
        ],
        search: [
          {
            name: "mobile",
            type: "text",
            label: "手机号码",
          },
        ],
      },
    };
  },
};
</script>
