<template>
  <el-dialog
    v-dialogDrag
    :visible.sync="visible"
    :title="title"
    append-to-body
    width="800px"
    @open="onOpen"
    @close="dialogClose"
  >
    <FileUpload ref="fileUpload" />
    <div slot="footer">
      <el-button @click="close">取消</el-button>
      <el-button
        type="primary"
        :loading="ensureLoading"
        :disabled="isUploadShow !== -1"
        @click="handelConfirm"
      >确定</el-button>
    </div>

  </el-dialog>
</template>

<script>
import FileUpload from '@/components/FileUpload/index.vue'

export default {
  components: {
    FileUpload
  },
  data() {
    return {
      ensureLoading: false,
      wmsIncomingReceiptInspectionId: undefined,
      fileList: [],
      form: {
      },
      isUploadShow: '',
      selectRows: [],
      rules: {
      },
      visible: false,
      title: null
    }
  },
  methods: {
    onOpen() {
      this.$nextTick(() => {
        this.$refs.fileUpload.isUploadShow = this.isUploadShow
        this.$refs.fileUpload.fileList = this.fileList
      })
    },
    close() {
      this.reset()
      this.visible = false
    },
    dialogClose() {
      // this.fileList = []
    },
    reset() {
      this.form = {
        id: undefined,
        inspectionItemId: undefined,
        inspectionNo: undefined
      }
      this.resetForm('form')
    },
    handelConfirm() {
      this.fileList = this.$refs.fileUpload.fileList
      this.visible = false
      this.$emit('files', this.fileList)
    },
    queryDetails() {

    },
    badCodeChange(v) {
      console.log(v)
    }
  }
}

</script>
  <style>
  </style>
