소스 검색

散件导入

chenrui 3 년 전
부모
커밋
e986fbceab

+ 37 - 0
src/api/stockImport.js

@@ -0,0 +1,37 @@
+import { axios } from '@/utils/request'
+
+//  库存/散件导入  列表  分页
+export const stockImportList = (params) => {
+  const url = `/stockImportDetail/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  散件导入  取消导入
+export const stockImportCancel = (params) => {
+  return axios({
+    url: `/stockImport/cancelImport`,
+    data: params,
+    method: 'post'
+  })
+}
+//  散件导入  确认导入
+export const stockImportFinish = (params) => {
+  return axios({
+    url: `/stockImport/finishImport`,
+    data: params,
+    method: 'post'
+  })
+}
+export const stockImportExportError = (params) => {
+  return axios({
+    url: '/stockImport/exportForSpareParts',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 91 - 35
src/components/UploadFile/index.vue

@@ -4,11 +4,12 @@
       :action="action"
       :listType="listType"
       :fileList="fileList"
+      :disabled="disabled"
       @preview="handlePreview"
       @change="handleChange"
       :beforeUpload="beforeUpload"
-      :preview-file="previewFile"
       :data="params"
+      :headers="headers"
       :value="comVal"
     >
       <div v-if="fileList.length < maxNums && listType=='picture-card'">
@@ -19,7 +20,7 @@
         <a-button> <a-icon type="upload" /> {{ upText }} </a-button>
       </div>
     </a-upload>
-    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
+    <a-modal :visible="previewVisible" :footer="null" centered :maskClosable="false" @cancel="handleCancel">
       <video v-if="fileType=='video/mp4'" controls="controls" style="width: 100%" :src="previewImage" />
       <img v-else alt="example" style="width: 100%" :src="previewImage" />
     </a-modal>
@@ -43,9 +44,7 @@ export default {
     },
     previewFile: {
       type: Function,
-      default: function () {
-
-      }
+      default: function () {}
     },
     action: {
       type: String,
@@ -57,7 +56,7 @@ export default {
     },
     upText: {
       type: String,
-      default: '上传'
+      default: ''
     },
     value: {
       type: String
@@ -66,14 +65,21 @@ export default {
       type: Object,
       default: function () {
         return {
-          savePathType: 'ali' // 存储类型 local 服务器本地,ali 阿里云
+          savePathType: 'ali' // 存储类型 local 服务器本地,ali 阿里云, web
         }
       }
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    },
+    uploadType: { //  上传类型  img图片;attach附件;import导入
+      type: String,
+      default: 'img'
     }
   },
   watch: {
     value (a, b) {
-      console.log(a, '=--====')
       this.comVal = a || ''
       if (a == undefined) {
         this.fileList = []
@@ -86,26 +92,47 @@ export default {
       previewImage: '',
       fileList: [],
       comVal: this.value,
-      params: this.uploadParams
+      params: this.uploadParams,
+      headers: {
+        'access-token': this.$store.getters.token
+      }
     }
   },
   methods: {
     setFileList (a) {
       const temp = []
       if (a && a.length > 0) {
-        a.split(',').map((item, index) => {
-          if (item) {
-            temp.push({
-              uid: index,
-              name: item,
-              status: 'done',
-              url: item,
-              response: {
-                data: item
-              }
-            })
-          }
-        })
+        if (this.uploadType == 'img' || this.uploadType == 'import') { // 图片/导入
+          a.split(',').map((item, index) => {
+            if (item) {
+              temp.push({
+                uid: index,
+                name: item,
+                status: 'done',
+                url: item,
+                response: {
+                  data: item
+                }
+              })
+            }
+          })
+        } else if (this.uploadType == 'attach') { // 附件
+          a.map((item, index) => {
+            if (item) {
+              const arr = []
+              arr.push(item) //  包裹成与新上传文件数据返回结构一致
+              temp.push({
+                uid: index,
+                name: item.fileName,
+                status: 'done',
+                url: item.filePath,
+                response: {
+                  data: arr
+                }
+              })
+            }
+          })
+        }
       }
       this.fileList = temp
     },
@@ -116,39 +143,54 @@ export default {
       if (this.listType == 'text') {
         return
       }
-      console.log(file, '8888888888')
       this.previewImage = file.url || file.thumbUrl
-      // this.previewImage = file.response.data
       this.previewVisible = true
     },
     handleChange ({ file, fileList }) {
-      if (file.status == 'error') {
+      // console.log(file, fileList, '-----change')
+      if (file.status == 'error' || (file.response && (file.response.status == 500))) {
         this.$message.error('上传失败,请重试!')
         return
       }
       this.fileList = this.validaFile(file, fileList)
       this.$emit('change', this.formatFile())
+      this.$emit('input', this.formatFile())
     },
     // 格式化文件列表数据,给表单
     formatFile () {
+      const _this = this
       const a = this.fileList
-      const temp = []
+      let temp = []
+      let obj = null
       if (a && a.length) {
-        a.map(item => {
-          if (item.response && item.status == 'done') {
-            temp.push(item.response.data)
-          }
-        })
+        if (this.uploadType == 'img' || this.uploadType == 'import') { // 图片/导入    将接口的返回图片地址逗号拼接后返回页面
+          a.map(item => {
+            if (item.response && item.status == 'done') {
+              temp.push(item.response.data)
+            }
+          })
+          obj = temp.join(',')
+        } else if (this.uploadType == 'attach') { // 附件    将接口的返回数据返回页面
+          a.map(item => {
+            if (item.response && item.status == 'done') {
+              if (_this.maxNums == 1) {
+                temp = [item.response.data]
+              } else {
+                temp = [...temp, ...item.response.data]
+              }
+            }
+          })
+          obj = JSON.stringify(temp)
+        }
       }
-      return temp.join(',')
+      return obj
     },
     // 文件校验
     validaFile (file, filesList) {
       if (filesList.length == 0) {
         return []
       }
-
-      console.log(file, filesList, this.beforeUpload(file, 0))
+      // console.log(file, filesList, this.beforeUpload(file, 0))
       if (!this.beforeUpload(file, 0) && file.status != 'removed') {
         const index = filesList.findIndex(item => item.uid == file.uid)
         filesList.splice(index, 1)
@@ -159,9 +201,16 @@ export default {
     beforeUpload (file, tip) {
       // 不限制
       if (this.fileType == '*') {
+        // 文件大小
+        const isLt2M = file.size / 1024 / 1024 < this.fileSize
+        if (!isLt2M) {
+          if (tip != 0) {
+            this.$message.error('上传文件不能超过 ' + this.fileSize + 'MB!')
+          }
+          return isLt2M
+        }
         return true
       }
-
       const isType = this.fileType.indexOf(file.type) >= 0 && file.type != ''
       if (!isType) {
         if (tip != 0) {
@@ -192,10 +241,12 @@ export default {
   .upload-file{
     float: left;
     overflow: hidden;
+    height: 80px;
     /* you can make up upload button and sample style by using stylesheets */
     .ant-upload-select-picture-card i {
       font-size: 32px;
       color: #999;
+      margin-top: 9px;
     }
     .ant-upload-select-picture-card .ant-upload-text {
       margin-top: 8px;
@@ -207,11 +258,16 @@ export default {
         padding: 4px 0;
       }
     }
+    .ant-upload-list-picture-card-container{
+      height: 80px;
+      width: 80px;
+    }
     .ant-upload.ant-upload-select-picture-card,
     .ant-upload-list-picture-card .ant-upload-list-item{
       width:80px;
       height:80px;
       padding: 4px;
+      margin: 0;
     }
     .ant-upload-list-item-info{
       padding: 0 22px 0 4px;

+ 50 - 0
src/config/router.config.js

@@ -1149,6 +1149,31 @@ export const asyncRouterMap = [
               }
             ]
           },
+          {
+            path: '/inventoryManagement/inventoryImport',
+            redirect: '/inventoryManagement/inventoryImport/list',
+            name: 'inventoryImport',
+            component: RouteView,
+            meta: {
+              title: '库存导入',
+              icon: 'frown'
+              // permission: 'M_bulkReturnGoodsList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'inventoryImportList',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/inventoryImport/list.vue'),
+                meta: {
+                  title: '库存导入列表',
+                  icon: 'frown',
+                  hidden: true
+                  // permission: 'M_bulkReturnGoodsList'
+                }
+              }
+            ]
+          },
           {
             path: '/inventoryManagement/warehouse',
             redirect: '/inventoryManagement/warehouse/list',
@@ -1302,6 +1327,31 @@ export const asyncRouterMap = [
                 }
               }
             ]
+          },
+          {
+            path: '/bulkManagement/bulkImport',
+            redirect: '/bulkManagement/bulkImport/list',
+            name: 'bulkImport',
+            component: RouteView,
+            meta: {
+              title: '散件导入',
+              icon: 'frown'
+              // permission: 'M_bulkReturnGoodsList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'bulkImportList',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/bulkManagement/bulkImport/list.vue'),
+                meta: {
+                  title: '散件导入列表',
+                  icon: 'frown',
+                  hidden: true
+                  // permission: 'M_bulkReturnGoodsList'
+                }
+              }
+            ]
           }
         ]
       },

+ 291 - 0
src/views/bulkManagement/bulkImport/list.vue

@@ -0,0 +1,291 @@
+<template>
+  <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="bulkImportList-attachList"
+          ref="importUpload"
+          :maxNums="1"
+          fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+          uploadType="attach"
+          :action="attachAction"
+          :uploadParams="uploadParams"
+          upText="选择导入文件"
+          @change="changeImport"></Upload>
+        <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">
+          <div class="explain-item">
+            <div class="explain-tit">导入文件说明</div>
+            <ul>
+              <li>1) 导入的EXCEL文件中必须包含名为"供应商"、"产品品牌"、"产品编码"、"原厂编码"、"产品名称"、"产品一级类别"、"产品二级类别"、"产品三级类别"、"仓库"、"仓位"、"入库数量"、"成本价"、"售价";列顺序可忽略、行顺序可忽略。其中"供应商"、"产品品牌"、"产品编码"、"产品名称"、"仓库"、"仓位"、"入库数量"、"成本价"、"售价"内容不能为空。</li>
+              <li>2) 红色底白字为错误项,对应错误原因列显示错误信息,存在错误项时不能导入,请取消修改后重新上传操作。</li>
+              <li>3) 上传成功显示产品列表后,第一次以后上传的文件名如果和第一次上传的文件名相同,将不再上传,采取第一次上传的文件,如要重新上传数据,请更改文件名称。</li>
+              <li>4) 供应商为必填项且不能包含箭牌供应商、产品品牌为必填项且不能包含箭牌品牌、产品名称为必填项。</li>
+            </ul>
+          </div>
+        </div>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        :style="{ height: tableHeight+84.5+'px' }"
+        size="small"
+        :rowClassName="(record, index) => record.isError==1 ? 'redBg-row':''"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ x: 1680, y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+      </s-table>
+      <div class="btn-con" v-if="uploadData && uploadData.stockImportSn">
+        <a-button
+          id="productInfoList-batchAudit"
+          type="primary"
+          class="button-warning"
+          @click="handleConfirm"
+          style="margin: 0 15px;">确认导入</a-button>
+        <a-button
+          id="productInfoList-batchLaunch"
+          type="primary"
+          class="button-primary"
+          @click="handleCancel"
+          style="margin: 0 15px;">取消导入</a-button>
+        <a-button
+          id="productInfoList-batchDownline"
+          type="primary"
+          class="button-grey"
+          @click="handleExportError"
+          style="margin: 0 15px;">导出错误项</a-button>
+      </div>
+    </a-spin>
+  </a-card>
+</template>
+
+<script>
+import { STable, Upload } from '@/components'
+import { stockImportList, stockImportFinish, stockImportCancel, stockImportExportError } from '@/api/stockImport'
+export default {
+  components: { STable, Upload },
+  data () {
+    return {
+      spinning: false,
+      exportLoading: false, // 导出loading
+      tableHeight: 0,
+      queryParam: {}, // 查询参数
+      // 表头
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 50, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品品牌', dataIndex: 'productBrandName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '供应商', dataIndex: 'supplierName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品一级分类', dataIndex: 'productTypeName1', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品二级分类', dataIndex: 'productTypeName2', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品三级分类', dataIndex: 'productTypeName3', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { 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: 150, align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.spinning = true
+        return stockImportList(Object.assign(parameter, { stockImportSn: this.uploadData && this.uploadData.stockImportSn })).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/stockImport/importForSpareParts',
+      uploadParams: {
+        savePathType: 'local'
+      },
+      uploadData: null,
+      filePath: 'http://jg-ocs.oss-cn-beijing.aliyuncs.com/templ/promo/normal_product_templ.xlsx'
+    }
+  },
+  methods: {
+    // 上传文件  change
+    changeImport (file) {
+      if (file && JSON.parse(file).length > 0) {
+        this.uploadData = JSON.parse(file)[0] || null
+        this.$refs.table.refresh(true)
+      } else {
+        this.uploadData = null
+      }
+    },
+    // 确认导入
+    handleConfirm () {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '您是否确认导入产品信息?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          stockImportFinish({ stockImportSn: _this.uploadData && _this.uploadData.stockImportSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.clearTable() //  清空列表数据
+              _this.$refs.importUpload.setFileList() //  清空导入文件
+              _this.uploadData = null //  清空上传数据
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 取消导入
+    handleCancel () {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '您确认取消导入产品的信息?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          stockImportCancel({ stockImportSn: _this.uploadData && _this.uploadData.stockImportSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.clearTable() //  清空列表数据
+              _this.$refs.importUpload.setFileList() //  清空导入文件
+              _this.uploadData = null //  清空上传数据
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 下载模板
+    handleExport () {},
+    // 导出错误项
+    handleExportError () {
+      const _this = this
+      _this.spinning = true
+      stockImportExportError({ 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 }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const fname = '散件导入模板'
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 400
+    }
+  },
+  mounted () {
+    const _this = this
+    this.$nextTick(() => { // 页面渲染完成后的回调
+      _this.setTableH()
+    })
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      setTimeout(() => {
+        _this.setTableH()
+      }, 400)
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+<style lang="less">
+  .bulkImportList-wrap{
+    .table-page-search-wrapper{
+      overflow: hidden;
+      .upload-file{
+        height: auto;
+        margin-bottom: 10px;
+        .ant-btn{
+          background-color: #f30;
+          border-color: #f30;
+          margin: 0 5px;
+          font-size: 12px;
+          color: #fff;
+        }
+      }
+    }
+    .importGuide-con{
+      .explain-con{
+        .explain-item{
+          margin-bottom: 10px;
+          .explain-tit{
+            font-weight: bold;
+            span{
+              display: inline-block;
+              width: 18px;
+              height: 18px;
+              line-height: 16px;
+              text-align: center;
+              margin-right: 5px;
+              border-radius: 50%;
+              border: 1px solid rgba(0, 0, 0, 0.3);
+            }
+          }
+          p{
+            margin: 8px 0;
+            padding-left: 23px;
+          }
+          ul{
+            list-style: none;
+            padding: 0;
+            padding-left: 23px;
+            margin: 0;
+            li{
+              line-height: 26px;
+              font-size: 12px;
+            }
+          }
+        }
+      }
+    }
+    .redBg-row{
+      background-color: #F39494;
+    }
+    .btn-con{
+      text-align: center;
+    }
+  }
+</style>

+ 289 - 0
src/views/inventoryManagement/inventoryImport/list.vue

@@ -0,0 +1,289 @@
+<template>
+  <a-card size="small" :bordered="false" class="inventoryImportList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <Upload
+          id="inventoryImportList-attachList"
+          ref="importUpload"
+          :maxNums="1"
+          fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+          uploadType="attach"
+          :action="attachAction"
+          :uploadParams="uploadParams"
+          upText="选择导入文件"
+          @change="changeImport"></Upload>
+        <a-button style="margin-left: 5px" @click="handleExport" id="inventoryImportList-download">下载模板</a-button>
+      </div>
+      <div class="importGuide-con">
+        <div class="explain-con">
+          <div class="explain-item">
+            <div class="explain-tit">导入文件说明</div>
+            <ul>
+              <li>1) 导入的EXCEL文件中必须包含名为"供应商"、"产品品牌"、"产品编码"、"原厂编码"、"产品名称"、"产品一级类别"、"产品二级类别"、"产品三级类别"、"仓库"、"仓位"、"入库数量"、"成本价"、"售价";列顺序可忽略、行顺序可忽略。其中"供应商"、"产品品牌"、"产品编码"、"产品名称"、"仓库"、"仓位"、"入库数量"、"成本价"、"售价"内容不能为空。</li>
+              <li>2) 红色底白字为错误项,对应错误原因列显示错误信息,存在错误项时不能导入,请取消修改后重新上传操作。</li>
+              <li>3) 上传成功显示产品列表后,第一次以后上传的文件名如果和第一次上传的文件名相同,将不再上传,采取第一次上传的文件,如要重新上传数据,请更改文件名称。</li>
+              <li>4) 供应商为必填项且不能包含箭牌供应商、产品品牌为必填项且不能包含箭牌品牌、产品名称为必填项。</li>
+            </ul>
+          </div>
+        </div>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        :style="{ height: tableHeight+84.5+'px' }"
+        size="small"
+        :rowClassName="(record, index) => record.isError==1 ? 'redBg-row':''"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ x: 1630, y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+      </s-table>
+      <div class="btn-con" v-if="uploadData && uploadData.stockImportSn">
+        <a-button
+          id="productInfoList-batchAudit"
+          type="primary"
+          class="button-warning"
+          @click="handleConfirm"
+          style="margin: 0 15px;">确认导入</a-button>
+        <a-button
+          id="productInfoList-batchLaunch"
+          type="primary"
+          class="button-primary"
+          @click="handleCancel"
+          style="margin: 0 15px;">取消导入</a-button>
+        <a-button
+          id="productInfoList-batchDownline"
+          type="primary"
+          class="button-grey"
+          @click="handleExportError"
+          style="margin: 0 15px;">导出错误项</a-button>
+      </div>
+    </a-spin>
+  </a-card>
+</template>
+
+<script>
+import { STable, Upload } from '@/components'
+import { stockImportList, stockImportFinish, stockImportCancel } from '@/api/stockImport'
+export default {
+  components: { STable, Upload },
+  data () {
+    return {
+      spinning: false,
+      exportLoading: false, // 导出loading
+      tableHeight: 0,
+      queryParam: {}, // 查询参数
+      // 表头
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 50, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品品牌', dataIndex: 'productBrandName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '供应商', dataIndex: 'supplierName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品一级分类', dataIndex: 'productTypeName1', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品二级分类', dataIndex: 'productTypeName2', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品三级分类', dataIndex: 'productTypeName3', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { 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 || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.spinning = true
+        return stockImportList(Object.assign(parameter, { stockImportSn: this.uploadData && this.uploadData.stockImportSn })).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/stockImport/importForStock',
+      uploadParams: {
+        savePathType: 'local'
+      },
+      uploadData: null
+    }
+  },
+  methods: {
+    // 上传文件  change
+    changeImport (file) {
+      if (file && JSON.parse(file).length > 0) {
+        this.uploadData = JSON.parse(file)[0] || null
+        this.$refs.table.refresh(true)
+      } else {
+        this.uploadData = null
+      }
+    },
+    // 确认导入
+    handleConfirm () {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '您是否确认导入产品信息?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          stockImportFinish({ stockImportSn: _this.uploadData && _this.uploadData.stockImportSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.clearTable() //  清空列表数据
+              _this.$refs.importUpload.setFileList() //  清空导入文件
+              _this.uploadData = null //  清空上传数据
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 取消导入
+    handleCancel () {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '您确认取消导入产品的信息?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          stockImportCancel({ stockImportSn: _this.uploadData && _this.uploadData.stockImportSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.clearTable() //  清空列表数据
+              _this.$refs.importUpload.setFileList() //  清空导入文件
+              _this.uploadData = null //  清空上传数据
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 导出错误项
+    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)
+      //   }
+      // })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const fname = '库存导入模板'
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 400
+    }
+  },
+  mounted () {
+    const _this = this
+    this.$nextTick(() => { // 页面渲染完成后的回调
+      _this.setTableH()
+    })
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      setTimeout(() => {
+        _this.setTableH()
+      }, 400)
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+<style lang="less">
+  .inventoryImportList-wrap{
+    .table-page-search-wrapper{
+      overflow: hidden;
+      .upload-file{
+        height: auto;
+        margin-bottom: 10px;
+        .ant-btn{
+          background-color: #f30;
+          border-color: #f30;
+          margin: 0 5px;
+          font-size: 12px;
+          color: #fff;
+        }
+      }
+    }
+    .importGuide-con{
+      .explain-con{
+        .explain-item{
+          margin-bottom: 10px;
+          .explain-tit{
+            font-weight: bold;
+            span{
+              display: inline-block;
+              width: 18px;
+              height: 18px;
+              line-height: 16px;
+              text-align: center;
+              margin-right: 5px;
+              border-radius: 50%;
+              border: 1px solid rgba(0, 0, 0, 0.3);
+            }
+          }
+          p{
+            margin: 8px 0;
+            padding-left: 23px;
+          }
+          ul{
+            list-style: none;
+            padding: 0;
+            padding-left: 23px;
+            margin: 0;
+            li{
+              line-height: 26px;
+              font-size: 12px;
+            }
+          }
+        }
+      }
+    }
+    .redBg-row{
+      background-color: red;
+      color: #fff;
+    }
+    .btn-con{
+      text-align: center;
+    }
+  }
+</style>