0
0
Fork 0

fix: refs #7524 use limit item Section

This commit is contained in:
Jorge Penadés 2024-08-26 16:34:46 +02:00
parent 89287c3ea3
commit 566a649c20
7 changed files with 30 additions and 70 deletions

View File

@ -202,7 +202,7 @@ function formatValue(value) {
function sanitizer(params) { function sanitizer(params) {
for (const [key, value] of Object.entries(params)) { for (const [key, value] of Object.entries(params)) {
if (typeof value == 'object') if (typeof value == 'object')
params[key] = Object.values(value)[0].replaceAll('%', ''); params[key] = Object.values(value)?.[0]?.replaceAll('%', '');
} }
return params; return params;
} }

View File

@ -19,15 +19,6 @@ const itemSpeciesOptions = ref([]);
const itemBotanicals = ref([]); const itemBotanicals = ref([]);
let itemBotanicalsForm = reactive({ itemFk: null }); let itemBotanicalsForm = reactive({ itemFk: null });
const onGenusCreated = (response, formData) => {
itemGenusOptions.value = [...itemGenusOptions.value, response];
formData.genusFk = response.id;
};
const onSpecieCreated = (response, formData) => {
itemSpeciesOptions.value = [...itemSpeciesOptions.value, response];
formData.specieFk = response.id;
};
const entityId = computed(() => { const entityId = computed(() => {
return route.params.id; return route.params.id;
}); });
@ -69,36 +60,35 @@ onMounted(async () => {
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
<VnSelectDialog <VnSelectDialog
ref="genusRef"
:label="t('Genus')" :label="t('Genus')"
v-model="data.genusFk" v-model="data.genusFk"
:options="itemGenusOptions" url="Genera"
option-label="name" option-label="name"
option-value="id" option-value="id"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected hide-selected
> >
<template #form> <template #form>
<CreateGenusForm <CreateGenusForm
@on-data-saved=" @on-data-saved="(_, res) => (data.genusFk = res.id)"
(_, requestResponse) =>
onGenusCreated(requestResponse, data)
"
/> />
</template> </template>
</VnSelectDialog> </VnSelectDialog>
<VnSelectDialog <VnSelectDialog
:label="t('Species')" :label="t('Species')"
v-model="data.specieFk" v-model="data.specieFk"
:options="itemSpeciesOptions" url="Species"
option-label="name" option-label="name"
option-value="id" option-value="id"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected hide-selected
> >
<template #form> <template #form>
<CreateSpecieForm <CreateSpecieForm
@on-data-saved=" @on-data-saved="(_, res) => (data.specieFk = res.id)"
(_, requestResponse) =>
onSpecieCreated(requestResponse, data)
"
/> />
</template> </template>
</VnSelectDialog> </VnSelectDialog>

View File

@ -3,7 +3,6 @@ import { onMounted, ref, computed, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
@ -24,8 +23,6 @@ const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const rowsSelected = ref([]); const rowsSelected = ref([]);
const parkingsOptions = ref([]);
const shelvingsOptions = ref([]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -104,7 +101,9 @@ const columns = computed(() => [
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
attrs: { attrs: {
options: parkingsOptions.value, url: 'parkings',
fields: ['code'],
'sort-by': 'code ASC',
'option-value': 'code', 'option-value': 'code',
'option-label': 'code', 'option-label': 'code',
dense: true, dense: true,
@ -124,7 +123,9 @@ const columns = computed(() => [
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
attrs: { attrs: {
options: shelvingsOptions.value, url: 'shelvings',
fields: ['code'],
'sort-by': 'code ASC',
'option-value': 'code', 'option-value': 'code',
'option-label': 'code', 'option-label': 'code',
dense: true, dense: true,
@ -188,18 +189,6 @@ onMounted(async () => {
</script> </script>
<template> <template>
<FetchData
url="parkings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (parkingsOptions = data)"
/>
<FetchData
url="shelvings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (shelvingsOptions = data)"
/>
<template v-if="stateStore.isHeaderMounted()"> <template v-if="stateStore.isHeaderMounted()">
<Teleport to="#st-data"> <Teleport to="#st-data">
<div class="q-pa-md q-mr-lg q-ma-xs" style="border: 2px solid #222"> <div class="q-pa-md q-mr-lg q-ma-xs" style="border: 2px solid #222">
@ -237,7 +226,6 @@ onMounted(async () => {
</QBtn> </QBtn>
</Teleport> </Teleport>
</template> </template>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable
:rows="rows" :rows="rows"

View File

@ -24,6 +24,7 @@ const getSelectedTagValues = async (tag) => {
const filter = { const filter = {
fields: ['value'], fields: ['value'],
order: 'value ASC', order: 'value ASC',
limit: 30,
}; };
const params = { filter: JSON.stringify(filter) }; const params = { filter: JSON.stringify(filter) };
@ -126,7 +127,7 @@ const insertTag = (rows) => {
:key="row.tagFk" :key="row.tagFk"
:label="t('Value')" :label="t('Value')"
v-model="row.value" v-model="row.value"
:options="valueOptionsMap.get(row.tagFk)" :url="`Tags/${row.tagFk}/filterValue`"
option-label="value" option-label="value"
option-value="value" option-value="value"
emit-value emit-value
@ -135,6 +136,7 @@ const insertTag = (rows) => {
:is-clearable="false" :is-clearable="false"
:required="false" :required="false"
:rules="validate('itemTag.tagFk')" :rules="validate('itemTag.tagFk')"
:use-like="false"
/> />
<VnInput <VnInput
v-else-if=" v-else-if="

View File

@ -30,7 +30,7 @@ const itemTypesRef = ref(null);
const categoriesOptions = ref([]); const categoriesOptions = ref([]);
const itemTypesOptions = ref([]); const itemTypesOptions = ref([]);
const buyersOptions = ref([]); const buyersOptions = ref([]);
const suppliersOptions = ref([]); const tagOptions = ref([]);
const tagValues = ref([]); const tagValues = ref([]);
const fieldFiltersValues = ref([]); const fieldFiltersValues = ref([]);
const moreFields = ref([]); const moreFields = ref([]);
@ -161,12 +161,6 @@ onMounted(async () => {
@on-fetch="(data) => (buyersOptions = data)" @on-fetch="(data) => (buyersOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC' }"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData <FetchData
url="Tags" url="Tags"
:filter="{ fields: ['id', 'name', 'isFree'] }" :filter="{ fields: ['id', 'name', 'isFree'] }"
@ -261,9 +255,11 @@ onMounted(async () => {
:label="t('params.supplierFk')" :label="t('params.supplierFk')"
v-model="params.supplierFk" v-model="params.supplierFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="suppliersOptions" url="Suppliers"
option-value="id" option-value="id"
option-label="name" option-label="name"
:fields="['id', 'name', 'nickname']"
sort-by="name ASC"
hide-selected hide-selected
dense dense
outlined outlined

View File

@ -22,7 +22,6 @@ import RightMenu from 'src/components/common/RightMenu.vue';
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify(); const { notify } = useNotify();
const stateStore = useStateStore(); const stateStore = useStateStore();
const workersOptions = ref([]);
let filterParams = ref({}); let filterParams = ref({});
const denyFormRef = ref(null); const denyFormRef = ref(null);
const denyRequestId = ref(null); const denyRequestId = ref(null);
@ -208,13 +207,6 @@ onBeforeMount(() => {
</script> </script>
<template> <template>
<FetchData
url="Workers"
:filter="{ where: { role: 'buyer' } }"
order="id"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<VnSearchbar <VnSearchbar
data-key="ItemRequests" data-key="ItemRequests"
url="TicketRequests/filter" url="TicketRequests/filter"
@ -268,7 +260,9 @@ onBeforeMount(() => {
<QTd> <QTd>
<VnSelect <VnSelect
v-model="row.attenderFk" v-model="row.attenderFk"
:options="workersOptions" :where="{ role: 'buyer' }"
sort-by="id"
url="Workers"
hide-selected hide-selected
option-label="firstName" option-label="firstName"
option-value="id" option-value="id"

View File

@ -24,7 +24,6 @@ const stateOptions = [
const itemTypesOptions = ref([]); const itemTypesOptions = ref([]);
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const workersOptions = ref([]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -72,18 +71,6 @@ const decrement = (paramsObj, key) => {
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Workers/search"
:filter="{
fields: ['id', 'name'],
order: 'name ASC',
}"
:params="{
departmentCodes: ['VT'],
}"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
@ -162,7 +149,10 @@ const decrement = (paramsObj, key) => {
:label="t('params.requesterFk')" :label="t('params.requesterFk')"
v-model="params.requesterFk" v-model="params.requesterFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="workersOptions" url="Workers/search"
:fields="['id', 'name']"
order="name ASC"
:params="{ departmentCodes: ['VT'] }"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected