apertura allegati

This commit is contained in:
Paolo Possanzini
2019-01-03 16:01:47 +01:00
parent 805dc416f0
commit d7ae5eb5b5
3 changed files with 25 additions and 3 deletions
@@ -92,7 +92,7 @@ export default class AlarmDetail extends Vue {
async openAttach(attach) {
if (attach) {
// await new MaintenanceService().OpenModal(attach, this.isimage(attach.fileName));
await alarmsService.OpenModal(attach, this.isimage(attach.fileName));
}
}
};
+23 -1
View File
@@ -1,5 +1,7 @@
import { baseRestService } from "src/_base/baseRestService";
import { AlarmModel } from "../store";
import { ModalHelper } from "src/components/modals";
import { ModalIframe, ModalImage } from "src/modules/base-components/index";
export class AlarmsService extends baseRestService {
BASE_URL = "api/alarm/";
@@ -38,13 +40,33 @@ export class AlarmsService extends baseRestService {
async getAttachment(attachId) { return await this.Get(this.BASE_URL + `attachment/${attachId}`, true); }
async deleteAttachments(attachId) { return await this.Delete(this.BASE_URL + `attachment/${attachId}`, true); }
async postAttachment(alarmId, file) {
let result = await this.upload(this.BASE_URL + `${alarmId}/attachment`, file, file.name, {});
// let result = await this.upload(this.BASE_URL + "maintenance/" + m.id + "/attachment", file, file.name, {});
// maintenanceActions.updateAttachMaintenance(store, result.data);
return result;
}
async getContentAttachmentURI(attach) {
let result = this.BASE_URL + "attachment/" + attach.attachmentId;
return result;
}
async OpenModal(attach, isimage) {
debugger
if (isimage) {
ModalHelper.modalImage.content = await this.getContentAttachmentURI(attach);
ModalHelper.modalImage.title = attach.fileName;
ModalHelper.ShowModal(ModalImage);
}
else {
ModalHelper.modalIframe.content = await this.getContentAttachmentURI(attach);
ModalHelper.modalIframe.title = attach.fileName;
ModalHelper.ShowModal(ModalIframe);
}
}
}
export const alarmsService = new AlarmsService();
@@ -75,7 +75,7 @@ export class MaintenanceService extends baseRestService {
let result = this.BASE_URL + "attachment/" + attach.attachmentId;
return result;
}
async
async DeleteAttachMaintenance(attach) {
let result = await this.Delete<any>(this.BASE_URL + "attachment/" + attach.attachmentId, true);
maintenanceActions.deleteAttachMaintenance(store, attach);