<template>
  <div class="app-container">
    <!--搜索区-->
    <div class="float">
      <el-select
        filterable
        clearable
        v-model="page.data.qqqqq"
        placeholder="请选择公司名称"
        class="margin-left input"
      >
        <el-option
          v-for="item in unit_list"
          :key="item.code"
          :label="item.desc"
          :value="item.code"
        >
        </el-option>
      </el-select>
      <el-input
        v-model="page.data.yyyyy"
        placeholder="请输入姓名"
        clearable
        class="margin-left input"
      ></el-input>
      <el-input
        v-model="page.data.eeeee"
        placeholder="请输入身份证号"
        clearable
        class="margin-left input"
      ></el-input>
      <el-input
        v-model="page.data.rrrrr"
        placeholder="请输入手机号"
        clearable
        class="margin-left input"
      ></el-input>
      <el-button
        type="primary"
        icon="el-icon-search"
        @click="fetchData"
        class="margin-left"
        >搜索</el-button
      >
    </div>
    <!--主表格-->
    <el-table
      class="table"
      ref="table_form"
      v-loading="listLoading"
      :data="list"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
    >
      <el-table-column label="序号" align="center" width="80px">
        <template slot-scope="scope">
          {{ indexMethod(scope.$index) }}
        </template>
      </el-table-column>
      <el-table-column label="公司名称" align="center">
        <template slot-scope="scope">
          {{ scope.row.content }}
        </template>
      </el-table-column>
      <el-table-column label="姓名" align="center">
        <template slot-scope="scope">
          {{ scope.row.content }}
        </template>
      </el-table-column>
      <el-table-column label="身份证号" align="center">
        <template slot-scope="scope">
          {{ scope.row.content }}
        </template>
      </el-table-column>
      <el-table-column label="手机号" align="center">
        <template slot-scope="scope">
          {{ scope.row.content }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="" label="操作区" width="200">
        <template slot-scope="scope">
          <el-button
            type="danger"
            size="small"
            @click="deleteFun(scope.row.birthdayQuotesId)"
            >删除</el-button
          >
          <el-button type="primary" size="small" @click="create(scope.row)"
            >违规记录</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <!--分页栏-->
    <pagination
      :total="total"
      :page.sync="page.pageNum"
      :limit.sync="page.pageSize"
      @pagination="fetchData"
    />
    <!--对话框-->
    <el-dialog
      title="违规记录"
      :visible.sync="dialogVisible"
      width="900px"
      :close-on-click-modal="false"
    >
      <el-table
        class="table"
        ref="table_form"
        v-loading="listLoading"
        :data="detailList"
        element-loading-text="Loading"
        border
        fit
        highlight-current-row
      >
        <el-table-column label="序号" align="center" width="80px">
          <template slot-scope="scope">
            {{ indexMethod1(scope.$index) }}
          </template>
        </el-table-column>
        <el-table-column label="违规证件编号" align="center">
          <template slot-scope="scope">
            {{ scope.row.content }}
          </template>
        </el-table-column>
        <el-table-column label="违规内容" align="center">
          <template slot-scope="scope">
            {{ scope.row.content }}
          </template>
        </el-table-column>
        <el-table-column label="证件到期时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.content }}
          </template>
        </el-table-column>
        <el-table-column label="证件归还时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.content }}
          </template>
        </el-table-column>
      </el-table>
      <!--分页栏-->
      <pagination
        :total="total1"
        :page.sync="page1.pageNum"
        :limit.sync="page1.pageSize"
        @pagination="create"
      />
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogVisible = false">
          确定
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Pagination from "@/components/Pagination";
export default {
  components: { Pagination },
  filters: {},
  computed: {},
  data() {
    return {
      // 主表格&主表格加载状态
      list: [{}],
      listLoading: true,
      // 分页参数
      page: {
        data: {
          qqqqq: null,
          yyyyy: null,
          eeeee: null,
          rrrrr: null,
        },
        pageNum: 1,
        pageSize: 10,
      },
      total: 0,
      page1: {
        data: {},
        pageNum: 1,
        pageSize: 10,
      },
      total1: 0,
      // 是否显示对话框
      dialogVisible: false,
      unit_list: [],
      num_list: [0, 1, 2, 3],
      detailList: [],
    };
  },
  created() {
    this.fetchData();
  },
  watch: {},
  methods: {
    // 获取列表数据
    fetchData() {
      // this.listLoading = true;
      // birthdayQuotesList(this.page).then((res) => {
      //   this.list = res.data.records;
      //   this.total = res.data.total;
      this.listLoading = false;
      // });
    },
    // 打开添加角色对话框
    create(row) {
      // this.detailList = row;
      this.dialogVisible = true;
    },
    // 删除角色
    deleteFun(id) {
      this.$confirm("确定要删除吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      }).then(() => {
        // birthdayQuotesDel(id).then((res) => {
        //   this.fetchData();
        //   this.$message({
        //     type: "success",
        //     message: "删除成功!",
        //   });
        // });
      });
    },
    // 返回列表序号
    indexMethod(index) {
      return (this.page.pageNum - 1) * this.page.pageSize + index + 1;
    },
    // 返回列表序号
    indexMethod1(index) {
      return (this.page1.pageNum - 1) * this.page1.pageSize + index + 1;
    },
  },
};
</script>
<style scoped lang="scss">
</style>
