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

View File

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