<template>
  <div class="import-file-instance part-box">
    <Button type="primary" @click="open">to upload</Button>

    <import-file
      :title="title"
      :upload-url="uploadUrl"
      :download-url="downloadUrl"
      :download-filename="downloadFilename"
      :headers="headers"
      :format="['xls', 'xlsx']"
      @upload-success="fileUploaded"
      ref="ImportFile"
    >
    </import-file>
  </div>
</template>

<script>
import ImportFile from "@/components/common/ImportFile";

export default {
  name: "import-file-instance",
  components: {
    ImportFile
  },
  data() {
    return {
      title: "导入文件",
      uploadUrl: this.GLOBAL.domain + "yourUploadPath",
      uploadData: {},
      downloadFilename: "要下载的文件.xls",
      downloadUrl: "/path/要下载的文件.xls",
      headers: {
        Authorization: "token"
      }
    };
  },
  methods: {
    open() {
      this.$refs.ImportFile.modalIsShow = true;
    },
    fileUploaded() {}
  }
};
</script>
