60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
import ngModule from '../../module';
|
|
import Component from 'core/lib/component';
|
|
import './style.scss';
|
|
|
|
class Controller extends Component {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
this.filter = {
|
|
include: {
|
|
relation: 'dms',
|
|
scope: {
|
|
fields: [
|
|
'dmsTypeFk',
|
|
'reference',
|
|
'hardCopyNumber',
|
|
'workerFk',
|
|
'description',
|
|
'hasFile',
|
|
'file',
|
|
'created',
|
|
],
|
|
include: [
|
|
{
|
|
relation: 'dmsType',
|
|
scope: {
|
|
fields: ['name']
|
|
}
|
|
}, {
|
|
relation: 'worker',
|
|
scope: {
|
|
fields: ['userFk'],
|
|
include: {
|
|
relation: 'user',
|
|
scope: {
|
|
fields: ['nickname']
|
|
}
|
|
},
|
|
}
|
|
}
|
|
]
|
|
},
|
|
}
|
|
};
|
|
}
|
|
|
|
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!'));
|
|
});
|
|
}
|
|
}
|
|
|
|
ngModule.component('vnWorkerDmsIndex', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
});
|