|
|
@ -610,6 +610,7 @@ class THeadSetLayer { |
|
|
|
exerciseData: data => data.exerciseData ? '是' : '否', |
|
|
|
exerciseData: data => data.exerciseData ? '是' : '否', |
|
|
|
resourceType: data => data.resourceType === 'file' ? '文件' : '数据库表', |
|
|
|
resourceType: data => data.resourceType === 'file' ? '文件' : '数据库表', |
|
|
|
fileSize: data => { |
|
|
|
fileSize: data => { |
|
|
|
|
|
|
|
return fileSizeFormat(data.fileSize, 'M'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -635,3 +636,17 @@ class THeadSetLayer { |
|
|
|
return [cols]; |
|
|
|
return [cols]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const units = ['B', 'K', 'M', 'G', 'T', 'P']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fileSizeFormat(size, initUnit = 'B') { |
|
|
|
|
|
|
|
initUnit = initUnit.toUpperCase(); |
|
|
|
|
|
|
|
const i = units.indexOf(initUnit); |
|
|
|
|
|
|
|
if (size > 1024 && i < units.length - 1) { |
|
|
|
|
|
|
|
return fileSizeFormat(size / 1024, units[i + 1]); |
|
|
|
|
|
|
|
} else if (size < 1 && i > -1) { |
|
|
|
|
|
|
|
return fileSizeFormat(size * 1024, units[i - 1]); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return Math.round(size * 100) / 100 + initUnit; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |