Parcourir la source

提交入库管理导入功能

caojunjie il y a 2 ans
Parent
commit
e7791111c2
1 fichiers modifiés avec 52 ajouts et 3 suppressions
  1. 52 3
      src/views/purchasingManagement/inStock/detailsPage.vue

+ 52 - 3
src/views/purchasingManagement/inStock/detailsPage.vue

@@ -51,10 +51,9 @@
             <el-button type="primary" icon="el-icon-plus" size="small" :disabled="detailData.status == 1"
               @click.stop="addRow">录入明细
             </el-button>
-            <el-button type="success" icon="el-icon-bottom" size="small" @click.stop="getTemplate">下载模板
-            </el-button>
+<!--            <el-button type="success" icon="el-icon-bottom" size="small" @click.stop="getTemplate">下载模板</el-button>-->
             <el-button type="info" icon="el-icon-top" size="small" :disabled="detailData.status == 1"
-              @click.stop="addRow">导入
+              @click.stop="excelBox = true">导入
             </el-button>
           </template>
           <template slot="oneCode" slot-scope="{ row, index }">
@@ -92,6 +91,22 @@
         </check-schedule>
       </el-dialog>
     </div>
+    <el-dialog title="导入"
+               append-to-body
+               :close-on-click-modal="false"
+               :visible.sync="excelBox"
+               width="555px">
+      <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
+        <template slot="excelTemplate">
+          <el-button type="primary" @click="getTemplate">
+            点击下载<i class="el-icon-download el-icon--right"></i>
+          </el-button>
+        </template>
+      </avue-form>
+      <p style="text-align: center;color: #DC0505">
+        温馨提示 第一次导入时请先下载模板
+      </p>
+    </el-dialog>
   </div>
 </template>
 
@@ -107,6 +122,32 @@ export default {
   data() {
     return {
       form: {},
+      excelBox:false,
+      excelOption: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+            label: '模板下载',
+            prop: 'excelTemplate',
+            formslot: true,
+            span: 24,
+          },{
+            label: '模板上传',
+            prop: 'excelFile',
+            type: 'upload',
+            drag: true,
+            loadText: '模板上传中,请稍等',
+            span: 24,
+            propsHttp: {
+              res: 'data'
+            },
+            tip: '请上传 .xls,.xlsx 标准格式文件',
+            action: "/api/trade-purchase/woodHarvestingCloud/import"
+          }
+        ]
+      },
+      excelForm:{},
       checkScheduleDialog: false,
       tableOption: {},
       option: {
@@ -418,6 +459,14 @@ export default {
     getTemplate() {
       window.open(`/api/trade-purchase/woodHarvestingCloud/export-template?${this.website.tokenHeader}=${getToken()}`)
     },
+    uploadAfter(res, done, loading, column) {
+      res.forEach(item => this.itemsVOList.push({
+        ...item,
+        $cellEdit: true
+      }))
+      this.excelBox = false
+      done();
+    },
     //返回列表
     backToList() {
       this.$emit("goBack");