0
0
Fork 0

Merge branch '6825-vnTable' of https://gitea.verdnatura.es/verdnatura/salix-front into 7406-workerFormation

This commit is contained in:
Alex Moreno 2024-06-14 09:25:13 +02:00
commit 4f36da7598
5 changed files with 60 additions and 23 deletions

View File

@ -300,7 +300,7 @@ watch(formUrl, async () => {
></slot> ></slot>
</template> </template>
</VnPaginate> </VnPaginate>
<SkeletonTable v-if="!formData" /> <SkeletonTable v-if="!formData" :columns="$attrs.columns?.length" />
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()"> <Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()">
<QBtnGroup push style="column-gap: 10px"> <QBtnGroup push style="column-gap: 10px">
<slot name="moreBeforeActions" /> <slot name="moreBeforeActions" />

View File

@ -35,6 +35,10 @@ const $props = defineProps({
type: Object, type: Object,
default: null, default: null,
}, },
showLabel: {
type: Boolean,
default: null,
},
}); });
const defaultComponents = { const defaultComponents = {
@ -43,12 +47,18 @@ const defaultComponents = {
attrs: { attrs: {
disable: !$props.isEditable, disable: !$props.isEditable,
}, },
forceAttrs: {
label: $props.showLabel && $props.column.label,
},
}, },
number: { number: {
component: markRaw(VnInput), component: markRaw(VnInput),
attrs: { attrs: {
disable: !$props.isEditable, disable: !$props.isEditable,
}, },
forceAttrs: {
label: $props.showLabel && $props.column.label,
},
}, },
date: { date: {
component: markRaw(VnInputDate), component: markRaw(VnInputDate),
@ -57,6 +67,9 @@ const defaultComponents = {
disable: !$props.isEditable, disable: !$props.isEditable,
style: 'min-width: 125px', style: 'min-width: 125px',
}, },
forceAttrs: {
label: $props.showLabel && $props.column.label,
},
}, },
checkbox: { checkbox: {
component: markRaw(QCheckbox), component: markRaw(QCheckbox),
@ -74,7 +87,7 @@ const defaultComponents = {
return defaultAttrs; return defaultAttrs;
}, },
forceAttrs: { forceAttrs: {
label: null, label: $props.showLabel && $props.column.label,
}, },
}, },
select: { select: {
@ -82,6 +95,9 @@ const defaultComponents = {
attrs: { attrs: {
disable: !$props.isEditable, disable: !$props.isEditable,
}, },
forceAttrs: {
label: $props.showLabel && $props.column.label,
},
}, },
icon: { icon: {
component: markRaw(QIcon), component: markRaw(QIcon),

View File

@ -108,12 +108,11 @@ async function addFilter(value) {
value = value === '' ? undefined : value; value = value === '' ? undefined : value;
let field = columnFilter.value?.name ?? $props.column.name; let field = columnFilter.value?.name ?? $props.column.name;
let params = { [field]: value };
if (columnFilter.value?.inWhere) { if (columnFilter.value?.inWhere) {
if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field; if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field;
return await arrayData.addFilterWhere(params); return await arrayData.addFilterWhere({ [field]: value });
} }
await arrayData.addFilter({ params }); await arrayData.addFilter({ [field]: value });
} }
function alignRow() { function alignRow() {

View File

@ -1,25 +1,38 @@
<script setup>
defineProps({
columns: {
type: Number,
default: 6,
},
});
</script>
<template> <template>
<div class="q-pa-md w"> <div class="q-pa-md q-mx-md container">
<div class="row q-gutter-md q-mb-md"> <div class="row q-gutter-md q-mb-md justify-around no-wrap">
<QSkeleton type="rect" square /> <QSkeleton type="rect" square v-for="n in columns" :key="n" class="column" />
<QSkeleton type="rect" square />
<QSkeleton type="rect" square />
<QSkeleton type="rect" square />
<QSkeleton type="rect" square />
<QSkeleton type="rect" square />
</div> </div>
<div class="row q-gutter-md q-mb-md" v-for="n in 5" :key="n"> <div
<QSkeleton type="QInput" square /> class="row q-gutter-md q-mb-md justify-around no-wrap"
<QSkeleton type="QInput" square /> v-for="n in 5"
<QSkeleton type="QInput" square /> :key="n"
<QSkeleton type="QInput" square /> >
<QSkeleton type="QInput" square /> <QSkeleton
<QSkeleton type="QInput" square /> type="QInput"
square
v-for="m in columns"
:key="m"
class="column"
/>
</div> </div>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.w { .container {
width: 80vw; width: 100%;
overflow-x: hidden;
}
.column {
flex-shrink: 0;
width: 200px;
} }
</style> </style>

View File

@ -66,10 +66,19 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
} }
} }
} }
console.log('setOptions store.url: ', store.url);
} }
async function fetch({ append = false, updateRouter = true }) { async function fetch({ append = false, updateRouter = true }) {
if (!store.url) return; if (!store.url) return;
console.log('store.url: ', store.url);
console.log('userOptions.url: ', userOptions.url);
console.log('route.params.id: ', route.params.id);
// const urlSplited = store.url.split('/');
// if (!isNaN(+urlSplited[1]) && urlSplited[1] != route.params.id) {
// urlSplited[1] = route.params.id;
// store.url = urlSplited.join('/');
// }
cancelRequest(); cancelRequest();
canceller = new AbortController(); canceller = new AbortController();