feat(frontend): Vue (CDN) UI matching templates design; reuse /static CSS and Bootstrap; mount /static in FastAPI

This commit is contained in:
Danamir
2025-11-10 08:45:25 +03:00
parent 779c256e7b
commit 3f91dc91ec
3 changed files with 115 additions and 97 deletions

View File

@@ -3,45 +3,79 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>ASU Inventory — Фронт</title>
<link rel="stylesheet" href="/app/styles.css" />
<title>АСУ Инвентаризация</title>
<link rel="stylesheet" href="/static/css/bootstrap.min.css" />
<link rel="stylesheet" href="/static/css/index.css" />
</head>
<body>
<header>
<h1>ASU Inventory</h1>
<nav>
<a href="/docs" target="_blank">API Docs</a>
</nav>
<h1>
<a href="/app/">АСУ Инвентаризация</a>
</h1>
<h2>Учет оборудования. Демоверсия</h2>
</header>
<main>
<section class="panel">
<h2>Оборудование по аудитории</h2>
<div class="controls">
<label for="aud-select">Аудитория:</label>
<select id="aud-select">
<option value="">— выберите аудиторию —</option>
</select>
<button id="load-btn">Показать</button>
<div class="row no-print">
<nav class="no-print navbar navbar-expand-lg navbar-light">
<div class="container-fluid">
<a class="navbar-brand" href="/app/">Главная</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item"><a class="nav-link" href="#" @click="view='byAud'">По аудитории</a></li>
<li class="nav-item"><a class="nav-link" href="/docs" target="_blank">API Docs</a></li>
</ul>
</div>
</div>
<div id="status" class="status"></div>
<table id="ob-table">
<thead>
<tr>
<th>ID</th>
<th>Инв. номер</th>
<th>Название</th>
<th>Расположение</th>
<th>Кол-во</th>
<th>Тип</th>
</tr>
</thead>
<tbody></tbody>
</table>
</section>
</main>
</nav>
</div>
<div id="app" class="container">
<div v-if="view==='byAud'" class="row">
<div class="card col-md-10 col-10">
<div class="card-body">
<h3 class="card-title">Оборудование по аудитории</h3>
<div class="mb-2 d-flex align-items-center gap-2">
<label for="aud-select" class="me-2">Аудитория:</label>
<select id="aud-select" class="form-select w-auto" v-model="selectedAudId">
<option value="">— выберите аудиторию —</option>
<option v-for="a in auditories" :key="a.id" :value="a.id">{{ a.id }} — {{ a.audnazvanie }}</option>
</select>
<button class="btn btn-primary" @click="loadOboruds">Показать</button>
</div>
<div class="status" :class="{error: !!error}">{{ status }}</div>
<div class="table-responsive">
<table class="table datatable">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Инв. номер</th>
<th scope="col">Название</th>
<th scope="col">Расположение</th>
<th scope="col">Кол-во</th>
<th scope="col">Тип</th>
</tr>
</thead>
<tbody>
<tr v-for="it in oboruds" :key="it.id">
<td>{{ it.id }}</td>
<td class="inv">{{ it.invNumber ?? '' }}</td>
<td>{{ it.nazvanie ?? '' }}</td>
<td class="rasp">{{ it.raspologenie ?? '' }}</td>
<td>{{ it.kolichestvo ?? '' }}</td>
<td>{{ it.type?.name ?? '' }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<script src="/app/app.js" defer></script>
</body>
</html>