<template>
  <div>
    <el-table v-loading='tableLoading' :data='tableData' border max-height="500px"
      @selection-change="handleSelectionChange" tooltip-effect="dark">
      <el-table-column type="selection" align="center" width="55">
      </el-table-column>
      <el-table-column show-overflow-tooltip align="center" prop="fileType" label="文件类型"></el-table-column>
      <el-table-column show-overflow-tooltip align="center" prop="fileTitle" label="题名"></el-table-column>
      <el-table-column show-overflow-tooltip align="center" prop="archiveNo" label="档号"></el-table-column>
      <el-table-column show-overflow-tooltip align="center" prop="fondsNo" label="全宗">
        <template slot-scope="scope">
          {{ (fondsList.filter(f => f.fondscode === scope.row["fondsNo"])[0] || {}).codeName }}
        </template>
      </el-table-column>
      <el-table-column show-overflow-tooltip align="center" prop="director" label="指导人"></el-table-column>
      <el-table-column show-overflow-tooltip align="center" prop="dirContent" label="指导内容"></el-table-column>
      <el-table-column show-overflow-tooltip align="center" prop="fileDate" width="180" label="指导时间"></el-table-column>
      <el-table-column align="center" prop="shijian" label="操作" v-if="showButtons.sc">
        <template slot-scope="scope">
          <!-- <el-button @click="edit(scope.row)" type="text" size="mini">修改</el-button> -->
          <el-button @click="del(scope.row)" type="text" style="color: #ff0000 " size="mini">删除
          </el-button>

        </template>
      </el-table-column>

    </el-table>
    <el-pagination @current-change="handleCurrentChange" @size-change="handleSizeChange"
      layout="total, prev, pager, next, sizes" :page-size="pagination.pageSize" :page-sizes="[10, 20, 30, 50]"
      :current-page="pagination.pageNum" :total="pagination.total">
    </el-pagination>
  </div>
</template>
<script>
  export default {
    props: {
      tableLoading: {
        type: Boolean,
        default: () => false,
      },
      fondsList: {
        type: Array,
        default: () => [],
      },
      tableData: {
        type: Array,
        default: () => [],
      },
      pagination: {
        type: Object,
        default: () => {},
      },
      showButtons: {
        type: Object,
        default: () => {},
      },
    },
    data() {
      return {}
    },
    methods: {
      handleSelectionChange(val) {
        this.$emit("handleSelectionChange", val)
      },
      handleCurrentChange(val) {
        this.pagination.pageNum = val;
        this.$emit("getData");
      },
      handleSizeChange(val) {
        this.pagination.pageSize = val;
        this.pagination.pageNum = 1;
        this.$emit("getData");
      },
      edit(val) {
        this.$emit("edit", val)
      },
      del(val) {
        this.$emit("del", 1, val)
      }
    }
  }

</script>
<style lang='scss' scoped>

</style>
