feat: use dataKey prop when same url
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-06-26 13:20:09 +02:00
parent 610aacb010
commit 94e626a460
3 changed files with 11 additions and 5 deletions

View File

@ -21,6 +21,10 @@ const $props = defineProps({
type: String, type: String,
default: 'id', default: 'id',
}, },
dataKey: {
type: String,
default: null,
},
optionFilter: { optionFilter: {
type: String, type: String,
default: null, default: null,
@ -89,7 +93,7 @@ const useURL = computed(() => $props.url);
import { useAttrs } from 'vue'; import { useAttrs } from 'vue';
const $attrs = useAttrs(); const $attrs = useAttrs();
const arrayDataKey = $props.url !== '' ? $props.url : $attrs.label; const arrayDataKey = $props.dataKey ?? ($props.url !== '' ? $props.url : $attrs.label);
const arrayDataOptions = { const arrayDataOptions = {
url: $props.url, url: $props.url,
where: $props.where, where: $props.where,

View File

@ -13,7 +13,6 @@ import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const workers = ref([]);
const businessTypes = ref([]); const businessTypes = ref([]);
const contactChannels = ref([]); const contactChannels = ref([]);
</script> </script>
@ -99,10 +98,11 @@ const contactChannels = ref([]);
<VnSelect <VnSelect
:input-debounce="0" :input-debounce="0"
:label="t('customer.basicData.salesPerson')" :label="t('customer.basicData.salesPerson')"
:options="workers"
:rules="validate('client.salesPersonFk')" :rules="validate('client.salesPersonFk')"
url="Workers/activeWithInheritedRole" url="Workers/activeWithInheritedRole"
hide-selected
:where="{ role: 'salesPerson' }" :where="{ role: 'salesPerson' }"
dense
emit-value emit-value
map-options map-options
option-label="name" option-label="name"

View File

@ -57,8 +57,7 @@ const props = defineProps({
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:where="{ role: 'salesPerson' }" data-key="salesperson"
option-filter="firstName"
url="Workers/activeWithInheritedRole" url="Workers/activeWithInheritedRole"
:input-debounce="0" :input-debounce="0"
:label="t('Salesperson')" :label="t('Salesperson')"
@ -68,6 +67,8 @@ const props = defineProps({
map-options map-options
option-label="name" option-label="name"
option-value="id" option-value="id"
:where="{ role: 'salesPerson' }"
option-filter="firstName"
outlined outlined
rounded rounded
use-input use-input
@ -142,6 +143,7 @@ const props = defineProps({
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
data-key="author"
:input-debounce="0" :input-debounce="0"
:label="t('Author')" :label="t('Author')"
url="Workers/activeWithInheritedRole" url="Workers/activeWithInheritedRole"