Explorar el Código

修改上传时报错

yangg hace 9 meses
padre
commit
5087efaa37

+ 1 - 1
.env.development

@@ -2,5 +2,5 @@
 ENV = 'development'
 port = 8080
 # base api
-VUE_APP_BASE_API = 'http://183.195.216.54:8084'
+VUE_APP_BASE_API = 'http://192.168.1.142:8084'
 #192.168.1.178

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/index.html


+ 0 - 0
dist/static/css/chunk-33b89c2e.d5ab40f5.css → dist/static/css/chunk-40af5bc0.d5ab40f5.css


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/js/app.3dd53097.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/js/chunk-33b89c2e.e9f1d581.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/js/chunk-40af5bc0.82b8cce3.js


+ 38 - 23
src/views/knowledgeMenu/category/components/dataSearch.vue

@@ -25,15 +25,21 @@
         </el-select>
       </el-form-item>
       <el-form-item label="文件类型:">
-          <el-select v-model="queryForm.type" class="m-2" clearable placeholder="请选择文件类型" size="large">
-              <el-option
-                v-for="item in typeList"
-                :key="item"
-                :label="item"
-                :value="item"
-              />
-            </el-select>
-        </el-form-item>
+        <el-select
+          v-model="queryForm.type"
+          class="m-2"
+          clearable
+          placeholder="请选择文件类型"
+          size="large"
+        >
+          <el-option
+            v-for="item in typeList"
+            :key="item"
+            :label="item"
+            :value="item"
+          />
+        </el-select>
+      </el-form-item>
 
       <el-form-item>
         <el-button type="primary" @click="onSubmit">
@@ -93,7 +99,7 @@
             :data="{
               bucket_id: queryForm.bucket_id,
               user_id: queryForm.user_id,
-              doc_type_id:0
+              doc_type_id: 0,
             }"
             multiple
             :on-change="handleFileChange"
@@ -120,7 +126,7 @@
 </template>
 
 <script>
-import { getBucketContents, postUpload,getSuffixName } from "@/api/knowledge";
+import { getBucketContents, postUpload, getSuffixName } from "@/api/knowledge";
 export default {
   props: {
     queryForm: {
@@ -202,8 +208,8 @@ export default {
       uploadForm: {},
       fileList: [],
       url: "",
-      typeList:[
-       /*  {
+      typeList: [
+        /*  {
           label:'xls',
           value:'xls',
         },
@@ -223,14 +229,14 @@ export default {
           label:'png',
           value:'png',
         }, */
-      ]
+      ],
     };
   },
   mounted() {
     this.url = process.env.VUE_APP_BASE_API;
     this.queryForm.bucket_id = this.$route.query.id;
     this.queryForm.user_id = this.$store.state.user.id;
-    this.getType()
+    this.getType();
   },
   methods: {
     onCreate(e) {
@@ -238,7 +244,6 @@ export default {
     },
     //搜索
     onSubmit() {
-     
       this.$emit("bindSetQuery", this.$props.queryForm);
     },
     /* 创建模版 */
@@ -272,7 +277,18 @@ export default {
     },
     /*  */
     handleFileChange(file, fileList) {
-      this.fileList = fileList.map((f) => f.raw);
+      // Update this method
+      this.fileList = fileList.map((f) => {
+        if (!f.uid) {
+          f.uid = Date.now() + this.randomString(); // Add a unique identifier
+        }
+        return f;
+      });
+    },
+
+    // Add this new method
+    randomString() {
+      return Math.random().toString(36).substring(2, 15);
     },
 
     handleRemove(file, fileList) {
@@ -280,7 +296,6 @@ export default {
     },
     handleAvatarSuccess(response, res, file) {
       if (response.status == 200) {
-        
         this.$emit("bindSetQuery", this.$props.queryForm);
         this.$message.success("添加成功!");
         this.uploadVisible = false;
@@ -302,11 +317,11 @@ export default {
       this.uploadVisible = false;
       this.fileList = [];
     },
-    getType(){
-      getSuffixName().then(res=>{
-       this.typeList=res.data
-      })
-    }
+    getType() {
+      getSuffixName().then((res) => {
+        this.typeList = res.data;
+      });
+    },
     /* submitUpload() {
       this.fileList.map((el) => {
         postUpload({ bucket_name: this.queryForm.bucket_name, file: el }).then(

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio