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 data = ref(useCardDescription());
|
||||||
const setData = async (entity) => {
|
const setData = async (entity) => {
|
||||||
|
try {
|
||||||
if (!entity) return;
|
if (!entity) return;
|
||||||
data.value = useCardDescription(entity.name, entity.id);
|
data.value = useCardDescription(entity.name, entity.id);
|
||||||
await updateStock();
|
await updateStock();
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error item');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getItemConfigs = async () => {
|
const getItemConfigs = async () => {
|
||||||
|
try {
|
||||||
const { data } = await axios.get('ItemConfigs/findOne');
|
const { data } = await axios.get('ItemConfigs/findOne');
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
return (warehouseConfig.value = data.warehouseFk);
|
return (warehouseConfig.value = data.warehouseFk);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error item');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const updateStock = async () => {
|
const updateStock = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -85,13 +93,13 @@ const updateStock = async () => {
|
||||||
dated: $props.dated,
|
dated: $props.dated,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
await getItemConfigs();
|
||||||
if (!params.warehouseFk) {
|
if (!params.warehouseFk) {
|
||||||
params.warehouseFk = warehouseConfig.value;
|
params.warehouseFk = warehouseConfig.value;
|
||||||
}
|
}
|
||||||
const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, {
|
const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
|
|
||||||
available.value = data.available;
|
available.value = data.available;
|
||||||
visible.value = data.visible;
|
visible.value = data.visible;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue