From c7125de4cfc16a324ca801adb898892713a1d4c1 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 05 十一月 2025 16:39:50 +0800
Subject: [PATCH] 采购台账添加签订日期

---
 src/views/procurementManagement/procurementLedger/index.vue |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 5165df7..a9d4d05 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -1152,10 +1152,15 @@
   });
 };
 const getModels = (value) => {
-  productForm.value.productCategory = findNodeById(productOptions.value, value);
-  modelList({ id: value }).then((res) => {
-    modelOptions.value = res;
-  });
+  if (value) {
+    productForm.value.productCategory = findNodeById(productOptions.value, value) || "";
+    modelList({ id: value }).then((res) => {
+      modelOptions.value = res;
+    });
+  } else {
+    productForm.value.productCategory = "";
+    modelOptions.value = [];
+  }
 };
 const getProductModel = (value) => {
   const index = modelOptions.value.findIndex((item) => item.id === value);
@@ -1170,12 +1175,12 @@
 const findNodeById = (nodes, productId) => {
   for (let i = 0; i < nodes.length; i++) {
     if (nodes[i].value === productId) {
-      return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+      return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣鐨刲abel
     }
     if (nodes[i].children && nodes[i].children.length > 0) {
       const foundNode = findNodeById(nodes[i].children, productId);
       if (foundNode) {
-        return foundNode.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+        return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝鐩存帴杩斿洖锛堝凡缁忔槸label瀛楃涓诧級
       }
     }
   }

--
Gitblit v1.9.3