0
0
Fork 0

fix(ZoneCard): fix ZoneLocations redirections

This commit is contained in:
Alex Moreno 2024-11-14 13:59:04 +01:00
parent a929dec2ab
commit 045a828bf9
1 changed files with 11 additions and 11 deletions

View File

@ -42,16 +42,15 @@ const arrayData = useArrayData(datakey, {
const { store } = arrayData; const { store } = arrayData;
const storeData = computed(() => store.data); const storeData = computed(() => store.data);
const nodes = ref([ const defaultNode = {
{
id: null, id: null,
name: props.rootLabel, name: props.rootLabel,
sons: true, sons: true,
tickable: false, tickable: false,
noTick: true, noTick: true,
children: [{}], children: [{}],
}, };
]); const nodes = ref([defaultNode]);
const _tickedNodes = computed({ const _tickedNodes = computed({
get: () => props.tickedNodes, get: () => props.tickedNodes,
@ -131,6 +130,7 @@ function getNodeIds(node) {
watch(storeData, async (val) => { watch(storeData, async (val) => {
// Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar // Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
if (!nodes.value[0]) nodes.value = [defaultNode];
nodes.value[0].childs = [...val]; nodes.value[0].childs = [...val];
const fetchedNodeKeys = val.flatMap(getNodeIds); const fetchedNodeKeys = val.flatMap(getNodeIds);
state.set('Tree', [...fetchedNodeKeys]); state.set('Tree', [...fetchedNodeKeys]);
@ -196,7 +196,7 @@ onUnmounted(() => {
<QBtn color="primary" icon="search" dense flat @click="reFetch()" /> <QBtn color="primary" icon="search" dense flat @click="reFetch()" />
</template> </template>
</VnInput> </VnInput>
<VnSearchbar :data-key="datakey" :url="url" :redirect="false"/> <VnSearchbar :data-key="datakey" :url="url" :redirect="false" />
<QTree <QTree
ref="treeRef" ref="treeRef"
:nodes="nodes" :nodes="nodes"