salix/modules/worker/front/dms/index/index.js

31 lines
827 B
JavaScript

import ngModule from '../../module';
import Component from 'core/lib/component';
import './style.scss';
class Controller extends Component {
constructor($element, $, vnFile) {
super($element, $);
this.vnFile = vnFile;
}
deleteDms(index) {
const workerDmsId = this.workerDms[index].dmsFk;
return this.$http.post(`WorkerDms/${workerDmsId}/removeFile`)
.then(() => {
this.$.model.remove(index);
this.vnApp.showSuccess(this.$t('Data saved!'));
});
}
downloadFile(dmsId) {
this.vnFile.download(`api/workerDms/${dmsId}/downloadFile`);
}
}
Controller.$inject = ['$element', '$scope', 'vnFile'];
ngModule.vnComponent('vnWorkerDmsIndex', {
template: require('./index.html'),
controller: Controller,
});