salix/modules/item/front/card/index.js

34 lines
1013 B
JavaScript
Raw Normal View History

2017-12-20 13:36:12 +00:00
import ngModule from '../module';
2019-11-10 10:08:44 +00:00
import ModuleCard from 'salix/components/module-card';
2017-12-20 13:36:12 +00:00
2019-11-10 10:08:44 +00:00
class Controller extends ModuleCard {
reload() {
2019-11-10 10:08:44 +00:00
this.$http.get(`Items/${this.$params.id}/getCard`)
.then(res => this.item = res.data);
this.$http.get('ItemConfigs/findOne')
.then(res => {
if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') return;
this.warehouseFk = res.data.warehouseFk;
this.getWarehouseName(res.data.warehouseFk);
});
}
getWarehouseName(warehouseFk) {
const filter = {
where: {id: warehouseFk}
};
this.$http.get('Warehouses/findOne', {filter})
.then(res => {
this.warehouseText = this.$t('WarehouseFk', {
warehouseName: res.data.name
});
});
}
2017-12-20 13:36:12 +00:00
}
ngModule.vnComponent('vnItemCard', {
template: require('./index.html'),
controller: Controller
2017-12-20 13:36:12 +00:00
});