<!--
 * @Description: 其他文件上传
 * @Author: lxl
 * @Date: 2020-11-17 16:00
-->
<template>
  <div>
    <el-dialog
      v-dialogDrag
      :visible.sync="upFileDialogData.upFileVisible"
      :close-on-click-modal="false"
      :lock-scroll="false"
      append-to-body
      title="其他文件上传"
      width="800px"
      custom-class="el-dialog__body-p8 el-dialog_table"
      @close="onClose"
    >
      <div>
        <upload
          ref="upload"
          :title="''"
          :on-change="principalFile"
          :success="onSuccess"
          :data="restFileType"
          :file-list="principalList"
          :auto-delete="true"
          :auto-upload="true"
          :limit="10"
          :file-size="200"
          tip-text="上传附件格式（*.doc;*.docx;*.pdf;*.png;*.jpg;*.zip;*.xlsx;*.xls;*.rar）单个文件不得超过200M"
          accept=".doc,.docx,.pdf,.png,.jpg,.zip,.jpeg,.txt,.xls,.ppt,.pptx,.rar"
          file-ref="fileRef"
          but-text="点击上传"
        />
      </div>
    </el-dialog>
  </div>
</template>
<script>
import upload from '@comp/common/updownload/upload'// 文件上传组件

export default {
  name: 'UploadRestDialog',
  components: {
    upload
  },
  props: {
    upFileDialogData: {
      type: Object,
      default: function() {
        return {
          upFileVisible: false
        }
      }
    },
    restFileType: {
      type: Object,
      default: function() {
        return {
          bizId: '',
          fileType: 'prot_archive_other_file'
        }
      }
    }
  },
  data() {
    return {
      principalList: []
    }
  },
  methods: {
    // 附件上传
    principalFile(file, fileList) {
      this.principalList = fileList
    },
    // 上传成功
    onSuccess(response) {
      this.$emit('upSuccess', '01') // 改变 isUpdateOtherFile 参数
    },
    // 弹框关闭
    onClose() {
      this.$emit('close')
    }
  }
}
</script>
