* добавил удаление карты, если она была добавлена не из МИС

* добавил диалог при удалении карты
* добавил сохранение движения
* добавил вывод сохраненного отчета
* изменил логику сохранения отчета
This commit is contained in:
brusnitsyn
2026-05-06 17:03:41 +09:00
parent fe2264dfce
commit 2026a1ca9f
22 changed files with 928 additions and 195 deletions

View File

@@ -0,0 +1,37 @@
import { h, ref, render, nextTick } from 'vue'
import AppDialog from '../Components/AppDialog.vue'
// Глобальная очередь диалогов
export const dialogQueue = ref([])
let idCounter = 0
// Вызывается при клике на кнопку / Esc / клик по маске
export function closeDialog(id, confirmed = false) {
const dialog = dialogQueue.value.find(d => d.id === id)
if (dialog && dialog.show) {
dialog.show = false // Запускает leave-анимацию
dialog.resolve(confirmed) // Резолвим промис сразу для лучшего UX
}
}
// Вызывается после завершения leave-анимации
export function cleanupDialog(id) {
dialogQueue.value = dialogQueue.value.filter(d => d.id !== id)
}
export function useAppDialog({title, content, positiveProps, negativeProps, positiveText = 'Подтвердить', negativeText = 'Отмена', maskClosable = false, onConfirm } = {}) {
return new Promise((resolve) => {
const id = idCounter++
// 1. Добавляем скрытым, чтобы сработала enter-анимация
dialogQueue.value.push({
id, show: false, title, content, loading: false, onConfirm,
positiveText, negativeText, positiveProps, negativeProps, maskClosable, resolve
})
// 2. Переключаем в visible на следующем тике
nextTick(() => {
const dialog = dialogQueue.value.find(d => d.id === id)
if (dialog) dialog.show = true
})
})
}