forked from verdnatura/salix-front
refs #6763 click
This commit is contained in:
parent
f715c615d2
commit
78877556cf
|
@ -1,7 +1,8 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref,computed, } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import CreateDepartmentChild from '../CreateDepartmentChild.vue';
|
||||
|
@ -13,6 +14,7 @@ const quasar = useQuasar();
|
|||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const { notify } = useNotify();
|
||||
const state = useState();
|
||||
|
||||
const treeRef = ref(null);
|
||||
const showCreateNodeFormVal = ref(false);
|
||||
|
@ -22,6 +24,7 @@ const expanded = ref([]);
|
|||
const nodes = ref([{ id: null, name: t('Departments'), sons: true, children: [{}] }]);
|
||||
|
||||
const fetchedChildrensSet = ref(new Set());
|
||||
const formData = computed(() => state.get('Tree'));
|
||||
|
||||
const onNodeExpanded = (nodeKeysArray) => {
|
||||
// Verificar si el nodo ya fue expandido
|
||||
|
@ -29,6 +32,7 @@ const onNodeExpanded = (nodeKeysArray) => {
|
|||
fetchedChildrensSet.value.add(nodeKeysArray.at(-1));
|
||||
fetchNodeLeaves(nodeKeysArray.at(-1)); // Llamar a la función para obtener los nodos hijos
|
||||
}
|
||||
state.set('Tree', nodeKeysArray.at(-1));
|
||||
};
|
||||
|
||||
const fetchNodeLeaves = async (nodeKey) => {
|
||||
|
@ -105,9 +109,12 @@ const redirectToDepartmentSummary = (id) => {
|
|||
class="row justify-between full-width q-pr-md cursor-pointer"
|
||||
@click.stop="redirectToDepartmentSummary(node.id)"
|
||||
>
|
||||
<span class="text-uppercase">
|
||||
<a
|
||||
:href="`#/department/department/${node.id}/summary`"
|
||||
color: inherit
|
||||
>
|
||||
{{ node.name }}
|
||||
</span>
|
||||
</a>
|
||||
<div class="row justify-between" style="max-width: max-content">
|
||||
<QIcon
|
||||
v-if="node.id"
|
||||
|
@ -149,6 +156,12 @@ const redirectToDepartmentSummary = (id) => {
|
|||
</QCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Departments: Departamentos
|
||||
|
@ -157,3 +170,4 @@ const redirectToDepartmentSummary = (id) => {
|
|||
Are you sure you want to delete it?: ¿Seguro que quieres eliminarlo?
|
||||
Delete department: Eliminar departamento
|
||||
</i18n>
|
||||
|
||||
|
|
Loading…
Reference in New Issue