chenrui il y a 2 ans
Parent
commit
bb5c6cb6d6

+ 11 - 2
src/api/sparePartsReturn.js

@@ -116,7 +116,7 @@ export const sparePartsReturnExportDetail = (params) => {
     responseType: 'blob'
   })
 }
-//批量保存
+// 批量保存
 export const sparePartsReturnDetailSaveBatch = (params) => {
   return axios({
     url: `/sparePartsReturn/detail/saveBatch`,
@@ -125,4 +125,13 @@ export const sparePartsReturnDetailSaveBatch = (params) => {
   })
 }
 
-//批量选择列表
+// 禁止选择重复列表
+export const queryDetailSnListBySn = params => {
+  const url = `/sparePartsReturn/detail/queryDetailSnListBySn/${params.sn}`
+  delete params.sn
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 12 - 14
src/views/purchasingManagement/purchaseReturn/purchaseReturnDeatil.vue

@@ -186,7 +186,7 @@ export default {
               data.list[i].no = no + i + 1
             }
 
-            this.$refs.partQuery.pageInit(this.supplierSn)
+            this.$refs.partQuery.pageInit(this.supplierSn, this.sparePartsReturnSn)
             this.disabled = false
           }
           this.chooseList = data.list
@@ -405,19 +405,17 @@ export default {
     },
     saveEdit (params) {
       this.spinning = true
-      sparePartsReturnDetailSave(params)
-        .then(res => {
-          if (res.status == 200) {
-            this.getStatisticsData()
-            this.$refs.table.refresh(true)
-          }
-          this.isInster = false
-          this.spinning = false
-          this.addMoreLoading = false
-        })
-        .catch(err => {
-          this.isInster = false
-        })
+      sparePartsReturnDetailSave(params).then(res => {
+        if (res.status == 200) {
+          this.getStatisticsData()
+          this.$refs.table.refresh(true)
+        }
+        this.isInster = false
+        this.spinning = false
+        this.addMoreLoading = false
+      }).catch(err => {
+        this.isInster = false
+      })
     },
     saveMore (params) {
       this.spinning = true

+ 14 - 2
src/views/purchasingManagement/purchaseReturn/queryPart.vue

@@ -46,7 +46,7 @@
       ref="chooseTable"
       size="small"
       :rowKey="(record) => record.id"
-      :row-selection="{ columnWidth: 40,getCheckboxProps: record => ({ props: { disabled: record.currentStockQty == 0 } }) }"
+      :row-selection="{ columnWidth: 40,getCheckboxProps: record => ({ props: { disabled: record.currentStockQty == 0 || record.isCheckedFlag} }) }"
       @rowSelection="rowSelectionFun"
       :columns="columns"
       :data="loadData"
@@ -85,6 +85,7 @@
 
 <script>
 import { queryDetailStockPage } from '@/api/spareParts'
+import { queryDetailSnListBySn } from '@/api/sparePartsReturn'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import { toFixedDecimal } from '@/libs/tools.js'
@@ -122,6 +123,7 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       selectArr: null,
       isChecked: false,
+      repeatList: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -131,9 +133,11 @@ export default {
           if (res.status == 200) {
             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
               data.list[i].qty = data.list[i].currentStockQty
+              data.list[i].isCheckedFlag = this.repeatList.findIndex(item => { return item == data.list[i].sparePartsDetailSn }) > -1
             }
             this.disabled = false
           }
@@ -186,8 +190,9 @@ export default {
       this.queryParam.beginDate = date[0] ? date[0] : ''
       this.queryParam.endDate = date[1] ? date[1] : ''
     },
-    pageInit (buyerSn) {
+    pageInit (buyerSn, returnSn) {
       this.buyerSn = buyerSn
+      this.getRepeatResult(returnSn)
       this.$refs.chooseTable.refresh()
       // this.$refs.chooseTable.clearSelected()
     },
@@ -205,6 +210,13 @@ export default {
         return
       }
       this.$emit('bachAdd', this.selectArr)
+    },
+    getRepeatResult (sn) {
+      queryDetailSnListBySn({ sn }).then(res => {
+        if (res.status == 200) {
+          this.repeatList = res.data
+        }
+      })
     }
   }
 }