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 | 157 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 148 insertions(+), 9 deletions(-) diff --git a/src/views/approveManage/tradeApproval/list.vue b/src/views/approveManage/tradeApproval/list.vue index 389e960..fcb656c 100644 --- a/src/views/approveManage/tradeApproval/list.vue +++ b/src/views/approveManage/tradeApproval/list.vue @@ -91,7 +91,7 @@ @click="btnClick('0','trade_point')" > <span class="numjx">绉垎寰呭姙</span> -<!-- <span>{{ workFlowStatus.tradePointDealData }}</span>--> + <span class="count-num">({{ workFlowStatus.tradePointDealData }})</span> </div> <div class="btnDiv" @@ -99,7 +99,7 @@ @click="btnClick('1','trade_point')" > <span class="numjx">绉垎宸插姙</span> -<!-- <span>{{ workFlowStatus.completedData }}</span>--> + <span class="count-num">({{ workFlowStatus.tradePointCompletedData }})</span> </div> <div class="btnDiv" @@ -107,7 +107,7 @@ @click="btnClick('0','trade_agreement')" > <span class="numjx">鍗忚寰呭姙</span> -<!-- <span>{{ workFlowStatus.dealwithData }}</span>--> + <span class="count-num">({{ workFlowStatus.tradeAgreementDealData }})</span> </div> <div class="btnDiv" @@ -115,7 +115,7 @@ @click="btnClick('1','trade_agreement')" > <span class="numjx">鍗忚宸插姙</span> -<!-- <span>{{ workFlowStatus.completedData }}</span>--> + <span class="count-num">({{ workFlowStatus.tradeAgreementCompletedData }})</span> </div> </div> </el-col> @@ -344,7 +344,6 @@ { 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' }, @@ -382,7 +381,12 @@ const workFlowStatus = reactive<any>({ btnClassShow: 'trade_point0', workFlowType: 0, - businessType: 'trade_point' // trade_point + businessType: 'trade_point', // trade_point + // 璁㈠崟鏁伴噺缁熻 + tradePointDealData: 1, // 绉垎寰呭姙鏁伴噺 - 涓存椂娴嬭瘯鏁版嵁 + tradePointCompletedData: 0, // 绉垎宸插姙鏁伴噺 + tradeAgreementDealData: 2, // 鍗忚寰呭姙鏁伴噺 - 涓存椂娴嬭瘯鏁版嵁 + tradeAgreementCompletedData: 0 // 鍗忚宸插姙鏁伴噺 }) // 浣跨敤宸ヤ綔娴佺▼鎺у埗鍣ㄧ殑鐘舵�佹槧灏� @@ -400,7 +404,7 @@ [OrderStatus.WAIT_CONFIRM]: 'WAIT_CONFIRM', [OrderStatus.COMPLETED]: 'COMPLETED', [OrderStatus.EVALUATED]: 'EVALUATED', - [OrderStatus.WAIT_APPROVAL_AUTHORIZE]: 'WAIT_APPROVAL_AUTHORIZE' + [OrderStatus.CANCELED]: 'CANCELED' } const formatDateTime = (val?: string) => { @@ -553,10 +557,10 @@ 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', + CANCELED: 'danger' } return statusMap[status] || 'info' } @@ -640,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 = { @@ -674,6 +788,12 @@ 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 flatData: any[] = [] @@ -719,11 +839,14 @@ }) orderList.value = flatData + + // 鏉′欢鏌ヨ鍚庯紝閲嶆柊鑾峰彇鎵�鏈�4绉嶇被鍨嬬殑璁㈠崟鎬绘暟骞舵洿鏂版寜閽樉绀� + await getOrderCounts() } const btnClick = (workFlowType?: any,businessType?: any) => { workFlowStatus.btnClassShow = businessType+workFlowType - workFlowStatus.workFlowType = workFlowType + workFlowStatus.workFlowType = Number(workFlowType) // 纭繚杞崲涓烘暟瀛楃被鍨� workFlowStatus.businessType = businessType // 鑾峰彇list鏁版嵁 @@ -819,6 +942,9 @@ getIndustryOptions(), getProductTypeOptions() ]) + + // 鑾峰彇鍒濆缁熻鏁版嵁 + await getOrderCounts() // 鎵ц鎼滅储 handleSearch() @@ -1232,6 +1358,10 @@ .btnDivClass { background-color: #2f4589 !important; color: #fff; + + .count-num { + color: #fff !important; + } } .btnDiv { @@ -1248,6 +1378,15 @@ cursor: pointer; background-color: #FFFFFF; + .numjx { + padding-right: 5px; + } + + .count-num { + color: #f04844; + font-weight: 500; + } + span :nth-child(2) { color: #f04844; } -- Gitblit v1.8.0