From bb91952d1f1f59c4719d77eaf56e47eafa10126a Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期三, 21 十月 2026 17:20:55 +0800
Subject: [PATCH] feat: 添加产品树过滤功能,支持新增和编辑场景下的产品类别选择

---
 src/views/procurementManagement/procurementLedger/index.vue |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index b28df5d..86aeb7d 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -547,7 +547,7 @@
                               filterable
                               check-strictly
                               @change="getModels"
-                              :data="productOptions"
+                              :data="productFormOptions"
                               :render-after-expand="false"
                               style="width: 100%" />
             </el-form-item>
@@ -705,6 +705,7 @@
     onMounted,
     reactive,
     toRefs,
+    computed,
     getCurrentInstance,
     nextTick,
   } from "vue";
@@ -762,6 +763,7 @@
   import dayjs from "dayjs";
   import FileUpload from "@/components/AttachmentUpload/file/index.vue";
   import { roundHalfUp, trimZeros } from "@/utils/formatNumber.js";
+  import { filterRawMaterialTree } from "@/utils/productTree.js";
 
   const userStore = useUserStore();
 
@@ -959,6 +961,12 @@
   // 浜у搧琛ㄥ崟寮规鏁版嵁
   const productFormVisible = ref(false);
   const productOperationType = ref("");
+  // 鏂板浜у搧鏃朵骇鍝佸ぇ绫诲彧灞曠ず銆屽師鏉愭枡銆嶏紝缂栬緫鏃朵繚鎸佸畬鏁翠骇鍝佹爲
+  const productFormOptions = computed(() =>
+    productOperationType.value === "add"
+      ? filterRawMaterialTree(productOptions.value)
+      : productOptions.value
+  );
   const productOperationIndex = ref("");
   const currentId = ref("");
   const productFormData = reactive({

--
Gitblit v1.9.3