update fileIcon 方法修改
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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)) ||
|
||||
|
||||
Reference in New Issue
Block a user