From 2d3530a7c11557a40807ad7c0b9e302ce6ce3a9f Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期五, 28 八月 2026 10:16:32 +0800
Subject: [PATCH] feat: 综合业务模块页面重构与交互完善

---
 src/views/salesManagement/salesQuotation/index.vue |  153 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 96 insertions(+), 57 deletions(-)

diff --git a/src/views/salesManagement/salesQuotation/index.vue b/src/views/salesManagement/salesQuotation/index.vue
index 687b6d1..edd0102 100644
--- a/src/views/salesManagement/salesQuotation/index.vue
+++ b/src/views/salesManagement/salesQuotation/index.vue
@@ -3,7 +3,7 @@
     <el-card class="box-card">
       <!-- 鎼滅储鍖哄煙 -->
       <el-row :gutter="20" class="search-row">
-        <el-col :span="8">
+        <el-col :span="6">
           <el-input
             v-model="searchForm.quotationNo"
             placeholder="璇疯緭鍏ユ姤浠峰崟鍙�"
@@ -15,9 +15,9 @@
             </template>
           </el-input>
         </el-col>
-        <el-col :span="8">
-          <el-select v-model="searchForm.customer" placeholder="璇烽�夋嫨瀹㈡埛" clearable>
-						<el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.customerName">
+        <el-col :span="6">
+          <el-select v-model="searchForm.customerId" placeholder="璇烽�夋嫨瀹㈡埛" clearable>
+						<el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id">
 							{{
 								item.customerName + "鈥斺��" + item.taxpayerIdentificationNumber
 							}}
@@ -32,7 +32,12 @@
 <!--            <el-option label="宸茶繃鏈�" value="宸茶繃鏈�"></el-option>-->
 <!--          </el-select>-->
 <!--        </el-col>-->
-        <el-col :span="8">
+        <el-col :span="6">
+          <el-select v-model="searchForm.projectId" placeholder="璇烽�夋嫨椤圭洰鍚嶇О" clearable filterable>
+            <el-option v-for="item in projectOptions" :key="item.id" :label="item.no + ' - ' + item.title" :value="item.id" />
+          </el-select>
+        </el-col>
+        <el-col :span="6">
           <el-button type="primary" @click="handleSearch">鎼滅储</el-button>
           <el-button @click="resetSearch">閲嶇疆</el-button>
           <el-button style="float: right;" type="primary" @click="handleAdd">
@@ -52,6 +57,7 @@
       >
 				<el-table-column align="center" label="搴忓彿" type="index" width="60" />
         <el-table-column prop="quotationNo" label="鎶ヤ环鍗曞彿" />
+        <el-table-column prop="projectName" label="椤圭洰鍚嶇О" />
         <el-table-column prop="customer" label="瀹㈡埛鍚嶇О" />
         <el-table-column prop="salesperson" label="涓氬姟鍛�" width="100" />
         <el-table-column prop="quotationDate" label="鎶ヤ环鏃ユ湡" width="120" />
@@ -102,8 +108,8 @@
           <div class="form-content">
             <el-row :gutter="24">
               <el-col :span="12">
-                <el-form-item label="瀹㈡埛鍚嶇О" prop="customer">
-                  <el-select v-model="form.customer" placeholder="璇烽�夋嫨瀹㈡埛" style="width: 100%" clearable filterable>
+                <el-form-item label="瀹㈡埛鍚嶇О" prop="customerId">
+                  <el-select v-model="form.customerId" placeholder="璇烽�夋嫨瀹㈡埛" style="width: 100%" clearable filterable>
                     <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id"></el-option>
                   </el-select>
                 </el-form-item>
@@ -151,6 +157,13 @@
                   <el-input v-model="form.paymentMethod" placeholder="璇疯緭鍏ヤ粯娆炬柟寮�" clearable />
                 </el-form-item>
               </el-col>
+              <el-col :span="12">
+                <el-form-item label="椤圭洰鍚嶇О" prop="projectId">
+                  <el-select v-model="form.projectId" placeholder="璇烽�夋嫨椤圭洰鍚嶇О" style="width: 100%" clearable filterable>
+                    <el-option v-for="item in projectOptions" :key="item.id" :label="item.no + ' - ' + item.title" :value="item.id" />
+                  </el-select>
+                </el-form-item>
+              </el-col>
             </el-row>
           </div>
         </el-card>
@@ -187,9 +200,9 @@
             </el-table-column>
             <el-table-column prop="specification" label="瑙勬牸鍨嬪彿" width="200">
               <template #default="scope">
-                <el-form-item :prop="`products.${scope.$index}.specificationId`" class="product-table-form-item">
+                <el-form-item :prop="`products.${scope.$index}.productModelId`" class="product-table-form-item">
                   <el-select
-                    v-model="scope.row.specificationId"
+                    v-model="scope.row.productModelId"
                     placeholder="璇烽�夋嫨"
                     clearable
                     @change="getProductModel($event, scope.row)"
@@ -239,10 +252,10 @@
           </template>
           <div class="form-content">
             <el-form-item label="澶囨敞" prop="remark">
-              <el-input 
-                type="textarea" 
-                v-model="form.remark" 
-                placeholder="璇疯緭鍏ュ娉ㄤ俊鎭紙閫夊~锛�" 
+              <el-input
+                type="textarea"
+                v-model="form.remark"
+                placeholder="璇疯緭鍏ュ娉ㄤ俊鎭紙閫夊~锛�"
                 :rows="4"
                 maxlength="500"
                 show-word-limit
@@ -258,6 +271,7 @@
     <el-dialog v-model="viewDialogVisible" title="鎶ヤ环璇︽儏" width="800px">
       <el-descriptions :column="2" border>
         <el-descriptions-item label="鎶ヤ环鍗曞彿">{{ currentQuotation.quotationNo }}</el-descriptions-item>
+        <el-descriptions-item label="椤圭洰鍚嶇О">{{ currentQuotation.projectName }}</el-descriptions-item>
         <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ currentQuotation.customer }}</el-descriptions-item>
         <el-descriptions-item label="涓氬姟鍛�">{{ currentQuotation.salesperson }}</el-descriptions-item>
         <el-descriptions-item label="鎶ヤ环鏃ユ湡">{{ currentQuotation.quotationDate }}</el-descriptions-item>
@@ -270,7 +284,7 @@
           <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">楼{{ currentQuotation.totalAmount?.toFixed(2) }}</span>
         </el-descriptions-item>
       </el-descriptions>
-      
+
       <div style="margin: 20px 0;">
         <h4>浜у搧鏄庣粏</h4>
         <el-table :data="currentQuotation.products" border style="width: 100%">
@@ -301,21 +315,24 @@
 import FormDialog from '@/components/Dialog/FormDialog.vue'
 import {getQuotationList,addQuotation,updateQuotation,deleteQuotation} from '@/api/salesManagement/salesQuotation.js'
 import {modelList, productTreeList} from "@/api/basicData/product.js";
-import {listCustomerPrivatePool} from "@/api/basicData/customerFile.js";
+import {listCustomer} from "@/api/basicData/customer.js";
 import { userListNoPage } from "@/api/system/user.js";
+import { listProject } from "@/api/projectManagement/project.js";
 
 // 鍝嶅簲寮忔暟鎹�
 const loading = ref(false)
 const searchForm = reactive({
   quotationNo: '',
-  customer: '',
-  status: ''
+  customerId: '',
+  status: '',
+  projectId: undefined
 })
 
 const quotationList = ref([])
 const userList = ref([])
 const productOptions = ref([]);
 const modelOptions  = ref([]);
+const projectOptions = ref([]);
 const pagination = reactive({
   total: 3,
   currentPage: 1,
@@ -327,6 +344,8 @@
 const dialogTitle = ref('鏂板鎶ヤ环')
 const form = reactive({
   quotationNo: '',
+  customerId: undefined,
+  projectId: undefined,
   customer: '',
   salesperson: '',
   quotationDate: '',
@@ -353,7 +372,7 @@
 
 const productRowRules = {
   productId: [{ required: true, message: '璇烽�夋嫨浜у搧鍚嶇О', trigger: 'change' }],
-  specificationId: [{ required: true, message: '璇烽�夋嫨瑙勬牸鍨嬪彿', trigger: 'change' }],
+  productModelId: [{ required: true, message: '璇烽�夋嫨瑙勬牸鍨嬪彿', trigger: 'change' }],
   unit: [{ required: true, message: '璇峰~鍐欏崟浣�', trigger: 'blur' }],
   unitPrice: [{ required: true, message: '璇峰~鍐欏崟浠�', trigger: 'change' }]
 }
@@ -361,7 +380,7 @@
   const r = { ...baseRules }
   ;(form.products || []).forEach((_, i) => {
     r[`products.${i}.productId`] = productRowRules.productId
-    r[`products.${i}.specificationId`] = productRowRules.specificationId
+    r[`products.${i}.productModelId`] = productRowRules.productModelId
     r[`products.${i}.unit`] = productRowRules.unit
     r[`products.${i}.unitPrice`] = productRowRules.unitPrice
   })
@@ -395,14 +414,10 @@
   searchForm.quotationNo = ''
   searchForm.customer = ''
   searchForm.status = ''
+  searchForm.projectId = undefined
   // 閲嶇疆鍒扮涓�椤靛苟閲嶆柊鏌ヨ
   pagination.currentPage = 1
   handleSearch()
-}
-
-const loadCustomerOptions = async () => {
-  const res = await listCustomerPrivatePool({ current: -1, size: -1 });
-  customerOption.value = res?.data?.records || [];
 }
 
 const handleAdd = async () => {
@@ -411,7 +426,22 @@
   resetForm()
   dialogVisible.value = true
   getProductOptions();
-  loadCustomerOptions();
+  fetchCustomerOptions();
+  fetchProjectOptions();
+}
+
+const fetchProjectOptions = () => {
+  if (projectOptions.value.length > 0) return
+  listProject({current: -1,size:-1}).then((res) => {
+    projectOptions.value = res.data.records;
+  });
+}
+
+const fetchCustomerOptions = () => {
+  if (customerOption.value.length > 0) return
+  listCustomer({current: -1,size:-1, type: 0}).then((res) => {
+    customerOption.value = res.data.records;
+  });
 }
 const getProductOptions = () => {
 	// 杩斿洖 Promise锛屼究浜庣紪杈戞椂 await 纭繚鑳藉弽鏄�
@@ -430,7 +460,7 @@
 		if (children && children.length > 0) {
 			newItem.children = convertIdToValue(children);
 		}
-		
+
 		return newItem;
 	});
 }
@@ -454,7 +484,7 @@
 		row.productId = '';
 		row.product = '';
 		row.modelOptions = [];
-		row.specificationId = '';
+		row.productModelId = '';
 		row.specification = '';
 		row.unit = '';
 		return;
@@ -475,13 +505,13 @@
 	if (!row) return;
 	// 濡傛灉娓呯┖閫夋嫨锛屽垯娓呯┖鐩稿叧瀛楁
 	if (!value) {
-		row.specificationId = '';
+		row.productModelId = '';
 		row.specification = '';
 		row.unit = '';
 		return;
 	}
-	// 鏇存柊 specificationId锛坴-model 宸茬粡鑷姩鏇存柊锛岃繖閲岀‘淇濅竴鑷存�э級
-	row.specificationId = value;
+	// 鏇存柊 productModelId锛坴-model 宸茬粡鑷姩鏇存柊锛岃繖閲岀‘淇濅竴鑷存�э級
+	row.productModelId = value;
 	const modelOptions = row.modelOptions || [];
 	const index = modelOptions.findIndex((item) => item.id === value);
 	if (index !== -1) {
@@ -520,14 +550,15 @@
     products: row.products ? row.products.map(product => ({
       productId: product.productId || '',
       product: product.product || product.productName || '',
-      specificationId: product.specificationId || '',
+      productModelId: product.productModelId || '',
       specification: product.specification || '',
       quantity: product.quantity || 0,
       unit: product.unit || '',
       unitPrice: product.unitPrice || 0,
       amount: product.amount || 0
     })) : [],
-    totalAmount: row.totalAmount || 0
+    totalAmount: row.totalAmount || 0,
+    projectName: row.projectName || ''
   }
   viewDialogVisible.value = true
 }
@@ -539,10 +570,14 @@
   form.id = row.id || form.id || null
   // 鍏堝姞杞戒骇鍝佹爲鏁版嵁锛屽惁鍒� el-tree-select 鏃犳硶鍙嶆樉浜у搧鍚嶇О
   await getProductOptions()
+  await fetchCustomerOptions()
+  await fetchProjectOptions()
 
   // 鍙鍒堕渶瑕佺殑瀛楁锛岄伩鍏嶅皢缁勪欢寮曠敤鏀惧叆鍝嶅簲寮忓璞�
   form.quotationNo = row.quotationNo || ''
   form.customer = row.customer || ''
+  form.customerId = row.customerId || undefined
+  form.projectId = row.projectId || undefined
   form.salesperson = row.salesperson || ''
   form.quotationDate = row.quotationDate || ''
   form.validDate = row.validDate || ''
@@ -555,32 +590,32 @@
     const resolvedProductId = product.productId
       ? Number(product.productId)
       : findNodeIdByLabel(productOptions.value, productName) || ''
-    
+
     // 濡傛灉鏈変骇鍝両D锛屽姞杞藉搴旂殑瑙勬牸鍨嬪彿鍒楄〃
     let modelOptions = [];
-    let resolvedSpecificationId = product.specificationId || '';
-    
+    let resolvedProductModelId = product.productModelId || '';
+
     if (resolvedProductId) {
       try {
         const res = await modelList({ id: resolvedProductId });
         modelOptions = res || [];
-        
-        // 濡傛灉杩斿洖鐨勬暟鎹病鏈� specificationId锛屼絾鏈� specification 鍚嶇О锛屾牴鎹悕绉版煡鎵� ID
-        if (!resolvedSpecificationId && product.specification) {
+
+        // 濡傛灉杩斿洖鐨勬暟鎹病鏈� productModelId锛屼絾鏈� specification 鍚嶇О锛屾牴鎹悕绉版煡鎵� ID
+        if (!resolvedProductModelId && product.specification) {
           const foundModel = modelOptions.find(item => item.model === product.specification);
           if (foundModel) {
-            resolvedSpecificationId = foundModel.id;
+            resolvedProductModelId = foundModel.id;
           }
         }
       } catch (error) {
         console.error('鍔犺浇瑙勬牸鍨嬪彿澶辫触:', error);
       }
     }
-    
+
     return {
       productId: resolvedProductId,
       product: productName,
-      specificationId: resolvedSpecificationId,
+      productModelId: resolvedProductModelId,
       specification: product.specification || '',
       quantity: product.quantity || 0,
       unit: product.unit || '',
@@ -624,6 +659,8 @@
 
 const resetForm = () => {
   form.customer = ''
+  form.customerId = undefined
+  form.projectId = undefined
   form.salesperson = ''
   form.quotationDate = ''
   form.validDate = ''
@@ -644,8 +681,7 @@
     productId: '',
     product: '',
     productName: '',
-    specificationId: '',
-    specification: '',
+    productModelId: '',
     quantity: 1,
     unit: '',
     unitPrice: 0,
@@ -688,6 +724,7 @@
         return sum + price
       }, 0)
 
+      form.customer = customerOption.value.find(item => item.id === form.customerId)?.customerName || ''
       if (isEdit.value) {
         // 缂栬緫
         const index = quotationList.value.findIndex(item => item.id === editId.value)
@@ -737,6 +774,7 @@
         id: item.id,
         quotationNo: item.quotationNo || '',
         customer: item.customer || '',
+        customerId: item.customerId || undefined,
         salesperson: item.salesperson || '',
         quotationDate: item.quotationDate || '',
         validDate: item.validDate || '',
@@ -748,7 +786,7 @@
         products: item.products ? item.products.map(product => ({
           productId: product.productId || '',
           product: product.product || product.productName || '',
-          specificationId: product.specificationId || '',
+          productModelId: product.productModelId || '',
           specification: product.specification || '',
           quantity: product.quantity || 0,
           unit: product.unit || '',
@@ -782,8 +820,9 @@
 
 onMounted(()=>{
   getUserList()
-  loadCustomerOptions()
   handleSearch()
+  fetchCustomerOptions()
+  fetchProjectOptions()
 })
 </script>
 
@@ -796,16 +835,16 @@
   padding: 10px 0;
   max-height: calc(100vh - 200px);
   overflow-y: auto;
-  
+
   &::-webkit-scrollbar {
     width: 6px;
     height: 6px;
   }
-  
+
   &::-webkit-scrollbar-thumb {
     background: #c1c1c1;
     border-radius: 3px;
-    
+
     &:hover {
       background: #a8a8a8;
     }
@@ -822,17 +861,17 @@
   margin-bottom: 24px;
   border-radius: 8px;
   transition: all 0.3s ease;
-  
+
   &:hover {
     box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
   }
-  
+
   :deep(.el-card__header) {
     padding: 16px 20px;
     background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
     border-bottom: 1px solid #ebeef5;
   }
-  
+
   :deep(.el-card__body) {
     padding: 20px;
   }
@@ -842,19 +881,19 @@
   display: flex;
   align-items: center;
   gap: 8px;
-  
+
   .card-icon {
     font-size: 18px;
     color: #409eff;
   }
-  
+
   .card-title {
     font-weight: 600;
     font-size: 16px;
     color: #303133;
     flex: 1;
   }
-  
+
   .header-btn {
     margin-left: auto;
   }
@@ -878,20 +917,20 @@
 .product-table {
   :deep(.el-table__header) {
     background-color: #f5f7fa;
-    
+
     th {
       background-color: #f5f7fa !important;
       color: #606266;
       font-weight: 600;
     }
   }
-  
+
   :deep(.el-table__row) {
     &:hover {
       background-color: #f5f7fa;
     }
   }
-  
+
   :deep(.el-table__cell) {
     padding: 12px 0;
   }

--
Gitblit v1.9.3