// 护照信息
<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.passportPhoto" alt="" /> -->
            <el-image
              v-if="item.passportPhoto"
              :src="item.passportPhoto"
            ></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.passport }}</div>
          </div>
          <div class="drive-info-right-item">
            <div class="content-tit">国 籍</div>
            <div class="right-item-text">{{ item.nationality }}</div>
          </div>
          <div class="drive-info-right-item">
            <div class="content-tit">签发日期</div>
            <div class="right-item-text">{{ item.signingTime }}</div>
          </div>

          <div class="drive-info-right-item">
            <div class="content-tit">有效期限</div>
            <div class="right-item-text">
              {{ item.documentStartTime }} 至 {{ item.documentEndTime }}
            </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 { getPersonPassportPageList } 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._getPersonPassportPageList();
  },
  methods: {
    _getPersonPassportPageList() {
      this.page.data.personId = this.personId;
      if (this.page.data.personId) {
        getPersonPassportPageList(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._getPersonPassportPageList();
    },
  },
};
</script>
<style lang="scss" scoped>
@import "./index.scss";
.drive-info-box {
  width: 710px;
  height: 242px;
}
</style>
