chenrui 2 rokov pred
rodič
commit
d37ac32a40

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

@@ -37,7 +37,7 @@
       <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
         <!-- <div>已入库产品信息</div>
         <a-divider /> -->
-        <queryPart ref="partQuery" :newLoading="isInster" @add="saveProduct" @bachAdd="saveMoreProduct"></queryPart>
+        <queryPart ref="partQuery" :newLoading="isInster" :addMoreLoading="addMoreLoading" @add="saveProduct" @bachAdd="saveMoreProduct"></queryPart>
       </a-card>
       <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
         <a-alert style="margin-bottom: 10px;" type="info">
@@ -247,7 +247,8 @@ export default {
       },
       openModal: false, // 修改信息弹窗
       statisticsObj: null, // 统计明细
-      detailsData: null// 基础信息数据
+      detailsData: null, // 基础信息数据
+      addMoreLoading: false// 批量添加动画
     }
   },
   methods: {
@@ -283,12 +284,14 @@ export default {
     },
     resetTable (flag) {
       this.$refs.table.refresh(flag)
+      this.$refs.partQuery.refreshTable()
     },
     //  重置
     resetSearchForm (flag) {
       this.productForm.productName = ''
       this.productForm.productCode = ''
       this.$refs.table.refresh(!!flag)
+      this.$refs.partQuery.refreshTable()
     },
     // 已选产品  blur
     onCellBlur (val, record) {
@@ -336,10 +339,14 @@ export default {
         sparePartsNo: row.sparePartsNo,
         sparePartsSn: row.sparePartsSn
       }
-      this.spinning = true
       this.saveEdit(paramsData)
     },
     saveMoreProduct (data) {
+      if (this.addMoreLoading) {
+        // 防止多次添加产品
+        return
+      }
+      this.addMoreLoading = true
       var ajax_data = []
       data.forEach(item => {
         const obj = {
@@ -364,12 +371,14 @@ export default {
       this.saveEdit(ajax_data)
     },
     saveEdit (params) {
+      this.spinning = true
       sparePartsReturnDetailSave(params).then(res => {
         if (res.status == 200) {
           this.resetSearchForm(true)
         }
         this.isInster = false
         this.spinning = false
+        this.addMoreLoading = false
       })
     },
     beforeSubmit () {

+ 9 - 7
src/views/purchasingManagement/purchaseReturn/queryPart.vue

@@ -30,7 +30,7 @@
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesReturnList-reset">重置</a-button>
             </a-col>
             <a-col :md="12" :sm="24" style="margin-bottom: 10px;display: flex;align-items: center;">
-              <a-button type="primary" style="margin-right: 5px" @click="handleBatchAdd" :disabled="disabledFlag">批量添加</a-button>
+              <a-button type="primary" style="margin-right: 5px" @click="handleBatchAdd" :loading="addMoreLoading">批量添加</a-button>
               <a-checkbox @change="onChange">
                 显示最大可退数量为0的产品
               </a-checkbox>
@@ -72,7 +72,7 @@
           size="small"
           type="link"
           class="button-info"
-          :disabled="newLoading"
+          :loading="newLoading"
           v-if="record.currentStockQty != 0"
           @click="handleAdd(record)"
         >添加</a-button>
@@ -99,6 +99,10 @@ export default {
     showReceiveQty: {
       type: Boolean,
       default: false
+    },
+    addMoreLoading: {
+      type: Boolean,
+      default: false
     }
   },
   data () {
@@ -160,6 +164,9 @@ export default {
       this.$refs.rangeDate.resetDate(this.warehousingDate)
       this.$refs.chooseTable.refresh(true)
     },
+    refreshTable () {
+      this.$refs.chooseTable.refresh(true)
+    },
     onChange (e) {
       this.queryParam.isZero = e.target.checked ? 1 : 0
       this.refreshData()
@@ -179,11 +186,6 @@ export default {
     },
     rowSelectionFun (obj) {
       this.selectArr = obj.selectedRows
-      if (obj && obj.selectedRows.length > 0) {
-        this.disabledFlag = false
-      } else {
-        this.disabledFlag = true
-      }
     },
     // 批量添加
     handleBatchAdd () {