<template>
  <el-dialog
    title="查看档案"
    :visible.sync="visible"
    v-dialogDrag
    width="75%"
    :before-close="cancel"
  >
    <el-table border v-loading="loading" :data="newTableData" max-height="500px">
      <el-table-column prop="archive_file_num" width="100" label="原文数量" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.archive_file_num?scope.row.archive_file_num:0}}</span>
        </template>
      </el-table-column>
      <el-table-column
        v-for="(ele, index) in JSON.parse(tableShow)"
        :prop="ele.columnName"
        :label="ele.columnChnName"
        :min-width="ele.width"
        :key="index+'_column'"
        align="center"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span>{{ scope.row[ele.columnName] }}</span>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
export default {
  props: {
    visible: {
      type: Boolean,
      default: () => false
    },
    loading: {
      type: Boolean,
      default: () => false
    },
    tableData: {
      type: Array,
      default: () => []
    },
    Alltable: {
      type: Object,
      default: () => {
        tableShow: "[]";
      }
    }
  },
  watch:{
    tableData:{
      handler:function(val,oldVal){
          this.newTableData = val
      },
      deep:true
    },
    Alltable:{
      handler:function(val,oldVal){
        this.tableShow = val.tableShow;
      },
      deep:true
    }
  },
  data() {
    return {
      newTableData:[],
      tableShow:""
    };
  },
  methods: {
    cancel() {
      this.$emit("cancel");
    }
  },
  mounted(){
    console.log
  }
};
</script>

<style></style>
