feat: refs #8197 working rightMenu
gitea/salix-front/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-12-12 11:03:28 +01:00
parent 2ae0d90e32
commit 3984327b51
4 changed files with 44 additions and 51 deletions

View File

@ -1,7 +1,6 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore';
import VnFilterPanel from 'components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
import VnFilter from 'components/VnTable/VnFilter.vue'; import VnFilter from 'components/VnTable/VnFilter.vue';
@ -22,7 +21,6 @@ defineProps({
}, },
}); });
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore();
const tableFilterRef = ref([]); const tableFilterRef = ref([]);
@ -34,52 +32,41 @@ function columnName(col) {
} }
</script> </script>
<template> <template>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <VnFilterPanel v-bind="$attrs" :search-button="true" :disable-submit-event="true">
<QScrollArea class="fit"> <template #body="{ params, orders }">
<VnFilterPanel <div
v-bind="$attrs" class="row no-wrap flex-center"
:search-button="true" v-for="col of columns.filter((c) => c.columnFilter ?? true)"
:disable-submit-event="true" :key="col.id"
> >
<template #body="{ params, orders }"> <VnFilter
<div ref="tableFilterRef"
class="row no-wrap flex-center" :column="col"
v-for="col of columns.filter((c) => c.columnFilter ?? true)" :data-key="$attrs['data-key']"
:key="col.id" v-model="params[columnName(col)]"
> :search-url="searchUrl"
<VnFilter />
ref="tableFilterRef" <VnTableOrder
:column="col" v-if="col?.columnFilter !== false && col?.name !== 'tableActions'"
:data-key="$attrs['data-key']" v-model="orders[col.orderBy ?? col.name]"
v-model="params[columnName(col)]" :name="col.orderBy ?? col.name"
:search-url="searchUrl" :data-key="$attrs['data-key']"
/> :search-url="searchUrl"
<VnTableOrder :vertical="true"
v-if=" />
col?.columnFilter !== false && </div>
col?.name !== 'tableActions' <slot
" name="moreFilterPanel"
v-model="orders[col.orderBy ?? col.name]" :params="params"
:name="col.orderBy ?? col.name" :orders="orders"
:data-key="$attrs['data-key']" :columns="columns"
:search-url="searchUrl" />
:vertical="true" </template>
/> <template #tags="{ tag, formatFn }" v-if="chipLocale">
</div> <div class="q-gutter-x-xs">
<slot <strong>{{ t(`${chipLocale}.${tag.label}`) }}: </strong>
name="moreFilterPanel" <span>{{ formatFn(tag.value) }}</span>
:params="params" </div>
:orders="orders" </template>
:columns="columns" </VnFilterPanel>
/>
</template>
<template #tags="{ tag, formatFn }" v-if="chipLocale">
<div class="q-gutter-x-xs">
<strong>{{ t(`${chipLocale}.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
</VnFilterPanel>
</QScrollArea>
</QDrawer>
</template> </template>

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import LeftMenu from '../LeftMenu.vue'; import LeftMenu from '../LeftMenu.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import RightMenu from './RightMenu.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
defineProps({ defineProps({
@ -17,5 +18,9 @@ defineProps({
</Teleport> </Teleport>
<slot name="body" v-if="section == $route.name" /> <slot name="body" v-if="section == $route.name" />
<RouterView v-else /> <RouterView v-else />
<slot name="rightPanel" /> <RightMenu>
<template #right-panel v-if="$slots['rightMenu']">
<slot name="rightMenu" />
</template>
</RightMenu>
</template> </template>

View File

@ -136,7 +136,7 @@ function exprBuilder(param, value) {
:right-search="false" :right-search="false"
/> />
</template> </template>
<template #rightPanel> <template #rightMenu>
<VnTableFilter :data-key="dataKey" :columns="columns" /> <VnTableFilter :data-key="dataKey" :columns="columns" />
</template> </template>
</VnCardMain> </VnCardMain>

View File

@ -114,6 +114,7 @@ const exprBuilder = (param, value) => {
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
redirect="account/role" redirect="account/role"
:right-search="false"
/> />
</template> </template>
</VnCardMain> </VnCardMain>