forked from verdnatura/salix-front
refs #7283 fix ItemDescriptor warehouse
This commit is contained in:
parent
27f25f611f
commit
3004d77d34
|
@ -65,15 +65,23 @@ onMounted(async () => {
|
|||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = async (entity) => {
|
||||
if (!entity) return;
|
||||
data.value = useCardDescription(entity.name, entity.id);
|
||||
await updateStock();
|
||||
try {
|
||||
if (!entity) return;
|
||||
data.value = useCardDescription(entity.name, entity.id);
|
||||
await updateStock();
|
||||
} catch (err) {
|
||||
console.error('Error item');
|
||||
}
|
||||
};
|
||||
|
||||
const getItemConfigs = async () => {
|
||||
const { data } = await axios.get('ItemConfigs/findOne');
|
||||
if (!data) return;
|
||||
return (warehouseConfig.value = data.warehouseFk);
|
||||
try {
|
||||
const { data } = await axios.get('ItemConfigs/findOne');
|
||||
if (!data) return;
|
||||
return (warehouseConfig.value = data.warehouseFk);
|
||||
} catch (err) {
|
||||
console.error('Error item');
|
||||
}
|
||||
};
|
||||
const updateStock = async () => {
|
||||
try {
|
||||
|
@ -85,13 +93,13 @@ const updateStock = async () => {
|
|||
dated: $props.dated,
|
||||
};
|
||||
|
||||
await getItemConfigs();
|
||||
if (!params.warehouseFk) {
|
||||
params.warehouseFk = warehouseConfig.value;
|
||||
}
|
||||
const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, {
|
||||
params,
|
||||
});
|
||||
|
||||
available.value = data.available;
|
||||
visible.value = data.visible;
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue