Przeglądaj źródła

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-wms into dev

wsx 9 miesięcy temu
rodzic
commit
0a67c34ddd

+ 17 - 1
src/api/system/file/index.js

@@ -105,4 +105,20 @@ export async function downLoadTemplateNew(url,fileName) {
   console.log(res.data,'***********');
   download(res.data, fileName);
 
-}
+}
+
+/**
+ * 导出
+ */
+export async function exportTable(data) {
+  const res = await request.post(
+    data.api,
+    data.data,
+    {
+      responseType: 'blob'
+    }
+  );
+  console.log(res.data, '***********');
+  download(res.data, data.fileName+'.xlsx');
+
+}

+ 41 - 0
src/components/upload/exportButton.vue

@@ -0,0 +1,41 @@
+<template>
+  <el-button
+    type="primary"
+    size="small"
+    icon="el-icon-download"
+    @click="exportFn"
+    >导出</el-button
+  >
+</template>
+
+<script>
+  import { exportTable } from '@/api/system/file/index.js';
+  export default {
+    props: {
+      apiUrl: '',
+      fileName: '',
+      params: {
+        default: () => {
+          return {};
+        }
+      }
+    },
+    //注册组件
+    data() {
+      return {};
+    },
+
+    created() {},
+    methods: {
+      exportFn() {
+        exportTable({
+          api: this.apiUrl,
+          fileName: this.fileName,
+          data:this.params
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>

+ 29 - 17
src/views/warehouseManagement/stockLedger/components/item-list.vue

@@ -23,18 +23,18 @@
     >
       <!-- 表头工具栏 -->
       <template v-slot:toolbar="{ row }">
-        <el-button
-          v-if="selectedDime == 3"
-          size="small"
-          :disabled="checkRadioData.length == 0"
-          icon="el-icon-set-up"
-          class="ele-btn-icon"
-          @click="allPrinting()"
-        >
-          打印条码
-        </el-button>
-
         <div class="upload">
+          <el-button
+            v-if="selectedDime == 3"
+            size="small"
+            :disabled="checkRadioData.length == 0"
+            icon="el-icon-set-up"
+            class="ele-btn-icon"
+            @click="allPrinting()"
+          >
+            打印条码
+          </el-button>
+
           <!-- <el-upload
             v-if="!isLoading"
             :show-file-list="false"
@@ -54,6 +54,7 @@
               >
             </slot>
           </el-upload> -->
+
           <el-button
             type="primary"
             size="small"
@@ -62,6 +63,12 @@
             @click="uploadFile"
             >导入</el-button
           >
+          <exportButton
+            fileName="库存台账"
+            apiUrl="/wms/statement/exportStockExcel"
+            :params="params"
+            v-if="selectedDime == 2"
+          ></exportButton>
         </div>
 
         <!-- <el-button
@@ -237,10 +244,11 @@
 
   import { qualityStatus, qualityResults } from '@/utils/dict/index';
   import { parameterGetByCode } from '@/api/sys/index.js';
+  import exportButton from '@/components/upload/exportButton.vue';
 
   export default {
     mixins: [tabMixins],
-    components: { ItemSearch, print, allot, importDialog },
+    components: { ItemSearch, print, allot, importDialog, exportButton },
     props: {
       // 机构id
       organizationId: [Number, String],
@@ -257,6 +265,7 @@
     },
     data() {
       return {
+        params: {},
         moudleName: 'stock',
         qualityStatus,
         qualityResults,
@@ -678,11 +687,13 @@
             ...where,
             ...order
           };
-          const data = storageApi.getBatchList({
-            ...params,
+          this.params = {
+               ...params,
             pageNum: page,
             size: limit
-          });
+          };
+          console.log('this.params----', this.params);
+          const data = storageApi.getBatchList(  this.params );
           return data;
         } else if (dimension == 4) {
           // 物料维度
@@ -721,6 +732,7 @@
               ...order
             };
           }
+
           const data = storageApi.getPackingList({
             ...params,
             pageNum: page,
@@ -841,8 +853,8 @@
 
 <style lang="scss" scoped>
   .upload {
-    display: inline-block;
-    width: 100px;
+    display: flex;
+    width: 100%;
     margin-left: 10px;
   }
 </style>