// 驾驶证信息
<template>
  <div>
    <div class="drive-info">
      <div
        class="drive-info-box"
        v-for="(item, index) in tableData"
        :key="index"
      >
        <div class="drive-info-left">
          <div class="content-tit">驾驶证照片</div>
          <div class="drive-left-img">
            <!-- <img :src="item.drviePhoto" alt="" /> -->
            <el-image v-if="item.drviePhoto" :src="item.drviePhoto"></el-image>
            <span v-else>无</span>
          </div>
        </div>
        <div class="drive-info-right">
          <div class="drive-info-right-item">
            <div class="content-tit">准驾车型</div>
            <div class="right-item-text">{{ item.driveCarType }}</div>
          </div>
          <div class="drive-info-right-item">
            <div class="content-tit">累积计分</div>
            <div class="right-item-text">{{ item.score }}分</div>
          </div>
          <div class="drive-info-right-item">
            <div class="content-tit">有效期限</div>
            <div class="right-item-text">
              {{
                item.documentStartTime
                  ? item.documentStartTime + "至" + item.documentEndTime
                  : ""
              }}
              <!-- {{ item.documentStartTime }}至{{ item.documentEndTime }} -->
            </div>
          </div>
          <div class="drive-info-right-item">
            <div class="content-tit">状 态</div>
            <el-tag
              v-if="item.status == 1"
              type="success"
              style="margin-left: 5px"
              >正常</el-tag
            >
            <!-- <el-tag
              v-else
              type="success"
              style="margin-left: 5px"
              >正常</el-tag
            > -->
          </div>
          <div class="drive-info-right-item">
            <div class="content-tit">档案编号</div>
            <div class="right-item-text">{{ item.archiveNumber }}</div>
          </div>
          <div class="drive-info-right-item">
            <div class="content-tit">初次领证日期</div>
            <div class="right-item-text">{{ item.firstDocumentTime }}</div>
          </div>
        </div>
      </div>
      <div v-if="tableData.length == 0" class="no-data-text">暂无数据</div>
    </div>
    <!--分页栏-->
    <pagination
      :total="total"
      :page.sync="page.pageNum"
      :limit.sync="page.pageSize"
      @pagination="handlePagination"
    />
  </div>
</template>
<script>
import { getPersonDrivePageList } from "@/api/personnelFiles";
import Pagination from "@/components/Pagination";
export default {
  components: { Pagination },
  props: {
    personId: {
      type: [Number, String],
      default: 0,
    },
  },
  data() {
    return {
      tableData: [],
      total: 0,
      page: {
        // 搜索表单
        data: {
          personId: "",
        },
        pageNum: 1,
        pageSize: 10,
      },
    };
  },
  mounted() {
    this._getPersonDrivePageList();
  },
  methods: {
    _getPersonDrivePageList() {
      this.page.data.personId = this.personId;
      if (this.page.data.personId) {
        getPersonDrivePageList(this.page).then((res) => {
          this.tableData = res.data.records;
          this.total = res.data.total;
        });
      }
    },
    handlePagination(item) {
      // this.page.pageNum = item.pageNum;
      // this.page.pageSize = item.limit;
      this._getPersonDrivePageList();
    },
  },
};
</script>
<style lang="scss" scoped>
@import "./index.scss";
.drive-info-box {
  width: 710px;
  height: 242px;
}
</style>
