forked from verdnatura/salix-front
refs #7283 fix ItemDescriptor warehouse
This commit is contained in:
parent
d6d5039f48
commit
27f25f611f
|
@ -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,
|
||||||
});
|
});
|
||||||
|
|
|
@ -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),
|
||||||
|
|
Loading…
Reference in New Issue