Ver Fonte

refactor(forecast-form): 移除库存获取逻辑并重构为独立方法

yz há 1 semana atrás
pai
commit
c413d669d7
1 ficheiros alterados com 14 adições e 2 exclusões
  1. 14 2
      src/components/forecast-form/forecast-form-avue.vue

+ 14 - 2
src/components/forecast-form/forecast-form-avue.vue

@@ -292,12 +292,12 @@ export default {
         this.formData.itemName = selectedItem.name
         this.formData.itemSpecs = selectedItem.specs || ''
         // 获取当前库存
-        this.getCurrentInventory(itemId)
+        // this.getCurrentInventory(itemId)
       } else {
         this.formData.itemCode = ''
         this.formData.itemName = ''
         this.formData.itemSpecs = ''
-        this.currentInventory = null
+        // this.currentInventory = null
       }
     },
 
@@ -324,6 +324,18 @@ export default {
     },
 
     /**
+     * 获取当前库存
+     * @param {string} itemId - 物料ID
+     */
+    getCurrentInventory(itemId) {
+      // 简化实现,实际应该调用API
+      setTimeout(() => {
+        // 模拟随机库存数量
+        this.currentInventory = Math.floor(Math.random() * 1000)
+      }, 300)
+    },
+
+    /**
      * 表单提交处理
      */
     async handleSubmit() {