<template>
  <div id='preprocessing-container '  class='mt20'>
    <el-form label-width='150px' :model='form' ref='processForm'>
      <el-form-item label='数据来源：' required prop='radio'>
        <el-radio-group v-model='form.radio' size='medium'>
          <el-radio-button label='1' size='medium'>使用本地文件</el-radio-button>
          <el-radio-button label='2' size='medium'>使用通用知识文件模板</el-radio-button>
        </el-radio-group>

        <div  class='mt10' v-if='form.radio==="2"'>
          <el-button type='primary' size='medium' class='fs14' >下载知识文件模板</el-button>
        </div>
      </el-form-item>
      <!-- 文件上传-->
      <el-form-item label='' required prop='file'>
        <el-upload drag :action='actionUrl' :headers='headers' class='upload-demo'>
         <el-empty>
           <template #description>
             <p>点击或将文件拖拽到这里上传</p>
             <p>支持扩展名：.xlsx .doc .docx .pdf .txt...</p>
           </template>
         </el-empty>
        </el-upload>
      </el-form-item>

      <!-- 本地文件 -->
      <div v-if='form.radio==="1"'>
        <el-form-item label='是否进行预处理：' required prop='preprocessing'>
          <el-radio-group v-model='form.preprocessing' size='medium'>
            <el-radio label='1' size='medium'>是</el-radio>
            <el-radio label='2' size='medium'>否</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label='是否ocr协助处理：' required prop='ocr'>
          <el-radio-group v-model='form.ocr' size='medium'>
            <el-radio label='1' size='medium'>是</el-radio>
            <el-radio label='2' size='medium'>否</el-radio>
          </el-radio-group>
        </el-form-item>
      </div>
    </el-form>
  </div>
</template>
<script>
export default {
  name: 'preprocessing',
  data() {
    return {
      actionUrl:'',
      headers:{},
      form:{
        radio:'1',
        fileList:[],
        preprocessing:'1',
        ocr:'1',
      }
    }
  },
  props: {},
  watch: {},
  components: {},
  filters: {},
  methods: {
    handleSuccess(response, file, fileList) {
      console.log(response, file, fileList)
    },
    handleError(err, file, fileList) {
      console.log(err, file, fileList)
    },
    beforeUpload(file) {
      console.log(file)
      return true
    },
    handleChange(file, fileList) {
      console.log(file, fileList)
    },
    handleRemove(file, fileList) {
      console.log(file, fileList)
    },
    handlePreview(file) {
      console.log(file)
    },
    emitForm() {
      this.$emit('getForm', this.$refs.processForm,this.form)
    },

  },
  created() {
  },
  mounted() {
  },
  computed: {}
}
</script>
<style scoped lang='scss'>
.upload-demo{
  //dashed 间隔大一点
  border-radius: 6px;
  border-style: dashed;
  border-width: 2px;
  border-color: #d9d9d9;
  height: 330px;
  width:50%;
  text-align: center;
  &:hover{
    border-color: #409EFF;
  }

   /deep/ .el-upload{
    width:100%;
     height: 100%;

     & .el-upload-dragger{
       width:100%;
       border:unset;
       height: 100%;

     }
  }
}
#preprocessing-container {
}
</style>
