<template>
  <div>
    <el-table v-loading="loading" size="small" :data="tableData" border max-height="650px">
      <el-table-column label="申请人" prop="operatorChn" align="center">
      </el-table-column>
      <el-table-column label="申请日期" prop="operateDate" align="center">
      </el-table-column>
      <el-table-column label="申请档案数量" prop="rec_nums" align="center">
      </el-table-column>
      <el-table-column label="申请原文数量" prop="originalTextNums" align="center">
      </el-table-column>
      <el-table-column label="申请理由" prop="args" align="center">
      </el-table-column>
      <el-table-column label="状态" prop="description" align="center">
        <template slot-scope="scope">
          <el-tag type="success">{{scope.row.description}}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作" prop="currentNodeName" align="center">
        <template slot-scope="scope">
          <el-button type="text" @click="handleView(scope.row)">查看</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>
    <dia-apply :visible="diaVisible" :isView="true" @cancel="cancel" ref="diaApply" />
  </div>
</template>

<script>
import DiaApply from "@/components/DiaApply";
export default {
  props: {
    loading: {
      type: Boolean,
      default: () => true,
    },
    pagination: {
      type: Object,
      default: () => {},
    },
    tableData: {
      type: Array,
      default: () => [],
    },
  },
  components: { DiaApply },
  data() {
    return {
      diaVisible: false,
    };
  },
  methods: {
    handleCurrentChange(val) {
      this.$emit("currentChange", val);
    },
    handleSizeChange(val) {
      this.$emit("sizeChange", val);
    },
    handleView(row) {
      this.diaVisible = true;
      this.$refs.diaApply.form = {
        applyUserName: row.operatorChn,
        applyTime: row.operateDate,
        rec_nums: row.rec_nums,
        originalTextNums: row.originalTextNums,
        applyReason: row.args,
      };
    },
    cancel() {
      this.diaVisible = false;
    },
  },
};
</script>

<style></style>
