|
|
@@ -43,7 +43,15 @@
|
|
|
<el-table-column label="评分方式" prop="scoringMethod" min-width="150" />
|
|
|
<el-table-column label="加减分项" prop="scoreType" min-width="120" />
|
|
|
<el-table-column label="自评得分" prop="selfScore" min-width="120" />
|
|
|
- <el-table-column label="资料说明" prop="materialDescription" min-width="200" />
|
|
|
+ <el-table-column label="资料说明" prop="materialDescription" min-width="400">
|
|
|
+ <template #default="scope">
|
|
|
+ <UploadFiles
|
|
|
+ label="上传附件"
|
|
|
+ :file-list="scope.row.attachmentFileList"
|
|
|
+ @uploadSuccess="(files) => handleRowUploadSuccess(scope.$index, files)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="复核人姓名" prop="reviewUserName" min-width="120" />
|
|
|
<el-table-column label="复核得分" prop="reviewScore" min-width="180">
|
|
|
<template #default="scope">
|
|
|
@@ -110,6 +118,7 @@
|
|
|
importSecurityExamineIssueDeptDetail,
|
|
|
} from '@/api/evaluationSystem';
|
|
|
import type { FileItem } from '@/components/UploadFiles/types';
|
|
|
+ import { formatAttachmentList } from '@/components/UploadFiles/utils';
|
|
|
|
|
|
const props = defineProps<{
|
|
|
id: number;
|
|
|
@@ -313,6 +322,12 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ // 行内上传附件成功
|
|
|
+ const handleRowUploadSuccess = (rowIndex: number, files: FileItem[]) => {
|
|
|
+ if (!evaluationItems.value[rowIndex]) return;
|
|
|
+ evaluationItems.value[rowIndex].attachmentFileList = files;
|
|
|
+ };
|
|
|
+
|
|
|
// 将逗号分隔的 URL 字符串转换为 FileItem[] 格式
|
|
|
const parseAttachmentsToFileList = (attachmentsStr: string | undefined): FileItem[] => {
|
|
|
if (!attachmentsStr || !attachmentsStr.trim()) {
|
|
|
@@ -386,7 +401,8 @@
|
|
|
selfScore: score.selfScore || 0, // 自评得分
|
|
|
reviewUserName: score.reviewUserName || '-', // 复核人姓名(从详情顶层获取)
|
|
|
reviewScore: score.reviewScore || 0, // 复核得分
|
|
|
- materialDescription: score.attachments || '', // 资料说明(使用附件字段)
|
|
|
+ materialDescription: score.attachments || '', // 资料说明(使用附件字段,字符串)
|
|
|
+ attachmentFileList: parseAttachmentsToFileList(score.attachments || ''), // 资料说明对应的附件文件列表
|
|
|
isReviewInput: score.isReviewInput == true, // 是否显示复核得分输入框
|
|
|
}));
|
|
|
} else {
|
|
|
@@ -407,18 +423,59 @@
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 使用详情原始数据,更新复核得分和isAdd字段
|
|
|
+ // 使用详情原始数据,更新复核得分、加减分项及资料说明附件
|
|
|
+ const updatedScores =
|
|
|
+ (await Promise.all(
|
|
|
+ (detailData.value.scores || []).map(async (score: any) => {
|
|
|
+ const item = evaluationItems.value.find((row) => row.id === score.id);
|
|
|
+
|
|
|
+ // 处理资料说明附件:将 UploadFiles 返回的文件列表转换为逗号分隔的 URL 字符串
|
|
|
+ let attachments = score.attachments || '';
|
|
|
+ if (item && Array.isArray(item.attachmentFileList)) {
|
|
|
+ const existingFiles: string[] = [];
|
|
|
+ const newFiles: any[] = [];
|
|
|
+
|
|
|
+ item.attachmentFileList.forEach((file: any) => {
|
|
|
+ if (file.fileUrl && !file.file) {
|
|
|
+ existingFiles.push(file.fileUrl);
|
|
|
+ } else {
|
|
|
+ newFiles.push(file);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ let uploadedUrls: string[] = [];
|
|
|
+ if (newFiles.length > 0) {
|
|
|
+ const uploadedFiles = await formatAttachmentList(newFiles);
|
|
|
+ uploadedUrls = uploadedFiles
|
|
|
+ .map((f: any) => f.fileUrl || f.url || '')
|
|
|
+ .filter((url: string) => url);
|
|
|
+ }
|
|
|
+
|
|
|
+ attachments = [...existingFiles, ...uploadedUrls].filter((url) => url).join(',');
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...score,
|
|
|
+ reviewScore: item ? Number(item.reviewScore) || 0 : score.reviewScore || 0,
|
|
|
+ isAdd: item
|
|
|
+ ? item.isAdd !== undefined
|
|
|
+ ? item.isAdd
|
|
|
+ : item.selfScore >= 0
|
|
|
+ ? 1
|
|
|
+ : 0
|
|
|
+ : score.isAdd !== undefined
|
|
|
+ ? score.isAdd
|
|
|
+ : score.selfScore >= 0
|
|
|
+ ? 1
|
|
|
+ : 0,
|
|
|
+ attachments,
|
|
|
+ };
|
|
|
+ }),
|
|
|
+ )) || [];
|
|
|
+
|
|
|
const submitData = {
|
|
|
...detailData.value,
|
|
|
- scores: detailData.value.scores?.map((score: any) => {
|
|
|
- // 找到对应的复核得分和isAdd
|
|
|
- const item = evaluationItems.value.find((item) => item.id === score.id);
|
|
|
- return {
|
|
|
- ...score,
|
|
|
- reviewScore: item ? Number(item.reviewScore) || 0 : score.reviewScore || 0,
|
|
|
- isAdd: item ? (item.isAdd !== undefined ? item.isAdd : (item.selfScore >= 0 ? 1 : 0)) : (score.isAdd !== undefined ? score.isAdd : (score.selfScore >= 0 ? 1 : 0)),
|
|
|
- };
|
|
|
- }) || [],
|
|
|
+ scores: updatedScores,
|
|
|
};
|
|
|
|
|
|
if (isAudit.value) {
|