From f0f22709fb7f9945e5bc246181e21fd0c282e694 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 04 六月 2026 15:51:29 +0800
Subject: [PATCH] 马铃薯app 1.客户往来、供应商往来查询展示修改 2.环境检测页面展示修改
---
src/pages/inspectionUpload/attachment.vue | 125 +++--------------------------------------
1 files changed, 10 insertions(+), 115 deletions(-)
diff --git a/src/pages/inspectionUpload/attachment.vue b/src/pages/inspectionUpload/attachment.vue
index 058e0d6..6c077c1 100644
--- a/src/pages/inspectionUpload/attachment.vue
+++ b/src/pages/inspectionUpload/attachment.vue
@@ -5,29 +5,11 @@
@back="goBack" />
<!-- 椤甸潰鍐呭 -->
<view class="attachment-content">
- <!-- 鍒嗙被鏍囩椤� -->
- <view class="attachment-tabs">
- <view class="tab-item"
- :class="{ active: currentViewType === 'before' }"
- @click="switchViewType('before')">
- 鐢熶骇鍓� ({{ getAttachmentsByType(0).length }})
- </view>
- <view class="tab-item"
- :class="{ active: currentViewType === 'after' }"
- @click="switchViewType('after')">
- 鐢熶骇涓� ({{ getAttachmentsByType(1).length }})
- </view>
- <view class="tab-item"
- :class="{ active: currentViewType === 'issue' }"
- @click="switchViewType('issue')">
- 鐢熶骇鍚� ({{ getAttachmentsByType(2).length }})
- </view>
- </view>
- <!-- 褰撳墠鍒嗙被鐨勯檮浠跺垪琛� -->
+ <!-- 闄勪欢鍒楄〃 -->
<view class="attachment-list-container">
- <view v-if="getCurrentViewAttachments().length > 0"
+ <view v-if="attachmentList.length > 0"
class="attachment-list">
- <view v-for="(file, index) in getCurrentViewAttachments()"
+ <view v-for="(file, index) in attachmentList"
:key="index"
class="attachment-item"
@click="previewAttachment(file)">
@@ -52,7 +34,7 @@
</view>
<view v-else
class="attachment-empty">
- <text class="empty-text">璇ュ垎绫绘殏鏃犻檮浠�</text>
+ <text class="empty-text">鏆傛棤闄勪欢</text>
</view>
</view>
</view>
@@ -96,9 +78,6 @@
// 闄勪欢鍒楄〃
const attachmentList = ref([]);
- // 褰撳墠鏌ョ湅绫诲瀷
- const currentViewType = ref("before"); // 'before', 'after', 'issue'
-
// 瑙嗛棰勮鐩稿叧鐘舵��
const showVideoDialog = ref(false);
const currentVideoFile = ref(null);
@@ -122,46 +101,18 @@
}
});
- // 鍔犺浇闄勪欢鏁版嵁
+ // 鍔犺浇闄勪欢鏁版嵁锛堢粺涓�浣跨敤 commonFileListVO锛�
const loadAttachments = () => {
const task = taskInfo.value;
if (!task) return;
attachmentList.value = [];
- // 鍚庣鍙嶆樉瀛楁 (VO浼樺厛)
- const beforeList = Array.isArray(task?.commonFileListBeforeVO)
- ? task.commonFileListBeforeVO
- : Array.isArray(task?.commonFileListBefore)
- ? task.commonFileListBefore
- : [];
-
- const duringList = Array.isArray(task?.commonFileListVO)
+ const fileList = Array.isArray(task?.commonFileListVO)
? task.commonFileListVO
- : Array.isArray(task?.commonFileListAfter)
- ? task.commonFileListAfter
- : []; // 鍏煎鏃ч�昏緫鎴栧懡鍚嶄笉涓�鑷�
-
- const afterList = Array.isArray(task?.commonFileListAfterVO)
- ? task.commonFileListAfterVO
- : Array.isArray(task?.commonFileListIssue)
- ? task.commonFileListIssue
: [];
- // 濡傛灉 VO 閮芥病鏈夛紝灏濊瘯浠� commonFileList 杩囨护
- const allList = Array.isArray(task?.commonFileList)
- ? task.commonFileList
- : [];
-
- const finalBefore =
- beforeList.length > 0 ? beforeList : allList.filter(f => f?.type === 10);
- const finalDuring =
- duringList.length > 0 ? duringList : allList.filter(f => f?.type === 11);
- const finalAfter =
- afterList.length > 0 ? afterList : allList.filter(f => f?.type === 12);
-
- const mapToViewFile = (file, viewType) => {
- // 鍏煎 previewURL, previewUrl, url, downloadURL, downloadUrl
+ attachmentList.value = fileList.map(file => {
const rawUrl =
file?.previewURL ||
file?.previewUrl ||
@@ -173,20 +124,14 @@
return {
...file,
- type: viewType,
- name:
- file?.originalFilename || file?.bucketFilename || file?.name || "闄勪欢",
+ name: file?.originalFilename || file?.bucketFilename || file?.name || "闄勪欢",
bucketFilename: file?.bucketFilename || file?.name,
originalFilename: file?.originalFilename || file?.name,
url: u,
downloadUrl: u,
size: file?.byteSize || file?.size || 0,
};
- };
-
- attachmentList.value.push(...finalBefore.map(f => mapToViewFile(f, 0)));
- attachmentList.value.push(...finalDuring.map(f => mapToViewFile(f, 1)));
- attachmentList.value.push(...finalAfter.map(f => mapToViewFile(f, 2)));
+ });
};
// 灏嗗悗绔繑鍥炵殑鏂囦欢鍦板潃瑙勮寖鎴愬彲璁块棶URL
@@ -220,30 +165,6 @@
uni.navigateBack();
};
- // 鍒囨崲鏌ョ湅绫诲瀷
- const switchViewType = type => {
- currentViewType.value = type;
- };
-
- // 鏍规嵁type鑾峰彇瀵瑰簲鍒嗙被鐨勯檮浠�
- const getAttachmentsByType = typeValue => {
- return attachmentList.value.filter(file => file.type === typeValue) || [];
- };
-
- // 鑾峰彇褰撳墠鏌ョ湅绫诲瀷鐨勯檮浠�
- const getCurrentViewAttachments = () => {
- switch (currentViewType.value) {
- case "before":
- return getAttachmentsByType(0);
- case "after":
- return getAttachmentsByType(1);
- case "issue":
- return getAttachmentsByType(2);
- default:
- return [];
- }
- };
-
// 鍒ゆ柇鏄惁涓哄浘鐗囨枃浠�
const isImageFile = file => {
if (file.contentType && file.contentType.startsWith("image/")) {
@@ -259,7 +180,7 @@
// 棰勮闄勪欢
const previewAttachment = file => {
if (isImageFile(file)) {
- const imageUrls = getCurrentViewAttachments()
+ const imageUrls = attachmentList.value
.filter(f => isImageFile(f))
.map(f => f.url || f.downloadUrl);
@@ -309,32 +230,6 @@
.attachment-content {
padding: 15px;
- }
-
- /* 鏍囩椤垫牱寮� */
- .attachment-tabs {
- display: flex;
- background: #fff;
- border-radius: 12px;
- margin-bottom: 15px;
- padding: 4px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
- }
-
- .tab-item {
- flex: 1;
- text-align: center;
- padding: 12px 8px;
- font-size: 14px;
- color: #666;
- border-radius: 8px;
- transition: all 0.3s ease;
- }
-
- .tab-item.active {
- background: #409eff;
- color: #fff;
- font-weight: 500;
}
/* 闄勪欢鍒楄〃鏍峰紡 */
--
Gitblit v1.9.3