This commit is contained in:
2026-02-27 13:55:30 +08:00
2 changed files with 7 additions and 3 deletions

View File

@@ -120,7 +120,7 @@
<template #default="{ row, column }">
<span class="td-text">
<span v-if="item.tableIcon === 'fileIcon' && isString(row[item.key])">
<img :src="fileUploadAllocationIconFun(row[item.key])" class="img" />
<img :src="fileUploadAllocationIconFun(row[item.key], row.dataType)" class="img" />
</span>
<span v-if="item.tableIcon && item.tableIcon !== 'fileIcon'" class="icon">
<el-icon :size="16">

View File

@@ -445,11 +445,15 @@ const iconMap: Record<string, IconEntry> = {
other: { icon: otherIcon, exts: [] },
};
export const fileUploadAllocationIconFun = (fileName: string) => {
export const fileUploadAllocationIconFun = (
fileName: string,
fileUploadAllocationIconFun?: any
) => {
const arr = fileName?.split('.');
const fileType = arr.length > 1 ? arr.pop()?.toLowerCase() : '';
if (fileType === '') {
return iconMap.folder.icon;
// 文件夹1 文件2 没有后缀的文件类型 统一使用otherIcon
return fileUploadAllocationIconFun == 2 ? iconMap.other.icon : iconMap.folder.icon;
} else {
const iconEntry =
Object.values(iconMap).find((entry) => entry.exts.includes(fileType as string)) ||