From 8ef070c84a703c4a8b838bf9320d68d00a7d6dca Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 28 五月 2026 11:15:32 +0800
Subject: [PATCH] 设备巡检去掉高度限制
---
src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue | 115 +++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 91 insertions(+), 24 deletions(-)
diff --git a/src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue b/src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue
index a907b61..9ac7b07 100644
--- a/src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue
+++ b/src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue
@@ -14,7 +14,7 @@
<div class="exception-section">
<div class="section-title">鏄惁瀛樺湪寮傚父锛�</div>
- <el-radio-group v-model="hasException">
+ <el-radio-group v-model="currentHasException">
<el-radio :value="false">姝e父</el-radio>
<el-radio :value="true">瀛樺湪寮傚父</el-radio>
</el-radio-group>
@@ -135,11 +135,27 @@
const afterModelValue = ref([]);
const issueModelValue = ref([]);
const currentUploadType = ref("before");
-const hasException = ref(null);
+const hasExceptionBefore = ref(null);
+const hasExceptionAfter = ref(null);
+const hasExceptionIssue = ref(null);
const currentTask = ref(null);
const showVideoDialog = ref(false);
const currentVideoFile = ref(null);
+
+// 鏍规嵁褰撳墠 Tab 鑾峰彇/璁剧疆瀵瑰簲鐨勫紓甯哥姸鎬�
+const currentHasException = computed({
+ get: () => {
+ if (currentUploadType.value === "before") return hasExceptionBefore.value;
+ if (currentUploadType.value === "after") return hasExceptionAfter.value;
+ return hasExceptionIssue.value;
+ },
+ set: (val) => {
+ if (currentUploadType.value === "before") hasExceptionBefore.value = val;
+ else if (currentUploadType.value === "after") hasExceptionAfter.value = val;
+ else hasExceptionIssue.value = val;
+ }
+});
const uploadConfig = {
action: "/file/upload",
@@ -148,7 +164,10 @@
fileType: ["jpg", "jpeg", "png", "gif", "webp", "mp4", "mov", "avi", "wmv"],
};
-const uploadUrl = `${import.meta.env.VITE_APP_BASE_API}${uploadConfig.action}`;
+const uploadUrl = computed(() => {
+ const type = getTabType();
+ return `${import.meta.env.VITE_APP_BASE_API}${uploadConfig.action}?type=${type}`;
+});
const uploadHeaders = {
Authorization: `Bearer ${getToken()}`,
};
@@ -213,7 +232,9 @@
afterModelValue.value = [];
issueModelValue.value = [];
currentUploadType.value = "before";
- hasException.value = null;
+ hasExceptionBefore.value = null;
+ hasExceptionAfter.value = null;
+ hasExceptionIssue.value = null;
currentTask.value = null;
uploadProgress.value = 0;
uploading.value = false;
@@ -240,8 +261,12 @@
: [];
currentUploadType.value = "before";
- hasException.value =
- typeof rawTask.hasException === "boolean" ? rawTask.hasException : null;
+ hasExceptionBefore.value =
+ typeof rawTask.hasExceptionBefore === "boolean" ? rawTask.hasExceptionBefore : null;
+ hasExceptionAfter.value =
+ typeof rawTask.hasExceptionAfter === "boolean" ? rawTask.hasExceptionAfter : null;
+ hasExceptionIssue.value =
+ typeof rawTask.hasExceptionIssue === "boolean" ? rawTask.hasExceptionIssue : null;
uploadFileList.value = [];
showUploadDialog.value = true;
};
@@ -383,15 +408,69 @@
}));
};
+const buildSubmitFileItem = item => {
+ if (!item) return null;
+
+ return {
+ id: item.id,
+ tempId: item.tempId,
+ tempFileId: item.tempFileId,
+ type: item.type,
+ url: item?.downloadUrl || item?.url || "",
+ downloadUrl: item?.downloadUrl || item?.url || "",
+ bucketFilename: item.bucketFilename,
+ originalFilename: item.originalFilename,
+ size: item.size,
+ byteSize: item.byteSize,
+ contentType: item.contentType,
+ };
+};
+
+const buildGroupedFiles = list => {
+ return (list || []).map(buildSubmitFileItem).filter(Boolean);
+};
+
+const buildSubmitPayload = () => {
+ const {
+ createTime,
+ updateTime,
+ storageBlobDTO,
+ commonFileListBefore,
+ commonFileListAfter,
+ commonFileList,
+ __raw,
+ ...rest
+ } = currentTask.value || {};
+
+ const files = buildSubmitFiles();
+ const tempFileIds = files
+ .map(item => item?.tempId ?? item?.tempFileId ?? item?.id)
+ .filter(Boolean);
+
+ return {
+ ...rest,
+ hasExceptionBefore: hasExceptionBefore.value,
+ hasExceptionAfter: hasExceptionAfter.value,
+ hasExceptionIssue: hasExceptionIssue.value,
+ tempFileIds,
+ commonFileListBefore: buildGroupedFiles(beforeModelValue.value),
+ commonFileListAfter: buildGroupedFiles(afterModelValue.value),
+ commonFileList: buildGroupedFiles(issueModelValue.value),
+ };
+};
+
const submitUpload = async () => {
- if (hasException.value === null) {
- ElMessage.warning("璇烽�夋嫨鏄惁瀛樺湪寮傚父");
+ // 鍙獙璇佸綋鍓� Tab 鐨勫紓甯哥姸鎬�
+ const currentException = currentHasException.value;
+ if (currentException === null) {
+ ElMessage.warning(`璇烽�夋嫨${getUploadTypeText()}鏄惁瀛樺湪寮傚父`);
return;
}
- const files = buildSubmitFiles();
- if (!files.length) {
- ElMessage.warning("璇峰厛涓婁紶鏂囦欢");
+ const currentFiles = getCurrentFiles();
+ // 鍙湁閫夋嫨"瀛樺湪寮傚父"鏃舵墠闇�瑕佷笂浼犳枃浠�
+ if (currentException === true && !currentFiles.length) {
+ ElMessage.warning(`${getUploadTypeText()}瀛樺湪寮傚父鏃惰涓婁紶鍥剧墖鎴栬棰慲);
return;
}
@@ -401,19 +480,7 @@
});
try {
- const tempFileIds = files
- .map(item => item?.tempId ?? item?.tempFileId ?? item?.id)
- .filter(Boolean);
-
- const payload = {
- ...currentTask.value,
- hasException: hasException.value,
- storageBlobDTO: files,
- tempFileIds,
- commonFileListBefore: beforeModelValue.value,
- commonFileListAfter: afterModelValue.value,
- commonFileList: issueModelValue.value,
- };
+ const payload = buildSubmitPayload();
const result = await uploadInspectionTask(payload);
if (result?.code === 200 || result?.success) {
--
Gitblit v1.9.3