fix(fe archive): added dynamic headers
This commit is contained in:
parent
69b6f089e4
commit
4eaca42c6d
1 changed files with 25 additions and 4 deletions
|
@ -1,12 +1,22 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import axios from "axios";
|
import {ref, reactive, watch, onBeforeMount} from "vue";
|
||||||
import {ref, reactive, watch, computed, onMounted} from "vue";
|
|
||||||
import {archive_page} from "@/composables/content/archive_page.ts";
|
import {archive_page} from "@/composables/content/archive_page.ts";
|
||||||
import FileUpload from "@/components/content/partials/dialogs/FileUpload.vue";
|
import FileUpload from "@/components/content/partials/dialogs/FileUpload.vue";
|
||||||
import FileEdit from "@/components/content/partials/dialogs/FileEdit.vue";
|
import FileEdit from "@/components/content/partials/dialogs/FileEdit.vue";
|
||||||
import ConfirmDelete from "@/components/content/partials/dialogs/ConfirmDelete.vue";
|
import ConfirmDelete from "@/components/content/partials/dialogs/ConfirmDelete.vue";
|
||||||
import Table from "@/components/content/partials/Table.vue";
|
import Table from "@/components/content/partials/Table.vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
hideColumns: {
|
||||||
|
type: Array,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
isDraggable: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const { items, listData, headers, selected, loading, search, getItems, editItem, deleteItem } = archive_page()
|
const { items, listData, headers, selected, loading, search, getItems, editItem, deleteItem } = archive_page()
|
||||||
|
|
||||||
const itemEdited = ref({})
|
const itemEdited = ref({})
|
||||||
|
@ -18,7 +28,9 @@ const dialog = reactive({
|
||||||
text: ''
|
text: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const openDialog = (type, title = '', text = '', bulk = false) => {
|
const visibleHeaders = ref(headers)
|
||||||
|
|
||||||
|
const openDialog = (type, title = '', text = '') => {
|
||||||
dialog.open = true
|
dialog.open = true
|
||||||
dialog.type = type
|
dialog.type = type
|
||||||
dialog.title = title
|
dialog.title = title
|
||||||
|
@ -65,6 +77,14 @@ const updateSearch = (text) => {
|
||||||
search.value = text
|
search.value = text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
if(props.hideColumns != undefined) {
|
||||||
|
visibleHeaders.value = headers.filter(el => {
|
||||||
|
return !props.hideColumns.includes(el.value)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
watch(search, (newValue, oldValue) => {
|
watch(search, (newValue, oldValue) => {
|
||||||
getItems(listData)
|
getItems(listData)
|
||||||
})
|
})
|
||||||
|
@ -73,13 +93,14 @@ watch(search, (newValue, oldValue) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Table
|
<Table
|
||||||
:headers="headers"
|
:headers="visibleHeaders"
|
||||||
v-model:selected="selected"
|
v-model:selected="selected"
|
||||||
v-model:search="search"
|
v-model:search="search"
|
||||||
:list-data="listData"
|
:list-data="listData"
|
||||||
:items="items"
|
:items="items"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:get-items="getItems"
|
:get-items="getItems"
|
||||||
|
:is-draggable="isDraggable"
|
||||||
:actions="true"
|
:actions="true"
|
||||||
:item-value="'track_title'"
|
:item-value="'track_title'"
|
||||||
:show-select="true"
|
:show-select="true"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue