Merge branch 'dev' into 8246-ZoneAddressFk
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
5c839b2dfa
|
@ -314,7 +314,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
show-if-above
|
||||
>
|
||||
<QScrollArea class="fit">
|
||||
<VnTableFilter :data-key="$attrs['data-key']" :columns="columns" />
|
||||
<VnTableFilter :data-key="$attrs['data-key']" :columns="columns" :redirect="redirect" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<CrudModel
|
||||
|
|
|
@ -14,6 +14,7 @@ defineProps({
|
|||
hide-dropdown-icon
|
||||
focus-on-mount
|
||||
@update:model-value="promise"
|
||||
data-cy="vnBtnSelect_select"
|
||||
/>
|
||||
</QBtnDropdown>
|
||||
</template>
|
||||
|
|
|
@ -297,7 +297,7 @@ defineExpose({
|
|||
ref="dmsRef"
|
||||
:data-key="$props.model"
|
||||
:url="$props.model"
|
||||
:filter="dmsFilter"
|
||||
:user-filter="dmsFilter"
|
||||
:order="['dmsFk DESC']"
|
||||
:auto-load="true"
|
||||
@on-fetch="setData"
|
||||
|
|
|
@ -20,16 +20,15 @@ const hasContent = ref();
|
|||
let observer;
|
||||
|
||||
onMounted(() => {
|
||||
if (teleportRef.value) {
|
||||
const checkContent = () => {
|
||||
hasContent.value = teleportRef.value.innerHTML.trim() !== '';
|
||||
};
|
||||
if (!teleportRef.value) return;
|
||||
const checkContent = () => {
|
||||
hasContent.value = teleportRef.value?.innerHTML?.trim() !== '';
|
||||
};
|
||||
|
||||
observer = new MutationObserver(checkContent);
|
||||
observer.observe(teleportRef.value, { childList: true, subtree: true });
|
||||
observer = new MutationObserver(checkContent);
|
||||
observer.observe(teleportRef.value, { childList: true, subtree: true });
|
||||
|
||||
checkContent();
|
||||
}
|
||||
checkContent();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -4,11 +4,12 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
|||
import VnTableFilter from '../VnTable/VnTableFilter.vue';
|
||||
import { onBeforeMount, computed } from 'vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const $props = defineProps({
|
||||
section: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: null,
|
||||
},
|
||||
dataKey: {
|
||||
type: String,
|
||||
|
@ -38,14 +39,28 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
keepData: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const sectionValue = computed(() => $props.section ?? $props.dataKey);
|
||||
const route = useRoute();
|
||||
let arrayData;
|
||||
const sectionValue = computed(() => $props.section ?? $props.dataKey);
|
||||
const isMainSection = computed(() => {
|
||||
const isSame = sectionValue.value == route.name;
|
||||
if (!isSame && arrayData) {
|
||||
arrayData.reset(['userParams', 'userFilter']);
|
||||
}
|
||||
return isSame;
|
||||
});
|
||||
|
||||
onBeforeMount(() => {
|
||||
if ($props.dataKey)
|
||||
arrayData = useArrayData($props.dataKey, {
|
||||
searchUrl: 'table',
|
||||
keepData: $props.keepData,
|
||||
...$props.arrayDataProps,
|
||||
navigate: $props.redirect,
|
||||
});
|
||||
|
@ -74,6 +89,6 @@ onBeforeMount(() => {
|
|||
</slot>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<slot name="body" v-if="sectionValue == $route.name" />
|
||||
<slot name="body" v-if="isMainSection" />
|
||||
<RouterView v-else />
|
||||
</template>
|
||||
|
|
|
@ -111,6 +111,7 @@ onMounted(async () => {
|
|||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (!store.keepData) arrayData.reset(['data']);
|
||||
arrayData.resetPagination();
|
||||
});
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ async function search() {
|
|||
delete filter.params.search;
|
||||
}
|
||||
await arrayData.applyFilter(filter);
|
||||
searchText.value = undefined;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
@ -53,6 +53,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
'searchUrl',
|
||||
'navigate',
|
||||
'mapKey',
|
||||
'keepData',
|
||||
];
|
||||
if (typeof userOptions === 'object') {
|
||||
for (const option in userOptions) {
|
||||
|
@ -302,7 +303,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
for (const row of data) {
|
||||
const key = row[store.mapKey];
|
||||
const val = { ...row, key };
|
||||
if (store.map.has(key)) {
|
||||
if (key && store.map.has(key)) {
|
||||
const { position } = store.map.get(key);
|
||||
val.position = position;
|
||||
store.map.set(key, val);
|
||||
|
|
|
@ -221,7 +221,7 @@ async function handleConfirm() {
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<FetchedTags :item="props.row.item" />
|
||||
<FetchedTags :item="props.row.item" :columns="3" />
|
||||
</QTd>
|
||||
<QTd key="quantity" :props="props">
|
||||
{{ props.row.quantity }}
|
||||
|
|
|
@ -18,6 +18,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
|
|||
navigate: null,
|
||||
page: 1,
|
||||
mapKey: 'id',
|
||||
keepData: false,
|
||||
};
|
||||
|
||||
function get(key) {
|
||||
|
|
|
@ -16,7 +16,9 @@ describe('Ticket expedtion', () => {
|
|||
|
||||
cy.wait('@show');
|
||||
cy.selectRows([1, 2]);
|
||||
cy.selectOption('[data-cy="change-state"]', 'Perdida');
|
||||
|
||||
cy.dataCy('change-state').click();
|
||||
cy.selectOption('[data-cy="vnBtnSelect_select"]', 'Perdida');
|
||||
cy.wait('@add');
|
||||
|
||||
cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
|
||||
|
|
Loading…
Reference in New Issue