Compare commits
3 Commits
fastapi-mi
...
72f1d53051
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72f1d53051 | ||
|
|
b1e0693131 | ||
|
|
f108e013c2 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,11 +1,9 @@
|
|||||||
*.csv
|
|
||||||
.vscode
|
.vscode
|
||||||
instance
|
.idea
|
||||||
venv/
|
venv/
|
||||||
123
|
instance/
|
||||||
|
__pycache__/
|
||||||
|
migrations/
|
||||||
*.csv
|
*.csv
|
||||||
*.db
|
*.db
|
||||||
c*.txt
|
c*.txt
|
||||||
migrations
|
|
||||||
__pycache__
|
|
||||||
.idea
|
|
||||||
|
|||||||
2
backend/__init__.py
Normal file
2
backend/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
"""Backend package initializer."""
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
# backend/main.py
|
# backend/main.py
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
from fastapi.responses import RedirectResponse
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
from backend.routers.equipment_types import equipment_types
|
from backend.routers.equipment_types import equipment_types
|
||||||
@@ -28,6 +29,11 @@ def ping():
|
|||||||
return {"message": "pong"}
|
return {"message": "pong"}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
def root():
|
||||||
|
return RedirectResponse(url="/docs")
|
||||||
|
|
||||||
|
|
||||||
# Подключение роутов
|
# Подключение роутов
|
||||||
app.include_router(equipment_types)
|
app.include_router(equipment_types)
|
||||||
app.include_router(auditories)
|
app.include_router(auditories)
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||||
from sqlalchemy.orm import relationship, declarative_base
|
from sqlalchemy.orm import relationship, declarative_base
|
||||||
import datetime
|
import datetime
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
db = SQLAlchemy()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
backend/routers/__init__.py
Normal file
2
backend/routers/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
"""Routers package initializer."""
|
||||||
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from typing import Optional
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from .. import models, schemas, database
|
from .. import models, schemas, database
|
||||||
|
|
||||||
@@ -13,8 +14,11 @@ def create_oborud(item: schemas.OborudCreate, db: Session = Depends(database.get
|
|||||||
return obj
|
return obj
|
||||||
|
|
||||||
@oboruds.get("/", response_model=list[schemas.OborudRead])
|
@oboruds.get("/", response_model=list[schemas.OborudRead])
|
||||||
def list_oboruds(db: Session = Depends(database.get_db)):
|
def list_oboruds(aud_id: Optional[int] = None, db: Session = Depends(database.get_db)):
|
||||||
return db.query(models.Oboruds).all()
|
query = db.query(models.Oboruds)
|
||||||
|
if aud_id is not None:
|
||||||
|
query = query.filter(models.Oboruds.aud_id == aud_id)
|
||||||
|
return query.all()
|
||||||
|
|
||||||
@oboruds.get("/{oborud_id}", response_model=schemas.OborudRead)
|
@oboruds.get("/{oborud_id}", response_model=schemas.OborudRead)
|
||||||
def get_oborud(oborud_id: int, db: Session = Depends(database.get_db)):
|
def get_oborud(oborud_id: int, db: Session = Depends(database.get_db)):
|
||||||
|
|||||||
147
templates/all_OLD.html
Normal file
147
templates/all_OLD.html
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<div class="modal fade" id="getmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
|
<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 ='modal_vednumber' placeholder="Номер из ведомости">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Количество
|
||||||
|
<input type="text" class="form-control" id ='modal_kolvo' placeholder="Количество">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal_rapolog' placeholder="Введите расположение">
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Modal2 -->
|
||||||
|
<div class="modal fade" id="addmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
|
<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="modal2_matcenn"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
№ из ведомости
|
||||||
|
<input type="text" class="form-control" id ='modal2_vednumber' placeholder="Номер из ведомости">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Инвентарный номер
|
||||||
|
<input type="text" class="form-control" id ='modal2_invnom' placeholder="Инвентарный номер">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Название
|
||||||
|
<input type="text" class="form-control" id ='modal2_nazvanie' placeholder="Название">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Количество
|
||||||
|
<input type="text" class="form-control" id ='modal2_kolvo' placeholder="Количество">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal2_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal2_rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modal2close">Закрыть</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="modal2savetodb" >Сохранить изменения</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row col-12">
|
||||||
|
<button class="button" id="printallbutton"> Печать </button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row col-12">
|
||||||
|
<button class="button" id="addoborud"> Добавить </button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-11 table-responsive">
|
||||||
|
<table id="alldatatable" class="alldatable table pagebreak" >
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">№ <br>п/п <br>АСУ</th>
|
||||||
|
<th scope="col">№ п/п <br>вед</th>
|
||||||
|
<th scope="col">Инв. номер</th>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
<th scope="col">Кол-во</th>
|
||||||
|
<th scope="col">Счёт</th>
|
||||||
|
<th scope="col">Ауд - я</th>
|
||||||
|
<th scope="col">Расположение</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="{{url_for('static', filename='js/allmatc.js') }}"></script>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user