forked from verdnatura/salix-front
Merge pull request 'fix: better performance' (!869) from warmFix_accountAcls into dev
Reviewed-on: verdnatura/salix-front#869 Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
This commit is contained in:
commit
c274641334
|
@ -151,8 +151,8 @@ const tableModes = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
setUserParams(route.query[$props.searchUrl]);
|
const urlParams = route.query[$props.searchUrl];
|
||||||
hasParams.value = params.value && Object.keys(params.value).length !== 0;
|
hasParams.value = urlParams && Object.keys(urlParams).length !== 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -185,7 +185,8 @@ watch(
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.query[$props.searchUrl],
|
() => route.query[$props.searchUrl],
|
||||||
(val) => setUserParams(val)
|
(val) => setUserParams(val),
|
||||||
|
{ immediate: true, deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||||
|
|
|
@ -9,6 +9,8 @@ import { useQuasar } from 'quasar';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -23,11 +25,18 @@ const stateStore = useStateStore();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
const roles = ref();
|
||||||
|
const validationsStore = useValidator();
|
||||||
|
const { models } = validationsStore;
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
return { model: { like: `%${value}%` } };
|
return {
|
||||||
|
or: [
|
||||||
|
{ model: { like: `%${value}%` } },
|
||||||
|
{ property: { like: `%${value}%` } },
|
||||||
|
],
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return { [param]: value };
|
return { [param]: value };
|
||||||
}
|
}
|
||||||
|
@ -47,6 +56,13 @@ const columns = computed(() => [
|
||||||
label: t('model'),
|
label: t('model'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
|
columnCreate: {
|
||||||
|
label: t('model'),
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
options: Object.keys(models),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -55,9 +71,10 @@ const columns = computed(() => [
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'VnRoles',
|
options: roles,
|
||||||
optionLabel: 'name',
|
optionLabel: 'name',
|
||||||
optionValue: 'name',
|
optionValue: 'name',
|
||||||
|
inputDebounce: 0,
|
||||||
},
|
},
|
||||||
create: true,
|
create: true,
|
||||||
},
|
},
|
||||||
|
@ -130,6 +147,11 @@ const deleteAcl = async ({ id }) => {
|
||||||
/>
|
/>
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
|
<FetchData
|
||||||
|
url="VnRoles?fields=['name']"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="(data) => (roles = data)"
|
||||||
|
/>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="AccountAcls"
|
data-key="AccountAcls"
|
||||||
|
|
|
@ -33,6 +33,7 @@ const rolesOptions = ref([]);
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
:hidden-tags="['search']"
|
:hidden-tags="['search']"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
|
search-url="table"
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
|
|
Loading…
Reference in New Issue