501 lines
37 KiB
HTML
501 lines
37 KiB
HTML
{% extends "default.html" %}
|
||
{% load static %}
|
||
{% load mysettings %}
|
||
|
||
{% block header_link %}
|
||
<link rel="stylesheet"
|
||
href="{% static 'lte/plugins/icheck-bootstrap/icheck-bootstrap.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
||
<link rel="stylesheet" href="{% static 'js/ol/theme/default/style.css' %}?ver={% settings_value 'APP_VER' %}">
|
||
{# <script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-core.js"></script>#}
|
||
{# <script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-service.js"></script>#}
|
||
{# <script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-ui.js"></script>#}
|
||
{# <script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-mapevents.js"></script>#}
|
||
{# <link rel="stylesheet" href="https://js.api.here.com/v3/3.1/mapsjs-ui.css">#}
|
||
<link rel="stylesheet" href="{% static 'js/ol/theme/default/ol.css' %}">
|
||
<link rel="stylesheet" href="{% static 'js/ol/theme/default/style.css' %}?ver={% settings_value 'APP_VER' %}">
|
||
<link rel="stylesheet" href="{% static 'js/ol/ol-ext/ol-ext.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
||
<link rel="stylesheet" href="{% static 'js/ol/ol-ext/ol-layer-theme.css' %}?ver={% settings_value 'APP_VER' %}">
|
||
<link rel="stylesheet" href="{% static 'css/main_page.css' %}?ver={% settings_value 'APP_VER' %}">
|
||
|
||
{% endblock header_link %}
|
||
|
||
{% block content %}
|
||
<section class="content text-sm">
|
||
<form id="list_acs" method="post" class="form-horizontal">
|
||
{% csrf_token %}
|
||
<input id="id_acs" type="hidden" value="None" name="id">
|
||
<input id="cmd" type="hidden" value="None" name="cmd">
|
||
<div class="container-fluid ">
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<div class="card card-primary card-outline ">
|
||
<div class="card-header text-sm">
|
||
<a href="/gto/reports/">Отчеты</a>
|
||
</div>
|
||
<div class="card-body">
|
||
<div class="tab-content">
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<ul class="nav nav-tabs" id="custom-content-above-tab" role="tablist">
|
||
<li class="nav-item">
|
||
<a class="nav-link" id="custom-content-above-home-tab"
|
||
data-toggle="pill" href="#custom-content-above-home" role="tab"
|
||
aria-controls="custom-content-above-home" aria-selected="false"
|
||
onclick="switchTab('#custom-content-above-home')">
|
||
Оборудование в работе ({{ clients_count }} шт.)
|
||
</a>
|
||
</li>
|
||
{% if user.profile.role == 1 %}
|
||
<li class="nav-item">
|
||
<a class="nav-link" id="custom-content-above-profile-tab"
|
||
data-toggle="pill" href="#custom-content-above-profile"
|
||
role="tab"
|
||
aria-controls="custom-content-above-profile"
|
||
aria-selected="false"
|
||
onclick="switchTab('#custom-content-above-profile')">
|
||
Заблокированное оборудование ({{ clients_count_block }} шт.)
|
||
</a>
|
||
</li>
|
||
{% endif %}
|
||
<li class="nav-item">
|
||
<a class="nav-link" id="custom-content-map-tab"
|
||
data-toggle="pill" href="#custom-content-map" role="tab"
|
||
aria-controls="custom-content-map" aria-selected="false"
|
||
onclick="switchTab('#custom-content-map')">
|
||
Карта
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
<div class="tab-content" id="custom-content-above-tabContent">
|
||
<div class="tab-pane fade" id="custom-content-above-home"
|
||
role="tabpanel" aria-labelledby="custom-content-above-home-tab">
|
||
<div class="card">
|
||
<div class="card-header text-sm">
|
||
{% block pagination_block %}
|
||
{% if is_paginated %}
|
||
<ul class="pagination pagination no-margin text-sm">
|
||
{% if 1 < start_page_list %}
|
||
<li class="paginate_button page-item"
|
||
id="mypaginator_next">
|
||
<a class="page-link" href="?page=
|
||
{{ start_page_list|add:-1}}"
|
||
aria-controls="mypaginator"
|
||
data-dt-idx="
|
||
{{ start_page_list|add:-1}}"
|
||
style="padding: .3rem .5rem;"><span>..</span></a>
|
||
</li>
|
||
|
||
{% endif %}
|
||
{% for n in page_list %}
|
||
{% if n == page_object.number %}
|
||
<li class="paginate_button page-item active"
|
||
id="mypaginator_next">
|
||
<a class="page-link"
|
||
href="?page={{ n }}"
|
||
aria-controls="mypaginator"
|
||
data-dt-idx="{{ n }}"
|
||
style="padding: .3rem .5rem;"><span>{{ n }}</span></a>
|
||
</li>
|
||
{% else %}
|
||
<li class="paginate_button page-item"
|
||
id="mypaginator_next">
|
||
<a class="page-link"
|
||
href="?page={{ n }}"
|
||
aria-controls="mypaginator"
|
||
data-dt-idx="{{ n }}"
|
||
style="padding: .3rem .5rem;"><span>{{ n }}</span></a>
|
||
</li>
|
||
{% endif %}
|
||
{% endfor %}
|
||
{% if end_page_list < num_pages %}
|
||
<li class="paginate_button page-item"
|
||
id="mypaginator_next">
|
||
<a class="page-link"
|
||
href="?page={{ end_page_list|add:1}}"
|
||
aria-controls="mypaginator"
|
||
data-dt-idx="
|
||
{{ end_page_list|add:1}}"
|
||
style="padding: .3rem .5rem;"><span>..</span></a>
|
||
</li>
|
||
|
||
{% endif %}
|
||
</ul>
|
||
|
||
{% endif %}
|
||
{% endblock %}
|
||
|
||
</div> <!-- /.card-header -->
|
||
<div class="card-body table-responsive p-0">
|
||
<table class="table table-bordered table-hover table-head-fixed text-nowrap">
|
||
<thead>
|
||
<tr role="row">
|
||
<th></th>
|
||
<th>Наименование</th>
|
||
<th>Государственный номер</th>
|
||
<th>Время координат</th>
|
||
<th>Широта</th>
|
||
<th>Долгота</th>
|
||
<th>Скорость</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
|
||
{% if page_object %}
|
||
{% for catalog in page_object.object_list %}
|
||
<tr id="tr_{{ catalog.id }}">
|
||
<td style="width:10px;cursor: pointer;">
|
||
{% if user.profile.role == 1 %}
|
||
<a class="nav-link"
|
||
data-toggle="dropdown" href="#"
|
||
aria-expanded="false"
|
||
style="color:black;">
|
||
<i class="fas fa-bars"></i>
|
||
</a>
|
||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right"
|
||
style="left: inherit; right: 0px;">
|
||
<a href="object/block/?id={{ catalog.id }}""
|
||
class="dropdown-item">
|
||
<!-- Message Start -->
|
||
<div class="media">
|
||
<div class="media-body">
|
||
<h3 class="dropdown-item-title">
|
||
Не контролировать
|
||
<span class="float-right text-sm text-danger"><i
|
||
class="fas fa-ban"></i></span>
|
||
</h3>
|
||
</div>
|
||
</div>
|
||
</a>
|
||
</div>
|
||
{% endif %}
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.name }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.statenum }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.time }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.lat }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.lon }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.speed }}</a>
|
||
</td>
|
||
</tr>
|
||
{% endfor %}
|
||
{% endif %}
|
||
</tbody>
|
||
</table>
|
||
</div> <!-- /.card-body -->
|
||
</div> <!-- /.card -->
|
||
</div>
|
||
{% if user.profile.role == 1 %}
|
||
<div class="tab-pane fade" id="custom-content-above-profile"
|
||
role="tabpanel"
|
||
aria-labelledby="custom-content-above-profile-tab">
|
||
<div class="card">
|
||
<div class="card-header text-sm">
|
||
{% block pagination %}
|
||
{% if is_paginated_block %}
|
||
<ul class="pagination pagination no-margin text-sm">
|
||
{% if 1 < start_page_list_block %}
|
||
<li class="paginate_button page-item"
|
||
id="mypaginator_next">
|
||
<a class="page-link" href="?page=
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
{{ start_page_list_block|add:-1}}"
|
||
aria-controls="mypaginator"
|
||
data-dt-idx="
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
{{ start_page_list_block|add:-1}}"
|
||
style="padding: .3rem .5rem;"><span>..</span></a>
|
||
</li>
|
||
|
||
{% endif %}
|
||
{% for n in page_list_block %}
|
||
{% if n == page_object_block.number %}
|
||
<li class="paginate_button page-item active"
|
||
id="mypaginator_next">
|
||
<a class="page-link"
|
||
href="?page={{ n }}"
|
||
aria-controls="mypaginator"
|
||
data-dt-idx="{{ n }}"
|
||
style="padding: .3rem .5rem;"><span>{{ n }}</span></a>
|
||
</li>
|
||
{% else %}
|
||
<li class="paginate_button page-item"
|
||
id="mypaginator_next">
|
||
<a class="page-link"
|
||
href="?page={{ n }}"
|
||
aria-controls="mypaginator"
|
||
data-dt-idx="{{ n }}"
|
||
style="padding: .3rem .5rem;"><span>{{ n }}</span></a>
|
||
</li>
|
||
{% endif %}
|
||
{% endfor %}
|
||
{% if end_page_list_block < num_pages_block %}
|
||
<li class="paginate_button page-item"
|
||
id="mypaginator_next">
|
||
<a class="page-link" href="?page=
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
{{ end_page_list_block|add:1}}"
|
||
aria-controls="mypaginator"
|
||
data-dt-idx="
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
{{ end_page_list_block|add:1}}"
|
||
style="padding: .3rem .5rem;"><span>..</span></a>
|
||
</li>
|
||
|
||
{% endif %}
|
||
</ul>
|
||
|
||
{% endif %}
|
||
{% endblock %}
|
||
|
||
</div> <!-- /.card-header -->
|
||
<div class="card-body table-responsive p-0">
|
||
<table class="table table-bordered table-hover table-head-fixed text-nowrap">
|
||
<thead>
|
||
<tr role="row">
|
||
<th></th>
|
||
<th>Наименование</th>
|
||
<th>Государственный номер</th>
|
||
<th>Время координат</th>
|
||
<th>Широта</th>
|
||
<th>Долгота</th>
|
||
<th>Скорость</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
|
||
{% if page_object_block %}
|
||
{% for catalog in page_object_block.object_list %}
|
||
<tr id="tr_{{ catalog.id }}">
|
||
<td style="width:10px;cursor: pointer;">
|
||
<a class="nav-link"
|
||
data-toggle="dropdown" href="#"
|
||
aria-expanded="false"
|
||
style="color:black;">
|
||
<i class="fas fa-bars"></i>
|
||
</a>
|
||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right"
|
||
style="left: inherit; right: 0px;">
|
||
<a href="object/block/?id={{ catalog.id }}"
|
||
class="dropdown-item">
|
||
<div class="media">
|
||
<div class="media-body">
|
||
<h3 class="dropdown-item-title">
|
||
Контролировать
|
||
<span class="float-right text-sm text-danger"><i
|
||
class="fas fa-rss"></i></span>
|
||
</h3>
|
||
</div>
|
||
</div>
|
||
</a>
|
||
</div>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.name }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.statenum }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.time }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.lat }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.lon }}</a>
|
||
</td>
|
||
<td>
|
||
<a href="object/?id={{ catalog.id }}">{{ catalog.speed }}</a>
|
||
</td>
|
||
</tr>
|
||
{% endfor %}
|
||
{% endif %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{% endif %}
|
||
<div class="tab-pane fade active show" id="custom-content-map"
|
||
role="tabpanel" aria-labelledby="custom-content-map-tab">
|
||
<div class="card">
|
||
<div class="card-body table-responsive p-0"
|
||
style="height: 70vh; padding-left: 0;">
|
||
<div id="map">
|
||
<button type="button" id="toStart" class="btn"
|
||
style="position: absolute; top: .5em; left: .5em; z-index: 999; background-color: rgba(255,255,255, 0.5); border: 1px solid #e2c4b0">
|
||
Вернуться на разрез
|
||
</button>
|
||
<div id="popup"></div>
|
||
<div id="LayerSwitcher">
|
||
<div class="layers-btn-container">
|
||
<div id="layers-btn"></div>
|
||
</div>
|
||
<div id="LayerSwitcherInner"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</section>
|
||
|
||
|
||
|
||
{% endblock %}
|
||
|
||
{% block script_footer %}
|
||
<script src="{% static 'js/ol/lib/OpenLayers.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||
<script src="{% static 'js/ol/ol-ext/ol-ext.min.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||
<script src="{% static 'js/ol/layersStyles.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||
<script src="{% static 'js/ol/map/map-core.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||
<script src="{% static 'js/ol/map/map-layer-switcher.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||
<script src="{% static 'js/ol/map/map-marker-manager.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||
<script src="{% static 'js/ol/map/map-created-layer-manager.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||
<script>
|
||
document.addEventListener("DOMContentLoaded", async () => {
|
||
// Инициализация карты
|
||
const mapCore = new MapCore('map', {
|
||
center: ['{{longitude}}', '{{latitude}}'],
|
||
zoom: 12
|
||
});
|
||
|
||
await mapCore.initialize();
|
||
|
||
|
||
// Инициализация менеджеров маркеров
|
||
const gtoLayer = new ol.layer.Vector({source: new ol.source.Vector()});
|
||
gtoLayer.set('title', 'Горнотранспортное оборудование')
|
||
gtoLayer.set('name', 'gto')
|
||
const gtoManager = new MarkerManager(gtoLayer, GTOStyleFunction);
|
||
|
||
mapCore.addLayer(gtoLayer, 'dynamic');
|
||
|
||
const scanLayer = new ol.layer.Tile({
|
||
source: new ol.source.XYZ({
|
||
url: `/media/map/orth/tiles/{z}/{x}/{y}.png?seed=${Math.random() * 1000}`,
|
||
}),
|
||
extent: ol.proj.transformExtent(
|
||
[
|
||
parseFloat('{{ orth_minLon }}'),
|
||
parseFloat('{{ orth_minLat }}'),
|
||
parseFloat('{{ orth_maxLon }}'),
|
||
parseFloat('{{ orth_maxLat }}')
|
||
],
|
||
'EPSG:4326', // Исходная проекция
|
||
'EPSG:3857' // Целевая проекция
|
||
)
|
||
});
|
||
scanLayer.set('title', 'Ортофотоплан')
|
||
scanLayer.set('name', 'orto')
|
||
mapCore.addLayer(scanLayer)
|
||
|
||
const mineBorderLayer = new ol.layer.Vector({
|
||
source: new ol.source.Vector({
|
||
url: '/{{ prgr }}',
|
||
format: new ol.format.KML({extractStyles: false}),
|
||
|
||
}),
|
||
style: polygonStyleFunction,
|
||
});
|
||
mineBorderLayer.set('title', 'Границы ПРГР')
|
||
mineBorderLayer.set('name', 'prgr')
|
||
|
||
mapCore.addLayer(mineBorderLayer)
|
||
|
||
// Инициализация статических слоев
|
||
const createdLayersManager = new CreatedLayersManager({
|
||
url: '{% url 'layers' %}',
|
||
mapCore: mapCore,
|
||
})
|
||
createdLayersManager.fetchLayers().then(() => {
|
||
const LayerSwitcherInner = document.getElementById('LayerSwitcherInner');
|
||
const layerSwitcher = new LayerSwitcher(mapCore, LayerSwitcherInner);
|
||
});
|
||
|
||
|
||
// Кнопка возврата
|
||
document.getElementById('toStart').addEventListener('click', () => {
|
||
mapCore.map.getView().animate({
|
||
center: ol.proj.fromLonLat(['{{longitude}}', '{{latitude}}']),
|
||
zoom: 12
|
||
});
|
||
});
|
||
|
||
// Функция для обновления маркеров
|
||
async function updateMarkers() {
|
||
// Обновление GTO
|
||
const gtoData = await fetch('/gto/update_object/', {
|
||
method: 'POST',
|
||
headers: {'X-CSRFToken': csrftoken}
|
||
}).then(r => r.json());
|
||
|
||
gtoData.forEach(item => {
|
||
if (gtoManager.markers[item.id]) {
|
||
if (gtoManager.markers[item.id].get('iso_time') !== item.iso_time) {
|
||
gtoManager.markers[item.id].setStyle(GTOStyleFunction)
|
||
}
|
||
gtoManager.animateMarker(item.id, [item.lon, item.lat]);
|
||
gtoManager.updateMarker(item.id, [item.lon, item.lat], item);
|
||
} else {
|
||
gtoManager.addMarker(item.id, [item.lon, item.lat], item);
|
||
}
|
||
});
|
||
}
|
||
|
||
await updateMarkers();
|
||
setInterval(updateMarkers, 3000);
|
||
});
|
||
</script>
|
||
|
||
{% endblock script_footer %}
|