|
|
@ -11,10 +11,10 @@ import { getFileSize } from '/@/utils/file/download'; |
|
|
|
import { h } from 'vue'; |
|
|
|
import { h } from 'vue'; |
|
|
|
import { useGlobSetting } from '/@/hooks/setting'; |
|
|
|
import { useGlobSetting } from '/@/hooks/setting'; |
|
|
|
import { Tag, Button } from 'ant-design-vue'; |
|
|
|
import { Tag, Button } from 'ant-design-vue'; |
|
|
|
const { filePreviewUrl = '', apiUrl } = useGlobSetting(); |
|
|
|
const { filePreviewUrl = '' } = useGlobSetting(); |
|
|
|
import { Api } from '/@/api/platform/system/controller/file'; |
|
|
|
import { Api } from '/@/api/platform/system/controller/file'; |
|
|
|
import { encodeURL } from 'js-base64'; |
|
|
|
import { encodeURL } from 'js-base64'; |
|
|
|
import { isDevMode } from '/@/utils/env'; |
|
|
|
import { getCloudProxyUrl } from '/@/utils'; |
|
|
|
|
|
|
|
|
|
|
|
/** 表格列配置 */ |
|
|
|
/** 表格列配置 */ |
|
|
|
export const columns: BasicColumn[] = [ |
|
|
|
export const columns: BasicColumn[] = [ |
|
|
@ -33,14 +33,7 @@ export const columns: BasicColumn[] = [ |
|
|
|
ellipsis: true, |
|
|
|
ellipsis: true, |
|
|
|
width: 380, |
|
|
|
width: 380, |
|
|
|
customRender: ({ record }) => { |
|
|
|
customRender: ({ record }) => { |
|
|
|
// 获取当前文件流基础地址
|
|
|
|
const url = encodeURL(`${getCloudProxyUrl()}${Api.get}/${record.bucketName}/${record.fileName}`); |
|
|
|
let baseUrl; |
|
|
|
|
|
|
|
if (isDevMode()) { |
|
|
|
|
|
|
|
const proxy: [string[]] = JSON.parse(import.meta.env.VITE_PROXY); |
|
|
|
|
|
|
|
const api = proxy.find(item => item[0] == apiUrl) || []; |
|
|
|
|
|
|
|
baseUrl = api[1]; |
|
|
|
|
|
|
|
} else baseUrl = `${window.location.origin}${apiUrl}`; |
|
|
|
|
|
|
|
const url = encodeURL(`${baseUrl}${Api.get}/${record.bucketName}/${record.fileName}`); |
|
|
|
|
|
|
|
return record.fileName ? h(Button, { |
|
|
|
return record.fileName ? h(Button, { |
|
|
|
type: 'link', |
|
|
|
type: 'link', |
|
|
|
target: '_blank', |
|
|
|
target: '_blank', |
|
|
|