0
0
Fork 0

refs #7355 fix vnTable

This commit is contained in:
Carlos Satorres 2024-07-01 17:53:48 +02:00
parent 731169053c
commit 64c21aa5d9
1 changed files with 68 additions and 52 deletions

View File

@ -2,7 +2,7 @@
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import VnTable from 'components/VnTable/VnTable.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
@ -47,6 +47,52 @@ const exprBuilder = (param, value) => {
} }
}; };
const columns = computed(() => [
{
align: 'left',
name: 'id',
label: t('id'),
isId: true,
field: 'id',
cardVisible: true,
},
{
align: 'left',
name: 'nickname',
label: t('nickname'),
field: 'nickname',
component: 'input',
columnField: {
component: null,
},
cardVisible: true,
create: true,
},
{
align: 'left',
name: 'name',
label: t('name'),
field: 'name',
component: 'input',
columnField: {
component: null,
},
cardVisible: true,
create: true,
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('View Summary'),
icon: 'preview',
action: (row) => viewSummary(row.id, AccountSummary),
},
],
},
]);
const getApiUrl = () => new URL(window.location).origin; const getApiUrl = () => new URL(window.location).origin;
const navigate = (event, id) => { const navigate = (event, id) => {
@ -90,55 +136,25 @@ const openCreateModal = () => accountCreateDialogRef.value.show();
<AccountFilter data-key="AccountList" :expr-builder="exprBuilder" /> <AccountFilter data-key="AccountList" :expr-builder="exprBuilder" />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list"> <VnTable
<VnPaginate ref="tableRef"
:filter="filter" data-key="AccountUsers"
data-key="AccountList" :url="`VnUsers`"
url="VnUsers/preview" :create="{
urlCreate: 'Accounts',
title: 'Create Account',
onDataSaved: () => tableRef.reload(),
formInitialData: {
workerFk: entityId,
},
}"
order="id DESC"
:columns="columns"
default-mode="table"
auto-load auto-load
> :right-search="false"
<template #body="{ rows }"> :is-editable="true"
<CardList :use-model="true"
v-for="row of rows"
:id="row.id"
:key="row.id"
:title="row.nickname"
@click="navigate($event, row.id)"
>
<template #list-items>
<VnLv :label="t('account.card.name')" :value="row.nickname">
</VnLv>
<VnLv
:label="t('account.card.nickname')"
:value="row.username"
>
</VnLv>
</template>
<template #actions>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, AccountSummary)"
color="primary"
style="margin-top: 15px"
/> />
</template> </template>
</CardList>
</template>
</VnPaginate>
</div>
<QDialog
ref="accountCreateDialogRef"
transition-hide="scale"
transition-show="scale"
>
<AccountCreate />
</QDialog>
<QPageSticky :offset="[20, 20]" v-if="showNewUserBtn">
<QBtn @click="openCreateModal" color="primary" fab icon="add" />
<QTooltip class="text-no-wrap">
{{ t('account.card.newUser') }}
</QTooltip>
</QPageSticky>
</QPage>
</template>