0
0
Fork 0

refs #7355 add role

This commit is contained in:
Carlos Satorres 2024-10-01 10:35:31 +02:00
parent 732bb0943c
commit e64e6eefe3
3 changed files with 25 additions and 3 deletions

View File

@ -108,6 +108,7 @@ async function search() {
...Object.fromEntries(staticParams),
search: searchText.value,
},
...{ filter: props.filter },
};
if (props.whereFilter) {

View File

@ -9,7 +9,9 @@ import { useSummaryDialog } from 'src/composables/useSummaryDialog';
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const tableRef = ref();
const filter = {
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
};
const columns = computed(() => [
{
align: 'left',
@ -29,7 +31,22 @@ const columns = computed(() => [
},
{
align: 'left',
name: 'username',
name: 'roleFk',
label: t('role'),
columnFilter: {
component: 'select',
name: 'roleFk',
attrs: {
url: 'VnRoles',
optionValue: 'id',
optionLabel: 'name',
},
},
format: ({ role }, dashIfEmpty) => dashIfEmpty(role?.name),
},
{
align: 'left',
name: 'nickname',
label: t('Nickname'),
isTitle: true,
component: 'input',
@ -104,12 +121,13 @@ const exprBuilder = (param, value) => {
:expr-builder="exprBuilder"
:label="t('account.search')"
:info="t('account.searchInfo')"
:filter="filter"
/>
<VnTable
ref="tableRef"
data-key="AccountUsers"
url="VnUsers/preview"
:filter="filter"
order="id DESC"
:columns="columns"
default-mode="table"

View File

@ -11,6 +11,9 @@ const { t } = useI18n();
data-key="Account"
:descriptor="AccountDescriptor"
search-data-key="AccountUsers"
:filter="{
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
}"
:searchbar-props="{
url: 'VnUsers/preview',
label: t('account.search'),