<template>
  <!--档案详情-操作记录-->
  <div class="fourTest-container">
    <el-table class="archives-table" :data="tableData" style="min-width: 100%" height="calc(100vh - 440px)">
      <el-table-column prop="operateType" label="操作类型" min-width="60" align="center">
        <template slot-scope="scope">
          <span class="row-state row-packing state-active">{{ getOperateTypeText(scope.row.operateType) }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="opinion" label="处理意见" min-width="60" />
      <el-table-column prop="update_by" label="处理人" min-width="60" />
      <el-table-column prop="update_time" label="处理时间" min-width="180">
        <template slot-scope="scope">
          <div>{{ scope.row.update_time | parseTime }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="remarks" label="备注" min-width="180" show-overflow-tooltip />
    </el-table>
    <!--分页组件-->
    <el-pagination
      v-if="tableData.length !== 0"
      :current-page="page.page+1"
      :total="page.total"
      :page-size="page.size"
      :pager-count="5"
      layout="total, prev, pager, next, sizes"
      @size-change="handleSizeChange"
      @current-change="handleCurrentPage"
    />
  </div>
</template>

<script>
import { FetchArchivesOperateLog } from '@/api/archivesManage/library'
export default {
  name: 'HandleInfo',
  components: { },
  mixins: [],
  data() {
    return {
      currentArcId: null,
      tableData: [],
      page: {
        page: 0,
        size: 10,
        total: 0
      },
      operateTypeMap: {
        1: '归档',
        2: '退回',
        3: '开放',
        4: '销毁',
        5: '赋权',
        6: '在线',
        7: '离线',
        8: '新增',
        9: '编辑',
        10: '删除',
        11: '装盒',
        12: '拆盒',
        13: '标签绑定',
        14: '标签解绑',
        15: '入库',
        16: '出库',
        17: '附件新增',
        18: '附件删除',
        19: '实体档案归还'
      }
    }
  },
  created() {

  },
  mounted() {
  },
  methods: {
    getArchivesOperateLog(arcId) {
      // 1.归档 2.退回 3.开放 4.销毁 5.赋权 6.在线7.离线 8.新香增 9.编辑 10.删除 11.装盒 12.拆盒 13.标签绑定 14.标签解绑 15.入库 16.出库 17.附件新增 18.附件删除 19.实体档案归还
      const params = {
        'archivesId': arcId,
        // 'operateType': null,
        'page': this.page.page,
        'size': this.page.size
        // 'startTime': '',
        // 'endTime': ''
      }
      FetchArchivesOperateLog(params).then(data => {
        if (data.content && data.content.length !== 0) {
          this.tableData = data.content
          this.page.total = data.totalElements
        } else {
          this.tableData = []
          this.page.total = 0
        }
      })
    },
    getOperateTypeText(type) {
      return this.operateTypeMap[type] || '-'
    },
    handleSizeChange(size) {
      this.page.size = size
      this.page.page = 0
      this.getArchivesOperateLog(this.currentArcId)
    },
    handleCurrentPage(val) {
      this.page.page = val - 1
      this.getArchivesOperateLog(this.currentArcId)
    }
  }
}
</script>

<style lang='scss' scoped>
@import "~@/assets/styles/collect-reorganizi.scss";
.fourTest-container{
  height: calc(100vh - 380px) !important;
  overflow: hidden;
}
</style>
