This commit is contained in:
@@ -11,17 +11,14 @@
|
||||
<v-tab-item key="list">
|
||||
<div class="mt-4" :style="cardTextStyle()">
|
||||
<v-list color="grey lighten-5" three-line>
|
||||
<v-list-item
|
||||
v-for="item in displayList"
|
||||
:key="item.id"
|
||||
@click="download(item.id)"
|
||||
>
|
||||
<v-list-item v-for="item in displayList" :key="item.id">
|
||||
<!-- @click="download(item.id)" -->
|
||||
<v-list-item-avatar>
|
||||
<v-icon v-text="item.icon"></v-icon>
|
||||
</v-list-item-avatar>
|
||||
|
||||
<v-list-item-content>
|
||||
<v-list-item-title v-text="item.name"></v-list-item-title>
|
||||
<v-list-item-title v-html="item.title"></v-list-item-title>
|
||||
|
||||
<v-list-item-subtitle
|
||||
v-text="item.date"
|
||||
@@ -95,33 +92,28 @@ export default {
|
||||
return "height: " + this.height + "px;overflow-y:auto;";
|
||||
},
|
||||
upload() {
|
||||
let vm = this;
|
||||
let at = {
|
||||
ayaId: this.ayaId,
|
||||
ayaType: this.ayaType,
|
||||
files: this.uploadFiles,
|
||||
notes: this.notes ? this.notes : ""
|
||||
ayaId: vm.ayaId,
|
||||
ayaType: vm.ayaType,
|
||||
files: vm.uploadFiles,
|
||||
notes: vm.notes ? vm.notes : ""
|
||||
};
|
||||
|
||||
window.$gz.api.uploadAttachment(at).then(res => {
|
||||
//vm.formState.loading = false;
|
||||
if (res.error) {
|
||||
console.log(res.error);
|
||||
// vm.formState.serverError = res.error;
|
||||
// window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
this.attachedFiles = res.data;
|
||||
this.updateDisplayList();
|
||||
}
|
||||
}); //todo: popup message box on error seems best way to handle this for now
|
||||
// .catch(function handleSubmitError(error) {
|
||||
// vm.formState.loading = false;
|
||||
// window.$gz.errorHandler.handleFormError(error, vm);
|
||||
// });
|
||||
// if (this.uploadFiles.length > 0) {
|
||||
// this.uploadFiles.forEach(file => {
|
||||
// window.console.log(file);
|
||||
// });
|
||||
// }
|
||||
window.$gz.api
|
||||
.uploadAttachment(at)
|
||||
.then(res => {
|
||||
if (res.error) {
|
||||
window.$gz.errorHandler.handleFormError(res.error);
|
||||
} else {
|
||||
vm.uploadFiles = [];
|
||||
vm.attachedFiles = res.data;
|
||||
vm.updateDisplayList();
|
||||
}
|
||||
})
|
||||
.catch(function handleUploadError(error) {
|
||||
window.$gz.errorHandler.handleFormError(error);
|
||||
});
|
||||
},
|
||||
getList() {
|
||||
let vm = this;
|
||||
@@ -129,26 +121,24 @@ export default {
|
||||
.get("Attachment/list?ayatype=" + vm.ayaType + "&ayaid=" + vm.ayaId)
|
||||
.then(res => {
|
||||
if (res.error) {
|
||||
console.log(res.error);
|
||||
window.$gz.errorHandler.handleFormError(res.error);
|
||||
} else {
|
||||
vm.attachedFiles = res.data;
|
||||
vm.updateDisplayList();
|
||||
}
|
||||
})
|
||||
.catch(function handleGetListError(error) {
|
||||
window.$gz.errorHandler.handleFormError(error);
|
||||
});
|
||||
// .catch(function handleGetDataFromAPIError(error) {
|
||||
// //Update the form status
|
||||
// window.$gz.form.setFormState({
|
||||
// vm: vm,
|
||||
// loading: false
|
||||
// });
|
||||
// window.$gz.errorHandler.handleFormError(error, vm);
|
||||
// });
|
||||
},
|
||||
download(item) {
|
||||
console.log("CLICK", item);
|
||||
},
|
||||
updateDisplayList() {
|
||||
//{"data":[{"id":1,"concurrencyToken":7733332,"contentType":"image/png","displayFileName":"Screen Shot 2020-01-09 at 10.50.24.png","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"},{"id":4,"concurrencyToken":7733354,"contentType":"text/plain","displayFileName":"TNT log file ayanova.txt","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"},{"id":2,"concurrencyToken":7733342,"contentType":"text/plain","displayFileName":"stack.txt","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"},{"id":3,"concurrencyToken":7733348,"contentType":"image/jpeg","displayFileName":"t2cx6sloffk41.jpg","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"}]}
|
||||
if (!this.attachedFiles) {
|
||||
this.attachedFiles = [];
|
||||
}
|
||||
|
||||
let timeZoneName = window.$gz.locale.getBrowserTimeZoneName();
|
||||
let languageName = window.$gz.locale.getBrowserLanguages();
|
||||
@@ -156,8 +146,15 @@ export default {
|
||||
let ret = [];
|
||||
for (let i = 0; i < this.attachedFiles.length; i++) {
|
||||
let o = this.attachedFiles[i];
|
||||
//http://localhost:7575/api/v8/Attachment/download/100?t=sssss
|
||||
ret.push({
|
||||
id: o.id,
|
||||
title:
|
||||
"<a href='" +
|
||||
window.$gz.api.downloadUrl(o.id) +
|
||||
"' target='_blank'>" +
|
||||
o.displayFileName +
|
||||
"</a>",
|
||||
name: o.displayFileName,
|
||||
date: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||
o.lastModified,
|
||||
|
||||
Reference in New Issue
Block a user