0
0
Fork 0

refs #7283 fix ItemDescriptor warehouse

This commit is contained in:
Carlos Satorres 2024-09-06 14:57:10 +02:00
parent d6d5039f48
commit 27f25f611f
2 changed files with 13 additions and 7 deletions

View File

@ -47,7 +47,7 @@ const router = useRouter();
const { t } = useI18n();
const state = useState();
const user = state.getUser();
const warehouseConfig = ref(null);
const entityId = computed(() => {
return $props.id || route.params.id;
});
@ -58,16 +58,23 @@ const visible = ref(null);
const salixUrl = ref();
onMounted(async () => {
updateStock();
salixUrl.value = await getUrl('');
await getItemConfigs();
await updateStock();
});
const data = ref(useCardDescription());
const setData = (entity) => {
const setData = async (entity) => {
if (!entity) return;
data.value = useCardDescription(entity.name, entity.id);
await updateStock();
};
const getItemConfigs = async () => {
const { data } = await axios.get('ItemConfigs/findOne');
if (!data) return;
return (warehouseConfig.value = data.warehouseFk);
};
const updateStock = async () => {
try {
available.value = null;
@ -77,10 +84,10 @@ const updateStock = async () => {
warehouseFk: $props.warehouseFk,
dated: $props.dated,
};
if (!params.warehouseFk) {
params.warehouseFk = user.value.warehouseFk;
}
if (!params.warehouseFk) {
params.warehouseFk = warehouseConfig.value;
}
const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, {
params,
});

View File

@ -47,7 +47,6 @@ const getWarehouseName = async (warehouseFk) => {
const filter = {
where: { id: warehouseFk },
};
const { data } = await axios.get('Warehouses/findOne', {
params: {
filter: JSON.stringify(filter),