2024-12-14 17:02:34 +01:00
|
|
|
<template>
|
2024-12-15 13:48:55 +01:00
|
|
|
<div class="flex flex-col border border-gray-300 rounded-md select-none">
|
2024-12-14 17:02:34 +01:00
|
|
|
<div class="flex flex-row gap-2 border-b border-gray-300 p-2">
|
2024-12-16 13:56:06 +01:00
|
|
|
<div
|
|
|
|
class="p-1 border border-gray-400 bg-green-200 rounded-md"
|
|
|
|
title="Abfrage starten"
|
|
|
|
@click="$emit('query:run')"
|
|
|
|
>
|
2024-12-14 17:02:34 +01:00
|
|
|
<PlayIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
|
|
|
|
</div>
|
2024-12-16 13:56:06 +01:00
|
|
|
<div
|
|
|
|
class="p-1 border border-gray-400 bg-gray-100 rounded-md"
|
|
|
|
title="Abfrage speichern"
|
|
|
|
@click="$emit('query:save')"
|
|
|
|
>
|
2024-12-14 17:02:34 +01:00
|
|
|
<InboxArrowDownIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
|
|
|
|
</div>
|
2024-12-16 13:56:06 +01:00
|
|
|
<div
|
|
|
|
class="p-1 border border-gray-400 bg-gray-100 rounded-md"
|
|
|
|
title="Ergebnisse exportieren"
|
|
|
|
@click="$emit('results:export')"
|
|
|
|
>
|
|
|
|
<ArchiveBoxArrowDownIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
class="p-1 border border-gray-400 bg-red-200 rounded-md"
|
|
|
|
title="Ergebnisse leeren"
|
|
|
|
@click="$emit('results:clear')"
|
|
|
|
>
|
2024-12-14 17:02:34 +01:00
|
|
|
<NoSymbolIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
|
|
|
|
</div>
|
2024-12-16 17:49:18 +01:00
|
|
|
<div
|
|
|
|
class="p-1 border border-gray-400 bg-red-200 rounded-md"
|
|
|
|
title="Anfrage löschen"
|
|
|
|
@click="$emit('update:model-value', undefined)"
|
|
|
|
>
|
|
|
|
<TrashIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
|
|
|
|
</div>
|
2024-12-14 17:02:34 +01:00
|
|
|
</div>
|
2024-12-16 13:56:06 +01:00
|
|
|
<div class="p-2 h-44 md:h-60 w-full overflow-y-scroll">
|
2024-12-15 13:48:55 +01:00
|
|
|
<Table v-model="value" />
|
2024-12-14 17:02:34 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { defineComponent, type PropType } from "vue";
|
|
|
|
import { mapActions, mapState } from "pinia";
|
|
|
|
import type { DynamicQueryStructure } from "../../types/dynamicQueries";
|
2024-12-16 17:49:18 +01:00
|
|
|
import {
|
|
|
|
ArchiveBoxArrowDownIcon,
|
|
|
|
InboxArrowDownIcon,
|
|
|
|
NoSymbolIcon,
|
|
|
|
PlayIcon,
|
|
|
|
TrashIcon,
|
|
|
|
} from "@heroicons/vue/24/outline";
|
2024-12-14 17:02:34 +01:00
|
|
|
import { useQueryBuilderStore } from "../../stores/admin/queryBuilder";
|
2024-12-15 13:48:55 +01:00
|
|
|
import Table from "./Table.vue";
|
2024-12-14 17:02:34 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
export default defineComponent({
|
|
|
|
props: {
|
2024-12-15 13:48:55 +01:00
|
|
|
modelValue: {
|
2024-12-14 17:02:34 +01:00
|
|
|
type: Object as PropType<DynamicQueryStructure>,
|
|
|
|
default: {
|
|
|
|
select: "*",
|
|
|
|
table: "",
|
|
|
|
where: [],
|
|
|
|
join: [],
|
|
|
|
orderBy: [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-12-16 13:56:06 +01:00
|
|
|
emits: ["update:model-value", "query:run", "query:save", "results:export", "results:clear"],
|
2024-12-14 17:02:34 +01:00
|
|
|
computed: {
|
|
|
|
...mapState(useQueryBuilderStore, ["tableMetas", "loading"]),
|
2024-12-15 13:48:55 +01:00
|
|
|
value: {
|
|
|
|
get() {
|
|
|
|
return this.modelValue;
|
|
|
|
},
|
|
|
|
set(val: DynamicQueryStructure) {
|
|
|
|
this.$emit("update:model-value", val);
|
|
|
|
},
|
|
|
|
},
|
2024-12-14 17:02:34 +01:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.fetchTableMetas();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(useQueryBuilderStore, ["fetchTableMetas"]),
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|