add all files
This commit is contained in:
310
app.py
Normal file
310
app.py
Normal file
@@ -0,0 +1,310 @@
|
|||||||
|
from flask import Flask, render_template, redirect, url_for, request, jsonify
|
||||||
|
from models import db, Oboruds, Auditory, Zametki
|
||||||
|
from flask_migrate import Migrate
|
||||||
|
from datetime import *
|
||||||
|
import csv
|
||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///project.db"
|
||||||
|
app.jinja_env.auto_reload = True
|
||||||
|
app.config['TEMPLATES_AUTO_RELOAD'] = True
|
||||||
|
|
||||||
|
app.secret_key = '6523e58bc0eec42c31b9635d5e0dfc23b6d119b73e633bf3a5284c79bb4a1ede'
|
||||||
|
|
||||||
|
db.init_app(app)
|
||||||
|
|
||||||
|
migrate = Migrate(app, db)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/", methods=['GET', 'POST'])
|
||||||
|
def index():
|
||||||
|
results = []
|
||||||
|
results1 = []
|
||||||
|
all_aud = db.session.query(Auditory).all()
|
||||||
|
auds = []
|
||||||
|
for item in all_aud:
|
||||||
|
auds.append(item.audnazvanie)
|
||||||
|
|
||||||
|
if request.method == 'POST':
|
||||||
|
p = request.form.get('srch').strip()
|
||||||
|
all_aud = db.session.query(Auditory).all()
|
||||||
|
s = db.session.query(Oboruds).filter(
|
||||||
|
Oboruds.invNumber.contains(p)).first()
|
||||||
|
if s:
|
||||||
|
for item in all_aud:
|
||||||
|
auds.append(item.audnazvanie)
|
||||||
|
if s.aud_id is None:
|
||||||
|
results.append([s.invNumber, s.nazvanie])
|
||||||
|
else:
|
||||||
|
results1.append(s.invNumber)
|
||||||
|
results1.append(s.nazvanie)
|
||||||
|
aud = db.session.get(Auditory, s.aud_id)
|
||||||
|
results1.append(aud.audnazvanie)
|
||||||
|
return render_template('index.html', aud=all_aud, results=results, res1=results1)
|
||||||
|
return render_template('index.html', aud=all_aud, results=results, res1=results1)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/perenos", methods=['GET', 'POST'])
|
||||||
|
def perenos():
|
||||||
|
audid = request.args.get('audid')
|
||||||
|
invnomer = request.args.get('invnum')
|
||||||
|
ob = db.session.query(Oboruds).filter_by(invNumber=invnomer).first()
|
||||||
|
ob.aud_id = audid
|
||||||
|
db.session.commit()
|
||||||
|
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/addaud", methods=['GET', 'POST'])
|
||||||
|
def addAud():
|
||||||
|
return render_template('addaud.html', methods=['GET', 'POST'])
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/searchonaud', methods=['GET', 'POST'])
|
||||||
|
def searchonaud():
|
||||||
|
all_aud = db.session.query(Auditory).all()
|
||||||
|
res = []
|
||||||
|
if request.method == 'GET' and request.args.get('auditory'):
|
||||||
|
audid = request.args.get('auditory')
|
||||||
|
q = db.session.query(Auditory, Oboruds).filter(
|
||||||
|
Auditory.id == Oboruds.aud_id
|
||||||
|
).filter(Auditory.id == audid
|
||||||
|
).order_by(Oboruds.invNumber).all()
|
||||||
|
results = []
|
||||||
|
for auditory, oboruds in q:
|
||||||
|
results.append({
|
||||||
|
'auditory_id': auditory.id,
|
||||||
|
'auditory_name': auditory.audnazvanie,
|
||||||
|
'inv_number': oboruds.invNumber,
|
||||||
|
'oboruds_id': oboruds.nazvanie,
|
||||||
|
})
|
||||||
|
return jsonify(results)
|
||||||
|
|
||||||
|
else:
|
||||||
|
return render_template('searchonaud.html', aud=all_aud, res=res)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/addaudtodb", methods=['GET', 'POST'])
|
||||||
|
def addaudtodb():
|
||||||
|
if request.method == 'POST':
|
||||||
|
aud = request.form.get('auditory')
|
||||||
|
db.session.add(Auditory(audnazvanie=aud))
|
||||||
|
db.session.commit()
|
||||||
|
return redirect(url_for('addAud'))
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/addoborudtodb", methods=['GET', 'POST'])
|
||||||
|
def addoborudtodb():
|
||||||
|
res = []
|
||||||
|
if request.method == 'POST':
|
||||||
|
audid = request.form.get('auditory')
|
||||||
|
invnomer = request.form.get('invnomer')
|
||||||
|
ob = db.session.query(Oboruds).filter_by(invNumber=invnomer).first()
|
||||||
|
ob.aud_id = audid
|
||||||
|
db.session.commit()
|
||||||
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/all')
|
||||||
|
def alloborud():
|
||||||
|
|
||||||
|
result = db.session.query(Oboruds).order_by(Oboruds.invNumber).all()
|
||||||
|
|
||||||
|
res = []
|
||||||
|
|
||||||
|
for ob in result:
|
||||||
|
if ob.aud_id is not None:
|
||||||
|
aud = db.session.query(Auditory).filter_by(id=ob.aud_id).first()
|
||||||
|
res.append([ob.invNumber, ob.nazvanie, aud.audnazvanie])
|
||||||
|
else:
|
||||||
|
res.append([ob.invNumber, ob.nazvanie])
|
||||||
|
|
||||||
|
return render_template('all.html', res=res)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/updateduplicate', methods=['GET', 'POST'])
|
||||||
|
def updateduplicate():
|
||||||
|
if request.method == 'POST':
|
||||||
|
aud = request.form.get('auditory_dubl')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/vneaud', methods=['GET', 'POST'])
|
||||||
|
def vneaud():
|
||||||
|
res = []
|
||||||
|
data = db.session.query(Oboruds).filter(Oboruds.aud_id == None).all()
|
||||||
|
|
||||||
|
ak = db.session.query(Oboruds).all()
|
||||||
|
|
||||||
|
for dt in data:
|
||||||
|
res.append([dt.invNumber, dt.nazvanie, dt.typeBalanse])
|
||||||
|
|
||||||
|
return render_template('vneaud.html', res=res, kolvo=len(data), all_kol=len(ak))
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/zametki', methods=['GET', 'POST'])
|
||||||
|
def zametki():
|
||||||
|
zam = db.session.query(Zametki).filter(Zametki.rmdt == None).all()
|
||||||
|
if request.method == 'POST':
|
||||||
|
textzam = request.form.get('textzam')
|
||||||
|
timeadd = datetime.now(timezone.utc)
|
||||||
|
if len(textzam) > 0:
|
||||||
|
db.session.add(Zametki(txtzam=textzam, created_date=timeadd))
|
||||||
|
db.session.commit()
|
||||||
|
return redirect(url_for('zametki'))
|
||||||
|
|
||||||
|
return render_template('zametki.html', zam=zam)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/zamrm', methods=['GET', 'POST'])
|
||||||
|
def js2():
|
||||||
|
zmid = request.args.get('zmid')
|
||||||
|
ob = db.session.query(Zametki).filter_by(id=zmid).first()
|
||||||
|
ob.rmdt = datetime.now(timezone.utc)
|
||||||
|
db.session.commit()
|
||||||
|
return jsonify({'success': True}), 200, {'ContentType': 'application/json'}
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/zamsearch', methods=['GET', 'POST'])
|
||||||
|
def zamsearch():
|
||||||
|
p = request.form.get('srch')
|
||||||
|
|
||||||
|
searchedZam = db.session.query(Zametki).filter(
|
||||||
|
Zametki.txtzam.contains(p)).all()
|
||||||
|
|
||||||
|
zam = []
|
||||||
|
|
||||||
|
for item in searchedZam:
|
||||||
|
zam.append([item.txtzam, item.created_date])
|
||||||
|
|
||||||
|
return render_template('zametki.html', zam=zam)
|
||||||
|
|
||||||
|
# ==================================================================================
|
||||||
|
|
||||||
|
# Выгрузка в пдф
|
||||||
|
|
||||||
|
@app.route('/pdfexport')
|
||||||
|
def pdfexport():
|
||||||
|
auds = db.session.query(Auditory).all()
|
||||||
|
print(auds)
|
||||||
|
for aud in auds:
|
||||||
|
q = db.session.query(Auditory, Oboruds).filter(
|
||||||
|
Auditory.id == Oboruds.aud_id
|
||||||
|
).filter(Auditory.id == aud.id
|
||||||
|
).order_by(Oboruds.invNumber).all()
|
||||||
|
print(q)
|
||||||
|
|
||||||
|
results = []
|
||||||
|
for auditory, oboruds in q:
|
||||||
|
results.append({
|
||||||
|
'auditory_id': auditory.id,
|
||||||
|
'auditory_name': auditory.audnazvanie,
|
||||||
|
'inv_number': oboruds.invNumber,
|
||||||
|
'oboruds_id': oboruds.nazvanie,
|
||||||
|
})
|
||||||
|
html = render_template('searchonaud.html', aud=auds, res=results)
|
||||||
|
|
||||||
|
return render_pdf(HTML(string=html))
|
||||||
|
|
||||||
|
|
||||||
|
# ==================================================================================
|
||||||
|
def createdb():
|
||||||
|
with app.app_context():
|
||||||
|
db.create_all()
|
||||||
|
auds = ['519', '521', '521a', '522', '523',
|
||||||
|
'601л',
|
||||||
|
'602л',
|
||||||
|
'603л',
|
||||||
|
'604л',
|
||||||
|
'605л',
|
||||||
|
'606л',
|
||||||
|
'607л',
|
||||||
|
'608л',
|
||||||
|
'609л',
|
||||||
|
'610л',
|
||||||
|
'611л',
|
||||||
|
'612л',
|
||||||
|
'613л',
|
||||||
|
'616л',
|
||||||
|
'617л',
|
||||||
|
'618л',
|
||||||
|
'619л',
|
||||||
|
'620л',
|
||||||
|
'621л',
|
||||||
|
'622л',
|
||||||
|
'626л',
|
||||||
|
'627л',
|
||||||
|
'703л',
|
||||||
|
'710л',
|
||||||
|
'713л']
|
||||||
|
for aud in auds:
|
||||||
|
db.session.add(Auditory(audnazvanie=aud))
|
||||||
|
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
with open('inventMavrin.csv', encoding='cp1251') as csv_file:
|
||||||
|
csv_reader = csv.reader(csv_file, delimiter=';')
|
||||||
|
for row in csv_reader:
|
||||||
|
db.session.add(
|
||||||
|
Oboruds(invNumber=row[0], nazvanie=row[1], typeBalanse='баланс'))
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
def updateOborud():
|
||||||
|
with app.app_context():
|
||||||
|
db.session.query(Oboruds).update({Oboruds.typeBalanse: 'баланс'})
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
def addZabalans():
|
||||||
|
with app.app_context():
|
||||||
|
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()
|
||||||
|
|
||||||
|
|
||||||
|
def randomraspr():
|
||||||
|
with app.app_context():
|
||||||
|
while db.session.query(Oboruds).filter(Oboruds.aud_id == None).all():
|
||||||
|
audid = random.choice(db.session.query(Auditory).all())
|
||||||
|
oborud = random.choice(db.session.query(
|
||||||
|
Oboruds).filter(Oboruds.aud_id == None).all())
|
||||||
|
oborud.aud_id = audid.id
|
||||||
|
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
def randomzam():
|
||||||
|
files = ['cf.txt', 'ci.txt', 'co.txt']
|
||||||
|
|
||||||
|
fio = []
|
||||||
|
for i in range(20):
|
||||||
|
tmp = []
|
||||||
|
for file in files:
|
||||||
|
f = open(file, "r", encoding="utf-8").readlines()
|
||||||
|
tmp.append(random.choice(f))
|
||||||
|
|
||||||
|
fio.append((''.join(tmp)).replace('\n', ' ').replace('\t', ''))
|
||||||
|
|
||||||
|
print(fio)
|
||||||
|
|
||||||
|
for item in fio:
|
||||||
|
timeadd = datetime.now(timezone.utc)
|
||||||
|
with app.app_context():
|
||||||
|
db.session.add(Zametki(txtzam=item, created_date=timeadd))
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
# ==================================
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
app.run(debug=True, host='0.0.0.0', port='3800')
|
||||||
33
models.py
Normal file
33
models.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
db = SQLAlchemy()
|
||||||
|
|
||||||
|
|
||||||
|
class Auditory(db.Model):
|
||||||
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
|
audnazvanie=db.Column(db.String)
|
||||||
|
oboruds = db.relationship('Oboruds')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Oboruds(db.Model):
|
||||||
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
|
invNumber=db.Column(db.Integer)
|
||||||
|
nazvanie=db.Column(db.String(500))
|
||||||
|
duplicate=db.Column(db.Boolean, unique=False, default=False)
|
||||||
|
typeBalanse = db.Column(db.String(30))
|
||||||
|
|
||||||
|
aud_id = db.Column(db.Integer, db.ForeignKey(Auditory.id))
|
||||||
|
duplicate_aud_id = (db.Integer, db.ForeignKey(Auditory.id))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Zametki(db.Model):
|
||||||
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
|
txtzam=db.Column(db.String(10000))
|
||||||
|
created_date = db.Column(db.DateTime, default=datetime.datetime.utcnow)
|
||||||
|
rmdt = db.Column(db.DateTime)
|
||||||
|
|
||||||
|
|
||||||
BIN
requirements.txt
Normal file
BIN
requirements.txt
Normal file
Binary file not shown.
7
static/css/bootstrap.min.css
vendored
Normal file
7
static/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/css/bootstrap.min.css.map
Normal file
1
static/css/bootstrap.min.css.map
Normal file
File diff suppressed because one or more lines are too long
135
static/css/index.css
Normal file
135
static/css/index.css
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #E2F3FD;
|
||||||
|
min-width: 580px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row{
|
||||||
|
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
|
||||||
|
border: 1px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
background-color: #6A90B6;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
|
||||||
|
text-decoration: none;
|
||||||
|
color: #041322;
|
||||||
|
}
|
||||||
|
|
||||||
|
a{
|
||||||
|
|
||||||
|
color: #041322;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: #E07D54;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
|
||||||
|
width: 200px;
|
||||||
|
margin: 10px;
|
||||||
|
border-radius: 15px;
|
||||||
|
border-color: #E07D54;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.hidden-column{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav{
|
||||||
|
|
||||||
|
width:100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
|
||||||
|
*{
|
||||||
|
font-family: "Times New Roman", Times, serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: transparent;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@page {
|
||||||
|
size: A4; /* или letter, legal, tabloid, etc. */
|
||||||
|
margin: 1cm; /* Устанавливаем поля */
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border: none;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
.no-print {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.rs-table-bordered{
|
||||||
|
border:1px solid #000000;
|
||||||
|
margin-top:20px;
|
||||||
|
font-size: 14pt;
|
||||||
|
|
||||||
|
}
|
||||||
|
table.rs-table-bordered > thead > tr > th{
|
||||||
|
border:1px solid #000000;
|
||||||
|
padding: 2px;
|
||||||
|
font-size: 14pt;
|
||||||
|
}
|
||||||
|
table.rs-table-bordered > tbody > tr > td{
|
||||||
|
border:1px solid #000000;
|
||||||
|
padding: 10px;
|
||||||
|
font-size: 14pt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
32
static/js/index.js
Normal file
32
static/js/index.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
$( document ).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
|
$(".updatebtn").click(function(){
|
||||||
|
|
||||||
|
|
||||||
|
var audid = document.getElementById('auditory_dubl').value;
|
||||||
|
var invnum = document.getElementById('invnomer').textContent;
|
||||||
|
|
||||||
|
console.log('start perenos')
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/perenos",
|
||||||
|
type: 'get',
|
||||||
|
contentType: 'application/json',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {'audid':audid,
|
||||||
|
'invnum':invnum
|
||||||
|
},
|
||||||
|
error: function(error){
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
invnomer.textContent=''
|
||||||
|
nazvanie.textContent=''
|
||||||
|
aud.textContent=''
|
||||||
|
auditory_dubl.selectedIndex = 0;
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
25
static/js/print.js
Normal file
25
static/js/print.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
|
||||||
|
$("#printbutton").click(function(){
|
||||||
|
|
||||||
|
|
||||||
|
let aud = document.getElementById('auditory')
|
||||||
|
let audtext = aud.options[aud.selectedIndex].text;
|
||||||
|
const h2 = document.querySelector('h2');
|
||||||
|
h2.textContent = "Аудитория № " + audtext
|
||||||
|
|
||||||
|
document.getElementById("datatable").className="rs-table-bordered px-3"
|
||||||
|
let column = document.getElementById("proverka")
|
||||||
|
column.classList.remove("hidden-column")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
window.print()
|
||||||
|
document.getElementById("datatable").className="table"
|
||||||
|
h2.textContent='распределение мат. ценностей'
|
||||||
|
column.classList.add("hidden-column")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
5
static/js/printall.js
Normal file
5
static/js/printall.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
$("#printallbutton").click(function(){
|
||||||
|
|
||||||
|
console.log("aaaaaaa")
|
||||||
|
|
||||||
|
})
|
||||||
44
static/js/searchonaud.js
Normal file
44
static/js/searchonaud.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
$("#searchbutton").click(function(){
|
||||||
|
|
||||||
|
const audid = document.getElementById('auditory')
|
||||||
|
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/searchonaud",
|
||||||
|
type: "get",
|
||||||
|
contentType: 'application/json',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
auditory: audid.value
|
||||||
|
},
|
||||||
|
|
||||||
|
success: function(response){
|
||||||
|
|
||||||
|
var data = response;
|
||||||
|
const table = document.getElementById('datatable')
|
||||||
|
table.innerHTML = ''
|
||||||
|
var headTable = '<tr> <td>Инв. номер</td><td>Название</td><td class="no-print">Аудитория</td><td id="proverka"class="hidden-column"> Проверено</td> </tr>'
|
||||||
|
table.innerHTML += headTable
|
||||||
|
var tr =""
|
||||||
|
|
||||||
|
data.forEach(element => {
|
||||||
|
|
||||||
|
tr += '<td>' + element.inv_number + '</td>'
|
||||||
|
tr += '<td>' + element.oboruds_id + '</td>'
|
||||||
|
tr += '<td class="no-print">' + element.auditory_name + '</td>'
|
||||||
|
tr += '<td>' + '\n' + '</td>'
|
||||||
|
|
||||||
|
tr += '</tr>'
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
table.innerHTML += tr
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
15
static/js/zametki.js
Normal file
15
static/js/zametki.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
$( document ).ready(function() {
|
||||||
|
$(".reshbtn").click(function(){
|
||||||
|
var zmid = this.id
|
||||||
|
$.ajax({
|
||||||
|
url: "/zamrm",
|
||||||
|
type: 'get',
|
||||||
|
contentType: 'application/json',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {'zmid':zmid},
|
||||||
|
})
|
||||||
|
var parent = document.getElementById('zambody')
|
||||||
|
var child = document.getElementById(zmid)
|
||||||
|
parent.removeChild(child)
|
||||||
|
})
|
||||||
|
})
|
||||||
24
templates/addaud.html
Normal file
24
templates/addaud.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Добавить аудиторию</h5>
|
||||||
|
|
||||||
|
<form method='POST' action="/addaudtodb" class="card" >
|
||||||
|
<input type="text" class="form-control" name="auditory">
|
||||||
|
<button> Добавить</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{%endblock%}
|
||||||
40
templates/all.html
Normal file
40
templates/all.html
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<h3 class=" no-print card-title"> Все мат. ценности </h3>
|
||||||
|
<button id="printallbutton"> Печать </button>
|
||||||
|
<table class="table pagebreak" col-md-10>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Инв. номер</th>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
<th scope="col">Аудитория</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
{% for item in res: %}
|
||||||
|
<tr>
|
||||||
|
<td> <input type="hidden" name="invnomer" value="{{ item[0] }}"> {{ item[0] }} </td>
|
||||||
|
<td> {{ item[1] }} </td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ item[2] }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
28
templates/base.html
Normal file
28
templates/base.html
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static',filename='css/bootstrap.min.css')}}">
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static',filename='css/index.css')}}">
|
||||||
|
|
||||||
|
<title class="no-print">Инвентаризация</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
|
||||||
|
{% include 'head.html' %}
|
||||||
|
|
||||||
|
<div class="row no-print">
|
||||||
|
{% include 'navbar.html' %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
{% block content %} {% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% include 'js.html' %}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
13
templates/head.html
Normal file
13
templates/head.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<header >
|
||||||
|
|
||||||
|
<h1>
|
||||||
|
<a href="/">Инвентаризация кафедры <br>
|
||||||
|
"Автоматизированные системы управления"</br> </a>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
распределение мат. ценностей
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
</header>
|
||||||
84
templates/index.html
Normal file
84
templates/index.html
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-6 col-10" >
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="POST" action="/">
|
||||||
|
<input type="text" name="srch" placeholder="инвентарный номер">
|
||||||
|
<button> Найти </button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="card-title"> Нераспределённые </h3>
|
||||||
|
<form method="POST" action="/addoborudtodb">
|
||||||
|
<table class="table" name="table" col-md-10>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Инв. номер</th>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
<th scope="col">Аудитория</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% for item in results: %}
|
||||||
|
<tr>
|
||||||
|
<td> <input type="hidden" name="invnomer" value="{{ item[0] }}"> {{ item[0] }} </td>
|
||||||
|
<td> {{ item[1] }} </td>
|
||||||
|
|
||||||
|
<td> <select name="auditory" id="auditory">
|
||||||
|
|
||||||
|
{% for item in aud: %}
|
||||||
|
<option name="optauditory" value="{{item.id}}">{{ item.audnazvanie }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<button> Обновить</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="card-title"> Распределённые </h3>
|
||||||
|
<table class="table" col-md-10>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Инв. номер</th>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
<th scope="col">Аудитория исходная</th>
|
||||||
|
<th scope="col">Аудитория переноса</th>
|
||||||
|
</tr>
|
||||||
|
<td id="invnomer"> {{res1[0]}} </td>
|
||||||
|
<td id="nazvanie"> {{res1[1]}} </td>
|
||||||
|
<td id="aud"> {{res1[2]}} </td>
|
||||||
|
<td>
|
||||||
|
<select name="auditory" id="auditory_dubl">
|
||||||
|
{% for item in aud: %}
|
||||||
|
<option name="optauditory" value="{{item.id}}">{{ item.audnazvanie }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</table>
|
||||||
|
<button class="updatebtn" > Перенести </button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{%endblock%}
|
||||||
11
templates/js.html
Normal file
11
templates/js.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="{{url_for('static', filename='js/index.js') }}"></script>
|
||||||
|
<script src="{{url_for('static', filename='js/printall.js') }}"></script>
|
||||||
|
<script src="{{url_for('static', filename='js/zametki.js') }}"></script>
|
||||||
|
<script src="{{url_for('static', filename='js/searchonaud.js') }}"></script>
|
||||||
|
<script src="{{url_for('static', filename='js/print.js') }}"></script>
|
||||||
39
templates/navbar.html
Normal file
39
templates/navbar.html
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<div class="row no-print">
|
||||||
|
<nav class="no-print navbar navbar-expand-lg navbar-light">
|
||||||
|
<div class="no-print container-fluid">
|
||||||
|
<button class="no-print navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
|
||||||
|
aria-controls="no-print navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="no-printnavbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="no-print ollapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="no-print navbar-nav me-auto mb-2 mb-lg-0">
|
||||||
|
<li class="nav-item no-print">
|
||||||
|
<a class="nav-link no-print" aria-current="page" href="{{ url_for('index') }}">Главная</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item no-print ">
|
||||||
|
<a class="nav-link no-print " aria-current="page" href="{{ url_for('alloborud') }}">Вся таблица</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item no-print">
|
||||||
|
<a class="nav-link no-print" href="{{url_for('searchonaud')}}">Поаудиторно</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item no-print">
|
||||||
|
<a class="nav-link no-print" aria-current="page" href="{{url_for('addAud')}}">Добавить аудиторию</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item no-print">
|
||||||
|
<a class="nav-link no-print" aria-current="page" href="{{url_for('vneaud')}}">Не распределено</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item no-print">
|
||||||
|
<a class="nav-link no-print" aria-current="page" href="{{url_for('zametki')}}">Заметки</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
49
templates/nevauditor.html
Normal file
49
templates/nevauditor.html
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="POST" action="/search">
|
||||||
|
<input type="text" name="srch" placeholder="инвентарный номер">
|
||||||
|
<button> Найти </button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="card-title"> Распределённые </h3>
|
||||||
|
<form method="POST" action="/updateduplicate">
|
||||||
|
<table class="table" col-md-10>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Инв. номер</th>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<td> {{res1[0]}} </td>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{%endblock%}
|
||||||
59
templates/pdfexport.html
Normal file
59
templates/pdfexport.html
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static',filename='css/bootstrap.min.css')}}">
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static',filename='css/index.css')}}">
|
||||||
|
<title>Инвентаризация</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
|
||||||
|
<h1>
|
||||||
|
Инвентаризация каф АСУ
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
Аудитория
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="card-title"> Поаудиторно </h3>
|
||||||
|
<form method="POST" action="/addoborudtodb">
|
||||||
|
<table class="table" id="datatable" col-md-10>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Инв. номер</th>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
<th scope="col">Аудитория</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% for item in res: %}
|
||||||
|
<tr>
|
||||||
|
<td> <input type="hidden" name="invnomer" value="{{ item[0] }}"> {{ item[0] }} </td>
|
||||||
|
<td> {{ item[1] }} </td>
|
||||||
|
<td>
|
||||||
|
{{item[2]}}
|
||||||
|
</td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
55
templates/searchonaud.html
Normal file
55
templates/searchonaud.html
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="row no-print">
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
|
||||||
|
<select name="auditory" id="auditory">
|
||||||
|
|
||||||
|
{% for item in aud: %}
|
||||||
|
<option name="optauditory" value="{{item.id}}">{{ item.audnazvanie }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<button id="searchbutton"> Найти </button>
|
||||||
|
<button id="printbutton"> Печать </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
<form method="POST" action="/addoborudtodb">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="card-title no-print"> Поаудиторно </h3>
|
||||||
|
|
||||||
|
<table class="table" id="datatable" col-md-10>
|
||||||
|
|
||||||
|
<td >Инв. номер</td>
|
||||||
|
<td >Название</td>
|
||||||
|
<td class="no-print">Аудитория</td>
|
||||||
|
|
||||||
|
{% for item in res: %}
|
||||||
|
|
||||||
|
<td> <input type="hidden" name="invnomer" value="{{ item[0] }}"> {{ item[0] }} </td>
|
||||||
|
<td> {{ item[1] }} </td>
|
||||||
|
<td class="no-print"> {{item[2]}} </td>
|
||||||
|
<td id="proverka"> Проверено </td>
|
||||||
|
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{%endblock%}
|
||||||
34
templates/vneaud.html
Normal file
34
templates/vneaud.html
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-10 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
<form>
|
||||||
|
<h3 class="card-title"> Не распределено {{ kolvo }} штук из {{ all_kol }} </h3>
|
||||||
|
<table class="table" col-md-10>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Инв. номер</th>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
{% for item in res: %}
|
||||||
|
<tr>
|
||||||
|
<td> <input type="hidden" name="invnomer" value="{{ item[0] }}"> {{ item[0] }} </td>
|
||||||
|
<td> {{ item[1] }} </td>
|
||||||
|
<td> {{ item[2] }} </td>
|
||||||
|
<td> {{ item[3] }} </td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
39
templates/zametki.html
Normal file
39
templates/zametki.html
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-8 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="card-title"> Добавление заметки </h3>
|
||||||
|
<form method="POST" action="/zametki">
|
||||||
|
<textarea id="textzam" name="textzam" class="col-6"></textarea>
|
||||||
|
<div class="row">
|
||||||
|
<button> Добавить </button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="zambody" class="container col-12">
|
||||||
|
|
||||||
|
{% for item in zam: %}
|
||||||
|
<div class="row" id="{{ item.id }}">
|
||||||
|
<div class="card col-md-6 col-10">
|
||||||
|
<div class="card-body">
|
||||||
|
{{ item.txtzam }}
|
||||||
|
</div>
|
||||||
|
{{ item.created_date }}
|
||||||
|
<div class="row">
|
||||||
|
<button id="{{ item.id }}" class="reshbtn col-4"> Решено </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{%endblock%}
|
||||||
Reference in New Issue
Block a user