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

View File

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

View File

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