forked from verdnatura/salix-front
refactor: refs #7500 refactor vnimg when storage is dms
This commit is contained in:
parent
e4e9496cac
commit
76a7f8a1b3
|
@ -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',
|
||||
}),
|
||||
},
|
||||
|
|
|
@ -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 = () => {
|
||||
|
|
Loading…
Reference in New Issue