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 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,
|
||||
});
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue