0
0
Fork 0

refactor: refs #7500 refactor vnimg when storage is dms

This commit is contained in:
Jon Elias 2024-09-02 12:09:48 +02:00
parent e4e9496cac
commit 76a7f8a1b3
2 changed files with 7 additions and 16 deletions

View File

@ -102,12 +102,8 @@ const columns = computed(() => [
storage: 'dms',
collection: null,
size: null,
token: prop.token,
url:
'api/dms/' +
prop.row.file.split('.')[0] +
'/downloadFile?access_token=' +
token,
id: prop.row.file.split('.')[0],
token: token,
class: 'rounded',
}),
},

View File

@ -12,10 +12,12 @@ const $props = defineProps({
collection: {
type: String,
default: 'catalog',
required: false,
},
resolution: {
type: String,
default: '200x200',
required: false,
},
zoomResolution: {
type: String,
@ -29,27 +31,20 @@ const $props = defineProps({
type: Number,
required: true,
},
url: {
type: String,
required: false,
default: null,
},
});
const show = ref(false);
const token = useSession().getTokenMultimedia();
const timeStamp = ref(`timestamp=${Date.now()}`);
if ($props.url) return $props.url;
const isEmployee = useRole().isEmployee();
const _url = [$props.storage, $props.collection, $props.size, $props.id]
.filter((prop) => prop)
.join('/');
const getUrl = (zoom = false) => {
const curResolution = zoom
? $props.zoomResolution || $props.resolution
: $props.resolution;
if ($props.storage === 'dms')
return `/api/${$props.storage}/${$props.id}/downloadFile?access_token=${token}`;
return isEmployee
? `/api/${_url}/download?access_token=${token}&${timeStamp.value}`
? `/api/${$props.storage}/${$props.collection}/${curResolution}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
: noImage;
};
const reload = () => {