From 8a709ba6db50831048f9c3e2452ea6dc6c3de36f Mon Sep 17 00:00:00 2001
From: Bang Hu <hu_bang@hotmail.com>
Date: 星期五, 12 九月 2025 15:45:33 +0800
Subject: [PATCH] bug修改代码提交

---
 src/views/approveManage/tradeApproval/list.vue |  660 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 556 insertions(+), 104 deletions(-)

diff --git a/src/views/approveManage/tradeApproval/list.vue b/src/views/approveManage/tradeApproval/list.vue
index cc335ab..fcb656c 100644
--- a/src/views/approveManage/tradeApproval/list.vue
+++ b/src/views/approveManage/tradeApproval/list.vue
@@ -9,14 +9,30 @@
             <el-input v-model="query.productName" placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�" clearable style="width: 100%" />
           </el-form-item>
           <el-form-item label="琛屼笟棰嗗煙" class="col-25">
-            <el-select v-model="query.industry" placeholder="璇烽�夋嫨琛屼笟棰嗗煙" clearable style="width: 100%">
+            <el-select v-model="query.industry" placeholder="璇烽�夋嫨琛屼笟棰嗗煙" clearable style="width: 100%" @change="handleIndustryChange">
               <el-option v-for="item in industryOptions" :key="item.value" :label="item.label" :value="item.value" />
             </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%">
@@ -31,15 +47,15 @@
             <el-input v-model="query.orderNo" placeholder="璇疯緭鍏ヨ鍗曠紪鍙�" clearable style="width: 100%" />
           </el-form-item>
           <el-form-item label="浜у搧绫诲瀷" class="col-25">
-            <el-select v-model="query.productType" placeholder="璇烽�夋嫨浜у搧绫诲瀷" clearable style="width: 100%">
+            <el-select v-model="query.productType" placeholder="璇烽�夋嫨浜у搧绫诲瀷" clearable style="width: 100%" @change="handleProductTypeChange">
               <el-option v-for="item in productTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
             </el-select>
           </el-form-item>
-          <el-form-item label="" class="col-17">
-            <el-select v-model="query.productSubType" placeholder="璇烽�夋嫨浜у搧绫诲瀷瀛愮骇" clearable style="width: 100%">
-              <el-option v-for="item in productSubTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
-            </el-select>
-          </el-form-item>
+<!--          <el-form-item label="" class="col-17">-->
+<!--            <el-select v-model="query.productSubType" placeholder="璇烽�夋嫨浜у搧绫诲瀷瀛愮骇" clearable style="width: 100%">-->
+<!--              <el-option v-for="item in productSubTypeOptions" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--            </el-select>-->
+<!--          </el-form-item>-->
           <el-form-item label="鐢宠鏃堕棿" class="col-30">
             <el-date-picker
               v-model="query.dateRange"
@@ -57,12 +73,54 @@
         <!-- 绗笁琛岋細鎿嶄綔鎸夐挳锛堝彸瀵归綈锛� -->
         <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>
     </el-card>
+
+    <div class="buttonDiv">
+      <el-row>
+        <el-col :span="6" style="margin-top: 10px"> </el-col>
+        <el-col :span="18" align="right" style="margin-top: 10px">
+          <div class="btnBox">
+            <div
+                class="btnDiv"
+                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_point0' }"
+                @click="btnClick('0','trade_point')"
+            >
+              <span class="numjx">绉垎寰呭姙</span>
+              <span class="count-num">({{ workFlowStatus.tradePointDealData }})</span>
+            </div>
+            <div
+                class="btnDiv"
+                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_point1' }"
+                @click="btnClick('1','trade_point')"
+            >
+              <span class="numjx">绉垎宸插姙</span>
+              <span class="count-num">({{ workFlowStatus.tradePointCompletedData }})</span>
+            </div>
+            <div
+                class="btnDiv"
+                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_agreement0' }"
+                @click="btnClick('0','trade_agreement')"
+            >
+              <span class="numjx">鍗忚寰呭姙</span>
+              <span class="count-num">({{ workFlowStatus.tradeAgreementDealData }})</span>
+            </div>
+            <div
+                class="btnDiv"
+                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_agreement1' }"
+                @click="btnClick('1','trade_agreement')"
+            >
+              <span class="numjx">鍗忚宸插姙</span>
+              <span class="count-num">({{ workFlowStatus.tradeAgreementCompletedData }})</span>
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </div>
 
     <!-- 璁㈠崟鍒楄〃鍖哄煙 -->
     <el-card class="mt15" shadow="never">
@@ -74,9 +132,6 @@
               <template #default="{ row }">
                 <div v-if="row.isMainOrder" class="main-order-info">
                   <div class="order-header">
-                    <div class="order-item status-item">
-                      <el-tag :type="getStatusType(row.status)" size="small">{{ row.statusName }}</el-tag>
-                    </div>
                     <div class="order-item">
                       <span class="label">鐢宠鏃堕棿:</span>
                       <span class="value">{{ row.applyTime }}</span>
@@ -92,6 +147,9 @@
                     <div class="order-item">
                       <span class="label">渚涘簲鏂�:</span>
                       <span class="value">{{ row.supplySide }}</span>
+                    </div>
+                    <div class="order-item status-item">
+                      <el-tag :type="getStatusType(row.status)" size="small">{{ row.statusName }}</el-tag>
                     </div>
                   </div>
                 </div>
@@ -141,9 +199,9 @@
             </el-table-column>
           </el-table-column>
           
-          <!-- 鎬讳环 -->
-          <el-table-column label="鎬讳环" align="center">
-            <el-table-column label="鍗曚环" prop="unitPrice" width="90">
+          <!-- 鍗曚环锛堜笌鈥滄湡闄�(骞�)鈥濅繚鎸佺浉鍚岀殑鐖跺瓙琛ㄥご缁撴瀯锛� -->
+          <el-table-column label="鍗曚环" align="center" width="80">
+            <el-table-column label="" prop="unitPrice" width="80">
               <template #default="{ row }">
                 <div v-if="row.isSpacer" class="spacer-cell"></div>
                 <div v-else-if="!row.isMainOrder" class="price-info">
@@ -162,7 +220,11 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="鏁伴噺" prop="quantity" width="50">
+          </el-table-column>
+
+          <!-- 鏁伴噺锛堜笌鈥滄湡闄�(骞�)鈥濅繚鎸佺浉鍚岀殑鐖跺瓙琛ㄥご缁撴瀯锛� -->
+          <el-table-column label="鏁伴噺" align="center" width="80">
+            <el-table-column label="" prop="quantity" width="80" align="center">
               <template #default="{ row }">
                 <div v-if="row.isSpacer" class="spacer-cell"></div>
                 <div v-else-if="!row.isMainOrder" class="quantity">{{ row.quantity }}</div>
@@ -172,7 +234,7 @@
           
           <!-- 鏈熼檺(骞�) -->
           <el-table-column label="鏈熼檺(骞�)" align="center" width="80">
-            <el-table-column label="" prop="period" width="80">
+            <el-table-column label="" prop="period" width="80" align="center">
               <template #default="{ row }">
                 <div v-if="row.isSpacer" class="spacer-cell"></div>
                 <div v-else-if="!row.isMainOrder" class="period-info">
@@ -194,16 +256,7 @@
                       <div class="action-buttons">
                         <template v-for="action in getAvailableActions(row.parentOrder)" :key="action.type">
                           <el-button 
-                            v-if="action.type === ActionType.AUTHORIZE"
-                            type="primary" 
-                            link 
-                            size="small" 
-                            @click="handleAction(action, row.parentOrder)"
-                          >
-                            鎺堟潈
-                          </el-button>
-                          <el-button 
-                            v-else-if="action.type === ActionType.VIEW"
+                            v-if="action.type === ActionType.VIEW"
                             type="primary" 
                             link 
                             size="small" 
@@ -219,6 +272,25 @@
                             @click="handleAction(action, row.parentOrder)"
                           >
                             杩借釜
+                          </el-button>
+                          <el-button 
+                            v-else-if="action.type === ActionType.AUTHORIZE"
+                            type="primary" 
+                            link 
+                            size="small" 
+                            @click="handleAction(action, row.parentOrder)"
+                          >
+                            鎺堟潈
+                          </el-button>
+                          <el-button
+                              v-else-if="action.type === ActionType.WAIT_APPROVAL_AUTHORIZE"
+                              type="primary"
+                              link
+                              size="small"
+                              @click="handleAction(action, row.parentOrder)"
+                          >
+
+                            瀹℃壒
                           </el-button>
                         </template>
                       </div>
@@ -246,26 +318,26 @@
     </el-card>
     
     <!-- 璁㈠崟鐘舵�佸璇濇 -->
-    <ProductOrderStatusDialog 
-      v-model="orderStatusDialogVisible" 
-      :order-id="currentOrderId" 
-    />
+<!--    <ProductOrderStatusDialog -->
+<!--      v-model="orderStatusDialogVisible" -->
+<!--      :order-id="currentOrderId" -->
+<!--    />-->
   </div>
 </template>
 
 <script setup lang="ts">
 import { onMounted, reactive, ref } from 'vue'
 import { useRouter } from 'vue-router'
-import { Search, Refresh } from '@element-plus/icons-vue'
-import { fetchApprovalPage } from '@/api/approvalManage'
-import orderApi from '@/api/orderApi'
-import { authorizeApproval, fetchApprovalByOrderId } from '@/api/approvalManage'
+import { ElMessage } from 'element-plus'
+import { fetchApprovalPage, fetchApprovalPageWithProductConditions } from '@/api/approvalManage'
+import productApi from '@/api/productApi'
 import { useUserInfo } from '@/stores/modules/userInfo'
-import ProductOrderStatusDialog from '@/views/productManage/productOrderStatusDialog/index.vue'
 import { OrderWorkflowController, OrderStatus, ActionType, PageType, StatusMapper } from '@/utils/orderWorkflow'
+import { queryUserDetail } from '@/api/userInfo'
 
 const router = useRouter()
 const userStore = useUserInfo()
+const areaIdTreeRef=ref<any>()
 
 // 鐘舵�侀�夐」锛堟洿鏂颁负鏂扮殑宸ヤ綔娴佺▼鐘舵�侊級
 const statusOptions = [
@@ -277,46 +349,23 @@
   { label: '宸茶瘎浠�', value: 'EVALUATED' },
 ]
 
-// 琛屼笟棰嗗煙閫夐」
-const industryOptions = [
-  { label: '寤虹瓚宸ョ▼', value: 'construction' },
-  { label: '浜ら�氬伐绋�', value: 'transportation' },
-  { label: '姘村埄宸ョ▼', value: 'water' },
-  { label: '鐢靛姏宸ョ▼', value: 'power' },
-]
-
-// 鍗曚綅宸ョ▼閫夐」
-const unitProjectOptions = [
-  { label: '鍦熷缓宸ョ▼', value: 'civil' },
-  { label: '瀹夎宸ョ▼', value: 'installation' },
-  { label: '瑁呴グ宸ョ▼', value: 'decoration' },
-]
-
-// 浜у搧绫诲瀷閫夐」
-const productTypeOptions = [
-  { label: '浼佷笟绉佹湁SaaS鐗堣鍙�', value: 'enterprise_private' },
-  { label: '浼佷笟鍏湁SaaS鐗堣鍙�', value: 'enterprise_public' },
-  { label: '椤圭洰鍏湁SaaS鐗堣鍙�', value: 'project_public' },
-  { label: '涓汉鍏湁SaaS鐗堣鍙�', value: 'personal_public' },
-]
-
-// 浜у搧绫诲瀷瀛愮骇閫夐」
-const productSubTypeOptions = [
-  { label: '鍩虹鐗�', value: 'basic' },
-  { label: '鏍囧噯鐗�', value: 'standard' },
-  { label: '楂樼骇鐗�', value: 'premium' },
-]
+// 鍔ㄦ�侀�夐」鏁版嵁
+const industryOptions = ref<any[]>([])
+const unitProjectOptions = ref<any[]>([])
+const productTypeOptions = ref<any[]>([])
+const productSubTypeOptions = ref<any[]>([])
 
 // 鏌ヨ鏉′欢
 const query = reactive({
   productName: '',
   industry: '',
-  unitProject: '',
+  unitProject: [] as string[],
   productType: '',
   productSubType: '',
+  importantDistrictIdList: [] as string[],
   orderNo: '',
   status: '',
-  dateRange: [],
+  dateRange: [] as string[],
 })
 
 // 鍒嗛〉淇℃伅
@@ -328,6 +377,17 @@
 // 璁㈠崟鐘舵�佸璇濇鐩稿叧
 const orderStatusDialogVisible = ref(false)
 const currentOrderId = ref<string>('')
+
+const workFlowStatus = reactive<any>({
+  btnClassShow: 'trade_point0',
+  workFlowType: 0,
+  businessType: 'trade_point', // trade_point
+  // 璁㈠崟鏁伴噺缁熻
+  tradePointDealData: 1,    // 绉垎寰呭姙鏁伴噺 - 涓存椂娴嬭瘯鏁版嵁
+  tradePointCompletedData: 0, // 绉垎宸插姙鏁伴噺
+  tradeAgreementDealData: 2,  // 鍗忚寰呭姙鏁伴噺 - 涓存椂娴嬭瘯鏁版嵁
+  tradeAgreementCompletedData: 0 // 鍗忚宸插姙鏁伴噺
+})
 
 // 浣跨敤宸ヤ綔娴佺▼鎺у埗鍣ㄧ殑鐘舵�佹槧灏�
 const statusUiToServer: Record<string, string> = {
@@ -344,6 +404,7 @@
   [OrderStatus.WAIT_CONFIRM]: 'WAIT_CONFIRM',
   [OrderStatus.COMPLETED]: 'COMPLETED',
   [OrderStatus.EVALUATED]: 'EVALUATED',
+  [OrderStatus.CANCELED]: 'CANCELED'
 }
 
 const formatDateTime = (val?: string) => {
@@ -361,6 +422,136 @@
   return 'currency'
 }
 
+const importantAreaCh=()=>{
+  let checkedKeys = areaIdTreeRef.value!.getCheckedNodes(false, true)
+  if(checkedKeys&&checkedKeys.length>0&& query.unitProject.length>0){
+    query.importantDistrictIdList=[] as string[]
+    checkedKeys.forEach((item:any)=>{
+      if(item.children&&item.children.length>0){
+        query.importantDistrictIdList.push(item.value)
+      }
+    })
+  }
+}
+
+const importantAreaClear=()=>{
+  query.unitProject = [] as string[]
+  query.importantDistrictIdList = [] as string[]
+  areaIdTreeRef.value.setCheckedKeys([])
+}
+
+// 鑾峰彇琛屼笟棰嗗煙閫夐」
+const getIndustryOptions = async () => {
+  try {
+    const res = await productApi.getCategoryByParent({ parentCode: 'business_direction' })
+    if (res?.code === 200 && res.data) {
+      industryOptions.value = res.data.map((item: any) => ({
+        label: item.name,
+        value: item.id
+      }))
+    }
+  } catch (error) {
+    console.error('鑾峰彇琛屼笟棰嗗煙閫夐」澶辫触:', error)
+  }
+}
+
+// 鑾峰彇浜у搧绫诲瀷閫夐」
+const getProductTypeOptions = async () => {
+  try {
+    const res = await productApi.getCategoryByParent({ parentCode: 'ProductTechnologyType' })
+    if (res?.code === 200 && res.data) {
+      productTypeOptions.value = res.data.map((item: any) => ({
+        label: item.name,
+        value: item.id
+      }))
+    }
+  } catch (error) {
+    console.error('鑾峰彇浜у搧绫诲瀷閫夐」澶辫触:', error)
+  }
+}
+
+// 鏍规嵁琛屼笟棰嗗煙鑾峰彇鍗曚綅宸ョ▼閫夐」
+const getUnitProjectOptions = async (industryCode: string) => {
+  if (!industryCode) {
+    unitProjectOptions.value = []
+    return
+  }
+  try {
+    const res = await productApi.getCategoryByParent({ parentId: industryCode })
+    if (res?.code === 200 && res.data) {
+      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
+  }
+}
+
+// 鏍规嵁浜у搧绫诲瀷鑾峰彇浜у搧瀛愮骇閫夐」
+const getProductSubTypeOptions = async (productTypeCode: string) => {
+  if (!productTypeCode) {
+    productSubTypeOptions.value = []
+    return
+  }
+  try {
+    const res = await productApi.getCategoryByParent({ parentId: productTypeCode })
+    if (res?.code === 200 && res.data) {
+      productSubTypeOptions.value = res.data.map((item: any) => ({
+        label: item.name,
+        value: item.id
+      }))
+    }
+  } catch (error) {
+    console.error('鑾峰彇浜у搧瀛愮骇閫夐」澶辫触:', error)
+    productSubTypeOptions.value = []
+  }
+}
+
+// 澶勭悊琛屼笟棰嗗煙鍙樺寲
+const handleIndustryChange = async (value: string) => {
+  // 娓呯┖鍗曚綅宸ョ▼閫夋嫨
+  query.unitProject = [] as string[]
+  // 鑾峰彇瀵瑰簲鐨勫崟浣嶅伐绋嬮�夐」
+  await getUnitProjectOptions(value)
+}
+
+// 澶勭悊浜у搧绫诲瀷鍙樺寲
+const handleProductTypeChange = async (value: string) => {
+  // 娓呯┖浜у搧瀛愮骇閫夋嫨
+  query.productSubType = ''
+  // 鑾峰彇瀵瑰簲鐨勪骇鍝佸瓙绾ч�夐」
+  // await getProductSubTypeOptions(value)
+}
+
 // 鑾峰彇鐘舵�佺被鍨�
 const getStatusType = (status: string) => {
   const statusMap: Record<string, 'warning' | 'danger' | 'success' | 'info'> = {
@@ -369,6 +560,7 @@
     WAIT_CONFIRM: 'warning',
     COMPLETED: 'success',
     EVALUATED: 'success',
+    CANCELED: 'danger'
   }
   return statusMap[status] || 'info'
 }
@@ -452,6 +644,116 @@
   }
 }
 
+// 鏍规嵁褰撳墠閫変腑鐨勬寜閽被鍨嬫洿鏂板搴旂殑鏁伴噺
+const updateButtonCount = (total: number) => {
+  const { workFlowType, businessType } = workFlowStatus
+  
+  console.log('updateButtonCount 琚皟鐢�:', {
+    total: total,
+    workFlowType: workFlowType,
+    businessType: businessType,
+    currentButton: `${businessType}${workFlowType}`
+  })
+  
+  if (businessType === 'trade_point') {
+    if (workFlowType == 0) { // 浣跨敤 == 鑰屼笉鏄� === 鏉ュ鐞嗗瓧绗︿覆鍜屾暟瀛楃殑姣旇緝
+      // 绉垎寰呭姙
+      workFlowStatus.tradePointDealData = total
+      console.log('鏇存柊绉垎寰呭姙鏁伴噺涓�:', total)
+    } else if (workFlowType == 1) { // 浣跨敤 == 鑰屼笉鏄� === 鏉ュ鐞嗗瓧绗︿覆鍜屾暟瀛楃殑姣旇緝
+      // 绉垎宸插姙
+      workFlowStatus.tradePointCompletedData = total
+      console.log('鏇存柊绉垎宸插姙鏁伴噺涓�:', total)
+    }
+  } else if (businessType === 'trade_agreement') {
+    if (workFlowType == 0) { // 浣跨敤 == 鑰屼笉鏄� === 鏉ュ鐞嗗瓧绗︿覆鍜屾暟瀛楃殑姣旇緝
+      // 鍗忚寰呭姙
+      workFlowStatus.tradeAgreementDealData = total
+      console.log('鏇存柊鍗忚寰呭姙鏁伴噺涓�:', total)
+    } else if (workFlowType == 1) { // 浣跨敤 == 鑰屼笉鏄� === 鏉ュ鐞嗗瓧绗︿覆鍜屾暟瀛楃殑姣旇緝
+      // 鍗忚宸插姙
+      workFlowStatus.tradeAgreementCompletedData = total
+      console.log('鏇存柊鍗忚宸插姙鏁伴噺涓�:', total)
+    }
+  }
+  
+  console.log('鏇存柊鍚庣殑鎸夐挳鏁伴噺:', {
+    tradePointDealData: workFlowStatus.tradePointDealData,
+    tradePointCompletedData: workFlowStatus.tradePointCompletedData,
+    tradeAgreementDealData: workFlowStatus.tradeAgreementDealData,
+    tradeAgreementCompletedData: workFlowStatus.tradeAgreementCompletedData
+  })
+}
+
+// 鑾峰彇璁㈠崟缁熻鏁版嵁锛堢敤浜庡垵濮嬪寲鍜屾潯浠舵煡璇㈠悗鏇存柊锛�
+const getOrderCounts = async () => {
+  try {
+    // 鑾峰彇缁熻鏁版嵁鏃朵娇鐢ㄥ綋鍓嶇殑鎼滅储鏉′欢锛屼絾涓嶅寘鎷姸鎬佺瓫閫�
+    const getCountForType = async (workFlowType: number, businessType: string) => {
+      const payload: any = {
+        pageNum: 1,
+        pageSize: 10, // 涓巋andleSearch淇濇寔涓�鑷�
+        userId: userStore.getUserId,
+        unitId: userStore.getUnitId,
+        workFlowType: workFlowType,
+        businessType: businessType,
+        departmentId: userStore.getDepartmentId
+      }
+      
+      // 娣诲姞浜у搧鏉′欢鏌ヨ锛堜笌handleSearch瀹屽叏淇濇寔涓�鑷达級
+      if (query.industry) payload.industryId = query.industry
+      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
+      if (query.productName) payload.productName = query.productName
+      if (query.orderNo) payload.orderId = query.orderNo
+      // 鍖呭惈鐘舵�佺瓫閫夋潯浠讹紝纭繚缁熻鏁版嵁鍙嶆槧褰撳墠鐨勭瓫閫夋潯浠�
+      if (query.status) payload.orderStatus = statusUiToServer[query.status]
+      if (Array.isArray(query.dateRange) && query.dateRange.length === 2) {
+        payload.applyTimeStart = query.dateRange[0]
+        payload.applyTimeEnd = query.dateRange[1]
+      }
+
+      // 鏍规嵁鏄惁鏈変骇鍝佹潯浠堕�夋嫨涓嶅悓鐨凙PI锛堜笌handleSearch淇濇寔涓�鑷达級
+      const hasProductConditions = query.industry || query.unitProject.length > 0 || query.productType || query.productSubType
+      const apiMethod = hasProductConditions ? fetchApprovalPageWithProductConditions : fetchApprovalPage
+      
+      console.log(`缁熻鏁版嵁-${businessType}${workFlowType}鏌ヨ鍙傛暟:`, payload)
+      const res = await apiMethod(payload) as any
+      console.log(`缁熻鏁版嵁-${businessType}${workFlowType}API鍝嶅簲:`, res)
+      return res?.data?.total || 0
+    }
+
+    // 骞惰鑾峰彇鎵�鏈夌粺璁℃暟鎹�
+    const [pointDealCount, pointCompletedCount, agreementDealCount, agreementCompletedCount] = await Promise.all([
+      getCountForType(0, 'trade_point'),    // 绉垎寰呭姙
+      getCountForType(1, 'trade_point'),    // 绉垎宸插姙
+      getCountForType(0, 'trade_agreement'), // 鍗忚寰呭姙
+      getCountForType(1, 'trade_agreement')  // 鍗忚宸插姙
+    ])
+
+    workFlowStatus.tradePointDealData = pointDealCount
+    workFlowStatus.tradePointCompletedData = pointCompletedCount
+    workFlowStatus.tradeAgreementDealData = agreementDealCount
+    workFlowStatus.tradeAgreementCompletedData = agreementCompletedCount
+
+    console.log('鏇存柊鍚庣殑缁熻鏁版嵁:', {
+      tradePointDealData: workFlowStatus.tradePointDealData,
+      tradePointCompletedData: workFlowStatus.tradePointCompletedData,
+      tradeAgreementDealData: workFlowStatus.tradeAgreementDealData,
+      tradeAgreementCompletedData: workFlowStatus.tradeAgreementCompletedData
+    })
+  } catch (error) {
+    console.error('鑾峰彇缁熻鏁版嵁澶辫触:', error)
+    // 濡傛灉鑾峰彇澶辫触锛屼娇鐢ㄩ粯璁ゅ��
+    workFlowStatus.tradePointDealData = 0
+    workFlowStatus.tradePointCompletedData = 0
+    workFlowStatus.tradeAgreementDealData = 0
+    workFlowStatus.tradeAgreementCompletedData = 0
+  }
+}
+
 // 鎼滅储澶勭悊锛堟帴鍏ョ湡瀹炲悗绔級
 const handleSearch = async () => {
   const payload: any = {
@@ -459,48 +761,60 @@
     pageSize: page.size,
     productName: query.productName || undefined,
     orderId: query.orderNo || undefined,
+    userId: userStore.getUserId,
+    unitId: userStore.getUnitId,
+    workFlowType: workFlowStatus.workFlowType,
+    businessType: workFlowStatus.businessType,
+    departmentId: userStore.getDepartmentId
   }
   if (query.status) payload.orderStatus = statusUiToServer[query.status]
   if (Array.isArray(query.dateRange) && query.dateRange.length === 2) {
     payload.applyTimeStart = query.dateRange[0]
     payload.applyTimeEnd = query.dateRange[1]
   }
+  
+  // 娣诲姞浜у搧鏉′欢鏌ヨ
+  if (query.industry) payload.industryId = query.industry
+  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
 
-  const res = (await fetchApprovalPage(payload)) as any
+  // 鏍规嵁鏄惁鏈変骇鍝佹潯浠堕�夋嫨涓嶅悓鐨凙PI
+  const hasProductConditions = query.industry || query.unitProject.length > 0 || query.productType || query.productSubType
+  const apiMethod = hasProductConditions ? fetchApprovalPageWithProductConditions : fetchApprovalPage
+  
+  const res = (await apiMethod(payload)) as any
   const pageData = res?.data
   const list: any[] = Array.isArray(pageData?.list) ? pageData.list : []
   page.total = Number(pageData?.total || 0)
+  
+  console.log('鎼滅储鍙傛暟:', payload)
+  console.log('API鍝嶅簲:', res)
+  console.log('鍒楄〃鏁版嵁:', list)
+  console.log('鎬昏褰曟暟:', page.total)
+  console.log('褰撳墠椤佃褰曟暟:', list.length)
 
-  // 骞跺彂鑾峰彇姣忎釜璁㈠崟鐨勮鎯咃紙鐢ㄤ簬鏋勯�犲瓙璁㈠崟琛岋級
-  const detailsArr = await Promise.all(
-    list.map(async (order: any) => {
-      try {
-        const detailRes = (await orderApi.getOrderDetail(order.orderId)) as any
-        return detailRes?.data
-      } catch (e) {
-        return null
-      }
-    })
-  )
 
-      const flatData: any[] = []
-    list.forEach((order: any, idx: number) => {
-      const uiStatus = statusServerToUi[order.orderStatus] || 'WAIT_UPLOAD'
-      const mainRow: any = {
-        id: order.orderId,
-        isMainOrder: true,
-        applyTime: formatDateTime(order.applyTime || ''),
-        orderNo: order.orderId,
-        demandSide: '',
-        supplySide: order.providerName || '',
-        status: uiStatus,
-        statusName: order.orderStatus || '',
-        orderStatus: StatusMapper.toUIStatus(order.orderStatus), // 杞崲涓烘爣鍑嗙姸鎬佹灇涓�
-      }
+  const flatData: any[] = []
+  list.forEach((order: any, idx: number) => {
+    const uiStatus = statusServerToUi[order.orderStatus] || 'WAIT_UPLOAD'
+    const mainRow: any = {
+      id: order.orderId,
+      isMainOrder: true,
+      applyTime: formatDateTime(order.applyTime || ''),
+      orderNo: order.orderId,
+      demandSide: '',
+      supplySide: order.providerName || '',
+      status: uiStatus,
+      statusName: order.orderStatus || '',
+      orderStatus: StatusMapper.toUIStatus(order.orderStatus), // 杞崲涓烘爣鍑嗙姸鎬佹灇涓�
+      workFlowId: order.workflowId || '',
+      taskId: order.taskId || ''
+    }
 
-    const detail = detailsArr[idx]
-    const subOrders: any[] = Array.isArray(detail?.orderDetails)
-      ? detail.orderDetails.map((d: any, i: number) => ({
+    const subOrders: any[] = Array.isArray(order?.orderDetails)
+      ? order?.orderDetails.map((d: any, i: number) => ({
           id: `${order.orderId}-${i + 1}`,
           isMainOrder: false,
           productName: order.productName || '',
@@ -525,6 +839,18 @@
   })
 
   orderList.value = flatData
+  
+  // 鏉′欢鏌ヨ鍚庯紝閲嶆柊鑾峰彇鎵�鏈�4绉嶇被鍨嬬殑璁㈠崟鎬绘暟骞舵洿鏂版寜閽樉绀�
+  await getOrderCounts()
+}
+
+const btnClick = (workFlowType?: any,businessType?: any) => {
+  workFlowStatus.btnClassShow = businessType+workFlowType
+  workFlowStatus.workFlowType = Number(workFlowType) // 纭繚杞崲涓烘暟瀛楃被鍨�
+  workFlowStatus.businessType = businessType
+
+  // 鑾峰彇list鏁版嵁
+  handleSearch()
 }
 
 // 閲嶇疆
@@ -532,13 +858,16 @@
   Object.assign(query, {
     productName: '',
     industry: '',
-    unitProject: '',
+    unitProject: [],
     productType: '',
     productSubType: '',
     orderNo: '',
     status: '',
     dateRange: [],
   })
+  // 娓呯┖鍔ㄦ�侀�夐」
+  unitProjectOptions.value = []
+  productSubTypeOptions.value = []
   page.current = 1
   handleSearch()
 }
@@ -547,6 +876,13 @@
 const toApprove = (row: any) => router.push({ name: 'tradeApproval', params: { id: row.id } })
 const toCheckFiles = (row: any) => router.push({ name: 'tradeCheckFiles', params: { id: row.id } })
 const toDetail = (row: any) => router.push({ name: 'tradeOrderDetail', params: { id: row.id } })
+const toTrack = (row: any) => {
+  if (!row.workFlowId) {
+    ElMessage.warning('璇ヨ鍗曟殏鏃犲伐浣滄祦淇℃伅')
+    return
+  }
+  router.push({ name: 'tradeTrack', params: { id: row.workFlowId } })
+}
 
 // 杩借釜璁㈠崟 - 鏄剧ず璁㈠崟鐘舵�佸璇濇
 const showOrderTrack = (row: any) => {
@@ -567,8 +903,9 @@
       toDetail(order)
       break
     case ActionType.TRACK:
-      showOrderTrack(order)
+      toTrack(order)
       break
+    case ActionType.WAIT_APPROVAL_AUTHORIZE:
     case ActionType.AUTHORIZE:
       toAuthorize(order)
       break
@@ -579,10 +916,39 @@
 
 // 鎺堟潈锛氳烦杞埌鎺堟潈椤甸潰
 const toAuthorize = (row: any) => {
-  router.push({ name: 'tradeAuthorization', params: { id: row.id } })
+  router.push({ name: 'tradeAuthorization', params: { id: row.id, taskId: row.taskId } })
 }
 
-onMounted(handleSearch)
+onMounted(async ()=>{
+  // 鑾峰彇鐢ㄦ埛淇℃伅
+  if (!userStore.getUserId) {
+    try {
+      const res: any = await queryUserDetail()
+      if (res?.code === 200 && res.data) {
+        userStore.updateUserDetail(res.data)
+      } else {
+        ElMessage.error(res?.msg || '鏃犳硶鑾峰彇鐢ㄦ埛淇℃伅锛岃鍏堢櫥褰�')
+        return
+      }
+    } catch (e) {
+      console.error('鑾峰彇鐢ㄦ埛璇︽儏澶辫触:', e)
+      ElMessage.error('鑾峰彇鐢ㄦ埛淇℃伅澶辫触锛岃绋嶅悗閲嶈瘯')
+      return
+    }
+  }
+  
+  // 鑾峰彇鍒濆閫夐」鏁版嵁
+  await Promise.all([
+    getIndustryOptions(),
+    getProductTypeOptions()
+  ])
+  
+  // 鑾峰彇鍒濆缁熻鏁版嵁
+  await getOrderCounts()
+  
+  // 鎵ц鎼滅储
+  handleSearch()
+})
 </script>
 
 <style scoped lang="scss">
@@ -720,12 +1086,16 @@
     gap: 20px;
     align-items: center;
     overflow: hidden;
-    
+
+    .status-item{
+      flex-direction: row-reverse;
+    }
     .order-item {
       display: flex;
       align-items: center;
       gap: 8px;
       flex-shrink: 0;
+      flex: 1;
       
       .label {
         color: #909399;
@@ -741,6 +1111,11 @@
         white-space: nowrap;
         overflow: hidden;
         text-overflow: ellipsis;
+      }
+      
+      &.status-item {
+        justify-content: flex-start;
+        margin-left: 0;
       }
     }
   }
@@ -773,6 +1148,7 @@
 .period-info {
   display: flex;
   align-items: center;
+  justify-content: center;
   gap: 8px;
   font-size: 12px;
   
@@ -966,6 +1342,82 @@
   padding-bottom: 0 !important;
   border-bottom: 2px solid #e4e7ed; // 鏄剧ず鍒嗛殧杈规绾�
 }
+.buttonDiv {
+  width: 100%;
+  height: 33px;
+}
+.btnBox {
+  width: 505px;
+  height: 33px;
+  //background-color: pink;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+
+  .btnDivClass {
+    background-color: #2f4589 !important;
+    color: #fff;
+    
+    .count-num {
+      color: #fff !important;
+    }
+  }
+
+  .btnDiv {
+    width: 120px;
+    height: 33px;
+    border-radius: 5px;
+    border: 1px solid #ebeef5;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: center;
+    font-size: 14px;
+    //color: #919399;
+    cursor: pointer;
+    background-color: #FFFFFF;
+
+    .numjx {
+      padding-right: 5px;
+    }
+
+    .count-num {
+      color: #f04844;
+      font-weight: 500;
+    }
+
+    span :nth-child(2) {
+      color: #f04844;
+    }
+  }
+
+  .elFormDiv {
+    width: 100%;
+    height: 100px;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: space-between;
+
+    .searchFormDiv {
+      display: flex;
+      flex-direction: row;
+      align-items: center;
+    }
+
+    .searchBtnDiv {
+      //width: 20%;
+      height: 100%;
+      display: flex;
+      flex-direction: row;
+      align-items: center;
+    }
+  }
+}
+.numjx {
+  padding-right: 5px;
+}
 </style>
 
 

--
Gitblit v1.8.0