<template>
  <div class="ele-body">
    <el-card shadow="never">
      <!-- 表格工具栏 -->
      <div class="ele-table-tool">
        <div class="ele-table-tool-title">案卷列表</div>
        <div class="ele-table-tool-right">
          <el-button @click="openFileSortDialog" type="primary" icon="el-icon-sort" class="ele-btn-icon">卷内文件调整
          </el-button>
        </div>
      </div>
      <!-- 数据表格 -->
      <ele-data-table ref="table" :config="{url: 'https://cdn.eleadmin.com/20200610/document.json'}"
                      :choose.sync="choose" highlight-current-row>
        <el-table-column type="selection" width="45" align="center" fixed="left"/>
        <el-table-column type="index" width="45" align="center" fixed="left"/>
        <el-table-column prop="piece_no" label="案卷档号" show-overflow-tooltip min-width="110" width="215px"/>
        <el-table-column prop="title" label="案卷题名" show-overflow-tooltip min-width="110"/>
        <el-table-column prop="year" label="年度" show-overflow-tooltip min-width="80"/>
        <el-table-column prop="retention" label="保管期限" show-overflow-tooltip min-width="110"/>
        <el-table-column prop="secret" label="密级" show-overflow-tooltip min-width="110"/>
        <el-table-column prop="type" label="档案类别" show-overflow-tooltip min-width="110"/>
        <el-table-column prop="carrier" label="载体规格" show-overflow-tooltip min-width="110"/>
      </ele-data-table>
    </el-card>
    <!-- 卷内文件调整弹窗 -->
    <file-sort :show.sync="showFileSort" :documents="fileSortChoose"/>
  </div>
</template>

<script>
import FileSort from './file-sort'

export default {
  name: "ExDocument",
  components: {FileSort},
  data() {
    return {
      showFileSort: false,  // 是否显示卷内文件调整弹窗
      choose: [],  // 列表选中数据
      fileSortChoose: []  // 选中的案卷
    }
  },
  mounted() {
  },
  methods: {
    // 打开卷内文件调整弹窗
    openFileSortDialog() {
      if (this.choose.length < 2) return this.$message.error('请至少选择两条数据');
      //this.fileSortChoose = [].concat(this.choose);  // 实际项目用这一行
      this.fileSortChoose = this.$refs.table.getData().slice(0, 3);  // 演示强制选前三个演示
      this.showFileSort = true;
    }
  }
}
</script>

<style scoped>
</style>