fix(02): form by type option
This commit is contained in:
parent
2ff18e7785
commit
2e4cc0874f
1 changed files with 152 additions and 39 deletions
|
|
@ -1,14 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import useUserStore from 'stores/user';
|
import useUserStore from 'stores/user';
|
||||||
|
import useOptionStore from 'stores/options';
|
||||||
import { UserAttachmentDelete } from 'stores/user/types';
|
import { UserAttachmentDelete } from 'stores/user/types';
|
||||||
import { dialog } from 'stores/utils';
|
import { dialog, selectFilterOptionRefMod } from 'stores/utils';
|
||||||
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
||||||
import { ref } from 'vue';
|
import { onMounted, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { Icon } from '@iconify/vue';
|
import { Icon } from '@iconify/vue';
|
||||||
|
import { QSelect } from 'quasar';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
const optionStore = useOptionStore();
|
||||||
|
|
||||||
const userId = defineModel<string>('userId');
|
const userId = defineModel<string>('userId');
|
||||||
const userType = defineModel<string>('userType');
|
const userType = defineModel<string>('userType');
|
||||||
|
|
@ -67,6 +70,60 @@ function deleteFile(name: string) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nationalityOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
let nationalityFilter: (
|
||||||
|
value: string,
|
||||||
|
update: (callbackFn: () => void, afterFn?: (ref: QSelect) => void) => void,
|
||||||
|
) => void;
|
||||||
|
|
||||||
|
const trainingPlaceOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
let trainingPlaceFilter: (
|
||||||
|
value: string,
|
||||||
|
update: (callbackFn: () => void, afterFn?: (ref: QSelect) => void) => void,
|
||||||
|
) => void;
|
||||||
|
|
||||||
|
const responsibleAreaOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
let responsibleAreaFilter: (
|
||||||
|
value: string,
|
||||||
|
update: (callbackFn: () => void, afterFn?: (ref: QSelect) => void) => void,
|
||||||
|
) => void;
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (optionStore.globalOption?.nationality) {
|
||||||
|
nationalityFilter = selectFilterOptionRefMod(
|
||||||
|
ref(optionStore.globalOption.nationality),
|
||||||
|
nationalityOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
trainingPlaceFilter = selectFilterOptionRefMod(
|
||||||
|
ref(optionStore.globalOption.training),
|
||||||
|
trainingPlaceOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
responsibleAreaFilter = selectFilterOptionRefMod(
|
||||||
|
ref(optionStore.globalOption.area),
|
||||||
|
responsibleAreaOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => optionStore.globalOption,
|
||||||
|
() => {
|
||||||
|
nationalityFilter = selectFilterOptionRefMod(
|
||||||
|
ref(optionStore.globalOption.nationality),
|
||||||
|
nationalityOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
trainingPlaceFilter = selectFilterOptionRefMod(
|
||||||
|
ref(optionStore.globalOption.training),
|
||||||
|
trainingPlaceOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="row col-12">
|
<div class="row col-12">
|
||||||
|
|
@ -224,23 +281,37 @@ function deleteFile(name: string) {
|
||||||
</template>
|
</template>
|
||||||
</VueDatePicker>
|
</VueDatePicker>
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
|
||||||
id="input-responsible-area"
|
|
||||||
v-if="userType === 'MESSENGER'"
|
v-if="userType === 'MESSENGER'"
|
||||||
:dense="dense"
|
|
||||||
outlined
|
outlined
|
||||||
:readonly="readonly"
|
clearable
|
||||||
:hide-dropdown-icon="readonly"
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
options-dense
|
hide-selected
|
||||||
:label="$t('formDialogInputResponsibleArea')"
|
hide-bottom-space
|
||||||
class="col-12"
|
class="col-12"
|
||||||
|
input-debounce="0"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
option-value="label"
|
option-value="value"
|
||||||
|
lazy-rules="ondemand"
|
||||||
|
id="input-responsible-area"
|
||||||
v-model="responsibleArea"
|
v-model="responsibleArea"
|
||||||
:options="userStore.userOption.responsibleAreaOpts"
|
:dense="dense"
|
||||||
/>
|
:readonly="readonly"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:label="$t('formDialogInputResponsibleArea')"
|
||||||
|
:options="responsibleAreaOptions"
|
||||||
|
@filter="responsibleAreaFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="userType === 'DELEGATE'"
|
v-if="userType === 'DELEGATE'"
|
||||||
|
|
@ -265,56 +336,98 @@ function deleteFile(name: string) {
|
||||||
style="margin-left: 0px; padding-left: 0px"
|
style="margin-left: 0px; padding-left: 0px"
|
||||||
>
|
>
|
||||||
<q-select
|
<q-select
|
||||||
|
outlined
|
||||||
|
clearable
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
input-debounce="0"
|
||||||
|
option-value="value"
|
||||||
|
option-label="label"
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
|
class="col-md-3 col-6"
|
||||||
|
v-model="sourceNationality"
|
||||||
id="input-source-nationality"
|
id="input-source-nationality"
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
outlined
|
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
|
:label="$t('formDialogInputSourceNationality')"
|
||||||
|
:options="nationalityOptions"
|
||||||
|
@filter="nationalityFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
<q-select
|
||||||
|
outlined
|
||||||
|
clearable
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
options-dense
|
hide-selected
|
||||||
:label="$t('formDialogInputSourceNationality')"
|
hide-bottom-space
|
||||||
class="col-md-3 col-6"
|
input-debounce="0"
|
||||||
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
option-value="label"
|
class="col-md-3 col-6"
|
||||||
v-model="sourceNationality"
|
|
||||||
:options="userStore.userOption.nationalityOpts"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
|
v-model="importNationality"
|
||||||
id="input-import-nationality"
|
id="input-import-nationality"
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
outlined
|
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
|
:label="$t('formDialogInputImportNationality')"
|
||||||
|
:options="nationalityOptions"
|
||||||
|
@filter="nationalityFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
<q-select
|
||||||
|
outlined
|
||||||
|
clearable
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
options-dense
|
hide-selected
|
||||||
:label="$t('formDialogInputImportNationality')"
|
hide-bottom-space
|
||||||
class="col-md-3 col-6"
|
input-debounce="0"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
option-value="label"
|
option-value="label"
|
||||||
v-model="importNationality"
|
|
||||||
:options="userStore.userOption.nationalityOpts"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
|
class="col-md-6 col-12"
|
||||||
|
v-model="trainingPlace"
|
||||||
id="select-trainig-place"
|
id="select-trainig-place"
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
outlined
|
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
options-dense
|
|
||||||
:label="$t('formDialogInputTrainingPlace')"
|
:label="$t('formDialogInputTrainingPlace')"
|
||||||
class="col-md-6 col-12"
|
:options="trainingPlaceOptions"
|
||||||
option-label="label"
|
@filter="trainingPlaceFilter"
|
||||||
option-value="label"
|
>
|
||||||
v-model="trainingPlace"
|
<template v-slot:no-option>
|
||||||
:options="userStore.userOption.trainingPlaceOpts"
|
<q-item>
|
||||||
/>
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
<q-input
|
<q-input
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
for="input-checkpoint"
|
for="input-checkpoint"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue