Новые страницы: - /wizard — агрегатор xlsx (7-шаговый мастер) - /generate — генерация сметы из описания работ (4 шага → Excel) - /reference — справочники НР/СП/ГЭСН - /check — проверка YAML-конфига сметы Используют smeta-railway как библиотеку (wizard_api, generator_api, chat_api, checker). Кнопки добавлены в header чата. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
116 lines
5.5 KiB
HTML
116 lines
5.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Справочники</title>
|
|
<style>
|
|
:root {
|
|
--bg: #f5f0eb; --bg-card: #ffffff;
|
|
--text: #3a3a3a; --text-muted: #6b6b6b; --text-light: #8b7355;
|
|
--border: #d4c5b2; --border-light: #ede5db;
|
|
--accent: #c4463a; --accent-hover: #a83830;
|
|
--success: #2b8a3e; --warn: #e8590c; --danger: #e03131; --info: #1971c2;
|
|
--shadow-sm: 0 1px 3px rgba(0,0,0,.05);
|
|
--shadow-md: 0 4px 16px rgba(0,0,0,.07);
|
|
--radius: 10px; --radius-lg: 16px;
|
|
}
|
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text); }
|
|
.container { max-width: 860px; margin: 24px auto; padding: 0 16px; }
|
|
.header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
|
|
.header h1 { font-size: 1.2rem; font-weight: 700; }
|
|
.header a { color: var(--accent); text-decoration: none; font-size: .85rem; font-weight: 500; }
|
|
.card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 24px; margin-bottom: 16px; }
|
|
label { display: block; font-size: .85rem; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
|
|
input, select { width: 100%; padding: .55rem .75rem; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .9rem; background: var(--bg); outline: none; }
|
|
input:focus { border-color: var(--accent); background: var(--bg-card); }
|
|
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
|
|
.tab { padding: .5rem 1rem; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: .85rem; font-weight: 500; color: var(--text-muted); background: transparent; transition: all .15s; }
|
|
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
|
|
.tab:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
|
|
.btn { padding: .55rem 1.2rem; border: none; border-radius: var(--radius); font-size: .85rem; font-weight: 600; cursor: pointer; background: var(--accent); color: #fff; }
|
|
.btn:hover { background: var(--accent-hover); }
|
|
.result { padding: 10px 14px; border-left: 3px solid var(--info); background: var(--bg); border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 6px; font-size: .88rem; }
|
|
.result strong { font-weight: 700; }
|
|
.score { display: inline-block; padding: 1px 6px; border-radius: 8px; font-size: .72rem; font-weight: 700; }
|
|
.score-hi { background: #d3f9d8; color: var(--success); }
|
|
.score-md { background: #fff3bf; color: var(--warn); }
|
|
.score-lo { background: #ffe3e3; color: var(--danger); }
|
|
.pct { font-size: 1.1rem; font-weight: 700; color: var(--accent); }
|
|
.muted { color: var(--text-muted); font-size: .82rem; }
|
|
.mt-2 { margin-top: 8px; }
|
|
.mt-3 { margin-top: 12px; }
|
|
.input-row { display: flex; gap: 8px; }
|
|
.input-row input { flex: 1; }
|
|
#results { min-height: 100px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="header">
|
|
<h1>Справочники</h1>
|
|
<a href="/">← Назад к чату</a>
|
|
</div>
|
|
|
|
<div class="tabs">
|
|
<button class="tab active" onclick="setTab('gesn')">Поиск ГЭСН</button>
|
|
<button class="tab" onclick="setTab('nr')">НР</button>
|
|
<button class="tab" onclick="setTab('sp')">СП</button>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="input-row">
|
|
<input type="text" id="q" placeholder="Введите запрос..." onkeydown="if(event.key==='Enter')search()">
|
|
<button class="btn" onclick="search()">Найти</button>
|
|
</div>
|
|
<div id="results" class="mt-3"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
let mode = 'gesn';
|
|
|
|
function setTab(m) {
|
|
mode = m;
|
|
document.querySelectorAll('.tab').forEach((t, i) => t.classList.toggle('active', ['gesn','nr','sp'][i] === m));
|
|
document.getElementById('q').placeholder = mode === 'gesn' ? 'Описание работ...' : 'Вид работ...';
|
|
document.getElementById('results').innerHTML = '';
|
|
document.getElementById('q').focus();
|
|
}
|
|
|
|
async function search() {
|
|
const q = document.getElementById('q').value.trim();
|
|
if (!q) return;
|
|
const url = mode === 'gesn' ? '/api/ref/search' : `/api/ref/${mode}`;
|
|
const body = mode === 'gesn' ? {query: q, top_k: 10} : {query: q};
|
|
const r = await fetch(url, {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(body)});
|
|
const d = await r.json();
|
|
|
|
let h = '';
|
|
if (mode === 'gesn') {
|
|
if (!d.results || !d.results.length) { h = '<p class="muted">Ничего не найдено</p>'; }
|
|
else {
|
|
for (const r of d.results) {
|
|
const sc = r.score > 0.6 ? 'score-hi' : r.score > 0.3 ? 'score-md' : 'score-lo';
|
|
h += `<div class="result"><strong>ГЭСН ${esc(r.code)}</strong> <span class="score ${sc}">${(r.score*100).toFixed(0)}%</span><br>${esc(r.name)}<br><span class="muted">Ед: ${esc(r.unit)} | сб.${esc(r.collection)}</span></div>`;
|
|
}
|
|
}
|
|
} else {
|
|
if (!d.results || !d.results.length) { h = `<p class="muted">${d.label}: ничего не найдено</p>`; }
|
|
else {
|
|
h = `<p class="muted">${d.label} — найдено: ${d.count}</p>`;
|
|
for (const r of d.results) {
|
|
h += `<div class="result">п.${esc(r.key)}. ${esc(r.name)} — <span class="pct">${r.percent}%</span> от ФОТ</div>`;
|
|
}
|
|
}
|
|
}
|
|
document.getElementById('results').innerHTML = h;
|
|
}
|
|
|
|
function esc(s) { return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }
|
|
document.getElementById('q').focus();
|
|
</script>
|
|
</body>
|
|
</html>
|