Pomenene vytvaranie, multiselectu
This commit is contained in:
@@ -13,9 +13,10 @@ import QueryBuilder from '@phongthien/vue3-query-builder';
|
||||
import Input from '@/Components/Input.vue';
|
||||
import Number from '@/Components/Number.vue';
|
||||
import JsonQueryBuilder from '@/Components/JsonQueryBuilder.vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import { defineEmits } from 'vue'
|
||||
import { Inertia } from '@inertiajs/inertia';
|
||||
import rpoJsonData from '../Data/RpoTree.json';
|
||||
|
||||
const query = ref({
|
||||
condition: 'and',
|
||||
@@ -44,6 +45,37 @@ const submit = () => {
|
||||
Inertia.post(`/search`, query.value);
|
||||
};
|
||||
|
||||
function createRPOmulti(tree,flatListRpo, level = 0, fullPathRpo = []) {
|
||||
console.log('keys=',Object.keys(tree));
|
||||
console.log('TT=',typeof tree);
|
||||
let fullPath = [ ...fullPathRpo ] ;
|
||||
if (tree.desc != undefined) fullPath.push(tree.desc);
|
||||
|
||||
if (level == 0 || tree.type == "Object" || tree.type == "Array" || tree.type == undefined) {
|
||||
Object.keys(tree).forEach(k => {
|
||||
console.log('k=',k);
|
||||
console.log('obj=',tree[k]);
|
||||
console.log(typeof tree[k]);
|
||||
console.log('t=',tree[k].type);
|
||||
console.log('rec=',k);
|
||||
if (typeof tree[k] != 'string') {
|
||||
console.log('DESC=',tree[k].desc);
|
||||
createRPOmulti(tree[k], flatListRpo, level + 1, fullPath );
|
||||
}
|
||||
});
|
||||
} else {
|
||||
flatListRpo.push({"name":tree.name, "type": tree.type, "desc": fullPath.join(' => ') });
|
||||
}
|
||||
}
|
||||
|
||||
const rpoMultiselect = computed(() => {
|
||||
console.log('Rpo Multiselect');
|
||||
var flatList = [];
|
||||
createRPOmulti(rpoJsonData, flatList);
|
||||
return flatList;
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -51,7 +83,7 @@ const submit = () => {
|
||||
|
||||
<Head title="Register" />
|
||||
|
||||
<JsonQueryBuilder :query="query" :queryOptions="rpoFields" @run-query="submit" ></JsonQueryBuilder>
|
||||
<JsonQueryBuilder :query="query" :queryOptions="rpoMultiselect" @run-query="submit" ></JsonQueryBuilder>
|
||||
|
||||
</GuestLayout>
|
||||
</template>
|
||||
|
||||
@@ -21,6 +21,7 @@ defineProps({
|
||||
<Head title="Register výsledky" />
|
||||
<Pagination :links="result.links" :data="query"/>
|
||||
<div v-for="r in result.data" :key="r.id">
|
||||
<h2 class="mt-5 bg-black text-white font-semibold text-xl">{{ r["fullNames"][0]["value"] }}</h2>
|
||||
<RpoRecord2 :data="r"/>
|
||||
</div>
|
||||
<Pagination :links="result.links" :data="query"/>
|
||||
|
||||
Reference in New Issue
Block a user