Jelajahi Sumber

Merge branch 'develop_yh12' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh12

chenrui 2 tahun lalu
induk
melakukan
0452c34610

+ 25 - 1
src/api/spareParts.js

@@ -24,11 +24,35 @@ export const sparePartsDetailExport = (params) => {
 // 审核
 export const sparePartsAudit = (params) => {
   return axios({
-    url: `/spareParts/audit`,
+    url: `/spareParts/audit/${params.sn}`,
+    method: 'get'
+  })
+}
+// 批量审核
+export const sparePartsBatchAudit = (params) => {
+  return axios({
+    url: `/spareParts/batchAudit`,
+    data: params,
+    method: 'post'
+  })
+}
+// 多审核校验
+export const sparePartsAuditVerify = (params) => {
+  return axios({
+    url: `/spareParts/auditVerify`,
     data: params,
     method: 'post'
   })
 }
+// 导出审核错误项
+export const sparePartsAuditFail = (params) => {
+  return axios({
+    url: `/spareParts/downloadAuditFail`,
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
 
 // 删除
 export const sparePartsDelete = (params) => {

+ 31 - 0
src/api/supplier.js

@@ -116,6 +116,14 @@ export const supplierProductDownload = params => {
     responseType: 'blob'
   })
 }
+// 供应商关联产品 下载模板
+export const supplierProductNewDownloadExcel = params => {
+  return axios.request({
+    url: `/supplierProduct/newDownloadExcel`,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
 // 设置成本导出明细
 export const supplierProductExportDetail = params => {
   return axios.request({
@@ -141,6 +149,14 @@ export const supplierProductParseProducts = params => {
     method: 'post'
   })
 }
+// 供应商关联产品  解析导入的文件
+export const supplierProductParseNewProducts = params => {
+  return axios({
+    url: '/supplierProduct/newParseProducts',
+    data: params,
+    method: 'post'
+  })
+}
 // 供应商关联产品  批量插入
 export const supplierProductBatchInsert = params => {
   return axios({
@@ -149,6 +165,13 @@ export const supplierProductBatchInsert = params => {
     method: 'post'
   })
 }
+export const supplierProductNewBatchInsert = params => {
+  return axios({
+    url: '/supplierProduct/newBatchInsert',
+    data: params,
+    method: 'post'
+  })
+}
 //  供应商关联产品 导入产品  导出错误项
 export const supplierProductailExcel = (params) => {
   return axios({
@@ -158,3 +181,11 @@ export const supplierProductailExcel = (params) => {
     responseType: 'blob'
   })
 }
+export const supplierProductailNewExcel = (params) => {
+  return axios({
+    url: '/supplierProduct/newDownloadFailExcel',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 96 - 0
src/views/purchasingManagement/bulkWarehousingOrder/auditNoPassModal.vue

@@ -0,0 +1,96 @@
+<template>
+  <a-modal
+    centered
+    class="bulkWarehousingOrder-auditNo-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="提示"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="960">
+    <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
+      <!-- 总计 -->
+      <a-alert style="margin-bottom:10px" type="error" message="对不起,审核失败! OCS和金蝶上产品成本不一致。请确保成本价格一致后再进行审核。" />
+      <!-- 列表 -->
+      <a-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :dataSource="list"
+        :scroll="{ y: 400 }"
+        :pagination="false"
+        bordered>
+      </a-table>
+    </a-card>
+    <div class="btn-cont">
+      <a-button id="bulkWarehousingOrder-auditNo-modal-back" @click="isShow = false" style="margin-left: 15px;">返回列表</a-button>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+export default {
+  name: 'auditNoPassModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      list: []
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '40%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+      ]
+      if (this.$hasPermissions('B_isShowCost')) { //  成本价权限
+        arr.splice(5, 0, { title: 'OCS成本价', dataIndex: 'verifyCost', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+        arr.splice(5, 0, { title: '金蝶成本价', dataIndex: 'productCost', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      }
+      return arr
+    }
+  },
+  methods: {
+    //  返回列表
+    handleBack () {
+      this.isShow = false
+    },
+    setData(data){
+      this.list = data
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    },
+  }
+}
+</script>
+
+<style lang="less">
+  .bulkWarehousingOrder-auditNo-modal{
+    .ant-modal-body {
+      padding: 10px 10px 20px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 5px 0 10px;
+    }
+  }
+</style>

+ 185 - 0
src/views/purchasingManagement/bulkWarehousingOrder/batchAuditNoModal.vue

@@ -0,0 +1,185 @@
+<template>
+  <a-modal
+    centered
+    class="batchAuditModal-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="批量审核"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="900">
+    <div class="batchAuditModal-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>
+      </a-table>
+      <!-- 按钮 -->
+      <div class="btn-con">
+        <a-button
+          type="primary"
+          id="batchAuditModal-submit"
+          size="large"
+          :loading="spinning"
+          :class="loadData.length==0?'button-grey':'button-primary'"
+          @click="handleSubmit"
+          style="padding: 0 40px;">确认审批</a-button>
+        <a-button
+          id="batchAuditModal-cancel"
+          size="large"
+          :loading="spinning"
+          class="button-cancel"
+          @click="isShow=false"
+          style="padding: 0 40px;margin-left: 15px;">取消</a-button>
+        <a-button
+          type="primary"
+          id="batchAuditModal-error"
+          size="large"
+          :loading="spinning"
+          class="button-error"
+          @click="handleError"
+          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { hdExportExcel } from '@/libs/exportExcel'
+import { sparePartsAuditVerify, sparePartsBatchAudit, sparePartsAuditFail } from '@/api/spareParts'
+export default {
+  name: 'batchAudtiModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      spinning: false,
+      nowColumns: [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入库单号', dataIndex: 'sparePartsNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入库类型', dataIndex: 'sparePartsTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '关联单号', dataIndex: 'relationNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '金蝶单号', dataIndex: 'kingdeeNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      loadData: [],
+      nowUnColumns: [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入库单号', dataIndex: 'sparePartsNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入库类型', dataIndex: 'sparePartsTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '关联单号', dataIndex: 'relationNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '金蝶单号', dataIndex: 'kingdeeNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      unLoadData: [],
+      loading: false,
+      snList: []
+    }
+  },
+  methods: {
+    getData (data) {
+      if (data.okList && data.okList.length > 0) {
+        data.okList.map((item, index) => {
+          item.no = index + 1
+          this.snList.push(item.sparePartsSn)
+        })
+      }
+      if (data.errList && data.errList.length > 0) {
+        data.errList.map((item, index) => {
+          item.no = index + 1
+        })
+      }
+      this.loadData = data.okList || []
+      this.unLoadData = data.errList || []
+    },
+    // 确认导入
+    handleSubmit () {
+      if (this.loadData.length == 0) {
+        this.$message.warning('没有可审核的数据!')
+      } else {
+        this.spinning = true
+        sparePartsBatchAudit(this.snList).then(res => {
+          if(res.status == 200){
+            this.$emit('ok',res.message)
+            this.isShow = false
+          }
+          this.spinning = false
+        })
+      }
+    },
+    // 导出
+    handleError () {
+      const _this = this
+      if (_this.unLoadData.length < 1) {
+        _this.$message.info('暂无可导出错误项~')
+        return
+      }
+      _this.spinning = true
+      hdExportExcel(sparePartsAuditFail, _this.unLoadData, '散件入库审核错误项', function () {
+        _this.spinning = false
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.loadData = []
+        this.unLoadData = []
+        this.snList = []
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .batchAuditModal-modal{
+    .batchAuditModal-con{
+      .red{
+        color: #f30;
+      }
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel,.button-error{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 7 - 2
src/views/purchasingManagement/bulkWarehousingOrder/edit.vue

@@ -25,7 +25,7 @@
       </a-card>
       <a-card size="small" :bordered="false" class="bulkWarehousingOrderEdit-cont">
         <!-- 操作按钮 -->
-        <div class="table-operator" style="display: flex;">
+        <div class="table-operator" style="display: flex;align-items:center;">
           <div>
             <a-button id="bulkWarehousingOrderEdit-add" type="primary" class="button-primary" @click="handleEdit()">新增产品</a-button>
             <a-button id="bulkWarehousingOrderEdit-import" type="default" class="button-primary" @click="openGuideModal=true">导入产品</a-button>
@@ -84,6 +84,11 @@
               class="button-error"
               id="bulkWarehousingOrderList-del-btn">删除</a-button>
           </template>
+          
+          <template slot="productName" slot-scope="text, record">
+            {{record.productName}}
+            <a-tag color="red" v-if="record.giftFlag==1">赠品</a-tag>
+          </template>
         </s-table>
       </a-card>
     </a-spin>
@@ -151,7 +156,7 @@ export default {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品名称', scopedSlots: { customRender: 'productName' },width: '25%', align: 'center' },
         { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '入库数量', dataIndex: 'productQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '入库单价', dataIndex: 'productCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 3 - 2
src/views/purchasingManagement/bulkWarehousingOrder/importGuideModal.vue

@@ -16,8 +16,9 @@
           </div>
           <ul>
             <li>1) 导入的Excel文件中必须包含名为“产品编码”、“数量”的列,且名称必须相同</li>
-            <li>2) 除了“产品编码”、“数量”两列,其他列可自定义,不影响数据导入</li>
-            <li>3) 如果导入的产品已经存在,则不会导入该行</li>
+            <li>2) 除了“产品编码”、“数量”、“成本价”两列,其他列可自定义,不影响数据导入</li>
+            <li>3) “成本价”为空或输入的价格与系统设置相同时,允许导入</li>
+            <li>4) 如果导入的产品已经存在,则不会导入该行</li>
           </ul>
           <a-button type="link" icon="download" style="padding: 0 0 0 23px;" :loading="exportLoading" @click="handleExport">下载导入模板</a-button>
         </div>

+ 46 - 21
src/views/purchasingManagement/bulkWarehousingOrder/list.vue

@@ -138,6 +138,9 @@
     <sparePartsDetailModal v-drag :openModal="openDetailModal" :itemSn="itemSn" @close="closeDetailModal" />
     <!-- 导出提示框 -->
     <reportModal :visible="showExport" @close="showExport=false"></reportModal>
+    <!-- 审核不通过弹框 -->
+    <auditNoPassModal v-drag ref="auditNoPassModal" :openModal="openAuditNoModal" @close="openAuditNoModal=false" />
+    <batchAuditNoModal v-drag ref="batchAuditNoModal" :openModal="openBatchAuditNoModal" @close="openBatchAuditNoModal=false" @ok="hanldeAuditOk" />
   </a-card>
 </template>
 
@@ -147,12 +150,14 @@ import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 import sparePartsDetailModal from './detailModal.vue'
 import reportModal from '@/views/common/reportModal.vue'
+import auditNoPassModal from './auditNoPassModal.vue'
+import batchAuditNoModal from './batchAuditNoModal.vue'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { sparePartsList, sparePartsDelete, sparePartsAudit, sparePartsDetailExport } from '@/api/spareParts'
+import { sparePartsList, sparePartsDelete, sparePartsAudit, sparePartsAuditVerify, sparePartsDetailExport } from '@/api/spareParts'
 export default {
   name: 'BulkWarehousingOrderList',
   mixins: [commonMixin],
-  components: { STable, VSelect, basicInfoModal, sparePartsDetailModal, reportModal },
+  components: { STable, VSelect, basicInfoModal, sparePartsDetailModal, reportModal, auditNoPassModal,batchAuditNoModal },
   data () {
     return {
       spinning: false,
@@ -160,6 +165,8 @@ export default {
       openModal: false, // 基本信息弹框是否显示
       showExport: false,
       exportLoading: false,
+      openAuditNoModal: false,
+      openBatchAuditNoModal: false,
       tableHeight: 0,
       // 查询参数
       queryParam: {
@@ -290,43 +297,61 @@ export default {
       this.$refs.table.refresh(true)
     },
     //  单条审核
-    handleAudit (row, isBatch) {
+    handleAudit (row) {
       const _this = this
-      let content = ''
-      let params = []
-      if (isBatch) { //  批量
-        content = '确认要批量审核吗?'
-        params = row
-      } else { //  单条
-        content = '确认要审核通过吗?'
-        params = [row.sparePartsSn]
-      }
       this.$confirm({
         title: '提示',
-        content: content,
+        content: '确认要审核通过吗?',
         centered: true,
         onOk () {
           _this.spinning = true
-          sparePartsAudit(params).then(res => {
+          sparePartsAudit({sn:row.sparePartsSn}).then(res => {
             if (res.status == 200) {
-              _this.$refs.table.clearSelected() // 清空表格选中项
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
+              if(res.data&&res.data.sparePartsDetailList){
+                _this.$nextTick(()=>{
+                  _this.openAuditNoModal = true
+                  _this.$refs.auditNoPassModal.setData(res.data.sparePartsDetailList)
+                })
+              }else{
+                _this.hanldeAuditOk(res.message)
+              }
             }
+            _this.spinning = false
           })
         }
       })
     },
     // 批量审核
     handleBatchAudit () {
+      const _this = this
       if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
-      this.handleAudit(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys, 'batch')
+      const snList = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys || []
+      this.$confirm({
+        title: '提示',
+        content: '确认要批量审核通过吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          sparePartsAuditVerify(snList).then(res => {
+            if(res.status == 200&&res.data){
+              _this.$nextTick(()=>{
+                _this.openBatchAuditNoModal = true
+                _this.$refs.batchAuditNoModal.getData(res.data)
+              })
+            }
+            _this.spinning = false
+          })
+        }
+      })
+    },
+    // 审核成功
+    hanldeAuditOk(message){
+      this.$refs.table.clearSelected() // 清空表格选中项
+      this.$message.success(message)
+      this.$refs.table.refresh()
     },
     pageInit () {
       const _this = this

+ 5 - 0
src/views/purchasingManagement/bulkWarehousingOrder/productModal.vue

@@ -191,6 +191,7 @@ export default {
     },
     // 详情
     getDetail () {
+      this.spinning = true
       sparePartsDetailD({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
           const data = res.data
@@ -199,7 +200,9 @@ export default {
           this.form.warehouse = [this.form.warehouseSn, this.form.warehouseLocationSn]
           this.warehouseSnBackups = this.form.warehouseSn || undefined
           this.warehouseLocationSnBackups = this.form.warehouseLocationSn || undefined
+          this.isGift = this.form.giftFlag == 1
         }
+        this.spinning = false
       })
     },
     //  保存
@@ -211,6 +214,7 @@ export default {
           form.sparePartsSn = this.nowData.sparePartsSn
           form.sparePartsNo = this.nowData.sparePartsNo
           form.supplierSn = this.nowData.supplierSn
+          form.giftFlag = this.isGift ? 1 : 0
           if (!_this.itemSn) {
             delete form.id
             delete form.sparePartsDetailSn
@@ -304,6 +308,7 @@ export default {
         productCost: '',
         productQty: ''
       }
+      this.isGift = false
       // this.$refs.productSn.focus()
     }
   },

+ 2 - 2
src/views/salesReturnManagement/receiveCheck/printModal.vue

@@ -12,7 +12,7 @@
                   <div style="display:flex;align-item:center;justify-content: space-between;flex-wrap: wrap;line-height: 20pt;margin:15pt 0;">
                     <div style="width: 100%;">客户名称:{{ detailData.buyerName||'--' }}</div>
                     <div style="width: 50%;">退货单号:{{ detailData.salesReturnBillNo||'--' }}</div>
-                    <div style="width: 50%;">退货日期:{{ detailData.createDate||'--' }}</div>
+                    <div style="width: 50%;">退货日期:{{ detailData.auditTime||'--' }}</div>
                   </div>
                   <div>
                     <div>
@@ -34,7 +34,7 @@
                           <td style="padding:3pt;width: 74pt;text-align:center;word-break:break-all;">{{ item.productEntity.name }}</td>
                           <td style="padding:3pt;width: 34pt;text-align:center;">{{ item.productEntity.unit }}</td>
                           <td style="padding:3pt;width: 52pt;text-align:center;">{{ item.initialQty }}</td>
-                          <td style="padding:3pt;width: 52pt;text-align:center;">{{ item.receiveQty }}</td>
+                          <td style="padding:3pt;width: 52pt;text-align:center;"></td>
                           <td style="padding:3pt;width: 60pt;text-align:center;word-break:break-all;">{{ item.returnReason }}</td>
                           <td style="padding:3pt;width: 74pt;text-align:center;word-break:break-all;"></td>
                           <td style="padding:3pt;width: 72pt;word-break:break-all;"></td>

+ 186 - 0
src/views/supplierManagement/costSetting/chooseImportModal.vue

@@ -0,0 +1,186 @@
+<template>
+  <a-modal
+    centered
+    class="chooseImport-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="导入"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="900">
+    <div class="chooseImport-con">
+      <!-- 可导入数据 -->
+      <p class="">可导入数据{{ loadData.length }}条</p>
+      <a-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.supplierSn"
+        :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>
+      </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 { hdExportExcel } from '@/libs/exportExcel'
+import { supplierProductParseNewProducts, supplierProductailNewExcel } from '@/api/supplier'
+export default {
+  name: 'ChooseImportModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    paramsData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      nowColumns: [ //  可导入
+        { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
+        { title: '供应商名称', dataIndex: 'product.unit', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '成本价', dataIndex: 'costText', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+      ],
+      nowUnColumns: [ //  不可导入
+        { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
+        { title: '供应商名称', dataIndex: 'product.unit', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '成本价', dataIndex: 'costText', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '备注', dataIndex: 'importErrorMsgList', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      loadData: [],
+      unLoadData: [],
+      loading: false
+    }
+  },
+  methods: {
+    getData () {
+      const _this = this
+      this.loading = true
+      supplierProductParseNewProducts(this.paramsData).then(res => {
+        this.loading = false
+        if (res.status == 200) {
+          if (res.data.okList && res.data.okList.length > 0) {
+            res.data.okList.map((item, index) => {
+              item.no = index + 1
+            })
+          }
+          if (res.data.failList && res.data.failList.length > 0) {
+            res.data.failList.map((item, index) => {
+              item.no = index + 1
+            })
+          }
+          _this.loadData = res.data.okList || []
+          _this.unLoadData = res.data.failList || []
+        }
+      })
+    },
+    // 确认导入
+    handleSubmit () {
+      if (this.loadData.length == 0) {
+        this.$message.warning('无可导入产品!')
+      } else {
+        this.$emit('ok', this.loadData)
+        this.isShow = false
+      }
+    },
+    // 导出
+    handleError () {
+      const _this = this
+      if (_this.unLoadData.length < 1) {
+        _this.$message.info('暂无可导出错误项~')
+        return
+      }
+      _this.spinning = true
+      hdExportExcel(supplierProductailNewExcel, _this.unLoadData, '关联产品导入错误项', 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>

+ 221 - 0
src/views/supplierManagement/costSetting/importGuideModal.vue

@@ -0,0 +1,221 @@
+<template>
+  <a-modal
+    centered
+    class="importGuide-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="导入"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="750">
+    <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>3) 如果导入的供应商名称、产品已经存在,未创建之间的关跌,则允许导入,同时系统的健关跌,若已建立之间的关跌,则允许导入,成本按照更新处理,若不存在,则需先完善供应商和产品</li>
+          </ul>
+          <a-button type="link" icon="download" style="padding: 0 0 0 23px;" :loading="exportLoading" @click="handleExport">下载导入模板</a-button>
+        </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="import"
+              :action="attachAction"
+              :uploadParams="uploadParams"
+              upText="添加文件"
+              @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'
+import { supplierProductNewDownloadExcel } from '@/api/supplier'
+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 + '/upload',
+      paramsData: null,
+      uploadParams: {
+        savePathType: 'local'
+      },
+      exportLoading: false
+    }
+  },
+  methods: {
+    // 下一步
+    handlerNextStep () {
+      if (this.paramsData) {
+        this.openImportModal = true
+      } else {
+        this.$message.warning('添加文件后再进行下一步操作!')
+      }
+    },
+    // 上传文件  change
+    changeImport (file) {
+      if (file) {
+        this.paramsData = {
+          path: file
+        }
+      }
+    },
+    // 导入
+    hanldeOk (obj) {
+      if (obj && obj.length > 0) {
+        this.$emit('ok', obj)
+        this.isShow = false
+      }
+    },
+    // 关闭
+    handleClose () {
+      this.openImportModal = false
+      this.isShow = false
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      _this.spinning = true
+      _this.exportLoading = true
+      supplierProductNewDownloadExcel({}).then(res => {
+        _this.spinning = false
+        _this.exportLoading = 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()
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.paramsData = null
+        this.$refs.importUpload.setFileList('')
+      }
+    }
+  }
+}
+</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>

+ 15 - 3
src/views/supplierManagement/costSetting/list.vue

@@ -108,6 +108,8 @@
     <addProductModal :openModal="newProduct" @close="newProduct=false" @ok="handleProductsOk" />
     <!-- 设置成本价 -->
     <SettingCost ref="settingCost" :openModal="openSetModal" @ok="$refs.table.refresh()" @close="openSetModal=false"></SettingCost>
+    <!-- 导入产品 -->
+    <importGuideModal :openModal="openGuideModal" @close="openGuideModal=false" @ok="handleGuideOk" />
   </a-card>
 </template>
 
@@ -118,17 +120,19 @@ import { hdExportExcel } from '@/libs/exportExcel'
 import ProductType from '@/views/common/productType.js'
 import ProductBrand from '@/views/common/productBrand.js'
 import addProductModal from './addProductModal.vue'
+import ImportGuideModal from './importGuideModal.vue'
 import SettingCost from './settingCost.vue'
-import { supplierProductList, supplierProductExportDetail, supplierProductUpdateAuditState } from '@/api/supplier'
+import { supplierProductList, supplierProductExportDetail, supplierProductUpdateAuditState, supplierProductNewBatchInsert } from '@/api/supplier'
 export default {
   name: 'costSettingList',
   mixins: [commonMixin],
-  components: { STable, VSelect, ProductBrand, ProductType, addProductModal, SettingCost },
+  components: { STable, VSelect, ProductBrand, ProductType, addProductModal, SettingCost, ImportGuideModal },
   data () {
     return {
       spinning: false,
       exportLoading: false,
       advanced: true, // 高级搜索 展开/关闭
+      openGuideModal: false,
       tableHeight: 0,
       queryParam: { //  查询条件
         supplierName: '',
@@ -193,6 +197,14 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
+    // 批量导入产品
+    handleGuideOk (obj) {
+      supplierProductNewBatchInsert(obj).then(res => {
+        if (res.status == 200) {
+          this.$refs.table.refresh(true)
+        }
+      })
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.supplierName = ''
@@ -230,7 +242,7 @@ export default {
     },
     // 批量导入
     handleBatchImport () {
-
+      this.openGuideModal=true
     },
     // 批量审核
     handleBatchAudit () {

+ 4 - 0
src/views/supplierManagement/costSetting/settingCost.vue

@@ -96,6 +96,7 @@ export default {
     setData (row) {
       this.form.supplierSn = row.supplierSn
       this.form.supplierProductSn = row.supplierProductSn
+      this.form.modifyCost = ''
       this.cost = row.cost
       this.productName = row.product.name
       this.productCode = row.product.code
@@ -130,6 +131,9 @@ export default {
       this.$emit('close')
       this.productName = ''
       this.productCode = ''
+      this.form.modifyCost = ''
+      this.form.supplierSn= ''
+      this.form.supplierProductSn= ''
       this.$refs.ruleForm.resetFields()
     }
   },