Prechádzať zdrojové kódy

关闭弹出 清除上传的文件

zhulu 2 rokov pred
rodič
commit
15916fd9f1

+ 6 - 1
src/components/K-FileUpload/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="upload-file">
-    <el-upload
+    <el-upload 
     multiple
     drag
     :action="uploadFileUrl"
@@ -281,6 +281,11 @@ export default {
         a.setAttribute("href", url);
         a.click();
       },
+      clearFiles(){
+        this.$refs["fileUpload"].clearFiles();
+        this.fileList = [];
+        this.fileValueList = [];        
+      },
   }
 };
 </script>

+ 2 - 1
src/views/core/drill/plan/index.vue

@@ -114,7 +114,7 @@
       </el-col>
     </el-row>
     <!-- 添加或修改教育培训计划对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="800px" height="800px" append-to-body>
+    <el-dialog :title="title" :visible.sync="open" :close="cancel" width="800px" height="800px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-row>
           <el-col :span="12">
@@ -408,6 +408,7 @@ export default {
     cancel() {
       this.open = false;
       this.reset();
+      this.$refs["upload"].clearFiles();
     },
     // 表单重置
     reset() {

+ 2 - 1
src/views/core/edu/plan/index.vue

@@ -135,7 +135,7 @@
       </el-col>
     </el-row>
     <!-- 添加或修改教育培训计划对话框 -->
-    <DialogCom :title="title" :visible.sync="open" width="800px" height="800px" append-to-body @close="clear">
+    <DialogCom :title="title" :visible.sync="open" :close="cancel" width="800px" height="800px" append-to-body @close="clear">
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-row>
           <el-col :span="12">
@@ -446,6 +446,7 @@ export default {
       this.open = false;
       this.reset();
       this.$refs['orgTreeSelect'].clear();
+      this.$refs["upload"].clearFiles();
     },
     // 表单重置
     reset() {

+ 1 - 1
src/views/core/edu/task/dialog.perform.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="edu-training-edit">
-    <DialogCom :title="'培训登记'" :visible.sync="isShow" width="960px">
+    <DialogCom :title="'培训登记'" :close="onHide" :visible.sync="isShow" width="960px">
       <div class="page-body">
         <el-form :model="formData" :rules="formDataRules" size="small" ref="form" label-position="right"
           label-width="120px" label-prefix=":">

+ 3 - 2
src/views/core/materials/index.vue

@@ -346,8 +346,9 @@ export default {
     cancel() {
       this.open = false;
       this.reset();
-      this.$refs["upload"].fileList = [];
-      this.$refs["upload"].fileValueList = [];
+      this.$refs["upload"].clearFiles();
+      // this.$refs["upload"].fileList = [];
+      // this.$refs["upload"].fileValueList = [];
     },
     // 表单重置
     reset() {