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) {
for (const [key, value] of Object.entries(params)) {
if (typeof value == 'object')
params[key] = Object.values(value)[0].replaceAll('%', '');
params[key] = Object.values(value)?.[0]?.replaceAll('%', '');
}
return params;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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