add funce
This commit is contained in:
Binary file not shown.
Binary file not shown.
38
app.py
38
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,11 +78,14 @@ 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,
|
||||||
})
|
})
|
||||||
|
print(results)
|
||||||
return jsonify(results)
|
return jsonify(results)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -183,25 +187,21 @@ 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
|
#b'rasp=asndhaslkj&ved=1111111&inv=18124'
|
||||||
# Convert the bytes object to a string
|
query_string = request.get_data().decode()
|
||||||
query_string_str = query_string.decode("utf-8")
|
un_query_string = unquote(unquote(query_string))
|
||||||
|
|
||||||
# Split the query string by '&' to get individual key-value pairs
|
print(un_query_string.split('&'))
|
||||||
key_value_pairs = query_string_str.split("&")
|
|
||||||
|
|
||||||
# Create a dictionary to store the key-value pairs
|
|
||||||
query_dict = {}
|
query_dict = {}
|
||||||
for pair in key_value_pairs:
|
for pair in un_query_string.split('&'):
|
||||||
key, value = pair.split("=")
|
key, value = pair.split("=")
|
||||||
query_dict[key] = value
|
query_dict[key] = value
|
||||||
|
|
||||||
# Retrieve the values for specific keys
|
ob = db.session.query(Oboruds).filter_by(invNumber=query_dict['inv']).first()
|
||||||
rasp_value = query_dict.get("rasp")
|
print(ob)
|
||||||
ved_value = query_dict.get("ved")
|
ob.raspologenie=query_dict['rasp']
|
||||||
|
ob.numberved = query_dict['ved']
|
||||||
print(f"Value for 'rasp': {rasp_value}")
|
db.session.commit()
|
||||||
print(f"Value for 'ved': {ved_value}")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -262,16 +262,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__':
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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){
|
||||||
|
console.log(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,58 +42,64 @@ $("#searchbutton").click(function(){
|
|||||||
getData();
|
getData();
|
||||||
})
|
})
|
||||||
|
|
||||||
function tableclick(x){
|
function tableclick(x){
|
||||||
let roww = x.rowIndex
|
let data = document.getElementById(x.rowIndex)
|
||||||
let data = document.getElementById(x.rowIndex)
|
|
||||||
|
|
||||||
let datas = x.innerText.split('\t')
|
let datas = x.innerText.split('\t')
|
||||||
|
|
||||||
console.log(datas)
|
|
||||||
|
|
||||||
$('#getmodal').modal('show')
|
|
||||||
|
|
||||||
let rasp = document.getElementById('rapolog')
|
$('#getmodal').modal('show')
|
||||||
let vedomost = document.getElementById('vednumber')
|
|
||||||
|
|
||||||
if (datas[0].length>0){
|
let rasp = document.getElementById('rapolog')
|
||||||
rasp.value=datas[0];
|
let vedomost = document.getElementById('vednumber')
|
||||||
}
|
let invnom = document.getElementById('modal_invnom')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
|
||||||
|
invnom.innerText=datas[1]+"\t"
|
||||||
|
matcen.innerText=datas[2].substring(0,15)
|
||||||
|
|
||||||
if (datas[4].length>0){
|
|
||||||
vedomost.value=datas[4]
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#modalclose').click(function(){
|
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(){
|
||||||
|
|
||||||
$('#getmodal').modal('hide');
|
|
||||||
} )
|
|
||||||
|
|
||||||
$('#modalsavetodb').click(function(){
|
$.ajax({
|
||||||
|
|
||||||
console.log(datas)
|
url: "/addraspved",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
rasp: rasp.value,
|
||||||
|
ved: vedomost.value,
|
||||||
|
inv: datas[1]
|
||||||
|
},
|
||||||
|
|
||||||
$.ajax({
|
})
|
||||||
|
rasp.value = '';
|
||||||
|
vedomost.value= '';
|
||||||
|
|
||||||
|
datas = [];
|
||||||
|
|
||||||
|
$('#getmodal').modal('hide');
|
||||||
|
|
||||||
url: "/addraspved",
|
getData();
|
||||||
type: "post",
|
})
|
||||||
contentType: 'application/json',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
rasp: rasp.value,
|
|
||||||
ved: vedomost.value
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
rasp.value='';
|
|
||||||
|
|
||||||
vedomost.value='';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#getmodal').modal('hide');
|
|
||||||
|
|
||||||
// getData();
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,21 @@
|
|||||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-body" id="textarea">
|
<div class="modal-body" id="textarea">
|
||||||
|
<div class="row">
|
||||||
|
<a id="modal_invnom"> 111 </a> <a id="modal_matcenn">2222</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input type="text" class="form-control" id ='rapolog' placeholder="Введите расположение">
|
<div class="row">
|
||||||
<input type="text" class="form-control" id ='vednumber' placeholder="Номер из веломости">
|
№ из ведомости
|
||||||
|
<input type="text" class="form-control" id ='vednumber' placeholder="Номер из ведомости">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@@ -45,13 +57,13 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h3 class="card-title no-print"> Поаудиторно </h3>
|
<h3 class="card-title no-print"> Поаудиторно </h3>
|
||||||
|
|
||||||
<table class="table" id="datatable" col-md-10>
|
<table class="table " id="datatable" >
|
||||||
|
|
||||||
<td >Номер в Инв. вед</td>
|
<th >Номер в Инв. вед</th>
|
||||||
<td >Инв. номер</td>
|
<th >Инв. номер</th>
|
||||||
<td >Название</td>
|
<th >Название</th>
|
||||||
<td class="no-print">Аудитория</td>
|
<th class="no-print">Аудитория</th>
|
||||||
<td >Расположение</td>
|
<th >Расположение</th>
|
||||||
|
|
||||||
|
|
||||||
{% for item in res: %}
|
{% for item in res: %}
|
||||||
|
|||||||
Reference in New Issue
Block a user