<!-- 修改记录 -->
<script>
import {recordColumns} from './column';
import {getRecordList} from '@/api/changeApply/basic';

export default {
  name:'AmendantRecord',
  components:{
    ElSuperTable: () => import("@/components/super-table/index.vue"),
  },
  dicts:[],
  props:{
    type:{
      type:String,
      default:'text',
    },
    value:{
      type:Object,
      require:true,
    },
    size:{
      type:String,
      default:'mini'
    }
  },
  data(){

    return {
      title:'修改记录',
      visible:false,
      loading:false,
      tableData:[],
      TableColumns:recordColumns,
      

    }
  },
  methods:{
    async beforeOpen(){
      try {
        let {id} = this.value;

        this.loading = true;

        let {code,rows} = await getRecordList({changeId:id});

        if(code == 200){
          this.tableData = rows;
        }
        
      } catch (error) {
        
      }finally{
        this.loading = false;
      }
    },
    // 
    handleClose(){},
    handleClick(){
      this.visible = true;
    },
  },
  created(){},
}
</script>

<template>

  <el-button 
    v-bind="$attrs"
    v-on="$listeners"
    :type="type"
    @click="handleClick"
    :size="size"
  >
    {{ title }}
    <el-drawer
      :title="title"
      v-loading="loading"
      width="50%"
      @open="beforeOpen"
      :visible.sync="visible"
      append-to-body
      direction="rtl"
      :size="size"
    >

      <div style="padding: 10px;height: 600px;display: flex;">

        <el-super-table
          v-model="tableData"
          :dict="dict"
          :columns="TableColumns"
          :size="size"
          >
        </el-super-table>
      </div>

    </el-drawer>
  </el-button>

</template>