From 22cc8ce22157a32bfcd4ee14d824769c6e318cec Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期一, 08 九月 2025 23:30:57 +0800 Subject: [PATCH] 修改取消订单列表展示的问题 --- src/views/tradeManage/detail/index.vue | 155 +++++++++++++++++++++++++++++++++++---------------- 1 files changed, 105 insertions(+), 50 deletions(-) diff --git a/src/views/tradeManage/detail/index.vue b/src/views/tradeManage/detail/index.vue index 098fffc..0f0b99d 100644 --- a/src/views/tradeManage/detail/index.vue +++ b/src/views/tradeManage/detail/index.vue @@ -24,7 +24,7 @@ <el-tag :type="getStatusType(detail.status)" size="small">{{ detail.statusName }}</el-tag> </el-descriptions-item> </el-descriptions> - + <!-- 鐢宠浜轰俊鎭紙涓庤鍗曚俊鎭悓鍗$墖锛屽鐢ㄥ垎闅旀爣棰樻牱寮忥級 --> <el-descriptions :column="2" @@ -74,7 +74,7 @@ <div class="desc-wrap">{{ detail.productDesc }}</div> </el-descriptions-item> </el-descriptions> - + <!-- 璁㈠崟璇︽儏锛堢Щ鍔ㄥ埌浜ゆ槗鍐呭涓嬮潰锛屽悓涓�鍗$墖鍐咃級 --> <div ref="orderTableWrapRef"> <el-table @@ -226,11 +226,11 @@ </el-card> <!-- 瀹℃壒杩借釜 --> - <el-card class="mt15" shadow="never" v-if="detail.records?.length"> + <el-card class="mt15" shadow="never"> <div class="title">瀹℃壒杩借釜</div> - + <!-- 鏍囩椤� --> - <el-tabs v-model="activeTab" class="approval-tabs"> + <!-- <el-tabs v-model="activeTab" class="approval-tabs"> <el-tab-pane label="瀹℃壒璁板綍" name="records"> <el-table :data="detail.records" @@ -279,13 +279,18 @@ </el-table-column> </el-table> </el-tab-pane> - </el-tabs> - - <!-- 杩斿洖鎸夐挳 --> - <div class="action-buttons"> + </el-tabs> --> + + <!-- 澶栭儴绯荤粺瀹℃壒杞ㄨ抗 iframe --> + <div class="iframe-wrap" v-if="workflowIframeUrl"> + <iframe :src="workflowIframeUrl" class="workflow-iframe" referrerpolicy="no-referrer"></iframe> + </div> + + </el-card> + <!-- 杩斿洖鎸夐挳 --> + <div class="action-buttons"> <el-button @click="goBack">杩斿洖</el-button> </div> - </el-card> </div> </template> @@ -296,12 +301,23 @@ import { ElMessage } from 'element-plus' import orderApi from '@/api/orderApi' import createAxios from '@/utils/axios' +import productApi from '@/api/productApi' +import sysUserService from '@/api/sysUser' +import { useUserInfo } from '@/stores/modules/userInfo' +const hostUrl = import.meta.env.VITE_AXIOS_BASE_URL const route = useRoute() const router = useRouter() const detail = reactive<any>({ items: [], records: [], nodes: [] }) const orderTableWrapRef = ref<HTMLElement | null>(null) const activeTab = ref('records') +const userStore = useUserInfo() +// 澶栭儴瀹℃壒杞ㄨ抗iframe鍦板潃 +const workflowIframeUrl = computed(() => { + const pid = (detail.workflowId || route.query.processinstId || '').toString().trim() + if (!pid) return '' + return `${hostUrl}/activity/history?processinstId=${encodeURIComponent(pid)}&token=${userStore.getAdminToken}` +}) const labelStyle = { width: '180px', maxWidth: '180px' } const contentStyle = { width: 'calc(50% - 180px)' } @@ -361,23 +377,56 @@ onMounted(async () => { const orderId = String(route.params.id || '') if (!orderId) return - + try { // 骞惰鑾峰彇璁㈠崟璇︽儏鍜屽崗璁被鍨嬫鏌� const [orderRes, agreementRes] = await Promise.all([ orderApi.getOrderDetail(orderId), orderApi.checkAgreementPriceType(orderId) ]) - + const res = orderRes as any const data = res?.data || {} - + // 璁剧疆鏄惁涓哄崗璁鍗� const agreementResult = agreementRes as any isAgreementOrder.value = agreementResult?.data === true const statusName: string = data.orderStatus || '' const uiStatus = statusServerToUi[statusName] || 'INFO' + + // 鏍规嵁浜у搧id鑾峰彇浜у搧淇℃伅锛屾洿鏂板ご閮ㄥ睍绀� + try { + if (data.productId) { + const detailRes: any = await productApi.getProductById({ id: data.productId }) + if (detailRes?.code === 200 && detailRes.data) { + // 鐢ㄤ骇鍝佽鎯呰ˉ鍏ㄥご淇℃伅 + data.productName = detailRes.data.name || data.productName + data.providerName = detailRes.data.submissionUnit || data.providerName + data.industry = detailRes.data.industrialChainName || data.industry + data.productDesc = detailRes.data.describe || data.productDesc + data.projectUnit = detailRes.data.importantAreaName || data.productDesc + data.productType = detailRes.data.typeName || data.productDesc + } + } + } catch (e) { + // 蹇界暐浜у搧璇︽儏澶辫触锛屼笉闃诲璁㈠崟璇︽儏 + } + + // 鑾峰彇鐢ㄦ埛淇℃伅 + try { + const userRes: any = await sysUserService.getUserdetail({ userId: data.userId }) + if (userRes?.code === 200 && userRes.data) { + // 鐢ㄤ骇鍝佽鎯呰ˉ鍏ㄥご淇℃伅 + data.unitName = userRes.data.unitName || data.unitName + data.userName = userRes.data.name || data.userName + data.userDept = userRes.data.departmentName || data.userDept + data.userPhone = userRes.data.phone || data.userPhone + data.userAccount = userRes.data.username || data.userAccount + } + }catch (e){ + + } // 鏄犲皠璁㈠崟璇︽儏澶撮儴淇℃伅 const head = { @@ -430,6 +479,7 @@ cashTotal: cashTotalNum.toLocaleString(), records: [], nodes: [], + workflowId: data.workflowId || data.processinstId || '' }) // 鍒濆鍖栦氦鏄撲俊鎭娉ㄦ暟鎹� @@ -443,11 +493,11 @@ endDateObj.setFullYear(endDateObj.getFullYear() + item.period) endDate = endDateObj.toISOString().split('T')[0] // 鏍煎紡鍖栦负 YYYY-MM-DD } - - return { + + return { name: item.name, start: data.applyTime ? data.applyTime.split('T')[0] : '', // 浣跨敤璁㈠崟鐢宠鏃堕棿 - end: endDate, + end: endDate, forever: item.period === 0, // 鏈熼檺涓�0鏃惰缃负姘镐箙 remark: item.remarks || '' // 浣跨敤濂椾欢淇℃伅涓殑remarks瀛楁 } @@ -510,7 +560,7 @@ } // 琛ㄥご鏂囧瓧灞呬腑锛屼絾绗竴琛岀殑"璇︽儏"鏂囧瓧闈犲乏瀵归綈 -const headerCenterStyle: CSSProperties = { +const headerCenterStyle: CSSProperties = { textAlign: 'center', fontSize: '14px', background: '#f3f6fb' @@ -520,7 +570,7 @@ const bodyCellStyle: CSSProperties = { fontSize: '12px' } // 瀹℃壒杩借釜琛ㄦ牸鏍峰紡 -const recordTableHeaderStyle: CSSProperties = { +const recordTableHeaderStyle: CSSProperties = { textAlign: 'center', fontSize: '14px', background: '#f3f6fb' @@ -528,7 +578,7 @@ const recordTableCellStyle: CSSProperties = { fontSize: '12px' } // 鏂囦欢鍒楄〃琛ㄦ牸琛ㄥご鏂囧瓧灞呬腑锛屼絾绗竴鍒楃殑"浜ゆ槗鏂囦欢"鏂囧瓧闈犲乏瀵归綈 -const fileTableHeaderStyle: CSSProperties = { +const fileTableHeaderStyle: CSSProperties = { textAlign: 'center', fontSize: '14px', background: '#f3f6fb' @@ -587,23 +637,23 @@ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // .xlsx 'application/vnd.openxmlformats-officedocument.presentationml.presentation', // .pptx ] - + // 濡傛灉MIME绫诲瀷鍖归厤锛岀洿鎺ヨ繑鍥瀟rue if (previewableTypes.includes(file.type || '')) { return true } - + // 濡傛灉MIME绫诲瀷涓虹┖鎴栦笉鍖归厤锛屾牴鎹枃浠舵墿灞曞悕鍒ゆ柇 const fileName = file.name || '' const fileExtension = fileName.toLowerCase().split('.').pop() - + const previewableExtensions = [ 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'txt', 'html', 'htm', 'css', 'js', 'pdf', 'docx', 'xlsx', 'pptx' ] - + return previewableExtensions.includes(fileExtension) } @@ -619,13 +669,13 @@ ElMessage.warning('鏂囦欢閾炬帴涓嶅瓨鍦�') return } - + // 鑾峰彇鏂囦欢鎵╁睍鍚� const fileName = file.name || '' const fileExtension = fileName.toLowerCase().split('.').pop() - + let previewUrl = file.url - + // 濡傛灉鏂囦欢瀛樺偍鍦∕inIO锛屼紭鍏堜娇鐢ㄩ瑙圲RL if (file.url.includes('order-attachments')) { try { @@ -637,13 +687,14 @@ fileName: file.url } }) - + console.log('棰勮URL鍝嶅簲:', previewResponse) - + // 妫�鏌ュ搷搴旀牸寮� const responseData = previewResponse as any if (responseData && responseData.code === 200 && responseData.data) { - previewUrl = responseData.data + previewUrl = responseData.data.replaceAll("http://192.168.20.52:9000", import.meta.env.VITE_FILE_PREVIEW_URL) + // previewUrl = responseData.data console.log('浣跨敤棰勮URL:', previewUrl) } else { console.log('棰勮URL鑾峰彇澶辫触锛屼娇鐢ㄤ笅杞芥柟寮�') @@ -657,7 +708,7 @@ originalName: file.name } }) - + // 鍒涘缓棰勮URL const blob = new Blob([response as any]) previewUrl = window.URL.createObjectURL(blob) @@ -669,30 +720,30 @@ return } } - + // 鍥剧墖鏂囦欢鐩存帴鍦ㄦ柊绐楀彛鎵撳紑 - if ((file.type && file.type.startsWith('image/')) || + if ((file.type && file.type.startsWith('image/')) || ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(fileExtension)) { console.log('棰勮鍥剧墖鏂囦欢:', previewUrl) window.open(previewUrl, '_blank') return } - + // PDF鏂囦欢鍦ㄦ柊绐楀彛鎵撳紑 if (file.type === 'application/pdf' || fileExtension === 'pdf') { console.log('棰勮PDF鏂囦欢:', previewUrl) window.open(previewUrl, '_blank') return } - + // 鏂囨湰鏂囦欢鍦ㄦ柊绐楀彛鎵撳紑 - if ((file.type && file.type.startsWith('text/')) || + if ((file.type && file.type.startsWith('text/')) || ['txt', 'html', 'htm', 'css', 'js'].includes(fileExtension)) { console.log('棰勮鏂囨湰鏂囦欢:', previewUrl) window.open(previewUrl, '_blank') return } - + // Office鏂囨。鍜屽叾浠栨枃浠剁被鍨嬶紝灏濊瘯鍦ㄦ柊绐楀彛鎵撳紑 try { console.log('棰勮鍏朵粬鏂囦欢:', previewUrl) @@ -709,14 +760,14 @@ ElMessage.warning('鏂囦欢閾炬帴涓嶅瓨鍦�') return } - + console.log('寮�濮嬩笅杞芥枃浠�:', file.name, 'URL:', file.url) - + try { // 濡傛灉鏂囦欢瀛樺偍鍦∕inIO锛屼娇鐢ㄥ悗绔洿鎺ヤ笅杞紸PI if (file.url.includes('order-attachments')) { console.log('浣跨敤MinIO涓嬭浇API') - + // 浣跨敤axios閫氳繃浠g悊璁块棶鍚庣API const response = await createAxios({ url: `/admin/file/download`, @@ -727,28 +778,28 @@ originalName: file.name } }) - + console.log('涓嬭浇鍝嶅簲:', response) - + // 鍒涘缓涓嬭浇閾炬帴 const blob = new Blob([response as any]) const downloadUrl = window.URL.createObjectURL(blob) - + console.log('鍒涘缓涓嬭浇閾炬帴:', downloadUrl) - + const link = document.createElement('a') link.href = downloadUrl link.download = file.name || 'download' link.target = '_blank' link.rel = 'noopener noreferrer' - + document.body.appendChild(link) link.click() document.body.removeChild(link) - + // 娓呯悊URL瀵硅薄 window.URL.revokeObjectURL(downloadUrl) - + ElMessage.success('鏂囦欢涓嬭浇鎴愬姛') } else { console.log('浣跨敤鐩存帴URL涓嬭浇') @@ -758,11 +809,11 @@ link.download = file.name || 'download' link.target = '_blank' link.rel = 'noopener noreferrer' - + document.body.appendChild(link) link.click() document.body.removeChild(link) - + ElMessage.success('寮�濮嬩笅杞芥枃浠�') } } catch (error) { @@ -1006,13 +1057,17 @@ text-align: left !important; } +/* 澶栭儴瀹℃壒杞ㄨ抗 iframe 鏍峰紡 */ +.iframe-wrap { margin-top: 10px; } +.workflow-iframe { width: 100%; height: 500px; border: none; border-radius: 6px; } + /* 鏂囦欢鎿嶄綔鎸夐挳鏍峰紡 */ .file-actions { display: flex; gap: 8px; align-items: center; justify-content: center; - + .preview-btn { color: #409eff; &:hover { @@ -1023,7 +1078,7 @@ cursor: not-allowed; } } - + .download-btn { color: #67c23a; &:hover { -- Gitblit v1.8.0