update : 21.07.2025 15:37:31,71
This commit is contained in:
parent
6aff26951a
commit
f1fdcf4e39
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.25 on 2025-07-21 02:47
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('gto', '0028_alter_gtoexternalsystem_options_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='gtoexternalsystem',
|
||||
name='external_system',
|
||||
field=models.CharField(choices=[('ask', 'АСК'), ('aftograf', 'АвтоГРАФ'), ('asd', 'АСД'), ('edds', 'ЕДДС'), ('sotekom', 'СоюзТехноКом'), ('wialon', 'Wialon')], default=0, max_length=15, verbose_name='Внешняя система'),
|
||||
),
|
||||
]
|
||||
@ -8,6 +8,7 @@ from apps.gto.models.model_type_sensor import TypeSensor
|
||||
class GtoExternalSystem(models.Model): #
|
||||
|
||||
external_system = models.CharField(
|
||||
max_length=15,
|
||||
choices=settings.GTO_EXTERNAL_SYSTEM_LIST,
|
||||
blank=False,
|
||||
default=0,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "default.html" %}
|
||||
{% extends "management_base.html" %}
|
||||
{% load static %}
|
||||
{% load mysettings %}
|
||||
|
||||
@ -40,9 +40,9 @@
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{% url 'mainindex' %}">Главная</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'management:main_index' %}">Параметры системы </a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a href="/management/pla/">Система оповещения</a></li>
|
||||
<li class="breadcrumb-item">Управление каналами</li>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "default.html" %}
|
||||
{% extends "management_base.html" %}
|
||||
{% load static %}
|
||||
{% load mysettings %}
|
||||
|
||||
@ -23,9 +23,9 @@
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{% url 'mainindex' %}">Главная</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'management:main_index' %}">Параметры системы </a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a href="/management/pla/">Система оповещения</a></li>
|
||||
<li class="breadcrumb-item">Управление каналами</li>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "default.html" %}
|
||||
{% extends "management_base.html" %}
|
||||
{% load static %}
|
||||
{% load mysettings %}
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="/management/">Главная</a></li>
|
||||
<li class="breadcrumb-item"><a href="/management/">Параметры системы</a></li>
|
||||
<li class="breadcrumb-item"><a href="/management/pla/">Система оповещения</a></li>
|
||||
<li class="breadcrumb-item">Управление каналами</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -164,8 +164,6 @@
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<!-- <a id="id_td_name{{catalog.id}}" class="action-form" data-target="#modal-edit" data-value="{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">{{ catalog.get_name }} </a>
|
||||
-->
|
||||
<a id="id_td_name{{catalog.id}}" class="action-form" onclick="openedit({{catalog.id}})" style="cursor:pointer;">{{ catalog.get_name }} </a>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "default.html" %}
|
||||
{% extends "management_base.html" %}
|
||||
{% load static %}
|
||||
{% load mysettings %}
|
||||
|
||||
@ -23,9 +23,9 @@
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{% url 'mainindex' %}">Главная</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'management:main_index' %}">Параметры системы </a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a href="/management/wkloaction/">Главная</a></li>
|
||||
<li class="breadcrumb-item active">Местоположение персонала</li>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
140
apps/management/templates/pla/pla_main.html
Normal file
140
apps/management/templates/pla/pla_main.html
Normal file
@ -0,0 +1,140 @@
|
||||
{% extends "management_base.html" %}
|
||||
{% load static %}
|
||||
{% load mysettings %}
|
||||
|
||||
{% block header_link %}
|
||||
<!-- Select2 -->
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'lte/plugins/select2/css/select2.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'lte/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
||||
<style>
|
||||
.file-upload-label {
|
||||
cursor: pointer;
|
||||
border: 1px solid #ced4da;
|
||||
padding: .375rem .75rem;
|
||||
border-radius: .25rem;
|
||||
font-weight: normal !important;
|
||||
}
|
||||
|
||||
.gap-3 {
|
||||
gap: .3em;
|
||||
}
|
||||
</style>
|
||||
{% endblock header_link %}
|
||||
|
||||
{% block content %}
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Параметры системы : Система оповещения</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="/management/">Главная</a></li>
|
||||
<li class="breadcrumb-item active">Система оповещения</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.container-fluid -->
|
||||
</section>
|
||||
|
||||
<section class="content text-sm">
|
||||
|
||||
{% csrf_token %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header text-sm">
|
||||
<h5 class="card-title">Система оповещения</h5>
|
||||
</div> <!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
<form id="id_form_pla" class="form-horizontal">
|
||||
<div class="form-group row">
|
||||
<label for="id_plasystem" class="col-sm-1 col-form-label">Система оповещения : </label>
|
||||
<div class="col-sm-4">
|
||||
<select id="id_plasystem" name="plasystem" class="form-control select2"
|
||||
style="width: 100%;">
|
||||
<option value="noSystem" {% if plasystem == "Не используется" %}
|
||||
selected {% endif %}>Не используется
|
||||
</option>
|
||||
<option {% if plasystem == "Asterisk" %} selected {% endif %}>Asterisk</option>
|
||||
<option {% if plasystem == "Radiusip" %} selected {% endif %}>Radiusip</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id='id_radius_panel'>
|
||||
<div class="form-group row">
|
||||
<label for="id_plaadress" class="col-sm-1 col-form-label">Адрес сервера : </label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="plaadress" value='{{ plaadress }}'
|
||||
placeholder='Адрес сервера' class="form-control" autofocus=""
|
||||
id="id_plaadress">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_plalogin" class="col-sm-1 col-form-label">Логин : </label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="plalogin" value='{{ plalogin }}' placeholder='Логин'
|
||||
class="form-control" autofocus="" id="id_plalogin">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_plapass" class="col-sm-1 col-form-label">Пароль : </label>
|
||||
<div class="col-sm-4">
|
||||
<input type="password" name="plapass" value='{{ plapass }}' placeholder='Пароль'
|
||||
class="form-control" autofocus="" id="id_plapass">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_platoken" class="col-sm-1 col-form-label">Токен : </label>
|
||||
<div class="col-sm-4">
|
||||
<textarea type="text" name="platoken" placeholder='Токен' class="form-control"
|
||||
autofocus="" id="id_wtoken">{{ platoken }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<a href="{% url 'management:manage_channel' %}" class="btn bg-gradient-primary">Управление
|
||||
каналами</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id='id_asterisk_panel'>
|
||||
<div class="form-group row">
|
||||
<label for="id_outgoing" class="col-sm-1 col-form-label">Каталог исходящих сообщений
|
||||
: </label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="outgoing" value='{{ outgoing }}'
|
||||
placeholder='Каталог исходящих сообщений' class="form-control"
|
||||
autofocus="" id="id_outgoing">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_alarm" class="col-sm-1 col-form-label">Каталог звуковых оповещений
|
||||
: </label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="alarm" value='{{ alarm }}'
|
||||
placeholder='Каталог звуковых оповещений' class="form-control"
|
||||
autofocus="" id="id_alarm">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- /.card-body -->
|
||||
<div class="card-footer">
|
||||
<button id="id_pla_btn_save" type="submit" class="btn bg-gradient-primary">Сохранить</button>
|
||||
</div>
|
||||
</div> <!-- /.card -->
|
||||
</div> <!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}{% endblock %}
|
||||
|
||||
{% block script_footer %}
|
||||
<script src="{% static 'js/management/pla.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||||
{% endblock script_footer %}
|
||||
@ -35,7 +35,6 @@
|
||||
|
||||
<section class="content">
|
||||
<form id="edit_user" autocomplete="off" action="/management/user/save/" method="post" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" value="{{user.id}}" name="id">
|
||||
<input type="hidden" value="{{mt}}" name="mt">
|
||||
<div class="container-fluid">
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
|
||||
<section class="content">
|
||||
<form id="edit_user" autocomplete="off" action="/management/user/save/" method="post" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" value="{{edit_user.id}}" name="id">
|
||||
<input type="hidden" value="{{mt}}" name="mt">
|
||||
<div class="container-fluid">
|
||||
|
||||
@ -41,15 +41,13 @@
|
||||
</section>
|
||||
|
||||
<section class="content text-sm">
|
||||
<form action="./?module=settings&cmd=oset_save" method="post" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header text-sm">
|
||||
<a href="user/add/" type="button"
|
||||
class="btn bg-gradient-primary float-left"
|
||||
style="margin-right:20px;">Добавить</a>
|
||||
<a type="button"
|
||||
class="btn bg-gradient-primary float-left"
|
||||
style="margin-right:20px;" onclick="openedit(0)" >Добавить</a>
|
||||
{% block pagination %}
|
||||
{% if is_paginated %}
|
||||
<ul class="pagination pagination no-margin text-sm">
|
||||
@ -109,9 +107,9 @@
|
||||
<th></th>
|
||||
<th style="text-align:center;">Пользователь</th>
|
||||
<th style="text-align:center;" >Роль</th>
|
||||
<th style="max-width:15px;text-align:center;">Только
|
||||
просмотр
|
||||
</th>
|
||||
<th style="max-width:25px;text-align:center;">Пароль </th>
|
||||
<th style="max-width:15px;text-align:center;">Только просмотр </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -134,7 +132,7 @@
|
||||
data-toggle="modal" style="color:red;"
|
||||
title='Удалить "{{ catalog.username }}"'><i
|
||||
class="far fa-trash-alt"></i></a>
|
||||
<div class="modal fade" id="large_{{ catalog.id }}">
|
||||
<div class="modal fade" id="large_{{ catalog.id }}" data-backdrop="static">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-danger">
|
||||
<div class="modal-header">
|
||||
@ -166,21 +164,26 @@
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<a href="user/?id={{ catalog.id }}">{{ catalog.username }} </a>
|
||||
<a id="id_td_name{{catalog.id}}" class="action-form" onclick="openedit({{catalog.id}})" style="cursor:pointer;">{{ catalog.username }} </a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="user/?id={{ catalog.id }}">
|
||||
<h6>{{ catalog.profile.get_role }}</h6>
|
||||
</a>
|
||||
<a id="id_td_role{{catalog.id}}" class="action-form" onclick="openedit({{catalog.id}})" style="cursor:pointer;">
|
||||
{{ catalog.profile.get_role_display }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a id="id_td_role{{catalog.id}}" class="action-form" onclick="editpassword({{catalog.id}})" style="cursor:pointer;">
|
||||
Изменить пароль
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td style="max-width:10px;text-align:center;">
|
||||
<div class="icheck-success d-inline" >
|
||||
<input type="checkbox" disabled {% if catalog.profile.isredonly %} checked {% endif %} id="checkboxSuccess{{ catalog.id }}"">
|
||||
<input id="id_td_isredonly_{{catalog.id}}" type="checkbox" disabled {% if catalog.profile.isredonly %} checked {% endif %} id="checkboxSuccess{{ catalog.id }}"">
|
||||
<label for="checkboxSuccess{{ catalog.id }}"></label>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@ -191,50 +194,125 @@
|
||||
</div> <!-- /.card -->
|
||||
</div> <!-- /.col -->
|
||||
</div><!-- <!-- /.row -->
|
||||
</form>
|
||||
</section>
|
||||
<div class="modal fade" id="modal-edit" data-backdrop="static">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 id="user_title" class="modal-title" >Новый пользователь</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="id_form_user">
|
||||
<input id="id" type="hidden" value="0" name="id" >
|
||||
<div class="form-group row">
|
||||
<label for="id_first_name" class="col-sm-2 col-form-label">Имя: </label>
|
||||
<div class="col-sm-10">
|
||||
<input autocomplete="off" type="text" name="first_name" class="form-control" autofocus="" required="" id="id_first_name" value="{{first_name}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_last_name" class="col-sm-2 col-form-label">Фамилия: </label>
|
||||
<div class="col-sm-10">
|
||||
<input autocomplete="off" type="text" name="last_name" class="form-control" autofocus="" required="" id="id_last_name" value="{{last_name}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_role" class="col-sm-2 col-form-label">Роль : </label>
|
||||
<div class="col-sm-10">
|
||||
<select name="role" id="id_role" class="form-control select2" style="width: 100%;">
|
||||
<option value="0">Пользователь</option>
|
||||
<option value="1">Администратор</option>
|
||||
<option value="3">Начальник участка</option>
|
||||
<option value="4">Главный инженер</option>
|
||||
<option value="5">Главный геолог</option>
|
||||
<option value="6">Главный технолог</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id='id_div_login'>
|
||||
<label for="id_username" class="col-sm-2 col-form-label">Логин : </label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="username" class="form-control" autofocus="" {% if users %} readonly {% endif %} required="" id="id_username" value="{{username}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id='id_div_password'>
|
||||
<label for="id_password" class="col-sm-2 col-form-label">Новый пароль : </label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" name="password" class="form-control" autofocus="" {% if users %} {% else %} required="" {% endif %} id="id_password" value="{{password}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id='id_div_password2'>
|
||||
<label for="id_password2" class="col-sm-2 col-form-label">Новый пароль - подтверждение: </label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" name="password2" class="form-control" autofocus="" {% if users %} {% else %} required="" {% endif %} id="id_password2" value="{{password2}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_isredonly" class="col-sm-2 col-form-label">Только просмотр: </label>
|
||||
<div class="col-sm-10">
|
||||
<div class="icheck-success d-inline" >
|
||||
<input id="id_isredonly" name="isredonly" type="checkbox">
|
||||
<label for="id_isredonly"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer justify-content-between">
|
||||
<button id="id_user_ok" type="button" class="btn btn-primary" onclick="ClickUserOK()">Сохранить</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal-password" data-backdrop="static">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 id="user_password_title" class="modal-title" >Новый пользователь</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="id_form_password">
|
||||
<input id="id_password_in" type="hidden" value="0" name="password_in" >
|
||||
<div class="form-group row" id='id_div_password'>
|
||||
<label for="id_password_edit" class="col-sm-2 col-form-label">Новый пароль : </label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" name="password_edit" autocomplete="on" class="form-control" autofocus="" {% if users %} {% else %} required="" {% endif %} id="id_password_edit" value="{{password}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" id='id_div_password2'>
|
||||
<label for="id_password_edit2" class="col-sm-2 col-form-label">Новый пароль - подтверждение: </label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" name="password_edit2" autocomplete="on" class="form-control" autofocus="" {% if users %} {% else %} required="" {% endif %} id="id_password_edit2" value="{{password2}}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer justify-content-between">
|
||||
<button id="id_user_password_ok" type="button" class="btn btn-primary" onclick="ClickUserPasswordOK()">Сохранить</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}{% endblock %}
|
||||
|
||||
{% block script_footer %}
|
||||
<script>
|
||||
<script src="{% static 'js/management/users.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||||
|
||||
document.getElementById("id_gtoystem").addEventListener('change', function (e) {
|
||||
console.log("Changed to: " + e.target.value)
|
||||
})
|
||||
|
||||
function delete_user(id) {
|
||||
var Rec = $.ajax({
|
||||
method: 'POST',
|
||||
url: window.location.icon.image.urlname + 'user/delete/',
|
||||
async: true,
|
||||
data: {
|
||||
id: id,
|
||||
cmd: 'delete',
|
||||
},
|
||||
success: function (data) {
|
||||
document.getElementById("tr_" + id).remove();
|
||||
$('#large_' + id).modal('hide');
|
||||
$('body').removeClass('modal-open');
|
||||
$('body').css({"height": "auto", "padding-right": "0px"});
|
||||
$('.modal-backdrop').remove();
|
||||
},
|
||||
error: function (dataerr) {
|
||||
$('#large_' + id).modal('hide');
|
||||
$('body').removeClass('modal-open');
|
||||
$('.modal-backdrop').remove();
|
||||
alert('Ошибка выполнение команды')
|
||||
|
||||
}
|
||||
//timeout: 120000
|
||||
|
||||
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
const forms = document.querySelectorAll('.form-horizontal');
|
||||
for (const form of forms) {
|
||||
|
||||
125
apps/management/templates/wklocation/wklocation_main.html
Normal file
125
apps/management/templates/wklocation/wklocation_main.html
Normal file
@ -0,0 +1,125 @@
|
||||
{% extends "management_base.html" %}
|
||||
{% load static %}
|
||||
{% load mysettings %}
|
||||
|
||||
{% block header_link %}
|
||||
<!-- Select2 -->
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'lte/plugins/select2/css/select2.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'lte/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
||||
<style>
|
||||
.file-upload-label {
|
||||
cursor: pointer;
|
||||
border: 1px solid #ced4da;
|
||||
padding: .375rem .75rem;
|
||||
border-radius: .25rem;
|
||||
font-weight: normal !important;
|
||||
}
|
||||
|
||||
.gap-3 {
|
||||
gap: .3em;
|
||||
}
|
||||
</style>
|
||||
{% endblock header_link %}
|
||||
|
||||
{% block content %}
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Параметры системы : Местоположение персонала</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="/management/">Главная</a></li>
|
||||
<li class="breadcrumb-item active">Местоположение персонала</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.container-fluid -->
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section class="content text-sm">
|
||||
{% csrf_token %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header text-sm">
|
||||
<h5 class="card-title">Местоположение персонала</h5>
|
||||
</div> <!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
<form id="id_form_wklocation" class="form-horizontal">
|
||||
<div class="form-group row">
|
||||
<label for="id_wlocationsystem" class="col-sm-1 col-form-label">Система определения
|
||||
местоположения : </label>
|
||||
<div class="col-sm-4">
|
||||
<select id="id_wlocationsystem" name="wlocationsystem" class="form-control select2"
|
||||
style="width: 100%;">
|
||||
<option {% if wlocationsystem == "Не используется" %} selected {% endif %}>Не
|
||||
используется
|
||||
</option>
|
||||
<option {% if wlocationsystem == "Внешняя ссылка" %} selected {% endif %}>
|
||||
Внешняя ссылка
|
||||
</option>
|
||||
<option {% if wlocationsystem == "RTLS" %} selected {% endif %}>RTLS</option>
|
||||
<option {% if wlocationsystem == "Radiusip" %} selected {% endif %}>Radiusip
|
||||
<option {% if wlocationsystem == "Hetonis" %} selected {% endif %}>Hetonis
|
||||
</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="id_wadress" class="col-sm-1 col-form-label">Адрес сервера : </label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="wadress" value='{{ wadress }}' placeholder='Адрес сервера'
|
||||
class="form-control" autofocus="" id="id_wadress">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_wlogin" class="col-sm-1 col-form-label">Логин : </label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="wlogin" value='{{ wlogin }}' placeholder='Логин'
|
||||
class="form-control" autofocus="" id="id_wlogin">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_wpass" class="col-sm-1 col-form-label">Пароль : </label>
|
||||
<div class="col-sm-4">
|
||||
<input type="password" name="wpass" value='{{ wpass }}' placeholder='Пароль'
|
||||
class="form-control" autofocus="" id="id_wpass">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_wtoken" class="col-sm-1 col-form-label">Токен : </label>
|
||||
<div class="col-sm-4">
|
||||
<textarea type="text" name="wtoken" placeholder='Токен' class="form-control"
|
||||
autofocus="" id="id_wtoken">{{ wtoken }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<a href="{% url 'management:manage_icons' %}" class="btn bg-gradient-primary">Изображения</a>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- /.card-body -->
|
||||
<div class="card-footer">
|
||||
<button id="id_wklocation_btn_save" type="submit" class="btn bg-gradient-primary">Сохранить</button>
|
||||
</div>
|
||||
</div> <!-- /.card -->
|
||||
</div> <!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}{% endblock %}
|
||||
|
||||
{% block script_footer %}
|
||||
<script src="{% static 'js/management/wklocation.js' %}?ver={% settings_value 'APP_VER' %}"></script>
|
||||
{% endblock script_footer %}
|
||||
@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from django.urls import path
|
||||
|
||||
from apps.management.views import views_management, views_user, views_general
|
||||
from apps.management.views import views_seismicproc, views_geoproc, views_gto
|
||||
from apps.management.views import views_management, views_user, views_general,views_wklocation
|
||||
from apps.management.views import views_seismicproc, views_geoproc, views_gto,views_pla
|
||||
|
||||
from apps.management.views.crud import schedule as views_schedule
|
||||
from apps.management.views.crud import channel as views_channel
|
||||
@ -15,7 +15,7 @@ from apps.management.views.crud import danger_zone as views_danger_zone
|
||||
app_name = "management"
|
||||
|
||||
urlpatterns = [
|
||||
path("", views_management.main_index, name="main_index"),
|
||||
path("", views_general.main, name="main"),
|
||||
|
||||
#Общие параметры
|
||||
path("general/", views_general.main, name="main"),
|
||||
@ -34,6 +34,40 @@ urlpatterns = [
|
||||
path("gto_icons/", views_gto_icons.manage_gto_icons, name="manage_gto_icons"),
|
||||
path("gto_icon/add/", views_gto_icons.add_gto_icon, name="add_gto_icon"),
|
||||
|
||||
#Система оповещения
|
||||
path("pla/", views_pla.main, name="main"),
|
||||
path("pla/save/", views_pla.save, name="save"),
|
||||
path("pla/channels/", views_channel.manage_channels, name="manage_channel"),
|
||||
path("pla/channels/create/", views_channel.add_channel, name="add_channel"),
|
||||
path("pla/channels/<int:pk>/edit/", views_channel.edit_channel, name="edit_channel"),
|
||||
path("pla/channels/<int:pk>/remove/", views_channel.remove_channel, name="remove_channel"),
|
||||
|
||||
#Местоположение персонала
|
||||
path("wkloaction/", views_wklocation.main, name="main"),
|
||||
path("wkloaction/save/", views_wklocation.save, name="save"),
|
||||
|
||||
#Пользователи
|
||||
path("users/", views_user.main, name="main"),
|
||||
path("users/get_user/", views_user.get_user, name="get_user"),
|
||||
path("users/save/", views_user.user_save, name="user_save"),
|
||||
path("users/savepassword/", views_user.user_password_save, name="user_password_save"),
|
||||
path("users/delete/", views_user.user_delete, name="user_delete"),
|
||||
|
||||
path("user/add/", views_user.user_add, name="user_add"),
|
||||
|
||||
|
||||
|
||||
|
||||
path("user/", views_user.user_edit, name="user_edit"),
|
||||
|
||||
path("user/password/save/", views_user.user_password_save, name="user_password_save"),
|
||||
|
||||
path("user/password/", views_user.user_password_edit, name="user_password_edit"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
path("orthomosaic/", views_ortho.manage_orthomosaic, name="manage_orthomosaic"),
|
||||
path("orthomosaic/create/", views_ortho.add_orthomosaic, name="add_orthomosaic"),
|
||||
path("orthomosaic/<int:pk>/edit/", views_ortho.edit_orthomosaic, name="edit_orthomosaic"),
|
||||
@ -49,18 +83,7 @@ urlpatterns = [
|
||||
path("icons/<int:pk>/edit/", views_icon.edit_icon, name="edit_icon"),
|
||||
path("icons/<int:pk>/remove/", views_icon.remove_icon, name="remove_icon"),
|
||||
|
||||
path("channels/", views_channel.manage_channels, name="manage_channel"),
|
||||
path("channels/create/", views_channel.add_channel, name="add_channel"),
|
||||
path("channels/<int:pk>/edit/", views_channel.edit_channel, name="edit_channel"),
|
||||
path("channels/<int:pk>/remove/", views_channel.remove_channel, name="remove_channel"),
|
||||
|
||||
path("users/", views_user.main, name="main"),
|
||||
path("user/add/", views_user.user_add, name="user_add"),
|
||||
path("user/", views_user.user_edit, name="user_edit"),
|
||||
path("user/password/", views_user.user_password_edit, name="user_password_edit"),
|
||||
path("user/password/save/", views_user.user_password_save, name="user_password_save"),
|
||||
path("user/save/", views_user.user_save, name="user_save"),
|
||||
path("user/delete/", views_user.user_delete, name="user_delete"),
|
||||
|
||||
path("schedules/", views_schedule.manage_schedules, name="manage_schedules"),
|
||||
path("schedules/<int:pk>/edit/", views_schedule.edit_schedule, name="edit_schedule"),
|
||||
|
||||
43
apps/management/views/views_pla.py
Normal file
43
apps/management/views/views_pla.py
Normal file
@ -0,0 +1,43 @@
|
||||
import traceback
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import redirect, render
|
||||
from django.views.decorators.cache import never_cache
|
||||
|
||||
from apps.general.models.model_settings import Settings
|
||||
|
||||
from apps.util import generalmodule
|
||||
from sabron.util import logging
|
||||
|
||||
@login_required(login_url="/")
|
||||
@never_cache
|
||||
def save(request):
|
||||
try:
|
||||
post_param = request.POST.dict()
|
||||
for param in post_param:
|
||||
element_link = Settings.objects.filter(name=param).first()
|
||||
if element_link is None:
|
||||
Settings.objects.create(name=param, value=post_param[param])
|
||||
else:
|
||||
element_link.value = post_param[param]
|
||||
element_link.save()
|
||||
data =dict()
|
||||
data.update(status='ok')
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
except Exception:
|
||||
logging.error(traceback.format_exc())
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
@login_required(login_url="/")
|
||||
@never_cache
|
||||
def main(request):
|
||||
try:
|
||||
get_param = request.GET.dict()
|
||||
if request.method == "GET":
|
||||
context = generalmodule.get_context_template()
|
||||
return render(request, "pla/pla_main.html", context)
|
||||
except Exception:
|
||||
logging.error(traceback.format_exc())
|
||||
return redirect("/management/")
|
||||
@ -22,16 +22,52 @@ from sabron.util import logging
|
||||
|
||||
@login_required(login_url="/")
|
||||
@never_cache
|
||||
def user_delete(request):
|
||||
def get_user(request):
|
||||
try:
|
||||
merror = []
|
||||
post_param = request.POST.dict()
|
||||
user = User.objects.filter(id=post_param["id"]).delete()
|
||||
|
||||
return generalmodule.ReturnJson(200, merror)
|
||||
response = dict()
|
||||
response.update(id=0)
|
||||
response.update(role = "")
|
||||
response.update(first_name = "")
|
||||
response.update(last_name = "")
|
||||
response.update(isredonly = False)
|
||||
data =dict()
|
||||
if 'id' in post_param:
|
||||
user = User.objects.filter(id=post_param['id']).first()
|
||||
print(user)
|
||||
if user is not None:
|
||||
response.update(id=user.id)
|
||||
response.update(first_name = user.first_name)
|
||||
response.update(last_name = user.last_name)
|
||||
response.update(role = user.profile.role)
|
||||
response.update(isredonly = user.profile.isredonly)
|
||||
data.update(status='ok')
|
||||
data.update(response=response)
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
except Exception as err:
|
||||
logging.error(traceback.format_exc())
|
||||
return redirect("/management/")
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
@login_required(login_url="/")
|
||||
@never_cache
|
||||
def user_delete(request):
|
||||
try:
|
||||
data =dict()
|
||||
post_param = request.POST.dict()
|
||||
user = User.objects.filter(id=post_param["id"]).first()
|
||||
if user is not None:
|
||||
data.update(name=user.username)
|
||||
user.delete()
|
||||
data.update(status='ok')
|
||||
data.update(response=post_param)
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
except Exception as err:
|
||||
logging.error(traceback.format_exc())
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
|
||||
@login_required(login_url="/")
|
||||
@ -86,83 +122,101 @@ def user_password_edit(request):
|
||||
@never_cache
|
||||
def user_save(request):
|
||||
try:
|
||||
role_list = (
|
||||
(0, "Пользователь"),
|
||||
(1, "Администратор"),
|
||||
(2, "Администратор системы"),
|
||||
(3, "Начальник участка"),
|
||||
(4, "Главный инженер"),
|
||||
(5, "Главный геолог"),
|
||||
(6, "Главный технолог"),
|
||||
)
|
||||
|
||||
post_param = request.POST.dict()
|
||||
context = generalmodule.get_context_template()
|
||||
if request.POST.get("password"):
|
||||
for param in post_param:
|
||||
context.update({param: request.POST.get(param)})
|
||||
if (
|
||||
request.POST.get("password") != ""
|
||||
and request.POST.get("password2") != ""
|
||||
):
|
||||
if request.POST.get("password") != request.POST.get("password2"):
|
||||
context.update(error=True)
|
||||
context.update(errorpass=True)
|
||||
context.update(
|
||||
error_comment=[
|
||||
"Пароли не совподают",
|
||||
]
|
||||
)
|
||||
return render(request, "user_edit.html", context)
|
||||
print(post_param)
|
||||
if 'id' in post_param:
|
||||
username = post_param["username"].strip()
|
||||
password = post_param["password"].strip()
|
||||
password2 = post_param["password2"].strip()
|
||||
first_name = post_param["first_name"].strip()
|
||||
last_name = post_param["last_name"].strip()
|
||||
role = post_param["role"].strip()
|
||||
if post_param['id'] == '0':
|
||||
if len(username)==0:
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
data.update(error_comment="Не задан логин")
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
user = User.objects.filter(username=username).first()
|
||||
if user is not None:
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
data.update(error_comment="Логин уже используется")
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
if len(password)==0 or len(password2)==0:
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
data.update(error_comment="Не задан пароль")
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
if password != password2:
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
data.update(error_comment="Пароли не совподают")
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
try:
|
||||
validators.validate_password(password=request.POST.get("password"))
|
||||
validators.validate_password(password=password)
|
||||
except exceptions.ValidationError as e:
|
||||
comment = list(e.messages)
|
||||
context.update(error=True)
|
||||
context.update(errorpass=True)
|
||||
context.update(error_comment=comment)
|
||||
return render(request, "user_edit.html", context)
|
||||
|
||||
if post_param["mt"] == "add": # добавляем пользователя
|
||||
user = User.objects.filter(username=request.POST.get("username")).first()
|
||||
if user is not None:
|
||||
context.update(error=True)
|
||||
context.update(errorpass=True)
|
||||
context.update(
|
||||
error_comment=[
|
||||
"Логин уже используется",
|
||||
]
|
||||
)
|
||||
context.update(name="")
|
||||
return render(request, "user_edit.html", context)
|
||||
user = User.objects.create_user(
|
||||
username=request.POST.get("username"),
|
||||
password=request.POST.get("password2"),
|
||||
first_name=request.POST.get("first_name"),
|
||||
last_name=request.POST.get("last_name"),
|
||||
)
|
||||
if user is not None:
|
||||
user.profile.isredonly = False
|
||||
user.profile.role = request.POST.get("id_role")
|
||||
if request.POST.get("isredonly") == "on":
|
||||
user.profile.isredonly = True
|
||||
user.save()
|
||||
return redirect("/management/")
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
data.update(error_comment=comment)
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
isredonly = False
|
||||
if 'isredonly' in post_param:
|
||||
isredonly = True
|
||||
user = User.objects.create_user(
|
||||
username=username,
|
||||
password=password,
|
||||
first_name=first_name,
|
||||
last_name=last_name,
|
||||
|
||||
)
|
||||
if user is not None:
|
||||
user.profile.isredonly = True
|
||||
user.profile.role = role
|
||||
user.save()
|
||||
else:
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
data.update(error_comment="Ошибка записи")
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
else:
|
||||
context.update(error=True)
|
||||
context.update(errorpass=True)
|
||||
context.update(
|
||||
error_comment=[
|
||||
"Ошибка записи",
|
||||
]
|
||||
)
|
||||
context.update(login="")
|
||||
return render(request, "user_edit.html", context)
|
||||
else:
|
||||
user = User.objects.filter(id=request.POST.get("id")).first()
|
||||
user.first_name = request.POST.get("first_name")
|
||||
user.last_name = request.POST.get("last_name")
|
||||
user.profile.isredonly = False
|
||||
user.profile.role = request.POST.get("id_role")
|
||||
if request.POST.get("isredonly") == "on":
|
||||
user.profile.isredonly = True
|
||||
user.save()
|
||||
|
||||
return redirect("/management/")
|
||||
return render(request, "user_edit.html", context)
|
||||
isredonly = False
|
||||
if 'isredonly' in post_param:
|
||||
isredonly = True
|
||||
user = User.objects.filter(id=post_param["id"]).first()
|
||||
user.first_name = first_name
|
||||
user.last_name=last_name
|
||||
user.profile.isredonly = isredonly
|
||||
user.profile.role = role
|
||||
user.save()
|
||||
|
||||
data =dict()
|
||||
data.update(status='ok')
|
||||
data.update(response=post_param)
|
||||
data.update(role=user.profile.get_role())
|
||||
data.update(isredonly=isredonly)
|
||||
data.update(username=user.username)
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
except Exception as err:
|
||||
logging.error(traceback.format_exc())
|
||||
return redirect("/management/")
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
|
||||
@login_required(login_url="/")
|
||||
@ -170,43 +224,48 @@ def user_save(request):
|
||||
def user_password_save(request):
|
||||
try:
|
||||
post_param = request.POST.dict()
|
||||
context = generalmodule.get_context_template()
|
||||
for param in post_param:
|
||||
context.update({param: request.POST.get(param)})
|
||||
if request.POST.get("password"):
|
||||
for param in post_param:
|
||||
context.update({param: request.POST.get(param)})
|
||||
if (
|
||||
request.POST.get("password") != ""
|
||||
and request.POST.get("password2") != ""
|
||||
):
|
||||
if request.POST.get("password") != request.POST.get("password2"):
|
||||
context.update(error=True)
|
||||
context.update(errorpass=True)
|
||||
context.update(
|
||||
error_comment=[
|
||||
"Пароли не совподают",
|
||||
]
|
||||
)
|
||||
return render(request, "user_edit_password.html", context)
|
||||
data =dict()
|
||||
if 'password_in' in post_param:
|
||||
password = post_param["password_edit"].strip()
|
||||
password2 = post_param["password_edit2"].strip()
|
||||
if post_param['password_in']:
|
||||
if len(password)==0 or len(password2)==0:
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
data.update(error_comment="Не задан пароль")
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
if password != password2:
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
data.update(error_comment="Пароли не совподают")
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
try:
|
||||
validators.validate_password(password=request.POST.get("password"))
|
||||
validators.validate_password(password=password)
|
||||
except exceptions.ValidationError as e:
|
||||
comment = list(e.messages)
|
||||
context.update(error=True)
|
||||
context.update(errorpass=True)
|
||||
context.update(error_comment=comment)
|
||||
return render(request, "user_edit_password.html", context)
|
||||
|
||||
edit_user = User.objects.filter(id=request.POST.get("id")).first()
|
||||
edit_user.password = make_password(request.POST.get("password2"))
|
||||
edit_user.save()
|
||||
|
||||
return redirect(f"/management/user/?id={edit_user.id}")
|
||||
return render(request, "user_edit.html", context)
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
data.update(error_comment=comment)
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
user = User.objects.filter(id=post_param["password_in"]).first()
|
||||
user.password=make_password(password)
|
||||
user.save()
|
||||
print(password)
|
||||
print(user.password)
|
||||
data.update(username=user.username)
|
||||
else:
|
||||
data.update(status='error')
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
data.update(status='ok')
|
||||
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
except Exception as err:
|
||||
logging.error(traceback.format_exc())
|
||||
return redirect(f"/management/user/?id={edit_user.id}")
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
|
||||
@login_required(login_url="/")
|
||||
|
||||
43
apps/management/views/views_wklocation.py
Normal file
43
apps/management/views/views_wklocation.py
Normal file
@ -0,0 +1,43 @@
|
||||
import traceback
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import redirect, render
|
||||
from django.views.decorators.cache import never_cache
|
||||
|
||||
from apps.general.models.model_settings import Settings
|
||||
|
||||
from apps.util import generalmodule
|
||||
from sabron.util import logging
|
||||
|
||||
@login_required(login_url="/")
|
||||
@never_cache
|
||||
def save(request):
|
||||
try:
|
||||
post_param = request.POST.dict()
|
||||
for param in post_param:
|
||||
element_link = Settings.objects.filter(name=param).first()
|
||||
if element_link is None:
|
||||
Settings.objects.create(name=param, value=post_param[param])
|
||||
else:
|
||||
element_link.value = post_param[param]
|
||||
element_link.save()
|
||||
data =dict()
|
||||
data.update(status='ok')
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
except Exception:
|
||||
logging.error(traceback.format_exc())
|
||||
data =dict()
|
||||
data.update(status='error')
|
||||
return generalmodule.ReturnJson(200, data)
|
||||
|
||||
@login_required(login_url="/")
|
||||
@never_cache
|
||||
def main(request):
|
||||
try:
|
||||
get_param = request.GET.dict()
|
||||
if request.method == "GET":
|
||||
context = generalmodule.get_context_template()
|
||||
return render(request, "wklocation/wklocation_main.html", context)
|
||||
except Exception:
|
||||
logging.error(traceback.format_exc())
|
||||
return redirect("/management/")
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
async function LoadData(id) {
|
||||
console.log(id)
|
||||
formdata = new FormData()
|
||||
@ -12,7 +11,7 @@ async function LoadData(id) {
|
||||
|
||||
let result = await response.json();
|
||||
if (result.status=='ok'){
|
||||
console.log(result.response.active)
|
||||
$("#id_external_system").val(result.response.external_system).trigger('change');
|
||||
$("#id").val(result.response.id)
|
||||
$("#id_adress").val(result.response.adress)
|
||||
$("#id_login").val(result.response.login)
|
||||
|
||||
61
static/js/management/pla.js
Normal file
61
static/js/management/pla.js
Normal file
@ -0,0 +1,61 @@
|
||||
|
||||
btn_pla_save = document.getElementById('id_pla_btn_save').onclick = ClickPlaSave;
|
||||
plasystem = document.getElementById('id_plasystem').onchange = OnChangePla;
|
||||
|
||||
|
||||
async function OnChangePla() {
|
||||
await PlaSystemVisibled()
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function PlaSystemVisibled() {
|
||||
|
||||
plasystem = document.getElementById('id_plasystem')
|
||||
|
||||
document.getElementById('id_asterisk_panel').style.visibility='hidden'
|
||||
document.getElementById('id_radius_panel').style.visibility='hidden'
|
||||
|
||||
if (plasystem.value=='Radiusip'){
|
||||
document.getElementById('id_radius_panel').style.visibility='visible'
|
||||
}
|
||||
|
||||
if (plasystem.value=='Asterisk'){
|
||||
document.getElementById('id_asterisk_panel').style.visibility='visible'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function ClickPlaSave() {
|
||||
var Toast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
timer: 2000
|
||||
});
|
||||
formdata = new FormData(id_form_pla)
|
||||
const csrftoken = getCookie('csrftoken');
|
||||
let response = await fetch('/management/pla/save/', {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
headers: {"X-CSRFToken": csrftoken},
|
||||
});
|
||||
|
||||
let result = await response.json();
|
||||
if (result.status=='ok'){
|
||||
toastr.success('Параметры сохранены')
|
||||
}else{
|
||||
toastr.error('Ошибка. Параметры не записы.')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Событие после загрузки страницы
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
|
||||
await PlaSystemVisibled()
|
||||
|
||||
});
|
||||
180
static/js/management/users.js
Normal file
180
static/js/management/users.js
Normal file
@ -0,0 +1,180 @@
|
||||
|
||||
async function editpassword(id) {
|
||||
if (id>0){
|
||||
|
||||
document.getElementById("id_form_password").reset();
|
||||
LoadData(id)
|
||||
$("#modal-password").modal('show')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function LoadData(id) {
|
||||
formdata = new FormData()
|
||||
formdata.append('id',id)
|
||||
const csrftoken = getCookie('csrftoken');
|
||||
let response = await fetch('/management/users/get_user/', {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
headers: {"X-CSRFToken": csrftoken},
|
||||
});
|
||||
|
||||
let result = await response.json();
|
||||
if (result.status=='ok'){
|
||||
console.log(result.response)
|
||||
$("#id_role").val(result.response.role).trigger('change');
|
||||
|
||||
$("#id").val(result.response.id)
|
||||
$("#id_password_in").val(result.response.id)
|
||||
$("#id_first_name").val(result.response.first_name)
|
||||
$("#id_last_name").val(result.response.last_name)
|
||||
$('#id_isredonly').prop('checked', result.response.isredonly);
|
||||
$('#user_title').html(result.response.first_name+ ' ' +result.response.last_name )
|
||||
$('#user_password_title').html(result.response.first_name+ ' ' +result.response.last_name )
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function openedit(id) {
|
||||
if (id>0){
|
||||
document.getElementById('id_div_login').style.display = "none";
|
||||
document.getElementById('id_div_password').style.display = "none";
|
||||
document.getElementById('id_div_password2').style.display = "none";
|
||||
LoadData(id)
|
||||
|
||||
}else{
|
||||
$('#user_title').html('Новый пользователь')
|
||||
document.getElementById('id_div_login').style.display = "flex";
|
||||
document.getElementById('id_div_password').style.display = "flex";
|
||||
document.getElementById('id_div_password2').style.display = "flex";
|
||||
}
|
||||
document.getElementById("id_form_user").reset();
|
||||
$("#modal-edit").modal('show')
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function ClickUserOK() {
|
||||
|
||||
var Toast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
timer: 2000
|
||||
});
|
||||
id= $("#id").val()
|
||||
//if (validateFormIncidentResolution()==false){return}
|
||||
formdata = new FormData(id_form_user)
|
||||
const csrftoken = getCookie('csrftoken');
|
||||
let response = await fetch('/management/users/save/', {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
headers: {"X-CSRFToken": csrftoken},
|
||||
});
|
||||
|
||||
let result = await response.json();
|
||||
if (result.status=='ok'){
|
||||
if (id>0){
|
||||
console.log(result)
|
||||
$("#id_td_role"+id).html(result.role)
|
||||
$("#id_td_name"+id).html(result.name)
|
||||
|
||||
$('#id_td_isredonly_'+id).prop('checked', false);
|
||||
if (result.response.isredonly=='on'){
|
||||
$('#id_td_isredonly_'+id).prop('checked', true);
|
||||
}
|
||||
}else{
|
||||
location.reload()
|
||||
}
|
||||
$('#modal-edit').modal('hide')
|
||||
toastr.success('Запись "'+result.username+'" успешно сохранена.')
|
||||
const form = document.getElementById("id_form_user");
|
||||
form.reset();
|
||||
|
||||
}else{
|
||||
toastr.error(result.error_comment)
|
||||
}
|
||||
//const form = document.getElementById('id_form_external_system'+id);
|
||||
//form.reset();
|
||||
}
|
||||
|
||||
|
||||
async function ClickUserPasswordOK() {
|
||||
|
||||
var Toast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
timer: 2000
|
||||
});
|
||||
id= $("#id").val()
|
||||
//if (validateFormIncidentResolution()==false){return}
|
||||
formdata = new FormData(id_form_password)
|
||||
const csrftoken = getCookie('csrftoken');
|
||||
let response = await fetch('/management/users/savepassword/', {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
headers: {"X-CSRFToken": csrftoken},
|
||||
});
|
||||
|
||||
let result = await response.json();
|
||||
console.log(result)
|
||||
if (result.status=='ok'){
|
||||
if (id>0){
|
||||
}else{
|
||||
location.reload()
|
||||
}
|
||||
$('#modal-password').modal('hide')
|
||||
toastr.success('Пароль "'+result.username+'" успешно изменен.')
|
||||
const form = document.getElementById("id_form_password");
|
||||
form.reset();
|
||||
|
||||
}else{
|
||||
toastr.error(result.error_comment)
|
||||
}
|
||||
//const form = document.getElementById('id_form_external_system'+id);
|
||||
//form.reset();
|
||||
}
|
||||
|
||||
async function delete_user(id) {
|
||||
var Toast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
timer: 2000
|
||||
});
|
||||
formdata = new FormData()
|
||||
formdata.append('id',id)
|
||||
const csrftoken = getCookie('csrftoken');
|
||||
let response = await fetch('/management/users/delete/', {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
headers: {"X-CSRFToken": csrftoken},
|
||||
});
|
||||
|
||||
let result = await response.json();
|
||||
if (result.status=='ok'){
|
||||
$('#large_'+id).modal('hide')
|
||||
$('#tr_'+id).remove()
|
||||
$('.modal-backdrop').remove()
|
||||
|
||||
toastr.success('Запись "'+result.name+'" удалена.')
|
||||
}else{
|
||||
|
||||
}
|
||||
//const form = document.getElementById('id_form_external_system'+id);
|
||||
//form.reset();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Событие после загрузки страницы
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
//Initialize Select2 Elements
|
||||
$('.select2').select2()
|
||||
|
||||
});
|
||||
35
static/js/management/wklocation.js
Normal file
35
static/js/management/wklocation.js
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
wklocation_btn_save = document.getElementById('id_wklocation_btn_save').onclick = ClickWkLocationSave;
|
||||
|
||||
|
||||
|
||||
async function ClickWkLocationSave() {
|
||||
var Toast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
timer: 2000
|
||||
});
|
||||
formdata = new FormData(id_form_wklocation)
|
||||
const csrftoken = getCookie('csrftoken');
|
||||
let response = await fetch('/management/wkloaction/save/', {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
headers: {"X-CSRFToken": csrftoken},
|
||||
});
|
||||
|
||||
let result = await response.json();
|
||||
if (result.status=='ok'){
|
||||
toastr.success('Параметры сохранены')
|
||||
}else{
|
||||
toastr.error('Ошибка. Параметры не записы.')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Событие после загрузки страницы
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
|
||||
|
||||
});
|
||||
@ -338,7 +338,7 @@
|
||||
<li class="nav-header"></li>
|
||||
<li class="nav-header"></li>
|
||||
<li class="nav-item">
|
||||
<a href="/management/" class="nav-link"
|
||||
<a href="/management/general/" class="nav-link"
|
||||
><i class="nav-icon fas fa-sliders-h"></i>
|
||||
<p>Администрирование</p></a
|
||||
>
|
||||
|
||||
@ -238,24 +238,21 @@
|
||||
<a href="/management/general/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Общие параметры</p></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/management/geoproc/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Геомеханические процессы</p></a>
|
||||
<a href="/management/geoproc/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Геомеханические процессы V</p></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/management/seismicproc/" class="nav-link"><i class="fas fa-minus nav-icon"></i></i><p>Сейсмические процессы</p></a>
|
||||
<a href="/management/seismicproc/" class="nav-link"><i class="fas fa-minus nav-icon"></i></i><p>Сейсмические процессы V</p></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/management/gto/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Горнотранспортное оборудование</p></a>
|
||||
<a href="/management/gto/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Горнотранспортное оборудование V</p></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/ogr/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Открытые горные работы</p></a>
|
||||
<a href="/management/pla/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Система оповещения V</p></a></li>
|
||||
<li class="nav-item">
|
||||
<a href="/management/wkloaction/" class="nav-link nav-item" ><i class="fas fa-minus nav-icon"></i><p>Местоположение персонала </p></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/pla/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Система оповещения</p></a></li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link nav-item" ><i class="fas fa-minus nav-icon"></i><p>Местоположение персонала</p></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/management/users/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Пользователи</p></a>
|
||||
<a href="/management/users/" class="nav-link"><i class="fas fa-minus nav-icon"></i><p>Пользователи V</p></a>
|
||||
</li>
|
||||
<li class="nav-header"></li>
|
||||
<li class="nav-header"></li>
|
||||
|
||||
@ -35,9 +35,12 @@ class Profile(models.Model):
|
||||
isredonly = models.BooleanField(
|
||||
blank=True, default=False, verbose_name="Только просмотр"
|
||||
)
|
||||
|
||||
def get_role(self, **kwargs):
|
||||
return self.role_list[self.role][1]
|
||||
class Meta: # отображение в админики
|
||||
verbose_name = "профиль"
|
||||
verbose_name_plural = "профили"
|
||||
|
||||
def get_role(self):
|
||||
return self.role_list[int(self.role)][1]
|
||||
|
||||
def get_readonly(self, **kwargs):
|
||||
if self.isredonly:
|
||||
@ -56,10 +59,9 @@ class Profile(models.Model):
|
||||
String for representing the Model object (in Admin site etc.)
|
||||
"""
|
||||
return str(self.user)
|
||||
def get_role_name(self):
|
||||
return self.get_role_display()
|
||||
|
||||
class Meta: # отображение в админики
|
||||
verbose_name = "профиль"
|
||||
verbose_name_plural = "профили"
|
||||
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user