|
|
@@ -74,7 +74,7 @@
|
|
|
<UploadFiles
|
|
|
label="上传附件"
|
|
|
:file-list="scope.row.attachmentFileList"
|
|
|
- @uploadSuccess="(files: FileItem[]) => handleRowUploadSuccess(scope.$index, files)"
|
|
|
+ @uploadSuccess="(list: FileItem[]) => handleRowUploadSuccess(scope.$index, list)"
|
|
|
/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -200,38 +200,36 @@
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
-let spanArr = ref<number[]>([]); // 存储每行的合并数,0表示被合并的行
|
|
|
-const generateSpanArr = (data) => {
|
|
|
- spanArr.value = [];
|
|
|
- let position = 0; // 记录当前考核项目的起始位置
|
|
|
-
|
|
|
- data.forEach((item, index) => {
|
|
|
- if (index === 0) {
|
|
|
- spanArr.value.push(1);
|
|
|
- position = 0;
|
|
|
- } else {
|
|
|
- // 当前考核项目与前一项相同时合并
|
|
|
- if (item.evaluationItem === data[index-1].evaluationItem) {
|
|
|
- spanArr.value[position] += 1; // 起始行合并数+1
|
|
|
- spanArr.value.push(0); // 当前行标记为合并
|
|
|
+
|
|
|
+ let spanArr = ref<number[]>([]); // 存储每行的合并数,0表示被合并的行
|
|
|
+ const generateSpanArr = (data) => {
|
|
|
+ spanArr.value = [];
|
|
|
+ let position = 0; // 记录当前考核项目的起始位置
|
|
|
+
|
|
|
+ data.forEach((item, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ spanArr.value.push(1);
|
|
|
+ position = 0;
|
|
|
} else {
|
|
|
- spanArr.value.push(1); // 新考核项目组
|
|
|
- position = index; // 更新起始位置
|
|
|
+ // 当前考核项目与前一项相同时合并
|
|
|
+ if (item.evaluationItem === data[index-1].evaluationItem) {
|
|
|
+ spanArr.value[position] += 1; // 起始行合并数+1
|
|
|
+ spanArr.value.push(0); // 当前行标记为合并
|
|
|
+ } else {
|
|
|
+ spanArr.value.push(1); // 新考核项目组
|
|
|
+ position = index; // 更新起始位置
|
|
|
+ }
|
|
|
}
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const spanMethod = ({ row, column, rowIndex, columnIndex }) => {
|
|
|
+ // 仅对考核项目列(columnIndex=1)进行合并
|
|
|
+ if (columnIndex === 1) {
|
|
|
+ const _row = spanArr.value[rowIndex];
|
|
|
+ const _col = _row > 0 ? 1 : 0;
|
|
|
+ return [_row, _col];
|
|
|
}
|
|
|
- });
|
|
|
-};
|
|
|
-const spanMethod = ({ row, column, rowIndex, columnIndex }) => {
|
|
|
- // 仅对考核项目列(columnIndex=1)进行合并
|
|
|
- if (columnIndex === 1) {
|
|
|
- const _row = spanArr.value[rowIndex];
|
|
|
- const _col = _row > 0 ? 1 : 0;
|
|
|
- return [_row, _col];
|
|
|
- }
|
|
|
- return [1, 1]; // 其他列不合并
|
|
|
-};
|
|
|
- const handleUploadSuccess = (files: any[]) => {
|
|
|
- ruleFormData.value.attachmentDocument = files;
|
|
|
+ return [1, 1]; // 其他列不合并
|
|
|
};
|
|
|
|
|
|
const handleDownloadTemplate = () => {
|
|
|
@@ -291,9 +289,9 @@ const spanMethod = ({ row, column, rowIndex, columnIndex }) => {
|
|
|
};
|
|
|
|
|
|
// 行内上传附件成功
|
|
|
- const handleRowUploadSuccess = (rowIndex: number, files: FileItem[]) => {
|
|
|
+ const handleRowUploadSuccess = async (rowIndex: number, list: FileItem[]) => {
|
|
|
if (!evaluationItems.value[rowIndex]) return;
|
|
|
- evaluationItems.value[rowIndex].attachmentFileList = files;
|
|
|
+ evaluationItems.value[rowIndex].attachmentFileList = await formatAttachmentList(list);
|
|
|
};
|
|
|
|
|
|
// 将逗号分隔的 URL 字符串转换为 FileItem[] 格式
|
|
|
@@ -357,7 +355,7 @@ const spanMethod = ({ row, column, rowIndex, columnIndex }) => {
|
|
|
selfScore: score.selfScore, // 自评得分
|
|
|
materialDescription: score.attachments || '', // 资料说明(使用附件字段,字符串)
|
|
|
reviewRejectReson: score.reviewRejectReson || '', // 复核不通过原因
|
|
|
- attachmentFileList: parseAttachmentsToFileList(score.attachments || ''), // 对应的附件文件列表
|
|
|
+ attachmentFileList: JSON.parse(score.attachments || '[]'), // 对应的附件文件列表
|
|
|
}));
|
|
|
generateSpanArr(evaluationItems.value);
|
|
|
} else {
|
|
|
@@ -400,30 +398,29 @@ const spanMethod = ({ row, column, rowIndex, columnIndex }) => {
|
|
|
(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(',');
|
|
|
+ // 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 = JSON.stringify(item.attachmentFileList || '[]');
|
|
|
+ // attachments = [...existingFiles, ...uploadedUrls].filter((url) => url).join(',');
|
|
|
}
|
|
|
|
|
|
return {
|