htc 1 주 전
부모
커밋
1fe8b758d5
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      src/views/modules/agent/knowledge/file.vue

+ 11 - 0
src/views/modules/agent/knowledge/file.vue

@@ -74,6 +74,7 @@
                 <el-upload
                     class="upload-demo"
                     drag
+                    :file-list="fileList"
                     :action="uploadUrl"
                     :headers="uploadHeaders"
                     :on-success="uploadFileSuccess"
@@ -108,6 +109,7 @@
         '1':'解析完成'
     }
     const title = ref('')
+    const fileList = ref([])
     const list = ref([])
     const show = ref(false)
     const buttonLoading = ref(false)
@@ -128,6 +130,7 @@
     })
     
     const uploadFileSuccess = e =>{
+        fileList.value = [e.file];
         fileDto.value.fileData = e.data;
         proxy?.$modal.msgSuccess('上传成功');
     }
@@ -164,10 +167,18 @@
     }
 
     const cancel = () => {
+        fileList.value = [];
+        fileDto.value = {
+            baseId:'',
+            fileData:'',
+            fileFormat:'',
+            fileName:''
+        }
         show.value = false;
     }
 
     const submitForm = () => {
+        if(!fileDto.value.fileData) return proxy?.$modal.msgError('请上传文件')
         buttonLoading.value = true;
         addKnowledgeFile(fileDto.value).then((res) => {
             if(res.code!==0) return proxy?.$modal.msgError(res.msg);