From 0d3db253cad1fb49c4fae9b9a537c8c318c7172f Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 29 十一月 2023 10:23:59 +0800
Subject: [PATCH] 优化应用中心卸载

---
 src/pages/ai/FileUpload/uploader.vue |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/pages/ai/FileUpload/uploader.vue b/src/pages/ai/FileUpload/uploader.vue
index 14735e4..69705de 100644
--- a/src/pages/ai/FileUpload/uploader.vue
+++ b/src/pages/ai/FileUpload/uploader.vue
@@ -41,6 +41,9 @@
         return {}
       }
     },
+    sourceType: {
+      type: Number,
+    },
     options: {
       type: Object,
       default() {
@@ -83,6 +86,16 @@
       }
     },
     filesAdded(files, fileList) {
+      if (this.sourceType == 3 && files[0]) {
+        if (
+          !files[0].name.endsWith(".tar") ||
+          !files[0].name.endsWith(".gz") ||
+          !files[0].name.endsWith(".tar.gz")
+        ) {
+          this.shouldStop = true
+          return
+        }
+      }
       this.$emit(kebabCase(FILES_ADDED_EVENT), files, fileList)
       if (files.ignored || fileList.ignored) {
         // is ignored, filter it
@@ -94,6 +107,16 @@
       this.fileList = this.uploader.fileList
     },
     filesSubmitted(files, fileList) {
+      if (this.sourceType == 3&& files[0]) {
+        if (
+          !files[0].name.endsWith(".tar") ||
+          !files[0].name.endsWith(".gz") ||
+          !files[0].name.endsWith(".tar.gz")
+        ) {
+          this.shouldStop = true
+          return
+        }
+      }
       this.files = this.uploader.files
       this.fileList = this.uploader.fileList
       if (this.autoStart) {
@@ -101,7 +124,6 @@
       }
     },
     allEvent(...args) {
-      console.log(args)
       const name = args[0]
       const EVENTSMAP = {
         [FILE_ADDED_EVENT]: true,
@@ -123,7 +145,6 @@
     }
   },
   created() {
-    // console.log('uploader attrs',this.attrs);
     // this.bindUploader();
     this.options.initialPaused = !this.autoStart
     const uploader = new Uploader(this.options)

--
Gitblit v1.8.0