浏览代码

fix: 调拨增加防抖

liujt 1 周之前
父节点
当前提交
e7226e1c21
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      src/views/warehouseManagement/inventoryAllocation/add.vue

+ 8 - 2
src/views/warehouseManagement/inventoryAllocation/add.vue

@@ -433,8 +433,8 @@
             </template>
           </ele-pro-table>
           <div class="submit_item">
-            <el-button v-click-once type="primary" @click="submit(0)">保存</el-button
-            ><el-button v-click-once type="primary" @click="config">提交</el-button></div
+            <el-button type="primary" :loading="loading"  @click="submit(0)">保存</el-button
+            ><el-button type="primary" :loading="loading" @click="config">提交</el-button></div
           >
         </div>
       </div>
@@ -450,6 +450,7 @@
   export default {
     data() {
       return {
+        loading: false,
         cacheKeyUrl: 'wms-inventoryAllocation-add-table-left',
         query: {},
         allocationType,
@@ -1533,7 +1534,9 @@
         }
       },
       submit(status) {
+        this.loading = true;
         if (!this.params.name) {
+          this.loading = false;
           return this.$message.error('名称不能为空!');
         } 
         
@@ -1595,6 +1598,7 @@
             const saleOrderNos = params.allotApplyAddPOBuilders.map((item) => item.saleOrderNos);
           
             if (new Set(customerNames).size !== 1, new Set(saleOrderNos).size !== 1) {
+              this.loading = false;
               return this.$message.warning('不同客户,不同销售订单的产品不允许调拨');
             } 
             storageApi.allotApplySave(params).then(() => {
@@ -1602,9 +1606,11 @@
               this.$router.go(-1);
             });
           } else {
+            this.loading = false;
             this.$message.warning('请调入相关数据');
           }
         }).catch((error) => {
+          this.loading = false;
           // 验证失败,不提交数据
           console.error('数据验证失败:', error);
         });