Pārlūkot izejas kodu

修改采购入库bug

chenrui 11 mēneši atpakaļ
vecāks
revīzija
74696ce843

+ 3 - 3
src/api/purchase.js

@@ -182,11 +182,11 @@ export const saveAttachment = (params) => {
   })
 }
 // 采购入库  轮胎唯一码
-export const traceCodeTraceCode = (params) => {
+export const traceCodeQueryList = (params) => {
   return axios({
-    url: '/purchase/traceCode/traceCode',
+    url: '/traceCode/queryList',
     data: params,
-    method: 'post',
+    method: 'get',
     headers: {
       'module': encodeURIComponent('查看唯一码')
     }

+ 5 - 5
src/views/purchasingManagement/purchaseReceipt/basicInfoModal.vue

@@ -50,13 +50,13 @@
           </a-select>
         </a-form-model-item>
         <a-form-model-item label="客户名称" >
-          <span>{{ itemData.dealerName||'--' }}</span>
+          <span>{{ (itemData&&itemData.dealerName)||'--' }}</span>
         </a-form-model-item>
         <a-form-model-item label="关联单号" >
-          <span>{{ itemData.lockBizNo||'--' }}</span>
+          <span>{{ (itemData&&itemData.lockBizNo)||'--' }}</span>
         </a-form-model-item>
         <a-form-model-item label="备注">
-          <span>{{ itemData.bizRemark||'--' }}</span>
+          <span>{{ (itemData&&itemData.bizRemark)||'--' }}</span>
         </a-form-model-item>
       </a-form-model>
       <div class="btn-cont">
@@ -123,9 +123,9 @@ export default {
       const _this = this
       warehouseCascadeList({}).then(res => {
         if (res.status == 200) {
-          this.warehouseCascadeData = res.data
+          _this.warehouseCascadeData = res.data
         } else {
-          this.warehouseCascadeData = []
+          _this.warehouseCascadeData = []
         }
       })
     },

+ 14 - 9
src/views/purchasingManagement/purchaseReceipt/detailModal.vue

@@ -19,7 +19,7 @@
             <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
             <a-descriptions-item label="入库仓库">{{ (basicInfoData&&basicInfoData.warehouseName) || '--' }}</a-descriptions-item>
             <a-descriptions-item label="采购单号">{{ (basicInfoData&&basicInfoData.lockBizNo) || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="客户名称">{{ (basicInfoData&&basicInfoData.dealerName) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="客户名称">{{ (basicInfoData&&basicInfoData.lockBizDealerName) || '--' }}</a-descriptions-item>
           </a-descriptions>
         </a-collapse-panel>
       </a-collapse>
@@ -38,10 +38,9 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
-
+        :defaultLoadData="false"
         :scroll="{ y: 300 }"
         bordered>
-        <!-- :defaultLoadData="false" -->
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
           <a-button
@@ -55,10 +54,10 @@
       </s-table>
     </a-card>
     <div class="btn-cont">
-      <a-button id="detail-basicInfo-modal-back" @click="isShow = false">返回列表</a-button>
+      <a-button id="detail-basicInfo-modal-back" @click="isShow = false">关闭</a-button>
     </div>
     <!-- 唯一码列表  不分页 -->
-    <uniqueCodeModal v-drag :openModal="openUniqueCodeModal" :uniqueData="uniqueList" @close="closeUniqueCodeModal" />
+    <uniqueCodeModal v-drag :openModal="openUniqueCodeModal" :itemData="itemUniqueCodeData" @close="closeUniqueCodeModal" />
   </a-modal>
 </template>
 
@@ -92,6 +91,7 @@ export default {
       basicInfoData: null, //  基础信息数据
       statisticsObj: null, //  统计数据
       openUniqueCodeModal: false, // 轮胎唯一码弹窗
+      itemUniqueCodeData: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         const params = Object.assign(parameter, { sparePartsSn: this.itemSn })
@@ -119,15 +119,15 @@ export default {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'left', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', scopedSlots: { customRender: 'productName' }, width: '40%', align: 'left', ellipsis: true },
+        { title: '产品名称', dataIndex: 'productName', width: '40%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '单位', dataIndex: 'unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '采购数量', dataIndex: 'productQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '采购单价', dataIndex: 'productCost1', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
         { title: '采购金额', dataIndex: 'productCost', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '操作', dataIndex: 'action', width: '10%', align: 'center', scopedSlots: { customRender: 'action' } }
+        { title: '唯一码', dataIndex: 'action', width: '10%', align: 'center', scopedSlots: { customRender: 'action' } }
       ]
       // if (this.basicInfoData && this.basicInfoData.state && this.basicInfoData.state === 'FINISH') {
-      //   arr.push({ title: '操作', dataIndex: 'action', width: '10%', align: 'center', scopedSlots: { customRender: 'action' } })
+      //   arr.push({ title: '唯一码', dataIndex: 'action', width: '10%', align: 'center', scopedSlots: { customRender: 'action' } })
       // }
       // if (this.$hasPermissions('B_sparePartsDetail_costPrice')) { //  成本价权限
       //   arr.splice(5, 0, { title: '入库单价', dataIndex: 'productCost', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
@@ -137,7 +137,8 @@ export default {
     }
   },
   methods: {
-    handleCheck () {
+    handleCheck (row) {
+      this.itemUniqueCodeData = { purchaseNo: row.sparePartsNo, productSn: row.productSn }
       this.openUniqueCodeModal = true
     },
     closeUniqueCodeModal () {
@@ -173,6 +174,10 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
+      } else {
+        this.$nextTick(() => {
+          this.$refs.table.refresh()
+        })
       }
     }
   }

+ 17 - 57
src/views/purchasingManagement/purchaseReceipt/edit.vue

@@ -23,7 +23,7 @@
           </div>
         </div>
         <a-descriptions size="small" :column="4" style="margin-bottom: 10px;">
-          <a-descriptions-item label="客户名称">{{ (detailsData && detailsData.dealerName) || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="客户名称">{{ (detailsData && detailsData.lockBizDealerName) || '--' }}</a-descriptions-item>
           <a-descriptions-item label="收货地址">{{ (detailsData && detailsData.shippingAddr) || '--' }}</a-descriptions-item>
           <a-descriptions-item label="收货人">{{ (detailsData &&detailsData.consigneeName) || '--' }}</a-descriptions-item>
           <a-descriptions-item label="收货电话">{{ (detailsData && detailsData.consigneeTel) || '--' }}</a-descriptions-item>
@@ -65,7 +65,7 @@
           <a-alert type="info">
             <div slot="message" class="total-bar">
               <span>采购数量:{{ statisticsObj && (statisticsObj.productTotalQty || statisticsObj.productTotalQty == 0) ? statisticsObj.productTotalQty : '--' }};</span>
-              <span v-if="$hasPermissions('B_purchaseReturnEdit_costPrice')">采购金额:{{ statisticsObj && statisticsObj.productTotalCost || statisticsObj.productTotalCost == 0 ? statisticsObj.productTotalCost : '--' }};</span>
+              <span v-if="$hasPermissions('B_purchaseReturnEdit_costPrice')">采购金额:{{ (statisticsObj && (statisticsObj.productTotalCost || statisticsObj.productTotalCost == 0) )? statisticsObj.productTotalCost : '--' }};</span>
             </div>
           </a-alert>
         </div>
@@ -114,7 +114,7 @@
       :itemSn="itemSn"
       :openModal="openAddModal"
       :nowData="detailsData"
-      @ok="handleAddOk"
+      @ok="resetTable"
       @close="openAddModal=false" />
     <!-- 导入弹窗 -->
     <importGuideModal :openModal="openGuideModal" :params="{sparePartsSn: $route.query.sn}" @close="openGuideModal=false" @ok="hanldleImportOk" />
@@ -162,11 +162,12 @@ export default {
         productCode: '', // 产品编码
         productName: '' // 产品名称
       },
-      statisticsObj: null, // 统计明细
+      statisticsObj: undefined, // 统计明细
 
-      sparePartsSn: null, // 采购入库sn
+      sparePartsSn: undefined, // 采购入库sn
+      itemSn: undefined, // 列表行 sn
 
-      itemObj: null, // 基础信息弹窗信息
+      itemObj: null, // 基础信息弹窗回显数据
 
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -303,17 +304,17 @@ export default {
     },
     // 编辑基础信息
     handleEditBase () {
-      this.itemObj = { dealerName: this.detailsData.dealerName, lockBizNo: this.detailsData.lockBizNo, bizRemark: this.detailsData.bizRemark }
+      this.itemObj = { dealerName: this.detailsData.lockBizDealerName, lockBizNo: this.detailsData.lockBizNo, bizRemark: this.detailsData.bizRemark }
       this.openBasicInfoModal = true
     },
-    //  返回
+    //  返回列表并刷新
     handleBack () {
       this.$router.push({ name: 'purchaseReceiptList', query: { closeLastOldTab: true } })
     },
     // 新增/编辑产品
     handleAddEdit (row) {
       if (this.detailsData && !this.detailsData.supplierName) {
-        this.$message.warning('供应商不能为空,请先变价基础信息!')
+        this.$message.warning('供应商不能为空,请先编辑基础信息!')
         return
       }
       this.itemSn = (row && row.sparePartsDetailSn) ? row.sparePartsDetailSn : null
@@ -323,8 +324,6 @@ export default {
     handleImport () {
       this.openGuideModal = true
     },
-    // 查询库存
-    handleQueryQty () {},
     // 删除所选产品
     handleDel (row) {
       const _this = this
@@ -339,24 +338,24 @@ export default {
           purchaseDetailDel({ sn: row.sparePartsDetailSn })
             .then(res => {
               if (res.status == 200) {
-                _this.resetTable(false)
-                _this.getBasicsData()
-                // _this.getChooseList()
-                // _this.$refs.partQuery.refreshLength()
+                _this.resetTable()
               }
               _this.$message.info(res.message)
               _this.delLoading = false
               _this.spinning = false
             })
             .catch(err => {
+              _this.$message.info(err.message)
               _this.delLoading = false
             })
         }
       })
     },
-    // 获取产品列表
-    resetTable (flag) {
-      this.$refs.table.refresh(flag)
+    // 刷新列表  更新操作时间
+    resetTable () {
+      this.itemSn = undefined
+      this.getBasicsData()
+      this.$refs.table.refresh(true)
     },
     //  重置
     resetSearchForm () {
@@ -364,42 +363,6 @@ export default {
       this.productForm.productCode = ''
       this.$refs.table.refresh(true)
     },
-    saveMoreProduct (data) {
-      if (this.addMoreLoading) {
-        // 防止多次添加产品
-        return
-      }
-      this.addMoreLoading = true
-      var ajax_data = []
-      data.forEach(item => {
-        const obj = {
-          sparePartsReturnSn: this.sparePartsReturnSn,
-          sparePartsReturnNo: this.sparePartsReturnNo,
-          sparePartsDetailSn: item.sparePartsDetailSn,
-          productSn: item.productSn,
-          stockDetailSn: item.stockDetailSn,
-          productCode: item.productCode,
-          putQty: item.productQty, // 入库数量
-          returnedQty: item.returnedQty, // 已退数量
-          qty: item.qty, // 申退数量
-          cost: item.productCost, // 成本
-          stockBatchNo: item.sparePartsBatchNo, // 批次号
-          warehouseSn: item.warehouseSn, // 仓库sn
-          warehouseLocationSn: item.warehouseLocationSn, // 仓位sn
-          sparePartsNo: item.sparePartsNo,
-          sparePartsSn: item.sparePartsSn
-        }
-        ajax_data.push(obj)
-      })
-      this.saveMore(ajax_data)
-    },
-    beforeSubmit () {
-      if (this.chooseList.length > 0) {
-        this.openDepartUserModal = true
-      } else {
-        this.$message.warning('请先添加要退货的产品!')
-      }
-    },
     // 提交采购入库
     handleSubmit (data) {
       this.spinning = true
@@ -422,9 +385,6 @@ export default {
         this.resetSearchForm()
       })
     },
-    getChooseList () {
-      this.$refs.partQuery.pageInit(this.supplierSn, this.sparePartsReturnSn, this.detailsData ? this.detailsData.warehouseSn : undefined, this.detailsData.grabFlag)
-    },
     // 获取页面统计数据
     getStatisticsData () {
       sparePartsPageCount({ sparePartsSn: this.sparePartsSn }).then(res => {

+ 19 - 7
src/views/purchasingManagement/purchaseReceipt/list.vue

@@ -165,7 +165,9 @@
       <!-- 审核弹窗 -->
       <reviewModal v-drag :openModal="openReviewModal" :itemSn="itemSn" @ok="okReviewModal" @close="closeReviewModal"></reviewModal>
       <!-- 上传凭证 -->
-      <uploadVoucherModal v-drag :openModal="openVoucherModal" :itemSn="itemSn" @close="openVoucherModal=false"></uploadVoucherModal>
+      <uploadVoucherModal v-drag :openModal="openVoucherModal" :itemSn="itemSn" @ok="handleSearch" @close="openVoucherModal=false"></uploadVoucherModal>
+      <!-- 查看上传凭证 -->
+      <seeVoucherModal v-drag :openModal="openSeeVoucherModal" :itemData="itemSeeData" @close="openSeeVoucherModal=false;itemSeeData=null"></seeVoucherModal>
     </a-card>
   </div>
 </template>
@@ -182,12 +184,13 @@ import supplier from '@/views/common/supplier.js'
 import reviewModal from './reviewModal.vue'
 import detailModal from './detailModal.vue'
 import uploadVoucherModal from './uploadVoucherModal.vue'
+import seeVoucherModal from './seeVoucherModal.vue'
 // 接口
 import { purchaseList, purchasePageCount, purchaseCancel, purchaseAudit } from '@/api/purchase'
 export default {
   name: 'PurchaseReceiptList',
   mixins: [commonMixin],
-  components: { STable, supplier, VSelect, custList, rangeDate, reviewModal, detailModal, uploadVoucherModal },
+  components: { STable, supplier, VSelect, custList, rangeDate, reviewModal, detailModal, uploadVoucherModal, seeVoucherModal },
   data () {
     return {
       spinning: false,
@@ -202,15 +205,17 @@ export default {
         endDate: getDate.getCurrMonthDays().endtime, // 创建结束时间
         sparePartsNo: undefined, // 采购单号
         supplierSn: undefined, // 供应商名称
-        buyerSn: undefined, // 客户名称
+        lockBizDealerSn: undefined, // 客户名称
         relationNo: undefined, // 关联单号
         state: undefined, // 业务状态
         thirdpartyBizState: undefined// 供应商状态
       },
       openReviewModal: false, // 审核弹窗
       openVoucherModal: false, // 上传凭证
+      openSeeVoucherModal: false, // 查看上传凭证弹窗
       openDetailModal: false, // 详情弹窗
       itemSn: null, // 采购入库sn
+      itemSeeData: null, // 查看凭证数据
       totalData: null, // 统计数据
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -255,7 +260,7 @@ export default {
         { title: '采购金额', dataIndex: 'productTotalCost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
         { title: '入库仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '关联单号', dataIndex: 'lockBizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'supplierName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户名称', dataIndex: 'lockBizDealerName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '业务状态', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '供应商状态', dataIndex: 'thirdpartyBizStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '备注', dataIndex: 'remark', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
@@ -280,7 +285,7 @@ export default {
     },
     // 是否显示查看凭证按钮
     isShowCheckBtn (con) {
-      const res = ((con.state === 'PASS' && con.thirdpartyBizState === 'AUDIT_PASS') || (con.state === 'WAIT_PUT' && con.thirdpartyBizState === 'WAIT_RECEIVE') || (con.state === 'WAIT_PUT' && con.thirdpartyBizState === 'FINISH') || (con.state === 'FINISH' && con.thirdpartyBizState === 'FINISH')) && con.attachmentList
+      const res = ((con.state === 'PASS' && con.thirdpartyBizState === 'AUDIT_PASS') || (con.state === 'WAIT_PUT' && con.thirdpartyBizState === 'WAIT_RECEIVE') || (con.state === 'WAIT_PUT' && con.thirdpartyBizState === 'FINISH') || (con.state === 'FINISH' && con.thirdpartyBizState === 'FINISH')) && (con.attachmentList && con.attachmentList.length > 0)
       return res
     },
     // 是否显示 --
@@ -368,6 +373,13 @@ export default {
       this.itemSn = row.sparePartsSn
       this.openVoucherModal = true
     },
+    // 查看凭证
+    seeVoucher (row) {
+      this.itemSeeData = row.attachmentList
+      this.$nextTick(() => {
+        this.openSeeVoucherModal = true
+      })
+    },
     //  取消
     handleDel (row) {
       const _this = this
@@ -391,7 +403,7 @@ export default {
     },
     // 客户名称 change
     custChange (obj) {
-      this.queryParam.buyerSn = obj.key
+      this.queryParam.lockBizDealerSn = obj.key
     },
     //  重置
     resetSearchForm () {
@@ -404,7 +416,7 @@ export default {
       this.$refs.rangeDate.resetDate(this.queryParam.time)
       this.queryParam.sparePartsNo = undefined
       this.queryParam.supplierSn = undefined
-      this.queryParam.buyerSn = undefined
+      this.queryParam.lockBizDealerSn = undefined
       this.queryParam.relationNo = undefined
       this.queryParam.state = undefined
       this.queryParam.thirdpartyBizState = undefined

+ 83 - 0
src/views/purchasingManagement/purchaseReceipt/seeVoucherModal.vue

@@ -0,0 +1,83 @@
+<template>
+  <a-modal
+    centered
+    class="seeVoucher-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="查看支付凭证"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="500">
+    <div class="seeVoucher-con">
+      <div v-if="itemData&&itemData.length>0">
+        <div v-for="item in itemData" :key="item.id" style="margin-bottom: 10px;">
+          <a class="link-bule" v-if="item.extName!=('jpg'||'jpeg'||'png')" :href="item.filePath">
+            <a-icon type="download" style="padding-right: 5px;" />{{ item.fileName }}
+          </a>
+          <img v-else :src="item.filePath" alt="图片走丢了" width="100%"/>
+        </div>
+      </div>
+      <!-- 按钮 -->
+      <div class="btn-con">
+        <a-button
+          id="seeVoucher-cancel"
+          size="large"
+          class="button-cancel"
+          @click="isShow=false"
+          style="margin-right: 15px;">关闭</a-button>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { Upload } from '@/components'
+export default {
+  name: 'SeeVoucherModal',
+  components: { Upload },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemData: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal //  是否打开弹框
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .seeVoucher-modal{
+    .seeVoucher-con{
+     .btn-con{
+       margin: 10px 0 20px;
+       text-align: center;
+       .button-cancel{
+         font-size: 12px;
+       }
+     }
+
+    }
+  }
+</style>

+ 9 - 6
src/views/purchasingManagement/purchaseReceipt/uniqueCodeModal.vue

@@ -20,6 +20,7 @@
         :columns="columns"
         :data="loadData"
         :scroll="{ y: 360 }"
+        :showPagination="false"
         bordered>
       </s-table>
     </a-card>
@@ -32,7 +33,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable } from '@/components'
-import { sparePartsDetailList } from '@/api/spareParts'
+import { traceCodeQueryList } from '@/api/purchase'
 export default {
   name: 'BulkWarehousingOrderDetailModal',
   mixins: [commonMixin],
@@ -42,9 +43,11 @@ export default {
       type: Boolean,
       default: false
     },
-    itemSn: {
-      type: [Number, String],
-      default: ''
+    itemData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
     }
   },
   data () {
@@ -52,11 +55,11 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return sparePartsDetailList(Object.assign(parameter, { sparePartsSn: this.itemSn })).then(res => {
+        return traceCodeQueryList(Object.assign(parameter, this.itemData)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
-            const no = (data.pageNo - 1) * data.pageSize
+            const no = 0
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
             }

+ 1 - 1
src/views/purchasingManagement/purchaseReceipt/uploadVoucherModal.vue

@@ -85,6 +85,7 @@ export default {
       }).then(res => {
         if (res.code == 200) {
           this.$message.success('上传成功')
+          this.$emit('ok')
           this.isShow = false
         }
       })
@@ -108,7 +109,6 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        this.paramsData = null
         this.itemSn = ''
         this.$refs.importUpload.setFileList('')
       }