浏览代码

新增导入模板下载

002390 2 年之前
父节点
当前提交
6db48ac36a
共有 2 个文件被更改,包括 17 次插入6 次删除
  1. 1 0
      src/api/material/basic.js
  2. 16 6
      src/views/material/basicFile/index.vue

+ 1 - 0
src/api/material/basic.js

@@ -337,6 +337,7 @@ const fileImport = (data) => {
   })
 }
 
+
 /**
  * 删除接口
  */

+ 16 - 6
src/views/material/basicFile/index.vue

@@ -26,7 +26,7 @@
               <el-dropdown-item :command="filterCondition('stop')">显示停用</el-dropdown-item>
               <el-dropdown-item :command="filterCondition('allot')">显示已分配</el-dropdown-item>
             </el-dropdown-menu>
-                          </el-dropdown> -->
+                                              </el-dropdown> -->
 
           <!-- <el-button size="small" @click="handleQuery">查询</el-button> -->
           <el-button size="small" @click="handleRefresh">刷新</el-button>
@@ -45,14 +45,14 @@
             </el-dropdown-menu>
           </el-dropdown>
         </el-button-group>
-                      </el-col> -->
+                                          </el-col> -->
 
       <!-- 申请单查询 -->
     <!-- <el-col :span="1.5">
         <el-button-group>
           <el-button size="small" @click="handleQueryForm">申请单查询</el-button>
         </el-button-group>
-                      </el-col> -->
+                                          </el-col> -->
 
       <!-- 导入导出 -->
       <el-col :span="1.5">
@@ -99,16 +99,17 @@
     </el-card>
 
     <!-- 导入弹窗 -->
-    <el-dialog title="批量导入" :visible.sync="importData.show" width="50%" center @before-close="handlefileDialogColse">
+    <el-dialog title="批量导入" :visible.sync="importData.show" width="30%" center @before-close="handlefileDialogColse">
       <div class="mb-import">
 
+
         <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 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>
       </div>
       <span slot="footer">
         <el-button @click="handleImportData('cancal')">取 消</el-button>
@@ -318,6 +319,11 @@ export default {
       }
       this.download('/system/material/export', params, `物料基本信息${new Date().getTime()}.xlsx`)
     },
+    // 下载模板
+    handleDownTemplate() {
+      console.log('下载模板');
+      this.download('/system/material/download', {}, `物料基本信息模板.xlsx`)
+    },
 
 
     // 操作弹窗显隐
@@ -433,7 +439,11 @@ export default {
 }
 
 .mb-import {
+  padding: 0 20%;
   text-align: center;
+  display: flex;
+  align-items: flex-start;
+  justify-content: space-around;
 }
 </style>
 <style scoped>