This is an automated email from the ASF dual-hosted git repository.

kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new fdf719c  [Fix-4796][UI] Fix child file upload failure and file id 
mixed problem (#4797)
fdf719c is described below

commit fdf719c1e9d6b0b7344aa21eeec79dead2cbb66d
Author: Shiwen Cheng <[email protected]>
AuthorDate: Sat Feb 20 08:43:12 2021 +0800

    [Fix-4796][UI] Fix child file upload failure and file id mixed problem 
(#4797)
---
 .../components/fileUpdate/definitionUpdate.vue     | 13 +++++------
 .../components/fileUpdate/fileChildReUpdate.vue    | 13 ++++++-----
 .../components/fileUpdate/fileChildUpdate.vue      | 15 ++++++-------
 .../module/components/fileUpdate/fileReUpload.vue  | 13 ++++++-----
 .../js/module/components/fileUpdate/fileUpdate.vue | 13 +++++------
 .../components/fileUpdate/resourceChildUpdate.vue  | 17 +++++++-------
 .../js/module/components/fileUpdate/udfUpdate.vue  | 26 ++++++----------------
 .../src/js/module/components/nav/nav.vue           |  2 +-
 8 files changed, 49 insertions(+), 63 deletions(-)

diff --git 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/definitionUpdate.vue 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/definitionUpdate.vue
index f1d61bf..6c34c8e 100644
--- 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/definitionUpdate.vue
+++ 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/definitionUpdate.vue
@@ -46,7 +46,7 @@
             <template slot="content">
               <div class="file-update-box">
                 <template v-if="progress === 0">
-                  <input name="file" id="file" type="file" class="file-update">
+                  <input ref="file" name="file" type="file" 
class="file-update" @change="_onChange">
                   <el-button size="mini">{{$t('Upload')}}<em 
class="el-icon-upload"></em></el-button>
                 </template>
                 <div class="progress-box" v-if="progress !== 0">
@@ -188,14 +188,13 @@
         this.file = file
         this.name = file.name
         this.dragOver = false
-      }
-    },
-    mounted () {
-      $('#file').change(() => {
-        let file = $('#file')[0].files[0]
+      },
+      _onChange () {
+        let file = this.$refs.file.files[0]
         this.file = file
         this.name = file.name
-      })
+        this.$refs.file.value = null
+      }
     },
     components: { mPopup, mListBoxF, mProgressBar }
   }
diff --git 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildReUpdate.vue 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildReUpdate.vue
index 39e8216..a47e01e 100644
--- 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildReUpdate.vue
+++ 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildReUpdate.vue
@@ -69,7 +69,7 @@
             <template slot="content">
               <div class="file-update-box">
                 <template v-if="progress === 0">
-                  <input name="file" id="file" type="file" class="file-update">
+                  <input ref="file" name="file" type="file" 
class="file-update" @change="_onChange">
                   <el-button size="mini">{{$t('Upload')}}<em 
class="el-icon-upload"></em></el-button>
                 </template>
                 <div class="progress-box" v-if="progress !== 0">
@@ -239,16 +239,17 @@
         this.file = file
         this.name = file.name
         this.dragOver = false
+      },
+      _onChange () {
+        let file = this.$refs.file.files[0]
+        this.file = file
+        this.name = file.name
+        this.$refs.file.value = null
       }
     },
     mounted () {
       this.name = this.fileName
       this.description = this.desc
-      $('#file').change(() => {
-        let file = $('#file')[0].files[0]
-        this.file = file
-        this.name = file.name
-      })
     },
     components: { mPopup, mListBoxF, mProgressBar }
   }
diff --git 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
index d6d7fac..a984af6 100644
--- 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
+++ 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
@@ -70,7 +70,7 @@
             <template slot="content">
               <div class="file-update-box">
                 <template v-if="progress === 0">
-                  <input name="file" id="file" type="file" class="file-update">
+                  <input ref="file" name="file" type="file" 
class="file-update" @change="_onChange">
                   <el-button size="mini">{{$t('Upload')}}<em 
class="el-icon-upload"></em></el-button>
                 </template>
                 <div class="progress-box" v-if="progress !== 0">
@@ -226,16 +226,15 @@
         this.progress = 0
         this.file = ''
         this.currentDir = localStore.getItem('currentDir')
-        this.pid = -1
+        this.pid = this.id
         this.dragOver = false
-      }
-    },
-    mounted () {
-      $('#file').change(() => {
-        let file = $('#file')[0].files[0]
+      },
+      _onChange () {
+        let file = this.$refs.file.files[0]
         this.file = file
         this.name = file.name
-      })
+        this.$refs.file.value = null
+      }
     },
     components: { mPopup, mListBoxF, mProgressBar }
   }
diff --git 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileReUpload.vue 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileReUpload.vue
index af58e14..4b64d66 100644
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileReUpload.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileReUpload.vue
@@ -69,7 +69,7 @@
             <template slot="content">
               <div class="file-update-box">
                 <template v-if="progress === 0">
-                  <input name="file" id="file" type="file" class="file-update">
+                  <input ref="file" name="file" type="file" 
class="file-update" @change="_onChange">
                   <el-button size="mini"> {{$t('Upload')}} </el-button>
                 </template>
                 <div class="progress-box" v-if="progress !== 0">
@@ -238,16 +238,17 @@
         this.file = file
         this.name = file.name
         this.dragOver = false
+      },
+      _onChange () {
+        let file = this.$refs.file.files[0]
+        this.file = file
+        this.name = file.name
+        this.$refs.file.value = null
       }
     },
     mounted () {
       this.name = this.fileName
       this.description = this.desc
-      $('#file').change(() => {
-        let file = $('#file')[0].files[0]
-        this.file = file
-        this.name = file.name
-      })
     },
     components: { mPopup, mListBoxF, mProgressBar }
   }
diff --git 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
index 6fa9d26..a9193a3 100755
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
@@ -70,7 +70,7 @@
             <template slot="content">
               <div class="file-update-box">
                 <template v-if="progress === 0">
-                  <input name="file" id="file" type="file" class="file-update">
+                  <input ref="file" name="file" type="file" 
class="file-update" @change="_onChange">
                   <el-button type="dashed" size="mini">{{$t('Upload')}}<em 
class="el-icon-upload"></em></el-button>
                 </template>
                 <div class="progress-box" v-if="progress !== 0">
@@ -226,14 +226,13 @@
         this.file = file
         this.name = file.name
         this.dragOver = false
-      }
-    },
-    mounted () {
-      $('#file').change(() => {
-        let file = $('#file')[0].files[0]
+      },
+      _onChange () {
+        let file = this.$refs.file.files[0]
         this.file = file
         this.name = file.name
-      })
+        this.$refs.file.value = null
+      }
     },
     components: { mPopup, mListBoxF, mProgressBar }
   }
diff --git 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
index 5cb0c3c..4bc438f 100755
--- 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
+++ 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
@@ -70,7 +70,7 @@
             <template slot="content">
               <div class="file-update-box">
                 <template v-if="progress === 0">
-                  <input name="file" id="file" type="file" class="file-update">
+                  <input ref="file" name="file" type="file" 
class="file-update" @change="_onChange">
                   <el-button size="mini">{{$t('Upload')}}<em 
class="el-icon-upload"></em></el-button>
                 </template>
                 <div class="progress-box" v-if="progress !== 0">
@@ -214,7 +214,7 @@
         this.progress = 0
         this.file = ''
         this.currentDir = localStore.getItem('currentDir')
-        this.pid = -1
+        this.pid = this.id
         this.dragOver = false
       },
       /**
@@ -226,17 +226,16 @@
         this.name = file.name
         this.dragOver = false
       },
+      _onChange () {
+        let file = this.$refs.file.files[0]
+        this.file = file
+        this.name = file.name
+        this.$refs.file.value = null
+      },
       close () {
         this.$emit('closeResourceChildUpdate')
       }
     },
-    mounted () {
-      $('#file').change(() => {
-        let file = $('#file')[0].files[0]
-        this.file = file
-        this.name = file.name
-      })
-    },
     components: { mPopup, mListBoxF, mProgressBar }
   }
 </script>
diff --git 
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue 
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
index b4e6dfd..4adc7a8 100644
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
@@ -29,7 +29,7 @@
                     :placeholder="$t('Please enter name')">
             </el-input>
             <div class="p1" style="position: absolute;">
-              <input name="file" id="file" type="file" class="file-update" 
v-if="!progress">
+              <input ref="file" name="file" type="file" class="file-update" 
@change="_onChange" v-if="!progress">
               <el-button type="dashed" size="small" :disabled="progress !== 
0">{{$t('Upload')}}<em class="el-icon-upload"></em></el-button>
             </div>
           </div>
@@ -159,26 +159,14 @@
         this.spinnerLoading = false
         this.pid = null
         this.currentDir = ''
-      }
-    },
-    watch: {},
-    created () {
-    },
-    mounted () {
-      $('#file').change(() => {
-        let file = $('#file')[0].files[0]
+      },
+      _onChange () {
+        let file = this.$refs.file.files[0]
         this.file = file
         this.udfName = file.name
-      })
-    },
-    updated () {
-    },
-    beforeDestroy () {
-    },
-    destroyed () {
-    },
-    computed: {},
-    components: {}
+        this.$refs.file.value = null
+      }
+    }
   }
 </script>
 
diff --git a/dolphinscheduler-ui/src/js/module/components/nav/nav.vue 
b/dolphinscheduler-ui/src/js/module/components/nav/nav.vue
index 0d7c2b2..68ff673 100644
--- a/dolphinscheduler-ui/src/js/module/components/nav/nav.vue
+++ b/dolphinscheduler-ui/src/js/module/components/nav/nav.vue
@@ -283,7 +283,7 @@
           this._toggleArchive()
           return
         }
-        this.type = true
+        this.type = type
         this.id = data
         this.fileChildUpdateDialog = true
       },

Reply via email to