add raspologenie and vde numbers
This commit is contained in:
BIN
__pycache__/models.cpython-311.pyc
Normal file
BIN
__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
0
addoborudtodb
Normal file
0
addoborudtodb
Normal file
23
app.py
23
app.py
@@ -85,7 +85,6 @@ def searchonaud():
|
||||
'oboruds_id': oboruds.nazvanie,
|
||||
'raspolog': oboruds.raspologenie,
|
||||
})
|
||||
print(results)
|
||||
return jsonify(results)
|
||||
|
||||
else:
|
||||
@@ -187,19 +186,19 @@ def zamsearch():
|
||||
@app.route('/addraspved', methods=['GET', 'POST'])
|
||||
def addraspved():
|
||||
if request.method == 'POST':
|
||||
#b'rasp=asndhaslkj&ved=1111111&inv=18124'
|
||||
query_string = request.get_data().decode()
|
||||
un_query_string = unquote(unquote(query_string)).split('&')
|
||||
|
||||
query_dict = {}
|
||||
for pair in un_query_string:
|
||||
key, value = pair.split("=")
|
||||
query_dict[key] = value
|
||||
query_string = request.data.decode()
|
||||
|
||||
print(query_dict)
|
||||
ob = db.session.query(Oboruds).filter_by(invNumber=query_dict['inv']).first()
|
||||
ob.raspologenie=query_dict['rasp']
|
||||
ob.numberved = query_dict['ved']
|
||||
print(query_string)
|
||||
un_query_string = unquote(unquote(query_string)).split(',')
|
||||
|
||||
print(un_query_string)
|
||||
|
||||
|
||||
|
||||
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()
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ function getData(){
|
||||
},
|
||||
|
||||
success: function(response){
|
||||
console.log(response)
|
||||
|
||||
var data = response;
|
||||
const table = document.getElementById('datatable')
|
||||
table.innerHTML = ''
|
||||
@@ -42,58 +42,84 @@ $("#searchbutton").click(function(){
|
||||
getData();
|
||||
})
|
||||
|
||||
function tableclick(x){
|
||||
let data = document.getElementById(x.rowIndex)
|
||||
$('#modalsavetodb').click(function(){
|
||||
|
||||
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')
|
||||
|
||||
let changeddata = new Array()
|
||||
|
||||
changeddata[0] = invnom.text
|
||||
changeddata[1] = vedomost.value
|
||||
changeddata[2] = rasp.value
|
||||
|
||||
let sendData = changeddata.join(',')
|
||||
|
||||
changeddata = []
|
||||
$.ajax({
|
||||
|
||||
url: "/addraspved",
|
||||
type: "POST",
|
||||
contentType: "application/json;charset=utf-8",
|
||||
dataType: "json",
|
||||
data: sendData,
|
||||
|
||||
success: function(){
|
||||
/*
|
||||
rasp='',
|
||||
vedomost = '',
|
||||
invnom = '',
|
||||
matcen = '',
|
||||
|
||||
changeddata = []
|
||||
*/
|
||||
$('#getmodal').modal('hide').data( 'bs.modal', null );
|
||||
getData();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
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('rapolog')
|
||||
//let vedomost = document.getElementById('vednumber')
|
||||
let rasp = document.getElementById('modal_rapolog')
|
||||
let vedomost = document.getElementById('modal_vednumber')
|
||||
let invnom = document.getElementById('modal_invnom')
|
||||
//let matcen = document.getElementById('modal_matcenn')
|
||||
let matcen = document.getElementById('modal_matcenn')
|
||||
|
||||
invnom.innerText=datas[1]+"\t"
|
||||
matcen.innerText=datas[2].substring(0,15)
|
||||
invnom.innerText = invnomer
|
||||
matcen.innerText = nazvanie.substring(0,15)
|
||||
|
||||
if (nomved.length >0){
|
||||
|
||||
if (datas[4].length>0){
|
||||
rasp.value=datas[4];
|
||||
vedomost.value = nomved
|
||||
}
|
||||
|
||||
if (datas[0].length>0){
|
||||
vedomost.value=datas[0]
|
||||
if(raspolog.length>0){
|
||||
rasp.value = raspolog
|
||||
}
|
||||
|
||||
$("#mimodal").on('hidden.bs.modal', function () {
|
||||
$(this).data('bs.modal', null);
|
||||
});
|
||||
|
||||
|
||||
$('#modalclose').click(function(){
|
||||
|
||||
$('#getmodal').modal('hide');
|
||||
$('#getmodal').modal('hide').data( 'bs.modal', null );
|
||||
|
||||
} )
|
||||
|
||||
$('#modalsavetodb').click(function(){
|
||||
$.ajax({
|
||||
|
||||
url: "/addraspved",
|
||||
type: "POST",
|
||||
contentType: "application/json;charset=utf-8",
|
||||
dataType: "json",
|
||||
data: {
|
||||
rasp: rasp.value,
|
||||
ved: vedomost.value,
|
||||
inv: datas[1]
|
||||
},
|
||||
success:function() {
|
||||
rasp.value = '';
|
||||
vedomost.value= '';
|
||||
data=[];
|
||||
rasp
|
||||
$('#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();
|
||||
}
|
||||
})
|
||||
})}
|
||||
@@ -8,27 +8,33 @@
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" id="textarea">
|
||||
<div class="row">
|
||||
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
№ из ведомости
|
||||
<input type="text" class="form-control" id ='vednumber' placeholder="Номер из ведомости">
|
||||
</div>
|
||||
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||
|
||||
</div>
|
||||
|
||||
<form method="POST" action="/addraspved">
|
||||
<div class="row">
|
||||
№ из ведомости
|
||||
<input type="text" class="form-control" name="modal_vednumber" id ='modal_vednumber' placeholder="Номер из ведомости">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
Расположение
|
||||
<input type="text" class="form-control" name="modal_rapolog" id ='modal_rapolog' placeholder="Введите расположение">
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
||||
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
Расположение
|
||||
<input type="text" class="form-control" id ='rapolog' placeholder="Введите расположение">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
||||
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user