lilei 2 years ago
parent
commit
57be95af58

BIN
public/templ/散件退货产品导入模板.xlsx


+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1679974248358
+  "version": 1681438104921
 }

+ 37 - 37
src/config/router.config.js

@@ -662,43 +662,43 @@ export const asyncRouterMap = [
               }
             ]
           },
-          {
-            path: '/numsGoodsShelves/recallStockManagement',
-            redirect: '/numsGoodsShelves/recallStockManagement/list',
-            name: 'recallStockManagement',
-            component: BlankLayout,
-            meta: {
-              title: '调回入库',
-              icon: 'monitor',
-              permission: 'M_recallStockManagement'
-            },
-            hideChildrenInMenu: true,
-            children: [
-              {
-                path: 'list',
-                name: 'recallStockManagementList',
-                component: () => import(/* webpackChunkName: "numsGoodsShelves" */ '@/views/numsGoodsShelves/recallStockManagement/list.vue'),
-                meta: {
-                  title: '调回入库列表',
-                  icon: 'monitor',
-                  hidden: true
-                  // permission: 'M_salesQueryList'
-                }
-              },
-              {
-                path: 'editStock/:stockPutSn',
-                name: 'editStock',
-                component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/numsGoodsShelves/recallStockManagement/editStock.vue'),
-                meta: {
-                  title: '编辑入库',
-                  icon: 'monitor',
-                  hidden: true,
-                  replaceTab: true
-                  // permission: 'M_salesQueryList'
-                }
-              }
-            ]
-          },
+          // {
+          //   path: '/numsGoodsShelves/recallStockManagement',
+          //   redirect: '/numsGoodsShelves/recallStockManagement/list',
+          //   name: 'recallStockManagement',
+          //   component: BlankLayout,
+          //   meta: {
+          //     title: '调回入库',
+          //     icon: 'monitor',
+          //     permission: 'M_recallStockManagement'
+          //   },
+          //   hideChildrenInMenu: true,
+          //   children: [
+          //     {
+          //       path: 'list',
+          //       name: 'recallStockManagementList',
+          //       component: () => import(/* webpackChunkName: "numsGoodsShelves" */ '@/views/numsGoodsShelves/recallStockManagement/list.vue'),
+          //       meta: {
+          //         title: '调回入库列表',
+          //         icon: 'monitor',
+          //         hidden: true
+          //         // permission: 'M_salesQueryList'
+          //       }
+          //     },
+          //     {
+          //       path: 'editStock/:stockPutSn',
+          //       name: 'editStock',
+          //       component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/numsGoodsShelves/recallStockManagement/editStock.vue'),
+          //       meta: {
+          //         title: '编辑入库',
+          //         icon: 'monitor',
+          //         hidden: true,
+          //         replaceTab: true
+          //         // permission: 'M_salesQueryList'
+          //       }
+          //     }
+          //   ]
+          // },
           {
             path: '/numsGoodsShelves/customerAnalysis',
             redirect: '/numsGoodsShelves/customerAnalysis/list',

+ 202 - 0
src/views/bulkManagement/bulkReturnGoods/chooseImportModal.vue

@@ -0,0 +1,202 @@
+<template>
+  <a-modal
+    centered
+    class="chooseImport-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="确认导入"
+    v-model="isShow"
+    @cancel="isShow=false"
+    width="80%">
+    <div class="chooseImport-con">
+      <!-- 可导入数据 -->
+      <p class="">可导入数据{{ loadData.length }}条</p>
+      <a-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.allocateSn"
+        :columns="nowColumns"
+        :dataSource="loadData"
+        :loading="loading"
+        :scroll="{ y: 200 }"
+        :pagination="false"
+        bordered>
+      </a-table>
+      <a-divider />
+      <!-- 不可导入数据 -->
+      <p class="red">不可导入数据{{ unLoadData.length }}条</p>
+      <a-table
+        class="unTable"
+        ref="unTable"
+        size="small"
+        :rowKey="(record) => record.errorDesc"
+        :columns="nowUnColumns"
+        :dataSource="unLoadData"
+        :loading="loading"
+        :scroll="{ y: 200 }"
+        :pagination="false"
+        bordered>
+        <template slot="errorMsg" slot-scope="text,record">
+          <a-popover placement="topRight">
+            <template slot="content">
+              <p v-for="d in record.importErrorMsgSet">{{ d }}</p>
+            </template>
+            <a-button type="link">
+              查看
+            </a-button>
+          </a-popover>
+        </template>
+      </a-table>
+      <!-- 按钮 -->
+      <div class="btn-con">
+        <a-button
+          type="primary"
+          id="chooseImport-submit"
+          size="large"
+          :class="loadData.length==0?'button-grey':'button-primary'"
+          @click="handleSubmit"
+          style="padding: 0 40px;">确认导入</a-button>
+        <a-button
+          id="chooseImport-cancel"
+          size="large"
+          class="button-cancel"
+          @click="isShow=false"
+          style="padding: 0 40px;margin-left: 15px;">取消</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-error"
+          size="large"
+          class="button-error"
+          @click="handleError"
+          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { salesDetailFailExcel } from '@/api/salesDetail'
+export default {
+  name: 'ChooseImportModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    paramsData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    const _this = this
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      nowColumns: [
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库', dataIndex: 'warehouseName', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '售价', dataIndex: 'importPrice', width: '14%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '数量', dataIndex: 'importQty', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'importProductUnit', align: 'center', width: '15%', customRender: function (text) { return text || '--' } }
+      ],
+      loadData: [],
+      nowUnColumns: [
+        { title: '序号', dataIndex: 'no', width: '9%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '售价', dataIndex: 'importPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '数量', dataIndex: 'importQty', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '错误说明', scopedSlots: { customRender: 'errorMsg' }, width: '10%', align: 'center' }
+      ],
+      unLoadData: [],
+      loading: false
+    }
+  },
+  methods: {
+    getData () {
+      const paramsData = JSON.parse(JSON.stringify(this.paramsData))
+      this.loadData = paramsData.rightList || []
+      this.unLoadData = paramsData.errorList || []
+      this.loadData.map((item, index) => {
+        item.no = index + 1
+        item.salesBillNo = paramsData.salesBillNo
+        item.salesBillSn = paramsData.salesBillSn
+      })
+      this.unLoadData.map((item, index) => {
+        item.no = index + 1
+        item.salesBillNo = paramsData.salesBillNo
+        item.salesBillSn = paramsData.salesBillSn
+      })
+    },
+    // 确认导入
+    handleSubmit () {
+      if (this.paramsData.rightList.length == 0) {
+        this.$message.warning('无可导入的产品!')
+      } else {
+        const data = this.paramsData.rightList
+        data.map(item => {
+          item.salesBillNo = this.paramsData.salesBillNo
+          item.salesBillSn = this.paramsData.salesBillSn
+        })
+        this.$emit('ok', data)
+        this.isShow = false
+      }
+    },
+    // 导出
+    handleError () {
+      const _this = this
+      if (_this.paramsData.errorList.length < 1) {
+        _this.$message.info('暂无可导出错误项~')
+        return
+      }
+      _this.spinning = true
+      hdExportExcel(salesDetailFailExcel, _this.paramsData.errorList, '销售产品导出错误项', function () {
+        _this.spinning = false
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.loadData = []
+        this.unLoadData = []
+      } else {
+        this.getData()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .chooseImport-modal{
+    .chooseImport-con{
+      .red{
+        color: #f30;
+      }
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel,.button-error{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 21 - 1
src/views/bulkManagement/bulkReturnGoods/edit.vue

@@ -137,10 +137,16 @@
             </div>
           </a-col>
           <a-col :span="7" style="text-align: right;">
+            <a-button
+              type="default"
+              @click="openGuideModal=true"
+              style="margin-right:5px;"
+              id="bulkReturnGoodsEdit-import">产品导入</a-button>
             <a-button
               class="button-error"
               type="primary"
               @click="bulkReturnGoodsDelAll"
+              id="bulkReturnGoodsEdit-clear"
               :loading="delLoading"
               ghost>清空列表 </a-button>
           </a-col>
@@ -188,6 +194,8 @@
           </template>
         </s-table>
       </a-card>
+      <!-- 导入产品 -->
+      <importGuideModal :openModal="openGuideModal" :params="{sparePartsReturnSn: $route.params.sn}" @close="openGuideModal=false" @ok="hanldeImprotOk" />
     </a-spin>
     <div class="affix-cont">
       <a-button
@@ -207,6 +215,7 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import Print from '@/views/common/print.vue'
 import { hdPrint } from '@/libs/JGPrint'
+import importGuideModal from './importGuideModal.vue'
 import { warehouseAllList } from '@/api/warehouse'
 import {
   sparePartsRetDetailList,
@@ -220,12 +229,13 @@ import {
   sparePartsRetDetailClear } from '@/api/sparePartsRet'
 export default {
   name: 'BulkReturnGoodsEdit',
-  components: { STable, VSelect, Print },
+  components: { STable, VSelect, Print, importGuideModal },
   mixins: [commonMixin],
   data () {
     const _this = this
     return {
       spinning: false,
+      openGuideModal: false,
       queryParam: {
         productCode: '',
         productName: '',
@@ -316,6 +326,16 @@ export default {
         _this.spinning = false
       })
     },
+    // 确认导入明细
+    hanldeImprotOk (obj) {
+      this.spinning = true
+      salesDetailInsertImport(obj).then(res => {
+        if (res.status == 200) {
+          this.chooseResetSearchForm()
+        }
+        this.spinning = false
+      })
+    },
     // 合计
     getDetailCount (params) {
       sparePartsRetDetailCount(params).then(res => {

+ 4 - 3
src/views/bulkManagement/bulkReturnGoods/grabEdit.vue

@@ -218,9 +218,10 @@ export default {
       dataSource: [],
       // 表头
       columns: [
-        { title: '散件入库单号', dataIndex: 'sparePartsPurchaseNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'productCode', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '散件入库单号', dataIndex: 'sparePartsPurchaseNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入库时间', dataIndex: 'createDate', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '入库价格', dataIndex: 'putCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
         { title: '入库数量', dataIndex: 'putQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '已退数量', dataIndex: 'returnQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 196 - 0
src/views/bulkManagement/bulkReturnGoods/importGuideModal.vue

@@ -0,0 +1,196 @@
+<template>
+  <a-modal
+    centered
+    class="importGuide-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="导入产品"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="800">
+    <div class="importGuide-con">
+      <div class="explain-con">
+        <div class="explain-item">
+          <div class="explain-tit">
+            <span>1</span>准备导入
+          </div>
+          <ul>
+            <li>1) 导入的Excel文件中必须包含名为“产品编码”、“仓库”、“仓位”、“售价”、“数量”的列,且名称必须相同,其它列可自定义,不影响数据导入</li>
+            <li>2) 如果导入的产品已经存在,则不会导入该行</li>
+            <li>
+              <a :href="filePath" style="margin: 5px 0 0;display: block;">
+                <a-icon type="download" style="padding-right: 5px;" />下载导入模板
+              </a>
+            </li>
+          </ul>
+        </div>
+        <div class="explain-item">
+          <div class="explain-tit">
+            <span>2</span>上传数据文件
+          </div>
+          <p>目前支持的文件类型*.xls,*.xlsx.</p>
+          <div style="overflow: hidden;padding-left: 23px;">
+            <Upload
+              id="importGuide-attachList"
+              ref="importUpload"
+              :maxNums="1"
+              fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+              uploadType="attach"
+              :action="attachAction"
+              :uploadParams="uploadParams"
+              upText="选择导入文件"
+              @remove="resetSearchForm"
+              @change="changeImport"></Upload>
+          </div>
+        </div>
+      </div>
+      <!-- 按钮 -->
+      <div class="btn-con">
+        <a-button
+          type="primary"
+          id="importGuide-nextStep"
+          size="large"
+          class="button-primary"
+          @click="handlerNextStep"
+          style="padding: 0 60px;">下一步</a-button>
+        <a-button
+          id="importGuide-cancel"
+          size="large"
+          class="button-cancel"
+          @click="isShow=false"
+          style="padding: 0 60px;margin-left: 15px;">取消</a-button>
+      </div>
+    </div>
+    <!-- 导入 -->
+    <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
+  </a-modal>
+</template>
+
+<script>
+import ChooseImportModal from './chooseImportModal.vue'
+import { Upload } from '@/components'
+export default {
+  name: 'ImportGuideModal',
+  components: { ChooseImportModal, Upload },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    params: {
+      type: Object,
+      default: null
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      openImportModal: false, //  导入
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/salesDetail/importDetail',
+      paramsData: null,
+      uploadParams: {
+        savePathType: 'local',
+        salesBillSn: this.params.salesBillSn
+      },
+      filePath: location.protocol + '//' +location.host + '/templ/散件退货产品导入模板.xlsx'
+    }
+  },
+  methods: {
+    // 清空数据
+    resetSearchForm () {
+      this.$refs.importUpload.setFileList() //  清空导入文件
+      this.paramsData = null //  清空上传数据
+    },
+    // 下一步
+    handlerNextStep () {
+      if (this.paramsData) {
+        this.openImportModal = true
+      } else {
+        this.$message.warning('添加文件后再进行下一步操作!')
+      }
+    },
+    // 上传文件  change
+    changeImport (file) {
+      // console.log(file, JSON.parse(file))
+      if (file && JSON.parse(file).length > 0) {
+        this.paramsData = Object.assign({}, JSON.parse(file)[0] || null, this.params)
+      } else {
+        this.paramsData = null
+      }
+    },
+    // 导入
+    hanldeOk (obj) {
+      if (obj && obj.length > 0) {
+        this.$emit('ok', obj)
+        this.isShow = false
+      }
+    },
+    // 关闭
+    handleClose () {
+      this.openImportModal = false
+      this.isShow = false
+    },
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.resetSearchForm()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .importGuide-modal{
+    .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;
+            }
+          }
+        }
+        #importGuide-attachList{
+          width: 100%;
+        }
+      }
+      .btn-con{
+        margin: 10px 0 20px;
+        text-align: center;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>