#7283 - fixItemDescriptor #680
|
@ -47,7 +47,7 @@ const router = useRouter();
|
|||
const { t } = useI18n();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
carlossa marked this conversation as resolved
|
||||
|
||||
const warehouseConfig = ref(null);
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
carlossa marked this conversation as resolved
jsegarra
commented
He visto que se hace en muchos sitios asi, pero si quieres un tip He visto que se hace en muchos sitios asi, pero si quieres un tip
`const entityId = computed(() => $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);
|
||||
};
|
||||
carlossa marked this conversation as resolved
Outdated
jsegarra
commented
Has puesto un condicional mas abajo, no seria lo mismo que poner Has puesto un condicional mas abajo, no seria lo mismo que poner
`$props.warehouseFk ?? user.value.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,
|
||||
});
|
||||
|
|
|
@ -47,7 +47,6 @@ const getWarehouseName = async (warehouseFk) => {
|
|||
const filter = {
|
||||
where: { id: warehouseFk },
|
||||
};
|
||||
|
||||
const { data } = await axios.get('Warehouses/findOne', {
|
||||
params: {
|
||||
carlossa marked this conversation as resolved
jsegarra
commented
Y si falla? Y si falla?
Poner try/catch
|
||||
filter: JSON.stringify(filter),
|
||||
|
|
Loading…
Reference in New Issue
Esto no se usa y salta warning