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

37 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-11-22 09:42:05 +00:00
import ngModule from '../../module';
2019-11-22 12:46:38 +00:00
import Component from 'core/lib/component';
2019-11-22 09:42:05 +00:00
import './style.scss';
2019-11-22 12:46:38 +00:00
class Controller extends Component {
2020-06-12 12:28:29 +00:00
constructor($element, $, vnFile) {
2019-11-22 12:46:38 +00:00
super($element, $);
2020-06-12 12:28:29 +00:00
this.vnFile = vnFile;
2019-11-22 09:42:05 +00:00
}
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!'));
2019-11-22 09:42:05 +00:00
});
}
2020-06-12 12:28:29 +00:00
downloadFile(dmsId, isDocuware) {
if (isDocuware) return this.vnFile.download(`api/workerDms/${dmsId}/docuwareDownload`);
2020-06-12 12:28:29 +00:00
this.vnFile.download(`api/workerDms/${dmsId}/downloadFile`);
}
2023-05-31 09:32:37 +00:00
async openDocuware() {
const url = await this.vnApp.getUrl(`WebClient`, 'docuware');
if (url) window.open(url).focus();
}
2019-11-22 09:42:05 +00:00
}
2020-06-12 12:28:29 +00:00
Controller.$inject = ['$element', '$scope', 'vnFile'];
ngModule.vnComponent('vnWorkerDmsIndex', {
2019-11-22 09:42:05 +00:00
template: require('./index.html'),
controller: Controller,
});