From 522737d66480d2f42b8e83c2ddde0efa3b740f38 Mon Sep 17 00:00:00 2001
From: p-honggang.li <p-honggang.li@pcitc.com>
Date: 星期六, 06 九月 2025 10:47:05 +0800
Subject: [PATCH] 修复审批的问题

---
 src/views/approveManage/tradeApproval/list.vue |  201 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 167 insertions(+), 34 deletions(-)

diff --git a/src/views/approveManage/tradeApproval/list.vue b/src/views/approveManage/tradeApproval/list.vue
index ed3f076..42524c7 100644
--- a/src/views/approveManage/tradeApproval/list.vue
+++ b/src/views/approveManage/tradeApproval/list.vue
@@ -35,11 +35,11 @@
               <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 +57,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>{{ workFlowStatus.tradePointDealData }}</span>-->
+            </div>
+            <div
+                class="btnDiv"
+                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_point1' }"
+                @click="btnClick('1','trade_point')"
+            >
+              <span class="numjx">绉垎宸插姙</span>
+<!--              <span>{{ workFlowStatus.completedData }}</span>-->
+            </div>
+            <div
+                class="btnDiv"
+                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_agreement0' }"
+                @click="btnClick('0','trade_agreement')"
+            >
+              <span class="numjx">鍗忚寰呭姙</span>
+<!--              <span>{{ workFlowStatus.dealwithData }}</span>-->
+            </div>
+            <div
+                class="btnDiv"
+                :class="{ btnDivClass: workFlowStatus.btnClassShow == 'trade_agreement1' }"
+                @click="btnClick('1','trade_agreement')"
+            >
+              <span class="numjx">鍗忚宸插姙</span>
+<!--              <span>{{ workFlowStatus.completedData }}</span>-->
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </div>
 
     <!-- 璁㈠崟鍒楄〃鍖哄煙 -->
     <el-card class="mt15" shadow="never">
@@ -220,6 +262,16 @@
                           >
                             鎺堟潈
                           </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>
                     </div>
@@ -246,24 +298,20 @@
     </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 { ElMessage } from 'element-plus'
 import { fetchApprovalPage, fetchApprovalPageWithProductConditions } from '@/api/approvalManage'
-import orderApi from '@/api/orderApi'
 import productApi from '@/api/productApi'
-import { authorizeApproval, fetchApprovalByOrderId } from '@/api/approvalManage'
 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'
 
@@ -275,6 +323,7 @@
   { label: '鍏ㄩ儴', value: '' },
   { label: '寰呬笂浼犳枃浠�', value: 'WAIT_UPLOAD' },
   { label: '寰呮巿鏉�', value: 'WAIT_AUTHORIZE' },
+  { label: '寰呭鎵规巿鏉�', value: 'WAIT_APPROVAL_AUTHORIZE' },
   { label: '寰呬氦鏄撶‘璁�', value: 'WAIT_CONFIRM' },
   { label: '宸插畬鎴�', value: 'COMPLETED' },
   { label: '宸茶瘎浠�', value: 'EVALUATED' },
@@ -308,6 +357,12 @@
 const orderStatusDialogVisible = ref(false)
 const currentOrderId = ref<string>('')
 
+const workFlowStatus = reactive<any>({
+  btnClassShow: 'trade_point0',
+  workFlowType: 0,
+  businessType: 'trade_point' // trade_point
+})
+
 // 浣跨敤宸ヤ綔娴佺▼鎺у埗鍣ㄧ殑鐘舵�佹槧灏�
 const statusUiToServer: Record<string, string> = {
   WAIT_UPLOAD: OrderStatus.WAIT_UPLOAD,
@@ -323,6 +378,7 @@
   [OrderStatus.WAIT_CONFIRM]: 'WAIT_CONFIRM',
   [OrderStatus.COMPLETED]: 'COMPLETED',
   [OrderStatus.EVALUATED]: 'EVALUATED',
+  [OrderStatus.WAIT_APPROVAL_AUTHORIZE]: 'WAIT_APPROVAL_AUTHORIZE'
 }
 
 const formatDateTime = (val?: string) => {
@@ -358,7 +414,7 @@
 // 鑾峰彇浜у搧绫诲瀷閫夐」
 const getProductTypeOptions = async () => {
   try {
-    const res = await productApi.getCategoryByParent({ parentCode: 'product_type' })
+    const res = await productApi.getCategoryByParent({ parentCode: 'ProductTechnologyType' })
     if (res?.code === 200 && res.data) {
       productTypeOptions.value = res.data.map((item: any) => ({
         label: item.name,
@@ -423,7 +479,7 @@
   // 娓呯┖浜у搧瀛愮骇閫夋嫨
   query.productSubType = ''
   // 鑾峰彇瀵瑰簲鐨勪骇鍝佸瓙绾ч�夐」
-  await getProductSubTypeOptions(value)
+  // await getProductSubTypeOptions(value)
 }
 
 // 鑾峰彇鐘舵�佺被鍨�
@@ -431,6 +487,7 @@
   const statusMap: Record<string, 'warning' | 'danger' | 'success' | 'info'> = {
     WAIT_UPLOAD: 'warning',
     WAIT_AUTHORIZE: 'warning',
+    WAIT_APPROVAL_AUTHORIZE: 'warning',
     WAIT_CONFIRM: 'warning',
     COMPLETED: 'success',
     EVALUATED: 'success',
@@ -524,6 +581,11 @@
     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) {
@@ -546,17 +608,6 @@
   const list: any[] = Array.isArray(pageData?.list) ? pageData.list : []
   page.total = Number(pageData?.total || 0)
 
-  // 骞跺彂鑾峰彇姣忎釜璁㈠崟鐨勮鎯咃紙鐢ㄤ簬鏋勯�犲瓙璁㈠崟琛岋級
-  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) => {
@@ -571,12 +622,12 @@
       status: uiStatus,
       statusName: order.orderStatus || '',
       orderStatus: StatusMapper.toUIStatus(order.orderStatus), // 杞崲涓烘爣鍑嗙姸鎬佹灇涓�
-      workFlowId: order.workflowId || ''
+      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 || '',
@@ -601,6 +652,15 @@
   })
 
   orderList.value = flatData
+}
+
+const btnClick = (workFlowType?: any,businessType?: any) => {
+  workFlowStatus.btnClassShow = businessType+workFlowType
+  workFlowStatus.workFlowType = workFlowType
+  workFlowStatus.businessType = businessType
+
+  // 鑾峰彇list鏁版嵁
+  handleSearch()
 }
 
 // 閲嶇疆
@@ -655,6 +715,7 @@
     case ActionType.TRACK:
       toTrack(order)
       break
+    case ActionType.WAIT_APPROVAL_AUTHORIZE:
     case ActionType.AUTHORIZE:
       toAuthorize(order)
       break
@@ -665,7 +726,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 ()=>{
@@ -832,12 +893,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;
@@ -853,6 +918,11 @@
         white-space: nowrap;
         overflow: hidden;
         text-overflow: ellipsis;
+      }
+      
+      &.status-item {
+        justify-content: flex-start;
+        margin-left: 0;
       }
     }
   }
@@ -1078,6 +1148,69 @@
   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;
+  }
+
+  .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;
+
+    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