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] 修改买家中心卖家中心产品类型等条件查询问题

---
 src/views/approveManage/tradeApproval/list.vue |   88 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 76 insertions(+), 12 deletions(-)

diff --git a/src/views/approveManage/tradeApproval/list.vue b/src/views/approveManage/tradeApproval/list.vue
index dda1fe7..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
@@ -622,7 +685,8 @@
       status: uiStatus,
       statusName: order.orderStatus || '',
       orderStatus: StatusMapper.toUIStatus(order.orderStatus), // 杞崲涓烘爣鍑嗙姸鎬佹灇涓�
-      workFlowId: order.workflowId || ''
+      workFlowId: order.workflowId || '',
+      taskId: order.taskId || ''
     }
 
     const subOrders: any[] = Array.isArray(order?.orderDetails)
@@ -725,7 +789,7 @@
 
 // 鎺堟潈锛氳烦杞埌鎺堟潈椤甸潰
 const toAuthorize = (row: any) => {
-  router.push({ name: 'tradeAuthorization', params: { id: row.id } })
+  router.push({ name: 'tradeAuthorization', params: { id: row.id, taskId: row.taskId } })
 }
 
 onMounted(async ()=>{

--
Gitblit v1.8.0