From 349091f54dab47b15ca81613f02765490a2ce7d0 Mon Sep 17 00:00:00 2001
From: p-honggang.li <p-honggang.li@pcitc.com>
Date: 星期四, 11 九月 2025 10:50:36 +0800
Subject: [PATCH] 修改买家中心卖家中心产品类型等条件查询问题

---
 vite.config.ts                                       |    2 
 src/views/tradeManage/buyer/index.vue                |   89 ++++++++++++--
 src/views/tradeManage/seller/index.vue               |   85 ++++++++++++--
 src/views/productManage/productPriceViewer/index.vue |    1 
 src/views/approveManage/tradeApproval/list.vue       |   83 ++++++++++++-
 src/views/tradeManage/detail/index.vue               |   29 ++++
 src/views/productManage/price/index.vue              |    4 
 src/App.vue                                          |   11 +
 8 files changed, 264 insertions(+), 40 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index 3eb6df3..77afe0a 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -123,5 +123,14 @@
 .rowBtnDiv .normal-btn,.action-btns .normal-btn{
     padding: 8px 4px !important;
   }
-  
+/* Tooltip 瀹藉害涓庢崲琛屾帶鍒讹紙Element Plus Teleport 鍒� body锛岄渶瑕� deep 閫夋嫨鍣級 */
+.tooltip-wrap{
+  max-width: 340px !important;
+}
+.tooltip-wrap .el-tooltip__content {
+  max-width: 340px !important;
+  white-space: normal !important;
+  word-break: break-word;
+  overflow-wrap: anywhere;
+}
 </style>
diff --git a/src/views/approveManage/tradeApproval/list.vue b/src/views/approveManage/tradeApproval/list.vue
index 42524c7..1ba6586 100644
--- a/src/views/approveManage/tradeApproval/list.vue
+++ b/src/views/approveManage/tradeApproval/list.vue
@@ -14,9 +14,25 @@
             </el-select>
           </el-form-item>
           <el-form-item label="" class="col-17">
-            <el-select v-model="query.unitProject" placeholder="璇烽�夋嫨鍗曚綅宸ョ▼" clearable style="width: 100%">
-              <el-option v-for="item in unitProjectOptions" :key="item.value" :label="item.label" :value="item.value" />
-            </el-select>
+<!--            <el-select v-model="query.unitProject" placeholder="璇烽�夋嫨鍗曚綅宸ョ▼" clearable style="width: 100%">-->
+<!--              <el-option v-for="item in unitProjectOptions" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--            </el-select>-->
+            <el-tree-select
+                ref="areaIdTreeRef"
+                v-model="query.unitProject"
+                :data="unitProjectOptions"
+                placeholder="璇烽�夋嫨鍗曚綅宸ョ▼"
+                multiple
+                collapse-tags
+                collapse-tags-tooltip
+                clearable
+                :default-expand-all="true"
+                :render-after-expand="false"
+                show-checkbox
+                style="width: 170px;"
+                @change="importantAreaCh"
+                @clear="importantAreaClear"
+            />
           </el-form-item>
           <el-form-item label="浜ゆ槗鐘舵��" class="col-30">
             <el-select v-model="query.status" placeholder="鍏ㄩ儴" style="width: 100%">
@@ -317,6 +333,7 @@
 
 const router = useRouter()
 const userStore = useUserInfo()
+const areaIdTreeRef=ref()
 
 // 鐘舵�侀�夐」锛堟洿鏂颁负鏂扮殑宸ヤ綔娴佺▼鐘舵�侊級
 const statusOptions = [
@@ -339,9 +356,10 @@
 const query = reactive({
   productName: '',
   industry: '',
-  unitProject: '',
+  unitProject: [],
   productType: '',
   productSubType: '',
+  importantDistrictIdList: [],
   orderNo: '',
   status: '',
   dateRange: [],
@@ -396,6 +414,24 @@
   return 'currency'
 }
 
+const importantAreaCh=()=>{
+  let checkedKeys = areaIdTreeRef.value!.getCheckedNodes(false, true)
+  if(checkedKeys&&checkedKeys.length>0&& query.unitProject.length>0){
+    query.importantDistrictIdList=[]
+    checkedKeys.forEach((item:any)=>{
+      if(item.children&&item.children.length>0){
+        query.importantDistrictIdList.push(item.value)
+      }
+    })
+  }
+}
+
+const importantAreaClear=()=>{
+  query.unitProject = []
+  query.importantDistrictIdList = []
+  areaIdTreeRef.value.setCheckedKeys([])
+}
+
 // 鑾峰彇琛屼笟棰嗗煙閫夐」
 const getIndustryOptions = async () => {
   try {
@@ -435,14 +471,40 @@
   try {
     const res = await productApi.getCategoryByParent({ parentId: industryCode })
     if (res?.code === 200 && res.data) {
-      unitProjectOptions.value = res.data.map((item: any) => ({
-        label: item.name,
-        value: item.id
-      }))
+      unitProjectOptions.value = handleIndustryData(res.data)
     }
   } catch (error) {
     console.error('鑾峰彇鍗曚綅宸ョ▼閫夐」澶辫触:', error)
     unitProjectOptions.value = []
+  }
+}
+
+const handleIndustryData=(list:any)=>{
+  if(list&& list.length>0){
+    let data=list.map((item:any)=>{
+      return {
+        label:item.name,
+        value:item.id,
+        parentId:item.parentId,
+        parentName:item.parentName,
+        children:item.childrenList?handleIndustryChildData(item,item.childrenList):[]
+      }
+    })
+    return data
+  }
+}
+const handleIndustryChildData=(parentItem:any,childList:any)=>{
+  if(childList&& childList.length>0){
+    let data=childList.map((item:any)=>{
+      return {
+        parentId:parentItem.id,
+        parentName:parentItem.name,
+        label:item.name,
+        value:item.id,
+        children:item.childrenList?handleIndustryChildData(item,item.childrenList):[]
+      }
+    })
+    return data
   }
 }
 
@@ -595,12 +657,13 @@
   
   // 娣诲姞浜у搧鏉′欢鏌ヨ
   if (query.industry) payload.industryId = query.industry
-  if (query.unitProject) payload.unitProjectId = query.unitProject
+  if (query.unitProject.length > 0) payload.unitProjectId = query.unitProject
+  if (query.importantDistrictIdList.length > 0) payload.importantDistrictId = query.importantDistrictIdList
   if (query.productType) payload.productTypeId = query.productType
   if (query.productSubType) payload.productSubTypeId = query.productSubType
 
   // 鏍规嵁鏄惁鏈変骇鍝佹潯浠堕�夋嫨涓嶅悓鐨凙PI
-  const hasProductConditions = query.industry || query.unitProject || query.productType || query.productSubType
+  const hasProductConditions = query.industry || query.unitProject.length > 0 || query.productType || query.productSubType
   const apiMethod = hasProductConditions ? fetchApprovalPageWithProductConditions : fetchApprovalPage
   
   const res = (await apiMethod(payload)) as any
diff --git a/src/views/productManage/price/index.vue b/src/views/productManage/price/index.vue
index 6c6701c..bdf27a7 100644
--- a/src/views/productManage/price/index.vue
+++ b/src/views/productManage/price/index.vue
@@ -13,7 +13,7 @@
             <el-icon class="section-icon"><Goods /></el-icon>
             <span>浜у搧鍩烘湰淇℃伅</span>
           </div>
-          <div class="id-info">浜у搧ID锛歿{ currentProductId || '鏈彁渚�' }}</div>
+<!--          <div class="id-info">浜у搧ID锛歿{ currentProductId || '鏈彁渚�' }}</div>-->
         </div>
       </template>
 
@@ -856,7 +856,7 @@
 function handleToggleEnableStatus(row: any) {
   const newStatus = row.enableStatus === 'ENABLED' ? 'DISABLED' : 'ENABLED'
   ElMessageBox.confirm(
-    `纭瑕�${newStatus === 'ENABLED' ? '鍚敤' : '鍋滅敤'}璇ヤ环鏍�(ID: ${row.id})鍚楋紵`,
+    `纭瑕�${newStatus === 'ENABLED' ? '鍚敤' : '鍋滅敤'}璇ュ畾浠锋爣鍑嗗悧锛焋,
     '鐘舵�佸彉鏇�',
     { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', type: 'warning' }
   )
diff --git a/src/views/productManage/productPriceViewer/index.vue b/src/views/productManage/productPriceViewer/index.vue
index 2d9b05c..38cada1 100644
--- a/src/views/productManage/productPriceViewer/index.vue
+++ b/src/views/productManage/productPriceViewer/index.vue
@@ -548,6 +548,7 @@
   try {
     await removeFromCart(String(suite.id))
     orderSuites.value.splice(index, 1)
+    selectedSuiteIds.value.delete(suite.id)
   } catch (e) {
   }
 }
diff --git a/src/views/tradeManage/buyer/index.vue b/src/views/tradeManage/buyer/index.vue
index 84e7ce4..a483ff1 100644
--- a/src/views/tradeManage/buyer/index.vue
+++ b/src/views/tradeManage/buyer/index.vue
@@ -14,9 +14,25 @@
             </el-select>
           </el-form-item>
           <el-form-item label="" class="col-17">
-            <el-select v-model="query.unitProject" placeholder="璇烽�夋嫨鍗曚綅宸ョ▼" clearable style="width: 100%">
-              <el-option v-for="item in unitProjectOptions" :key="item.value" :label="item.label" :value="item.value" />
-            </el-select>
+<!--            <el-select v-model="query.unitProject" placeholder="璇烽�夋嫨鍗曚綅宸ョ▼" clearable style="width: 100%">-->
+<!--              <el-option v-for="item in unitProjectOptions" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--            </el-select>-->
+            <el-tree-select
+                ref="areaIdTreeRef"
+                v-model="query.unitProject"
+                :data="unitProjectOptions"
+                placeholder="璇烽�夋嫨鍗曚綅宸ョ▼"
+                multiple
+                collapse-tags
+                collapse-tags-tooltip
+                clearable
+                :default-expand-all="true"
+                :render-after-expand="false"
+                show-checkbox
+                style="width: 170px;"
+                @change="importantAreaCh"
+                @clear="importantAreaClear"
+            />
           </el-form-item>
           <el-form-item label="浜ゆ槗鐘舵��" class="col-30">
             <el-select v-model="query.status" placeholder="鍏ㄩ儴" style="width: 100%">
@@ -57,8 +73,8 @@
         <!-- 绗笁琛岋細鎿嶄綔鎸夐挳锛堝彸瀵归綈锛� -->
         <div class="form-row actions">
           <el-form-item class="row-actions">
-            <el-button type="primary" @click="handleSearch" :icon="Search">鏌ヨ</el-button>
-            <el-button @click="reset" :icon="Refresh">閲嶇疆</el-button>
+            <el-button type="primary" @click="handleSearch" icon="Search">鏌ヨ</el-button>
+            <el-button @click="reset" icon="Refresh">閲嶇疆</el-button>
           </el-form-item>
         </div>
       </el-form>
@@ -290,6 +306,8 @@
 const router = useRouter()
 const userStore = useUserInfo()
 
+const areaIdTreeRef=ref()
+
 // 鐘舵�侀�夐」锛堟洿鏂颁负鏂扮殑宸ヤ綔娴佺▼鐘舵�侊級
 const statusOptions = [
   { label: '鍏ㄩ儴', value: '' },
@@ -310,9 +328,10 @@
 const query = reactive({
   productName: '',
   industry: '',
-  unitProject: '',
+  unitProject: [],
   productType: '',
   productSubType: '',
+  importantDistrictIdList: [],
   orderNo: '',
   status: '',
   dateRange: [],
@@ -360,6 +379,25 @@
   return 'currency'
 }
 
+
+const importantAreaCh=()=>{
+  let checkedKeys = areaIdTreeRef.value!.getCheckedNodes(false, true)
+  if(checkedKeys&&checkedKeys.length>0&& query.unitProject.length>0){
+    query.importantDistrictIdList=[]
+    checkedKeys.forEach((item:any)=>{
+      if(item.children&&item.children.length>0){
+        query.importantDistrictIdList.push(item.value)
+      }
+    })
+  }
+}
+
+const importantAreaClear=()=>{
+  query.unitProject = []
+  query.importantDistrictIdList = []
+  areaIdTreeRef.value.setCheckedKeys([])
+}
+
 // 鑾峰彇琛屼笟棰嗗煙閫夐」
 const getIndustryOptions = async () => {
   try {
@@ -400,14 +438,40 @@
   try {
     const res = await productApi.getCategoryByParent({ parentId: industryCode })
     if (res?.code === 200 && res.data) {
-      unitProjectOptions.value = res.data.map((item: any) => ({
-        label: item.name,
-        value: item.id
-      }))
+      unitProjectOptions.value = handleIndustryData(res.data)
     }
   } catch (error) {
     console.error('鑾峰彇鍗曚綅宸ョ▼閫夐」澶辫触:', error)
     unitProjectOptions.value = []
+  }
+}
+
+const handleIndustryData=(list:any)=>{
+  if(list&& list.length>0){
+    let data=list.map((item:any)=>{
+      return {
+        label:item.name,
+        value:item.id,
+        parentId:item.parentId,
+        parentName:item.parentName,
+        children:item.childrenList?handleIndustryChildData(item,item.childrenList):[]
+      }
+    })
+    return data
+  }
+}
+const handleIndustryChildData=(parentItem:any,childList:any)=>{
+  if(childList&& childList.length>0){
+    let data=childList.map((item:any)=>{
+      return {
+        parentId:parentItem.id,
+        parentName:parentItem.name,
+        label:item.name,
+        value:item.id,
+        children:item.childrenList?handleIndustryChildData(item,item.childrenList):[]
+      }
+    })
+    return data
   }
 }
 
@@ -556,12 +620,13 @@
 
   // 娣诲姞浜у搧鏉′欢鏌ヨ
   if (query.industry) payload.industryId = query.industry
-  if (query.unitProject) payload.unitProjectId = query.unitProject
+  if (query.unitProject.length > 0) payload.unitProjectId = query.unitProject
+  if (query.importantDistrictIdList.length > 0) payload.importantDistrictId = query.importantDistrictIdList
   if (query.productType) payload.productTypeId = query.productType
   if (query.productSubType) payload.productSubTypeId = query.productSubType
 
   // 鏍规嵁鏄惁鏈変骇鍝佹潯浠堕�夋嫨涓嶅悓鐨凙PI
-  const hasProductConditions = query.industry || query.unitProject || query.productType || query.productSubType
+  const hasProductConditions = query.industry || query.unitProject.length > 0 || query.productType || query.productSubType
   const apiMethod = hasProductConditions ? orderApi.getBuyerOrderPageWithProductConditions : orderApi.getBuyerOrderPage
 
   const res = (await apiMethod(payload)) as any
diff --git a/src/views/tradeManage/detail/index.vue b/src/views/tradeManage/detail/index.vue
index 0f0b99d..d0cfb81 100644
--- a/src/views/tradeManage/detail/index.vue
+++ b/src/views/tradeManage/detail/index.vue
@@ -68,10 +68,16 @@
         </el-descriptions-item>
         <el-descriptions-item label="鎻愪緵鑰�">{{ detail.supplier }}</el-descriptions-item>
         <el-descriptions-item label="琛屼笟棰嗗煙">{{ detail.industry }}</el-descriptions-item>
-        <el-descriptions-item label="鍗曚綅宸ョ▼">{{ detail.projectUnit }}</el-descriptions-item>
+        <el-descriptions-item label="鍗曚綅宸ョ▼">
+          <el-tooltip effect="dark" :content="detail.projectUnit || '-'" placement="top" :disabled="!(detail.projectUnit && String(detail.projectUnit).trim())" popper-class="tooltip-wrap">
+            <div class="ellipsis-1">{{ detail.projectUnit || '-' }}</div>
+          </el-tooltip>
+        </el-descriptions-item>
         <el-descriptions-item label="浜у搧绫诲瀷">{{ detail.productType || '-' }}</el-descriptions-item>
         <el-descriptions-item label="浜у搧绠�浠�">
-          <div class="desc-wrap">{{ detail.productDesc }}</div>
+          <el-tooltip effect="dark" :content="detail.productDesc || '-'" placement="top" :disabled="!(detail.productDesc && String(detail.productDesc).trim())" popper-class="tooltip-wrap" trigger="click">
+            <div class="desc-wrap ellipsis-3">{{ detail.productDesc || '-' }}</div>
+          </el-tooltip>
         </el-descriptions-item>
       </el-descriptions>
 
@@ -1011,6 +1017,25 @@
   line-height: 22px;
 }
 
+/* 鍗曡鐪佺暐锛堢敤浜庘�滃崟浣嶅伐绋嬧�濓級 */
+.ellipsis-1 {
+  max-height: 22px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+/* 澶氳鐪佺暐锛堢敤浜庘�滀骇鍝佺畝浠嬧�濓紝鍥哄畾涓�3琛岋紝鍙寜闇�璋冩暣锛� */
+.ellipsis-3 {
+  display: -webkit-box;
+  line-clamp: 3;
+  -webkit-line-clamp: 3;
+  -webkit-box-orient: vertical;
+  overflow: hidden;
+}
+
+
+
 /* 瀹℃壒杩借釜鏍囩椤垫牱寮� */
 .approval-tabs {
   margin-top: 15px;
diff --git a/src/views/tradeManage/seller/index.vue b/src/views/tradeManage/seller/index.vue
index b3dfeb3..8c4f3db 100644
--- a/src/views/tradeManage/seller/index.vue
+++ b/src/views/tradeManage/seller/index.vue
@@ -14,9 +14,25 @@
             </el-select>
           </el-form-item>
           <el-form-item label="" class="col-17">
-            <el-select v-model="query.unitProject" placeholder="璇烽�夋嫨鍗曚綅宸ョ▼" clearable style="width: 100%">
-              <el-option v-for="item in unitProjectOptions" :key="item.value" :label="item.label" :value="item.value" />
-            </el-select>
+<!--            <el-select v-model="query.unitProject" placeholder="璇烽�夋嫨鍗曚綅宸ョ▼" clearable style="width: 100%">-->
+<!--              <el-option v-for="item in unitProjectOptions" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--            </el-select>-->
+            <el-tree-select
+                ref="areaIdTreeRef"
+                v-model="query.unitProject"
+                :data="unitProjectOptions"
+                placeholder="璇烽�夋嫨鍗曚綅宸ョ▼"
+                multiple
+                collapse-tags
+                collapse-tags-tooltip
+                clearable
+                :default-expand-all="true"
+                :render-after-expand="false"
+                show-checkbox
+                style="width: 170px;"
+                @change="importantAreaCh"
+                @clear="importantAreaClear"
+            />
           </el-form-item>
           <el-form-item label="浜у搧绫诲瀷" class="col-30">
             <el-select v-model="query.productType" placeholder="璇烽�夋嫨浜у搧绫诲瀷" clearable style="width: 100%" @change="handleProductTypeChange">
@@ -254,6 +270,7 @@
 
 const router = useRouter()
 const userStore = useUserInfo()
+const areaIdTreeRef=ref()
 
 // 鐘舵�侀�夐」锛堟洿鏂颁负鏂扮殑宸ヤ綔娴佺▼鐘舵�侊級
 const statusOptions = [
@@ -275,9 +292,10 @@
 const query = reactive({
   productName: '',
   industry: '',
-  unitProject: '',
+  unitProject: [],
   productType: '',
   productSubType: '',
+  importantDistrictIdList: [],
   orderNo: '',
   status: '',
   dateRange: [],
@@ -363,14 +381,40 @@
   try {
     const res = await productApi.getCategoryByParent({ parentId: industryCode })
     if (res?.code === 200 && res.data) {
-      unitProjectOptions.value = res.data.map((item: any) => ({
-        label: item.name,
-        value: item.id
-      }))
+      unitProjectOptions.value = handleIndustryData(res.data)
     }
   } catch (error) {
     console.error('鑾峰彇鍗曚綅宸ョ▼閫夐」澶辫触:', error)
     unitProjectOptions.value = []
+  }
+}
+
+const handleIndustryData=(list:any)=>{
+  if(list&& list.length>0){
+    let data=list.map((item:any)=>{
+      return {
+        label:item.name,
+        value:item.id,
+        parentId:item.parentId,
+        parentName:item.parentName,
+        children:item.childrenList?handleIndustryChildData(item,item.childrenList):[]
+      }
+    })
+    return data
+  }
+}
+const handleIndustryChildData=(parentItem:any,childList:any)=>{
+  if(childList&& childList.length>0){
+    let data=childList.map((item:any)=>{
+      return {
+        parentId:parentItem.id,
+        parentName:parentItem.name,
+        label:item.name,
+        value:item.id,
+        children:item.childrenList?handleIndustryChildData(item,item.childrenList):[]
+      }
+    })
+    return data
   }
 }
 
@@ -394,6 +438,24 @@
   }
 }
 
+const importantAreaCh=()=>{
+  let checkedKeys = areaIdTreeRef.value!.getCheckedNodes(false, true)
+  if(checkedKeys&&checkedKeys.length>0&& query.unitProject.length>0){
+    query.importantDistrictIdList=[]
+    checkedKeys.forEach((item:any)=>{
+      if(item.children&&item.children.length>0){
+        query.importantDistrictIdList.push(item.value)
+      }
+    })
+  }
+}
+
+const importantAreaClear=()=>{
+  query.unitProject = []
+  query.importantDistrictIdList = []
+  areaIdTreeRef.value.setCheckedKeys([])
+}
+
 // 澶勭悊琛屼笟棰嗗煙鍙樺寲
 const handleIndustryChange = async (value: string) => {
   // 娓呯┖鍗曚綅宸ョ▼閫夋嫨
@@ -409,8 +471,6 @@
   // 鑾峰彇瀵瑰簲鐨勪骇鍝佸瓙绾ч�夐」
  // await getProductSubTypeOptions(value)
 }
-
-
 
 // 鑾峰彇鐘舵�佺被鍨�
 const getStatusType = (status: string) => {
@@ -525,12 +585,13 @@
 
     // 娣诲姞浜у搧鏉′欢鏌ヨ
     if (query.industry) payload.industryId = query.industry
-    if (query.unitProject) payload.unitProjectId = query.unitProject
+    if (query.unitProject.length > 0) payload.unitProjectId = query.unitProject
+    if (query.importantDistrictIdList.length > 0) payload.importantDistrictId = query.importantDistrictIdList
     if (query.productType) payload.productTypeId = query.productType
     if (query.productSubType) payload.productSubTypeId = query.productSubType
 
     // 鏍规嵁鏄惁鏈変骇鍝佹潯浠堕�夋嫨涓嶅悓鐨凙PI
-    const hasProductConditions = query.industry || query.unitProject || query.productType || query.productSubType
+    const hasProductConditions = query.industry || query.unitProject.length > 0 || query.productType || query.productSubType
     const apiMethod = hasProductConditions ? orderApi.getSellerOrderPageWithProductConditions : orderApi.getSellerOrderPage
 
     const res = (await apiMethod(payload)) as any
diff --git a/vite.config.ts b/vite.config.ts
index 399f173..79f3ce3 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -33,7 +33,7 @@
       // target:'http://10.209.233.16/admin',//淇″垱姝e紡
       // target: 'http://36.133.126.111:7099/api', //娴嬭瘯
       // target: 'https://zynlpt.ccccltd.cn/admin', // 姝e紡  (瑕佹墦寮�changeOrigin鍜宺ewrite)
-      //   target: 'http://localhost:8089',
+       //  target: 'http://localhost:8089',
        target: 'http://36.133.126.111:7099/trade-api',
       changeOrigin: true, // 鍏佽璺ㄥ煙
       rewrite: (path) => path.replace(/^\/api/, '/'), //杩炴祴璇曠幆澧冭娉ㄩ噴杩欒锛岃繛鍚庣涓汉鍒欐墦寮�

--
Gitblit v1.8.0