From e449a5408265e4bd1f6c66f5be28a42efac444ee Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期日, 20 九月 2026 15:22:46 +0800
Subject: [PATCH] 天津豹鸣app 1.需求修改

---
 src/pages/sales/salesQuotation/edit.vue |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/src/pages/sales/salesQuotation/edit.vue b/src/pages/sales/salesQuotation/edit.vue
index bfcb930..2490874 100644
--- a/src/pages/sales/salesQuotation/edit.vue
+++ b/src/pages/sales/salesQuotation/edit.vue
@@ -23,6 +23,16 @@
                        @click="showCustomerSheet = true"></up-icon>
             </template>
           </up-form-item>
+          <up-form-item label="鎵�灞為」鐩�"
+                        prop="projectId">
+            <FormPicker v-model="form.projectId"
+                        :display-text="form.projectName"
+                        type="select"
+                        title="閫夋嫨鎵�灞為」鐩�"
+                        :options="projectOptions"
+                        placeholder="璇烽�夋嫨鎵�灞為」鐩�"
+                        @change="onProjectChange" />
+          </up-form-item>
           <up-form-item label="涓氬姟鍛�"
                         prop="salesperson"
                         required>
@@ -199,7 +209,9 @@
   import { onLoad } from "@dcloudio/uni-app";
   import FooterButtons from "@/components/FooterButtons.vue";
   import PageHeader from "@/components/PageHeader.vue";
+  import FormPicker from "@/components/FormPicker.vue";
   import { formatDateToYMD } from "@/utils/ruoyi";
+  import { loadProjectOptions, pickProjectName } from "@/utils/projectOptions";
   import { modelList, productTreeList } from "@/api/basicData/product";
   import { userListNoPageByTenantId } from "@/api/system/user";
   import {
@@ -224,6 +236,7 @@
   const salespersonList = ref([]);
   const productList = ref([]);
   const modelActions = ref([]);
+  const projectOptions = ref([]);
 
   let uidSeed = 1;
 
@@ -232,6 +245,8 @@
     quotationNo: "",
     customerId: undefined,
     customer: "",
+    projectId: "",
+    projectName: "",
     salesperson: "",
     quotationDate: "",
     validDate: "",
@@ -420,6 +435,31 @@
     );
   };
 
+  const onProjectChange = (value, item) => {
+    form.value.projectName = pickProjectName(item);
+  };
+
+  const loadProjectList = async () => {
+    try {
+      projectOptions.value = await loadProjectOptions();
+    } catch (error) {
+      projectOptions.value = [];
+    }
+  };
+
+  // 鎶ヤ环鍗曞彧甯� projectId 涓嶅甫鍚嶇О鏃讹紝浠庝笅鎷夐�夐」鍙嶆煡琛ュ叏锛岄伩鍏嶄繚瀛樻椂鎶婂悕绉版竻绌�
+  const resolveProjectName = () => {
+    if (form.value.projectName) return;
+    if (!form.value.projectId) {
+      form.value.projectName = "";
+      return;
+    }
+    const matched = projectOptions.value.find(
+      option => String(option.value) === String(form.value.projectId)
+    );
+    form.value.projectName = matched ? matched.name : "";
+  };
+
   // 鏍规嵁鍚嶇О鍙嶆煡鑺傜偣 id锛屼究浜庝粎瀛樺悕绉版椂鐨勫弽鏄�
   const findNodeIdByLabel = (nodes, label) => {
     if (!label) return null;
@@ -498,6 +538,8 @@
         quotationNo: data.quotationNo || "",
         customerId: data.customerId,
         customer: data.customer || "",
+        projectId: data.projectId ?? "",
+        projectName: data.projectName || "",
         salesperson: data.salesperson || "",
         quotationDate: data.quotationDate || "",
         validDate: data.validDate || "",
@@ -546,6 +588,7 @@
     // 鍚屾鏈�鏂扮殑鎬婚
     form.value.totalAmount = totalAmount.value;
     form.value.subtotal = totalAmount.value;
+    resolveProjectName();
 
     const payload = {
       ...form.value,
@@ -586,7 +629,7 @@
   });
 
   onMounted(async () => {
-    await fetchBaseOptions();
+    await Promise.all([fetchBaseOptions(), loadProjectList()]);
     if (quotationId.value) {
       await loadDetail();
     }

--
Gitblit v1.9.3