diff --git a/src/components/common/VnComponent.vue b/src/components/common/VnComponent.vue index e411059c2..364f8044f 100644 --- a/src/components/common/VnComponent.vue +++ b/src/components/common/VnComponent.vue @@ -2,17 +2,12 @@ + diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 684770e9c..f37d0dc6d 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -2,7 +2,12 @@ import { computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; -const emit = defineEmits(['update:modelValue', 'update:options', 'keyup.enter']); +const emit = defineEmits([ + 'update:modelValue', + 'update:options', + 'keyup.enter', + 'remove', +]); const $props = defineProps({ modelValue: { @@ -43,6 +48,7 @@ const onEnterPress = () => { const handleValue = (val = null) => { value.value = val; + emit('remove'); }; const focus = () => { diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index a589f31e5..9e3e50eed 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -22,6 +22,10 @@ const $props = defineProps({ type: String, default: 'id', }, + optionFilter: { + type: String, + default: null, + }, url: { type: String, default: '', @@ -59,7 +63,7 @@ const $props = defineProps({ const { t } = useI18n(); const requiredFieldRule = (val) => val ?? t('globals.fieldRequired'); -const { optionLabel, optionValue, options, modelValue } = toRefs($props); +const { optionLabel, optionValue, optionFilter, options, modelValue } = toRefs($props); const myOptions = ref([]); const myOptionsOriginal = ref([]); const vnSelectRef = ref(); @@ -109,7 +113,7 @@ async function fetchFilter(val) { const { fields, sortBy, limit } = $props; let key = optionLabel.value; - if (new RegExp(/\d/g).test(val)) key = optionValue.value; + if (new RegExp(/\d/g).test(val)) key = optionFilter.value ?? optionValue.value; const where = { ...{ [key]: { like: `%${val}%` } }, ...$props.where }; const fetchOptions = { where, order: sortBy, limit }; diff --git a/src/components/common/VnTable.vue b/src/components/common/VnTable.vue index 1c23ac733..9cd3ac4a4 100644 --- a/src/components/common/VnTable.vue +++ b/src/components/common/VnTable.vue @@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; import { useStateStore } from 'stores/useStateStore'; +import FormModelPopup from 'components/FormModelPopup.vue'; import VnPaginate from 'components/ui/VnPaginate.vue'; import VnFilterPanel from 'components/ui/VnFilterPanel.vue'; import VnLv from 'components/ui/VnLv.vue'; @@ -189,7 +190,7 @@ const rowClickFunction = computed(() => { :column="col" :show-title="true" :data-key="$attrs['data-key']" - v-model="params[col.field]" + v-model="params[col.columnFilter?.field ?? col.field]" /> @@ -197,7 +198,12 @@ const rowClickFunction = computed(() => {