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

View File

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

View File

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

View File

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