ваше сообщение коммита

This commit is contained in:
2025-06-04 18:39:53 +03:00
parent 59557e4413
commit 80e0cb5272
16 changed files with 504 additions and 265 deletions

View File

@@ -44,6 +44,7 @@
<script setup>
import { ref, onMounted, watch, nextTick } from 'vue';
import { useRouter } from 'vue-router';
import UserTableView from './UserTableView.vue';
import tablesService from '../../services/tablesService';
@@ -52,6 +53,8 @@ const props = defineProps({
});
const emit = defineEmits(['update:selected-table-id']);
const router = useRouter();
const tables = ref([]);
const showDeleteModal = ref(false);
const selectedTable = ref(null);
@@ -62,22 +65,12 @@ async function fetchTables() {
onMounted(fetchTables);
function selectTable(table) {
if (props.selectedTableId === table.id) return;
if (props.selectedTableId) {
emit('update:selected-table-id', null);
nextTick(() => {
emit('update:selected-table-id', table.id);
});
} else {
emit('update:selected-table-id', table.id);
}
router.push({ name: 'user-table-view', params: { id: table.id } });
}
function createTable() {
const name = prompt('Название таблицы');
if (name) {
tablesService.createTable({ name }).then(fetchTables);
}
router.push({ name: 'create-table' });
}
function renameTable(table) {
const name = prompt('Новое имя', table.name);
if (name && name !== table.name) {