refactor: refs #8684 improve slot usage and clean up ItemTags and ItemListFilter components
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
9c13cd921e
commit
21c7b2088b
|
@ -106,7 +106,7 @@ function checkIsMain() {
|
|||
<slot
|
||||
name="moreFilterPanel"
|
||||
v-bind="{ params, orders, searchFn }"
|
||||
></slot>
|
||||
/>
|
||||
</template>
|
||||
</VnTableFilter>
|
||||
</slot>
|
||||
|
|
|
@ -17,7 +17,7 @@ const itemTagsRef = ref();
|
|||
const tagOptions = ref([]);
|
||||
const valueOptionsMap = ref(new Map());
|
||||
const getSelectedTagValues = async (tag) => {
|
||||
if (!tag.tagFk && tag.tag.isFree) return;
|
||||
if (!tag.tagFk && tag.tag?.isFree) return;
|
||||
const filter = {
|
||||
fields: ['value'],
|
||||
order: 'value ASC',
|
||||
|
@ -25,6 +25,7 @@ const getSelectedTagValues = async (tag) => {
|
|||
};
|
||||
|
||||
const params = { filter: JSON.stringify(filter) };
|
||||
if (!tag.tagFk) return;
|
||||
const { data } = await axios.get(`Tags/${tag.tagFk}/filterValue`, {
|
||||
params,
|
||||
});
|
||||
|
@ -143,7 +144,6 @@ const insertTag = (rows) => {
|
|||
v-model="row.priority"
|
||||
:required="true"
|
||||
:rules="validate('itemTag.priority')"
|
||||
style="max-width: 60%"
|
||||
/>
|
||||
<div class="row justify-center" style="flex: 0">
|
||||
<QIcon
|
||||
|
|
|
@ -227,6 +227,16 @@ onMounted(async () => {
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.isFloramondo')"
|
||||
v-model="params.isFloramondo"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<!-- Tags filter -->
|
||||
<QItemLabel header>
|
||||
{{ t('params.tags') }}
|
||||
|
@ -293,74 +303,6 @@ onMounted(async () => {
|
|||
@click="removeTag(index, params, searchFn)"
|
||||
/>
|
||||
</QItem>
|
||||
<!-- Filter fields -->
|
||||
<QItemLabel header
|
||||
>{{ t('More fields') }}
|
||||
<QIcon
|
||||
name="add_circle"
|
||||
class="fill-icon-on-hover q-ml-md"
|
||||
size="sm"
|
||||
color="primary"
|
||||
@click="fieldFiltersValues.push({})"
|
||||
/></QItemLabel>
|
||||
<QItem v-for="(fieldFilter, index) in fieldFiltersValues" :key="index">
|
||||
<QItemSection class="col">
|
||||
<VnSelect
|
||||
class="full-width"
|
||||
:label="t('params.tag')"
|
||||
:model-value="fieldFilter.selectedField"
|
||||
:options="moreFields"
|
||||
option-label="label"
|
||||
option-value="label"
|
||||
dense
|
||||
filled
|
||||
:emit-value="false"
|
||||
use-input
|
||||
:is-clearable="false"
|
||||
@update:model-value="
|
||||
($event) => {
|
||||
fieldFilter.name = $event.name;
|
||||
fieldFilter.value = null;
|
||||
fieldFilter.selectedField = $event;
|
||||
}
|
||||
"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection class="col">
|
||||
<VnCheckbox
|
||||
v-if="fieldFilter.selectedField?.type === 'boolean'"
|
||||
v-model="fieldFilter.value"
|
||||
:label="t('params.value')"
|
||||
@update:model-value="applyFieldFilters(params, searchFn)"
|
||||
/>
|
||||
<VnInput
|
||||
v-else
|
||||
v-model="fieldFilter.value"
|
||||
:label="t('params.value')"
|
||||
:disable="!fieldFilter.selectedField"
|
||||
filled
|
||||
@keydown.enter="applyFieldFilters(params, searchFn)"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection side
|
||||
><QIcon
|
||||
name="delete"
|
||||
class="fill-icon-on-hover q-ml-xs"
|
||||
size="sm"
|
||||
color="primary"
|
||||
@click="removeFieldFilter(index, params, searchFn)"
|
||||
/></QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.isFloramondo')"
|
||||
v-model="params.isFloramondo"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue