<template>
  <div class="content-box">
    <div class="container">
      <p>导入设置</p>
      <!-- <div class="test-div">
      <i class="el-icon-edit"></i>
      <i class="el-icon-share"></i>
      <i class="el-icon-delete"></i>
    </div> -->

      <el-upload class="upload-demo" ref="upload" action="https://jsonplaceholder.typicode.com/posts/"
        :file-list="fileList" :auto-upload="false" @on-success="fileSuccess" @on-error="fileError" @on-progress="fileProgress">
        <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
        <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">导入</el-button>
      </el-upload>

      <div class="warning">
        <i class="el-icon-warning" style="color: #409EFF; margin: 0 3px 0 10px;"></i>范围1-8、默认6
        将一个保存好的系统设置文件导入本系统。导入后将覆盖现有的所有分析和用户设置，并重启系统，未保存的数据可能会丢失，请谨慎使用.
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fileList: [],
    }
  },
  methods: {
    submitUpload() {
      this.$refs.upload.submit();
      console.log(this.$refs.upload, '上传');
    },
    // 成功
    fileSuccess(response, file, fileList) {
      console.log(response, file, fileList, '成功');
    },
    // 失败
    fileError(err, file, fileList){
      console.log(err, file, fileList, '失败');
    },
    // 上传中
    fileProgress(event, file, fileList){
      console.log(event, file, fileList, '上传中');
    }
  }
}
</script>

<style>
.test-div i {
  font-size: 25px;
}

.warning {
  margin-top: 10px;
  width: 35%;
}
</style>