2019-11-07 10:19:05 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'attachment',
|
|
|
|
computed: {
|
|
|
|
path() {
|
|
|
|
const filename = this.attachment.filename;
|
|
|
|
const component = this.attachment.component;
|
|
|
|
if (this.attachment.cid)
|
|
|
|
return `/api/${component}/assets/files/${filename}`;
|
|
|
|
else
|
|
|
|
return `/api/report/${component}?${this.getHttpParams()}`;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getHttpParams() {
|
|
|
|
const props = this.args;
|
|
|
|
let query = '';
|
|
|
|
for (let param in props) {
|
2020-05-22 13:20:55 +00:00
|
|
|
if (!(props[param] instanceof Object)) {
|
|
|
|
if (query != '') query += '&';
|
|
|
|
query += `${param}=${props[param]}`;
|
|
|
|
}
|
2019-11-07 10:19:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
attachment: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
args: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|