ソースを参照

修改导入弹窗布局,增加导入之后成功或失败提示

002390 2 年 前
コミット
cfe17cf17d
1 ファイル変更18 行追加4 行削除
  1. 18 4
      src/views/material/basicFile/index.vue

+ 18 - 4
src/views/material/basicFile/index.vue

@@ -131,13 +131,20 @@
     <el-dialog title="批量导入" :visible.sync="importData.show" width="35%" center @before-close="handlefileDialogColse">
       <div class="mb-import">
 
-        <el-upload class="upload-demo" accept=".xls, .xlsx" ref="upload" action="#" :on-remove="handleFileRemove"
+        <!-- <el-upload class="upload-demo" accept=".xls, .xlsx" ref="upload" action="#" :on-remove="handleFileRemove"
           :file-list="importData.list" :auto-upload="false" :on-change="handleChangeFile" :limit="1">
           <el-button slot="trigger" type="primary">选取文件</el-button>
-          <!-- <el-button style="margin-left: 10px;" size="small" type="success" @click="handleSubmitUpload">上传到服务器</el-button> -->
           <div slot="tip" class="el-upload__tip">只能上传Excel文件</div>
         </el-upload>
-        <el-button type="success" @click="handleDownTemplate">下载模板</el-button>
+        <el-button type="success" @click="handleDownTemplate">下载模板</el-button> -->
+
+
+        <el-upload class="upload-demo" accept=".xls, .xlsx" ref="upload" action="#" :on-remove="handleFileRemove"
+          :file-list="importData.list" :auto-upload="false" :on-change="handleChangeFile" :limit="1">
+          <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
+          <el-button style="margin-left: 10px;" size="small" type="success" @click="handleDownTemplate">下载模板</el-button>
+          <div slot="tip" class="el-upload__tip">只能上传Excel文件</div>
+        </el-upload>
 
       </div>
       <span slot="footer">
@@ -342,7 +349,14 @@ export default {
 
             formData.append('file', this.importData.list[0].raw);
             materialApi.fileImport(formData).then(res => {
-              if (res.code == 200) this.importData.show = false;
+              if (res.code == 200) {
+                this.importData.show = false;
+                this.importData.list = [];
+              }
+              this.$message({
+                message: res.msg,
+                type: res.code == 200 ? 'success' : 'warning'
+              });
             })
           } else {
             this.$message({