Поправил привязку вч загрузки, сделал модальное окно.

This commit is contained in:
2025-11-12 00:04:55 +03:00
parent 5e94086bf0
commit 902eb23bd8
9 changed files with 526 additions and 60 deletions

View File

@@ -75,7 +75,7 @@
<h3 class="card-title mb-0">Добавление списка спутников</h3>
</div>
<p class="card-text">Добавьте новый список спутников в базу данных для последующего использования в загрузке данных.</p>
<a href="{% url 'mainapp:add_sats' %}" class="btn btn-info">
<a href="{% url 'mainapp:add_sats' %}" class="btn btn-info disabled">
Добавить список спутников
</a>
</div>
@@ -96,7 +96,7 @@
<h3 class="card-title mb-0">Добавление транспондеров</h3>
</div>
<p class="card-text">Добавьте список транспондеров из JSON-файла в базу данных. Требуется наличие файла transponders.json.</p>
<a href="{% url 'mainapp:add_trans' %}" class="btn btn-warning">
<a href="{% url 'mainapp:add_trans' %}" class="btn btn-warning disabled">
Добавить транспондеры
</a>
</div>

View File

@@ -0,0 +1,236 @@
<!-- SigmaParameter Data Modal -->
<div class="modal fade" id="sigmaParameterModal" tabindex="-1" aria-labelledby="sigmaParameterModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header bg-info text-white">
<h5 class="modal-title" id="sigmaParameterModalLabel">
<i class="bi bi-graph-up"></i> Данные SigmaParameter
</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body" id="sigmaParameterModalBody">
<div class="text-center py-4">
<div class="spinner-border text-info" role="status">
<span class="visually-hidden">Загрузка...</span>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
</div>
</div>
</div>
</div>
<script>
function showSigmaParameterModal(parameterId) {
// Показываем модальное окно
const modal = new bootstrap.Modal(document.getElementById('sigmaParameterModal'));
modal.show();
// Показываем индикатор загрузки
const modalBody = document.getElementById('sigmaParameterModalBody');
modalBody.innerHTML = `
<div class="text-center py-4">
<div class="spinner-border text-info" role="status">
<span class="visually-hidden">Загрузка...</span>
</div>
</div>
`;
// Загружаем данные
fetch(`/api/sigma-parameter/${parameterId}/`)
.then(response => {
if (!response.ok) {
throw new Error('Ошибка загрузки данных');
}
return response.json();
})
.then(data => {
if (data.sigma_parameters.length === 0) {
modalBody.innerHTML = `
<div class="alert alert-info" role="alert">
<i class="bi bi-info-circle"></i> Нет связанных SigmaParameter
</div>
`;
return;
}
// Формируем HTML с данными
let html = '<div class="container-fluid">';
data.sigma_parameters.forEach((sigma, index) => {
html += `
<div class="card mb-3">
<div class="card-header bg-light">
<strong><i class="bi bi-broadcast"></i> SigmaParameter #${index + 1}</strong>
</div>
<div class="card-body">
<div class="row g-3">
<!-- Основная информация -->
<div class="col-md-6">
<div class="card h-100">
<div class="card-header bg-light">
<strong><i class="bi bi-info-circle"></i> Основная информация</strong>
</div>
<div class="card-body">
<table class="table table-sm table-borderless mb-0">
<tbody>
<tr>
<td class="text-muted" style="width: 40%;">Спутник:</td>
<td><strong>${sigma.satellite}</strong></td>
</tr>
<tr>
<td class="text-muted">Частота:</td>
<td><strong>${sigma.frequency} МГц</strong></td>
</tr>
<tr>
<td class="text-muted">Частота в Ku:</td>
<td><strong>${sigma.transfer_frequency} МГц</strong></td>
</tr>
<tr>
<td class="text-muted">Полоса частот:</td>
<td><strong>${sigma.freq_range} МГц</strong></td>
</tr>
<tr>
<td class="text-muted">Поляризация:</td>
<td><span class="badge bg-info">${sigma.polarization}</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Технические параметры -->
<div class="col-md-6">
<div class="card h-100">
<div class="card-header bg-light">
<strong><i class="bi bi-gear"></i> Технические параметры</strong>
</div>
<div class="card-body">
<table class="table table-sm table-borderless mb-0">
<tbody>
<tr>
<td class="text-muted" style="width: 40%;">Модуляция:</td>
<td><span class="badge bg-secondary">${sigma.modulation}</span></td>
</tr>
<tr>
<td class="text-muted">Стандарт:</td>
<td><span class="badge bg-secondary">${sigma.standard}</span></td>
</tr>
<tr>
<td class="text-muted">Сим. скорость:</td>
<td><strong>${sigma.bod_velocity} БОД</strong></td>
</tr>
<tr>
<td class="text-muted">ОСШ:</td>
<td><strong>${sigma.snr} дБ</strong></td>
</tr>
<tr>
<td class="text-muted">Мощность:</td>
<td><strong>${sigma.power} дБм</strong></td>
</tr>
<tr>
<td class="text-muted">Статус:</td>
<td>${sigma.status}</td>
</tr>
<tr>
<td class="text-muted">Пакетность:</td>
<td>${sigma.packets}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Временные параметры -->
<div class="col-md-6">
<div class="card">
<div class="card-header bg-light">
<strong><i class="bi bi-clock-history"></i> Временные параметры</strong>
</div>
<div class="card-body">
<table class="table table-sm table-borderless mb-0">
<tbody>
<tr>
<td class="text-muted" style="width: 40%;">Начало измерения:</td>
<td><strong>${sigma.datetime_begin}</strong></td>
</tr>
<tr>
<td class="text-muted">Окончание измерения:</td>
<td><strong>${sigma.datetime_end}</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Отметки -->
<div class="col-md-6">
<div class="card">
<div class="card-header bg-light">
<strong><i class="bi bi-check2-square"></i> Отметки (${sigma.marks.length})</strong>
</div>
<div class="card-body">
`;
if (sigma.marks.length > 0) {
html += `
<div class="table-responsive" style="max-height: 200px; overflow-y: auto;">
<table class="table table-sm table-striped mb-0">
<thead class="table-light sticky-top">
<tr>
<th style="width: 20%;">Отметка</th>
<th>Дата</th>
</tr>
</thead>
<tbody>
`;
sigma.marks.forEach(mark => {
const markClass = mark.mark === '+' ? 'text-success' : 'text-danger';
html += `
<tr>
<td class="${markClass}"><strong>${mark.mark}</strong></td>
<td>${mark.date}</td>
</tr>
`;
});
html += `
</tbody>
</table>
</div>
`;
} else {
html += `
<p class="text-muted mb-0">Нет отметок</p>
`;
}
html += `
</div>
</div>
</div>
</div>
</div>
</div>
`;
});
html += '</div>';
modalBody.innerHTML = html;
})
.catch(error => {
modalBody.innerHTML = `
<div class="alert alert-danger" role="alert">
<i class="bi bi-exclamation-triangle"></i> ${error.message}
</div>
`;
});
}
</script>

View File

@@ -20,7 +20,17 @@
{% endfor %}
{% endif %}
<p class="card-text">Введите допустимый разброс для частоты и полосы</p>
<div class="alert alert-info" role="alert">
<strong>Информация о привязке:</strong>
<p class="mb-2">Погрешность центральной частоты определяется автоматически в зависимости от полосы:</p>
<ul class="mb-0 small">
<li>0 - 500 кГц: <strong>0.1%</strong></li>
<li>500 кГц - 1.5 МГц: <strong>0.5%</strong></li>
<li>1.5 - 5 МГц: <strong>1%</strong></li>
<li>5 - 10 МГц: <strong>2%</strong></li>
<li>Более 10 МГц: <strong>5%</strong></li>
</ul>
</div>
<form method="post">
{% csrf_token %}
@@ -38,17 +48,19 @@
<div class="text-danger mt-1">{{ form.ku_range.errors }}</div>
{% endif %}
</div> {% endcomment %}
<div class="mb-3">
{% comment %} <div class="mb-3">
<label for="{{ form.value1.id_for_label }}" class="form-label">Разброс по частоте(в МГц)</label>
{{ form.value1 }}
<small class="form-text text-muted">Не используется - погрешность определяется автоматически</small>
{% if form.value1.errors %}
<div class="text-danger mt-1">{{ form.value1.errors }}</div>
{% endif %}
</div>
</div> {% endcomment %}
<div class="mb-3">
<label for="{{ form.value2.id_for_label }}" class="form-label">Разброс по полосе(в %)</label>
<label for="{{ form.value2.id_for_label }}" class="form-label">Разброс по полосе (в %)</label>
{{ form.value2 }}
<small class="form-text text-muted">Допустимое отклонение полосы частот в процентах</small>
{% if form.value2.errors %}
<div class="text-danger mt-1">{{ form.value2.errors }}</div>
{% endif %}

View File

@@ -257,6 +257,12 @@
onchange="toggleColumn(this)"> Тип источника
</label>
</li>
<li>
<label class="dropdown-item">
<input type="checkbox" class="column-toggle" data-column="25" checked
onchange="toggleColumn(this)"> Sigma
</label>
</li>
</ul>
</div>
@@ -470,6 +476,7 @@
{% include 'mainapp/components/_table_header.html' with label="Усреднённое" field="" sortable=False %}
{% include 'mainapp/components/_table_header.html' with label="Стандарт" field="standard" sort=sort %}
{% include 'mainapp/components/_table_header.html' with label="Тип источника" field="" sortable=False %}
{% include 'mainapp/components/_table_header.html' with label="Sigma" field="" sortable=False %}
</tr>
</thead>
<tbody>
@@ -511,10 +518,19 @@
-
{% endif %}
</td>
<td>
{% if item.has_sigma %}
<a href="#" class="text-info text-decoration-none" onclick="showSigmaParameterModal({{ item.obj.parameter_obj.id }}); return false;" title="{{ item.sigma_info }}">
<i class="bi bi-graph-up"></i> {{ item.sigma_info }}
</a>
{% else %}
-
{% endif %}
</td>
</tr>
{% empty %}
<tr>
<td colspan="25" class="text-center py-4">
<td colspan="26" class="text-center py-4">
{% if selected_satellite_id %}
Нет данных для выбранных фильтров
{% else %}
@@ -1182,6 +1198,9 @@
<!-- Include the selected items offcanvas component -->
{% include 'mainapp/components/_selected_items_offcanvas.html' %}
<!-- Include the sigma parameter modal component -->
{% include 'mainapp/components/_sigma_parameter_modal.html' %}
<!-- LyngSat Data Modal -->
<div class="modal fade" id="lyngsatModal" tabindex="-1" aria-labelledby="lyngsatModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">