fix: add exprBuilder
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
127567898d
commit
c1ed4ab032
|
@ -145,7 +145,8 @@ const customTags = computed(() =>
|
||||||
);
|
);
|
||||||
|
|
||||||
async function remove(key) {
|
async function remove(key) {
|
||||||
userParams.value[key] = null;
|
// userParams.value[key] = null;
|
||||||
|
if (userParams.value[key]) delete userParams.value[key];
|
||||||
await search();
|
await search();
|
||||||
emit('remove', key);
|
emit('remove', key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,10 @@ async function search() {
|
||||||
const staticParams = Object.entries(store.userParams).filter(
|
const staticParams = Object.entries(store.userParams).filter(
|
||||||
([key, value]) => value && (props.staticParams || []).includes(key)
|
([key, value]) => value && (props.staticParams || []).includes(key)
|
||||||
);
|
);
|
||||||
|
// const filter =props?.where? { where: JSON.parse(props.where) }: {}
|
||||||
await arrayData.applyFilter({
|
await arrayData.applyFilter({
|
||||||
params: {
|
params: {
|
||||||
|
// filter ,
|
||||||
...Object.fromEntries(staticParams),
|
...Object.fromEntries(staticParams),
|
||||||
search: searchText.value,
|
search: searchText.value,
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,6 +24,17 @@ const redirectToItemTypeSummary = (id) => {
|
||||||
const redirectToCreateView = () => {
|
const redirectToCreateView = () => {
|
||||||
router.push({ name: 'ItemTypeCreate' });
|
router.push({ name: 'ItemTypeCreate' });
|
||||||
};
|
};
|
||||||
|
const exprBuilder = (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'name':
|
||||||
|
case 'code':
|
||||||
|
case 'search':
|
||||||
|
return {
|
||||||
|
name: { like: `%${value}%` },
|
||||||
|
code: { like: `%${value}%` },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -32,8 +43,10 @@ const redirectToCreateView = () => {
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="ItemTypeList"
|
data-key="ItemTypeList"
|
||||||
url="ItemTypes"
|
url="ItemTypes"
|
||||||
:label="t('Search item type')"
|
:label="t('Search item type')"
|
||||||
|
:redirect="false"
|
||||||
:info="t('Search itemType by id, name or code')"
|
:info="t('Search itemType by id, name or code')"
|
||||||
|
:expr-builder="exprBuilder"
|
||||||
/>
|
/>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
<Teleport to="#actions-append">
|
<Teleport to="#actions-append">
|
||||||
|
@ -54,7 +67,7 @@ const redirectToCreateView = () => {
|
||||||
</template>
|
</template>
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea class="fit text-grey-8">
|
<QScrollArea class="fit text-grey-8">
|
||||||
<ItemTypeFilter data-key="ItemTypes" />
|
<ItemTypeFilter data-key="ItemTypeList" :expr-builder="exprBuilder" />
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
|
|
|
@ -10,10 +10,16 @@ const props = defineProps({
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['search']);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
<VnFilterPanel
|
||||||
|
:data-key="props.dataKey"
|
||||||
|
:search-button="true"
|
||||||
|
@search="emit('search')"
|
||||||
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
|
Loading…
Reference in New Issue