소스 검색

库存导入

chenrui 3 년 전
부모
커밋
01fbc17606
2개의 변경된 파일43개의 추가작업 그리고 31개의 파일을 삭제
  1. 10 0
      src/api/stockImport.js
  2. 33 31
      src/views/inventoryManagement/inventoryImport/list.vue

+ 10 - 0
src/api/stockImport.js

@@ -27,6 +27,7 @@ export const stockImportFinish = (params) => {
     method: 'post'
   })
 }
+//  散件导入  错误导出
 export const stockImportExportError = (params) => {
   return axios({
     url: '/stockImport/exportForSpareParts',
@@ -35,3 +36,12 @@ export const stockImportExportError = (params) => {
     responseType: 'blob'
   })
 }
+//  库存导入  错误导出
+export const stockImportKCExportError = (params) => {
+  return axios({
+    url: '/stockImport/exportForStock',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 33 - 31
src/views/inventoryManagement/inventoryImport/list.vue

@@ -1,9 +1,9 @@
 <template>
-  <a-card size="small" :bordered="false" class="inventoryImportList-wrap">
+  <a-card size="small" :bordered="false" class="bulkImportList-wrap">
     <a-spin :spinning="spinning" tip="Loading...">
       <div ref="tableSearch" class="table-page-search-wrapper">
         <Upload
-          id="inventoryImportList-attachList"
+          id="bulkImportList-attachList"
           ref="importUpload"
           :maxNums="1"
           fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@@ -12,7 +12,9 @@
           :uploadParams="uploadParams"
           upText="选择导入文件"
           @change="changeImport"></Upload>
-        <a-button style="margin-left: 5px" @click="handleExport" id="inventoryImportList-download">下载模板</a-button>
+        <a :href="filePath" style="margin: 5px 0 0 15px;display: block;float: left;">
+          <a-icon type="download" style="padding-right: 5px;" />下载导入模板
+        </a>
       </div>
       <div class="importGuide-con">
         <div class="explain-con">
@@ -37,7 +39,7 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
-        :scroll="{ x: 1630, y: tableHeight }"
+        :scroll="{ x: 1680, y: tableHeight }"
         :defaultLoadData="false"
         bordered>
       </s-table>
@@ -67,7 +69,7 @@
 
 <script>
 import { STable, Upload } from '@/components'
-import { stockImportList, stockImportFinish, stockImportCancel } from '@/api/stockImport'
+import { stockImportList, stockImportFinish, stockImportCancel, stockImportKCExportError } from '@/api/stockImport'
 export default {
   components: { STable, Upload },
   data () {
@@ -92,7 +94,7 @@ export default {
         { title: '入库数量', dataIndex: 'putQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '成本价', dataIndex: 'cost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '售价', dataIndex: 'terminalPrice', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '错误原因', dataIndex: 'errorMsg', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '错误原因', dataIndex: 'errorMsg', width: 150, align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -111,7 +113,8 @@ export default {
       uploadParams: {
         savePathType: 'local'
       },
-      uploadData: null
+      uploadData: null,
+      filePath: 'http://jg-ocs.oss-cn-beijing.aliyuncs.com/templ/promo/normal_product_templ.xlsx'
     }
   },
   methods: {
@@ -170,28 +173,28 @@ export default {
         }
       })
     },
-    // 导出错误项
-    handleExportError () {},
     // 下载模板
-    handleExport () {
-      // const _this = this
-      // _this.spinning = true
-      // allocateBillDownload({}).then(res => {
-      //   _this.spinning = false
-      //   if (res.type == 'application/json') {
-      //     var reader = new FileReader()
-      //     reader.addEventListener('loadend', function () {
-      //       const obj = JSON.parse(reader.result)
-      //       _this.$notification.error({
-      //         message: '提示',
-      //         description: obj.message
-      //       })
-      //     })
-      //     reader.readAsText(res)
-      //   } else {
-      //     this.download(res)
-      //   }
-      // })
+    handleExport () {},
+    // 导出错误项
+    handleExportError () {
+      const _this = this
+      _this.spinning = true
+      stockImportKCExportError({ stockImportSn: _this.uploadData && _this.uploadData.stockImportSn }).then(res => {
+        _this.spinning = false
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.download(res)
+        }
+      })
     },
     download (data) {
       if (!data) { return }
@@ -229,7 +232,7 @@ export default {
 }
 </script>
 <style lang="less">
-  .inventoryImportList-wrap{
+  .bulkImportList-wrap{
     .table-page-search-wrapper{
       overflow: hidden;
       .upload-file{
@@ -279,8 +282,7 @@ export default {
       }
     }
     .redBg-row{
-      background-color: red;
-      color: #fff;
+      background-color: #F39494;
     }
     .btn-con{
       text-align: center;