refs #6677 dataRef
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-01-24 08:43:50 +01:00
parent b3fc865c18
commit 8f870f8d67
2 changed files with 25 additions and 11 deletions

View File

@ -1,6 +1,8 @@
<script setup> <script setup>
import FetchData from 'src/components/FetchData.vue';
import { ref, toRefs, computed, watch } from 'vue'; import { ref, toRefs, computed, watch } from 'vue';
const emit = defineEmits(['update:modelValue', 'update:options']); const emit = defineEmits(['update:modelValue', 'update:options']);
const dataRef = ref();
const $props = defineProps({ const $props = defineProps({
modelValue: { modelValue: {
@ -15,6 +17,14 @@ const $props = defineProps({
type: String, type: String,
default: '', default: '',
}, },
optionValue: {
type: String,
default: '',
},
url: {
type: String,
default: '',
},
filterOptions: { filterOptions: {
type: Array, type: Array,
default: () => [], default: () => [],
@ -89,7 +99,14 @@ watch(options, (newValue) => {
</script> </script>
<template> <template>
<FetchData
ref="dataRef"
:url="$props.url"
@on-fetch="(data) => (dataRef = data)"
auto-load
/>
<QSelect <QSelect
v-if="dataRef"
v-model="value" v-model="value"
:options="myOptions" :options="myOptions"
:option-label="optionLabel" :option-label="optionLabel"

View File

@ -6,7 +6,6 @@ import { useQuasar } from 'quasar';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { downloadFile } from 'src/composables/downloadFile'; import { downloadFile } from 'src/composables/downloadFile';
import FetchData from 'src/components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import axios from 'axios'; import axios from 'axios';
@ -146,12 +145,12 @@ function supplierRefFilter(val) {
} }
</script> </script>
<template> <template>
<FetchData <!-- <FetchData
ref="suppliersRef" ref="suppliersRef"
url="Suppliers" url="Suppliers"
@on-fetch="(data) => (suppliers = data)" @on-fetch="(data) => (suppliers = data)"
/> /> -->
<FetchData <!-- <FetchData
ref="currenciesRef" ref="currenciesRef"
url="Currencies" url="Currencies"
:filter="{ fields: ['id', 'code'] }" :filter="{ fields: ['id', 'code'] }"
@ -193,21 +192,19 @@ function supplierRefFilter(val) {
url="UserConfigs/getUserConfig" url="UserConfigs/getUserConfig"
@on-fetch="(data) => (userConfig = data)" @on-fetch="(data) => (userConfig = data)"
auto-load auto-load
/> /> -->
<FormModel v-if="invoiceIn" :url="`InvoiceIns/${route.params.id}`" model="invoiceIn"> <FormModel v-if="invoiceIn" :url="`InvoiceIns/${route.params.id}`" model="invoiceIn">
<template #form="{ data }"> <template #form="{ data }">
<div class="row q-gutter-md q-mb-md"> <div class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelectFilter <VnSelectFilter
v-if="suppliersRef"
:label="t('supplierFk')" :label="t('supplierFk')"
v-model="data.supplierFk" v-model="data.supplierFk"
:options="suppliers"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:input-debounce="100" url="Suppliers"
@input-value="supplierRefFilter" :filter="{ fields: ['id', 'code'], order: 'code' }"
:default-filter="false" @update-options="(data) => (suppliersRef = data)"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -418,7 +415,7 @@ function supplierRefFilter(val) {
<div class="row q-gutter-md q-mb-md"> <div class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelectFilter <VnSelectFilter
v-if="currenciesRef" url="Currencies"
:label="t('Currency')" :label="t('Currency')"
v-model="data.currencyFk" v-model="data.currencyFk"
:options="currencies" :options="currencies"