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>
</template>
</VnPaginate>
<SkeletonTable v-if="!formData" />
<SkeletonTable v-if="!formData" :columns="$attrs.columns?.length" />
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()">
<QBtnGroup push style="column-gap: 10px">
<slot name="moreBeforeActions" />

View File

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

View File

@ -108,12 +108,11 @@ async function addFilter(value) {
value = value === '' ? undefined : value;
let field = columnFilter.value?.name ?? $props.column.name;
let params = { [field]: value };
if (columnFilter.value?.inWhere) {
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() {

View File

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