forked from verdnatura/salix-front
Implement shelving filter
This commit is contained in:
parent
8855880306
commit
b11253ba28
|
@ -26,7 +26,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['refresh', 'clear']);
|
const emit = defineEmits(['refresh', 'clear', 'search']);
|
||||||
|
|
||||||
const arrayData = useArrayData(props.dataKey);
|
const arrayData = useArrayData(props.dataKey);
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
|
@ -49,6 +49,7 @@ async function search() {
|
||||||
if (!props.showAll && !Object.values(params).length) store.data = [];
|
if (!props.showAll && !Object.values(params).length) store.data = [];
|
||||||
|
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
|
emit('search');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reload() {
|
async function reload() {
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import LeftMenu from 'components/LeftMenu.vue';
|
import LeftMenu from 'components/LeftMenu.vue';
|
||||||
import ShelvingSearchbar from "pages/Shelving/Card/ShelvingSearchbar.vue";
|
import ShelvingDescriptor from 'pages/Shelving/Card/ShelvingDescriptor.vue';
|
||||||
import ShelvingDescriptor from "pages/Shelving/Card/ShelvingDescriptor.vue";
|
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
|
||||||
<ShelvingSearchbar />
|
|
||||||
</Teleport>
|
|
||||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||||
<QScrollArea class="fit">
|
<QScrollArea class="fit">
|
||||||
<ShelvingDescriptor />
|
<ShelvingDescriptor />
|
||||||
|
|
|
@ -12,6 +12,8 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['search']);
|
||||||
|
|
||||||
const workers = ref();
|
const workers = ref();
|
||||||
const parkings = ref();
|
const parkings = ref();
|
||||||
|
|
||||||
|
@ -39,7 +41,7 @@ function setParkings(data) {
|
||||||
@on-fetch="setWorkers"
|
@on-fetch="setWorkers"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true" @search="emit('search')">
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import {computed, onMounted, onUnmounted} from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import {useRoute, useRouter} from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
|
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -12,7 +14,11 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const stateStore = useStateStore();
|
||||||
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
onMounted(() => (stateStore.rightDrawer = false));
|
||||||
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -33,6 +39,23 @@ const filter = {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<template v-if="stateStore.isHeaderMounted()">
|
||||||
|
<Teleport to="#actions-append">
|
||||||
|
<div class="row q-gutter-x-sm">
|
||||||
|
<QBtn
|
||||||
|
flat
|
||||||
|
@click="stateStore.toggleRightDrawer()"
|
||||||
|
round
|
||||||
|
dense
|
||||||
|
icon="menu"
|
||||||
|
>
|
||||||
|
<QTooltip bottom anchor="bottom right">
|
||||||
|
{{ t('globals.collapseMenu') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</div>
|
||||||
|
</Teleport>
|
||||||
|
</template>
|
||||||
<CardSummary ref="summary" :url="`Shelvings/${entityId}`" :filter="filter">
|
<CardSummary ref="summary" :url="`Shelvings/${entityId}`" :filter="filter">
|
||||||
<template #header="{ entity }">
|
<template #header="{ entity }">
|
||||||
<div>{{ entity.code }}</div>
|
<div>{{ entity.code }}</div>
|
||||||
|
@ -42,18 +65,12 @@ const filter = {
|
||||||
<div class="header">
|
<div class="header">
|
||||||
{{ t('shelving.pageTitles.basicData') }}
|
{{ t('shelving.pageTitles.basicData') }}
|
||||||
</div>
|
</div>
|
||||||
<VnLv
|
<VnLv :label="t('shelving.summary.code')" :value="entity.code" />
|
||||||
:label="t('shelving.summary.code')"
|
|
||||||
:value="entity.code"
|
|
||||||
/>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('shelving.summary.parking')"
|
:label="t('shelving.summary.parking')"
|
||||||
:value="entity.parking?.code"
|
:value="entity.parking?.code"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv :label="t('shelving.summary.priority')" :value="entity.priority" />
|
||||||
:label="t('shelving.summary.priority')"
|
|
||||||
:value="entity.priority"
|
|
||||||
/>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('shelving.summary.worker')"
|
:label="t('shelving.summary.worker')"
|
||||||
:value="entity.worker?.user?.nickname"
|
:value="entity.worker?.user?.nickname"
|
||||||
|
@ -65,4 +82,12 @@ const filter = {
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
|
<QScrollArea class="fit text-grey-8">
|
||||||
|
<ShelvingFilter
|
||||||
|
data-key="ShelvingList"
|
||||||
|
@search="router.push({ name: 'ShelvingList' })"
|
||||||
|
/>
|
||||||
|
</QScrollArea>
|
||||||
|
</QDrawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -34,6 +34,17 @@ function viewSummary(id) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function exprBuilder(param, value) {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return {code: {like: `%${value}%`}};
|
||||||
|
case 'parkingFk':
|
||||||
|
case 'userFk':
|
||||||
|
case 'isRecyclable':
|
||||||
|
return {[param]: value};
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -68,6 +79,7 @@ function viewSummary(id) {
|
||||||
data-key="ShelvingList"
|
data-key="ShelvingList"
|
||||||
url="Shelvings"
|
url="Shelvings"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
|
:expr-builder="exprBuilder"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
|
|
Loading…
Reference in New Issue