Merge branch 'dev'
This commit is contained in:
Binary file not shown.
Binary file not shown.
0
addoborudtodb
Normal file
0
addoborudtodb
Normal file
39
app.py
39
app.py
@@ -6,6 +6,7 @@ from flask_migrate import Migrate
|
|||||||
from datetime import *
|
from datetime import *
|
||||||
import csv
|
import csv
|
||||||
import random
|
import random
|
||||||
|
from urllib.parse import unquote
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@@ -77,10 +78,12 @@ def searchonaud():
|
|||||||
results = []
|
results = []
|
||||||
for auditory, oboruds in q:
|
for auditory, oboruds in q:
|
||||||
results.append({
|
results.append({
|
||||||
|
'num_ved': oboruds.numberved,
|
||||||
'auditory_id': auditory.id,
|
'auditory_id': auditory.id,
|
||||||
'auditory_name': auditory.audnazvanie,
|
'auditory_name': auditory.audnazvanie,
|
||||||
'inv_number': oboruds.invNumber,
|
'inv_number': oboruds.invNumber,
|
||||||
'oboruds_id': oboruds.nazvanie,
|
'oboruds_id': oboruds.nazvanie,
|
||||||
|
'raspolog': oboruds.raspologenie,
|
||||||
})
|
})
|
||||||
return jsonify(results)
|
return jsonify(results)
|
||||||
|
|
||||||
@@ -183,28 +186,22 @@ def zamsearch():
|
|||||||
@app.route('/addraspved', methods=['GET', 'POST'])
|
@app.route('/addraspved', methods=['GET', 'POST'])
|
||||||
def addraspved():
|
def addraspved():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
query_string = request.data
|
|
||||||
# Convert the bytes object to a string
|
|
||||||
query_string_str = query_string.decode("utf-8")
|
|
||||||
|
|
||||||
# Split the query string by '&' to get individual key-value pairs
|
query_string = request.data.decode()
|
||||||
key_value_pairs = query_string_str.split("&")
|
|
||||||
|
|
||||||
# Create a dictionary to store the key-value pairs
|
print(query_string)
|
||||||
query_dict = {}
|
un_query_string = unquote(unquote(query_string)).split(',')
|
||||||
for pair in key_value_pairs:
|
|
||||||
key, value = pair.split("=")
|
|
||||||
query_dict[key] = value
|
|
||||||
|
|
||||||
# Retrieve the values for specific keys
|
print(un_query_string)
|
||||||
rasp_value = query_dict.get("rasp")
|
|
||||||
ved_value = query_dict.get("ved")
|
|
||||||
|
|
||||||
print(f"Value for 'rasp': {rasp_value}")
|
|
||||||
print(f"Value for 'ved': {ved_value}")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ob = db.session.query(Oboruds).filter_by(invNumber=un_query_string[0]).first()
|
||||||
|
ob.raspologenie=un_query_string[2]
|
||||||
|
ob.numberved = un_query_string[1]
|
||||||
|
db.session.commit()
|
||||||
|
db.session.close()
|
||||||
|
|
||||||
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
||||||
|
|
||||||
|
|
||||||
@@ -262,16 +259,6 @@ def createdb():
|
|||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
"""
|
|
||||||
with open('zabalans.csv', encoding='utf-8') as csv_file:
|
|
||||||
csv_reader = csv.reader(csv_file, delimiter=';')
|
|
||||||
for row in csv_reader:
|
|
||||||
print(row)
|
|
||||||
db.session.add(
|
|
||||||
Oboruds(invNumber=row[0], nazvanie=row[1], typeBalanse="забаланс"))
|
|
||||||
|
|
||||||
db.session.commit()
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
BIN
migrations/versions/__pycache__/be7c94c549e5_.cpython-312.pyc
Normal file
BIN
migrations/versions/__pycache__/be7c94c549e5_.cpython-312.pyc
Normal file
Binary file not shown.
34
migrations/versions/be7c94c549e5_.py
Normal file
34
migrations/versions/be7c94c549e5_.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: be7c94c549e5
|
||||||
|
Revises: 8e838956713f
|
||||||
|
Create Date: 2024-04-01 15:09:52.082987
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'be7c94c549e5'
|
||||||
|
down_revision = '8e838956713f'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('oboruds', schema=None) as batch_op:
|
||||||
|
batch_op.add_column(sa.Column('balancenumber', sa.String(length=30), nullable=True))
|
||||||
|
batch_op.drop_column('typeBalanse')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('oboruds', schema=None) as batch_op:
|
||||||
|
batch_op.add_column(sa.Column('typeBalanse', sa.VARCHAR(length=30), nullable=True))
|
||||||
|
batch_op.drop_column('balancenumber')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
@@ -16,7 +16,7 @@ class Oboruds(db.Model):
|
|||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
invNumber=db.Column(db.Integer)
|
invNumber=db.Column(db.Integer)
|
||||||
nazvanie=db.Column(db.String(500))
|
nazvanie=db.Column(db.String(500))
|
||||||
typeBalanse = db.Column(db.String(30))
|
balancenumber = db.Column(db.String(30))
|
||||||
raspologenie = db.Column(db.String(200))
|
raspologenie = db.Column(db.String(200))
|
||||||
numberved = db.Column(db.String(100))
|
numberved = db.Column(db.String(100))
|
||||||
aud_id = db.Column(db.Integer, db.ForeignKey(Auditory.id))
|
aud_id = db.Column(db.Integer, db.ForeignKey(Auditory.id))
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ body {
|
|||||||
|
|
||||||
border: 1px;
|
border: 1px;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
@@ -77,6 +78,28 @@ nav{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table{
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aud{
|
||||||
|
width: 110px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inv{
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rasp{
|
||||||
|
max-width: 200px;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal_matcenn{
|
||||||
|
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
|
|
||||||
*{
|
*{
|
||||||
|
|||||||
@@ -13,20 +13,22 @@ function getData(){
|
|||||||
},
|
},
|
||||||
|
|
||||||
success: function(response){
|
success: function(response){
|
||||||
|
|
||||||
var data = response;
|
var data = response;
|
||||||
const table = document.getElementById('datatable')
|
const table = document.getElementById('datatable')
|
||||||
table.innerHTML = ''
|
table.innerHTML = ''
|
||||||
var headTable = '<tr> <td >Номер в Инв. вед</td> <td>Инв. номер</td><td>Название</td><td class="no-print">Аудитория</td> <td >Расположение</td> <td id="proverka"class="hidden-column"> Проверено</td> </tr>'
|
var headTable = '<tr> <td >Номер в Инв. вед</td> <td id="invnomer">Инв. номер</td><td>Название</td><td class="no-print aud">Аудитория</td> <td >Расположение</td> <td id="proverka"class="hidden-column"> Проверено</td> </tr>'
|
||||||
table.innerHTML += headTable
|
table.innerHTML += headTable
|
||||||
var tr =""
|
var tr =""
|
||||||
|
|
||||||
|
|
||||||
data.forEach(element => {
|
data.forEach(element => {
|
||||||
tr += '<tr onclick="tableclick(this)">'
|
tr += '<tr onclick="tableclick(this)">'
|
||||||
tr += '<td> </td>'
|
tr += '<td>' + element.num_ved + '</td>'
|
||||||
tr += '<td>' + element.inv_number + '</td>'
|
tr += '<td clas="inv">' + element.inv_number + '</td>'
|
||||||
tr += '<td>' + element.oboruds_id + '</td>'
|
tr += '<td>' + element.oboruds_id + '</td>'
|
||||||
tr += '<td class="no-print">' + element.auditory_name + '</td>'
|
tr += '<td class="no-print">' + element.auditory_name + '</td>'
|
||||||
tr += '<td> </td>'
|
tr += '<td class="rasp">' +element.raspolog + '</td>'
|
||||||
tr += '<td>' + '\n' + '</td>'
|
tr += '<td>' + '\n' + '</td>'
|
||||||
|
|
||||||
tr += '</tr>'
|
tr += '</tr>'
|
||||||
@@ -40,59 +42,84 @@ $("#searchbutton").click(function(){
|
|||||||
getData();
|
getData();
|
||||||
})
|
})
|
||||||
|
|
||||||
function tableclick(x){
|
$('#modalsavetodb').click(function(){
|
||||||
let roww = x.rowIndex
|
|
||||||
let data = document.getElementById(x.rowIndex)
|
|
||||||
|
|
||||||
let datas = x.innerText.split('\t')
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
let vedomost = document.getElementById('modal_vednumber')
|
||||||
|
let invnom = document.getElementById('modal_invnom')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
|
||||||
console.log(datas)
|
let changeddata = new Array()
|
||||||
|
|
||||||
$('#getmodal').modal('show')
|
changeddata[0] = invnom.text
|
||||||
|
changeddata[1] = vedomost.value
|
||||||
|
changeddata[2] = rasp.value
|
||||||
|
|
||||||
let rasp = document.getElementById('rapolog')
|
let sendData = changeddata.join(',')
|
||||||
let vedomost = document.getElementById('vednumber')
|
|
||||||
|
|
||||||
if (datas[0].length>0){
|
|
||||||
rasp.value=datas[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datas[4].length>0){
|
|
||||||
vedomost.value=datas[4]
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#modalclose').click(function(){
|
|
||||||
|
|
||||||
$('#getmodal').modal('hide');
|
|
||||||
} )
|
|
||||||
|
|
||||||
$('#modalsavetodb').click(function(){
|
|
||||||
|
|
||||||
console.log(datas)
|
|
||||||
|
|
||||||
|
changeddata = []
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
||||||
url: "/addraspved",
|
url: "/addraspved",
|
||||||
type: "post",
|
type: "POST",
|
||||||
contentType: 'application/json',
|
contentType: "application/json;charset=utf-8",
|
||||||
dataType: 'json',
|
dataType: "json",
|
||||||
data: {
|
data: sendData,
|
||||||
ved: vedomost.value,
|
|
||||||
rasp: rasp.value
|
|
||||||
|
|
||||||
},
|
success: function(){
|
||||||
|
/*
|
||||||
|
rasp='',
|
||||||
|
vedomost = '',
|
||||||
|
invnom = '',
|
||||||
|
matcen = '',
|
||||||
|
|
||||||
|
changeddata = []
|
||||||
|
*/
|
||||||
|
$('#getmodal').modal('hide').data( 'bs.modal', null );
|
||||||
|
getData();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
rasp.value='';
|
|
||||||
|
|
||||||
vedomost.value='';
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function tableclick(tableRow){
|
||||||
|
|
||||||
|
let nomved = tableRow.childNodes[0].innerHTML;
|
||||||
|
let invnomer = tableRow.childNodes[1].innerHTML;
|
||||||
|
let nazvanie = tableRow.childNodes[2].innerHTML;
|
||||||
|
let raspolog = tableRow.childNodes[4].innerHTML;
|
||||||
|
|
||||||
|
$('#getmodal').modal('show')
|
||||||
|
|
||||||
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
let vedomost = document.getElementById('modal_vednumber')
|
||||||
|
let invnom = document.getElementById('modal_invnom')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
|
||||||
|
invnom.innerText = invnomer
|
||||||
|
matcen.innerText = nazvanie.substring(0,15)
|
||||||
|
|
||||||
|
if (nomved.length >0){
|
||||||
|
|
||||||
|
vedomost.value = nomved
|
||||||
|
}
|
||||||
|
|
||||||
|
if(raspolog.length>0){
|
||||||
|
rasp.value = raspolog
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#mimodal").on('hidden.bs.modal', function () {
|
||||||
|
$(this).data('bs.modal', null);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#modalclose').click(function(){
|
||||||
|
|
||||||
|
$('#getmodal').modal('hide').data( 'bs.modal', null );
|
||||||
|
|
||||||
|
} )
|
||||||
|
|
||||||
$('#getmodal').modal('hide');
|
|
||||||
|
|
||||||
// getData();
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
47
static/js/tmp.js
Normal file
47
static/js/tmp.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
function tableclick(x){
|
||||||
|
// let data = document.getElementById(x.rowIndex)
|
||||||
|
|
||||||
|
let datas = x.innerText.split('\t')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
invnom.innerText=datas[1]+"\t"
|
||||||
|
matcen.innerText=datas[2]
|
||||||
|
|
||||||
|
|
||||||
|
if (datas[4].length>0){
|
||||||
|
rasp.value=datas[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (datas[0].length>0){
|
||||||
|
vedomost.value=datas[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#modalclose').click(function(){
|
||||||
|
|
||||||
|
$('#getmodal').modal('hide');
|
||||||
|
|
||||||
|
} )
|
||||||
|
|
||||||
|
$('#modalsavetodb').click(function(){
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/addraspved",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
rasp: rasp.value,
|
||||||
|
ved: vedomost.value,
|
||||||
|
inv: invnomer
|
||||||
|
},
|
||||||
|
success:function() {
|
||||||
|
rasp.value = '';
|
||||||
|
vedomost.value= '';
|
||||||
|
data=[];
|
||||||
|
rasp
|
||||||
|
$('#getmodal').modal('hide');
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})}
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-body" id="textarea">
|
<div class="modal-body" id="textarea">
|
||||||
|
|
||||||
<input type="text" class="form-control" id ='rapolog' placeholder="Введите расположение">
|
|
||||||
<input type="text" class="form-control" id ='vednumber' placeholder="Номер из веломости">
|
<input type="text" class="form-control" id ='vednumber' placeholder="Номер из веломости">
|
||||||
|
<input type="text" class="form-control" id ='rapolog' placeholder="Введите расположение">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|||||||
Reference in New Issue
Block a user