<template>
  <div class="cmain" style="display: flex;justify-content: center;align-items: center;">
    <el-upload
      class="upload-demo"
      drag
      action="#"
      :http-request="AvatarUpload"
      multiple
      :auto-upload="true"
    >
      <i class="el-icon-upload"></i>
      <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
    </el-upload>
    <div class="mfooter">
      <el-button @click="$layer.close(layerid)">取 消</el-button>
    </div>
  </div>
</template>

<script>
import { importData } from "@/api/portal/GARDENTRADEDATA/GARDENTRADEDATA.js";
export default {
  data() {
    return {};
  },
  props:{
    layerid: {
      type: String
    }
  },
  methods: {
    AvatarUpload(file) {
        let formData = new FormData()
        formData.append('file',file.file)
        importData(formData).then(res=>{
            if(res.code == 200){
              this.$modal.msgSuccess(res.msg);
              this.$parent.getList();
              this.$layer.close(this.layerid);
            }
        })
    },
  },
};
</script>

<style>
</style>