Show norm cost breakdown and reference rates in finder

This commit is contained in:
anor
2026-12-04 22:51:01 +10:00
parent 4bb95e757f
commit 011c57df9e
9 changed files with 261 additions and 39 deletions
+8 -7
View File
@@ -1,4 +1,12 @@
[
{
"version": "2026-12-04h",
"date": "2026-12-04",
"changes": [
"В подборе норм показана разбивка базисной стоимости ФЕР: ПЗ, ОТ, ЭМ, ОТм и материалы",
"Добавлен отдельный просмотр ставок НР/СП по выбранному виду работ и коэффициентов; отсутствующие значения помечены"
]
},
{
"version": "2026-12-04g",
"date": "2026-12-04",
@@ -26,12 +34,5 @@
"changes": [
"После обновления подбора норм браузер сразу получает новую версию интерфейса"
]
},
{
"version": "2026-12-04c",
"date": "2026-12-04",
"changes": [
"Таблица ресурсов в подборе норм теперь прокручивается внутри карточки и не растягивает страницу телефона"
]
}
]
+42 -7
View File
@@ -85,9 +85,17 @@
.table-panel h2 { margin:0; }
.table-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; }
.norm-scroll { max-width:100%; overflow-x:auto; }
.norm-table { min-width:720px; table-layout:fixed; font-size:.78rem; line-height:1.28; }
.norm-table { min-width:1420px; table-layout:fixed; font-size:.78rem; line-height:1.28; }
.norm-table th,.norm-table td { border:1px solid #d9e0e2; padding:4px 6px; vertical-align:middle; }
.norm-table th { background:#eef2f4; position:sticky; top:0; z-index:1; }
.norm-table tr > :first-child { position:sticky; left:0; z-index:2; background:#fff; }
.norm-table thead th:first-child { z-index:3; background:#eef2f4; }
.norm-table .norm-family-row td:first-child { background:#e8f0f3; }
.norm-table .norm-section-heading td:first-child,
.norm-table .norm-tools-row td:first-child { background:#f7fafb; }
.norm-table .norm-tools-row td:first-child { position:static; }
.norm-table .norm-work-row td:first-child,
.norm-table .norm-resource-row td:first-child { background:#fbfcfc; }
.norm-table .norm-row:hover { background:#f2f7f7; }
.norm-table .norm-row td,.norm-table .norm-resource-row td,
.norm-table .norm-work-row td { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
@@ -107,7 +115,15 @@
.norm-tools { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.norm-tools .secondary { min-height:26px; padding:2px 8px; font-size:.75rem; }
.norm-tools .variant-list { width:100%; }
.table-mobile-hint { display:none; }
.rate-panel { border:1px solid var(--line); border-radius:8px; padding:9px 12px; margin:4px 0 12px; }
.rate-panel summary { cursor:pointer; font-weight:650; }
.rate-panel[open] summary { margin-bottom:10px; }
.rate-panel label { max-width:620px; margin:12px 0; }
.rate-panel .scroll { margin:8px 0 14px; }
.rate-panel table { min-width:650px; }
.rate-panel th,.rate-panel td { border:1px solid var(--line); }
.rate-panel input { width:100%; min-width:88px; }
.table-scroll-hint { margin:2px 0 8px; }
.breadcrumb { color:var(--muted); font-size:.84rem; overflow-wrap:anywhere; }
.catalog-mobile { display:none; }
[hidden] { display:none !important; }
@@ -118,8 +134,7 @@
.catalog-mobile { display:block; margin-bottom:10px; }
.catalog-tree { position:static; max-height:45vh; margin-bottom:12px; }
.catalog-tree[hidden] { display:none !important; }
.table-mobile-hint { display:block; }
.norm-table { min-width:760px; }
.norm-table { min-width:1420px; }
}
</style>
</head>
@@ -147,8 +162,28 @@
<section id="results-section" class="panel table-panel" aria-label="Нормы сборника">
<div class="table-heading"><h2 id="results-title">Нормы сборника</h2><span id="result-count" class="hint"></span></div>
<p id="breadcrumb" class="breadcrumb"></p>
<p class="hint table-mobile-hint">Таблица прокручивается по горизонтали.</p>
<div class="norm-scroll"><table class="norm-table"><colgroup><col style="width:18%"><col style="width:47%"><col style="width:12%"><col style="width:10%"><col style="width:13%"></colgroup><thead><tr><th>Шифр</th><th>Наименование</th><th>Ед. изм.</th><th class="num">Расход</th><th class="num">ПЗ, руб.</th></tr></thead><tbody id="results"></tbody></table></div>
<details id="rate-panel" class="rate-panel">
<summary>НР, СП и коэффициенты</summary>
<p class="hint">Ставки НР и СП зависят от вида работ. Выберите пункт загруженного справочника 812/пр и 774/пр; по одному номеру сборника ставка не назначается.</p>
<label for="rate-type">Вид работ для НР и СП<select id="rate-type"><option value="">Выберите вид работ</option></select></label>
<div class="scroll"><table><thead><tr><th>НР, код</th><th class="num">НР, %</th><th class="num">НР, % (МРК)</th><th class="num">НР, % (РКС)</th><th>СП, код</th><th class="num">СП, %</th></tr></thead><tbody><tr id="rate-values"><td>—</td><td class="num">—</td><td class="num">—</td><td class="num">—</td><td>—</td><td class="num">—</td></tr></tbody></table></div>
<p class="hint">Отдельные значения для МРК и РКС в загруженном справочнике отсутствуют. Коэффициенты к НР и СП указывайте только при наличии основания.</p>
<div class="scroll"><table><thead><tr><th>НР, К</th><th>СП, К</th></tr></thead><tbody><tr>
<td><input id="coef-nr" type="number" min="0.01" max="100" step="any" inputmode="decimal" aria-label="Коэффициент НР" placeholder="1,00"></td>
<td><input id="coef-sp" type="number" min="0.01" max="100" step="any" inputmode="decimal" aria-label="Коэффициент СП" placeholder="1,00"></td>
</tr></tbody></table></div>
<p class="hint">Коэффициенты задаются условиями проекта. Введите их вручную для справки: они не меняют базисные суммы таблицы.</p>
<div class="scroll"><table><thead><tr><th>ОТ</th><th>ЗТ</th><th>ЭМ</th><th>ОТм</th><th>ЗТм</th><th>МАТ</th></tr></thead><tbody><tr>
<td><input id="coef-ot" type="number" min="0.01" max="100" step="any" inputmode="decimal" aria-label="Коэффициент ОТ" placeholder="1,00"></td>
<td><input id="coef-zt" type="number" min="0.01" max="100" step="any" inputmode="decimal" aria-label="Коэффициент ЗТ" placeholder="1,00"></td>
<td><input id="coef-em" type="number" min="0.01" max="100" step="any" inputmode="decimal" aria-label="Коэффициент ЭМ" placeholder="1,00"></td>
<td><input id="coef-otm" type="number" min="0.01" max="100" step="any" inputmode="decimal" aria-label="Коэффициент ОТм" placeholder="1,00"></td>
<td><input id="coef-ztm" type="number" min="0.01" max="100" step="any" inputmode="decimal" aria-label="Коэффициент ЗТм" placeholder="1,00"></td>
<td><input id="coef-mat" type="number" min="0.01" max="100" step="any" inputmode="decimal" aria-label="Коэффициент МАТ" placeholder="1,00"></td>
</tr></tbody></table></div>
</details>
<p class="hint table-scroll-hint">Прокрутите таблицу вправо для разбивки затрат; шифр останется виден. ОТм входит в ЭМ. В ГЭСН указаны нормы расхода без готовой единичной цены. Суммы ФЕР-2020 — базис на 01.01.2000, не текущие цены.</p>
<div class="norm-scroll"><table class="norm-table"><colgroup><col style="width:13%"><col style="width:31%"><col style="width:9%"><col style="width:7%"><col style="width:8%"><col style="width:8%"><col style="width:8%"><col style="width:8%"><col style="width:8%"></colgroup><thead><tr><th>Шифр</th><th>Наименование</th><th>Ед. изм.</th><th class="num">Расход</th><th class="num">ПЗ, руб.</th><th class="num" title="Оплата труда рабочих">ОТ, руб.</th><th class="num" title="Эксплуатация машин">ЭМ, руб.</th><th class="num" title="Оплата труда машинистов входит в ЭМ, второй раз к ПЗ не прибавляется">ОТм, руб.</th><th class="num" title="Материалы">МАТ, руб.</th></tr></thead><tbody id="results"></tbody></table></div>
<div class="actions" style="margin-top:16px"><button id="more-results" type="button" class="secondary" hidden>Показать ещё нормы</button></div>
</section>
</div>
@@ -179,6 +214,6 @@
<section id="compare-section" class="section" hidden><h2>Сравнение норм</h2><p id="compare-warning" class="notice" hidden></p>
<div id="comparison" class="comparison"></div></section>
</main>
<script src="/static/norm-finder.js?v=2026-12-04g" defer></script>
<script src="/static/norm-finder.js?v=2026-12-04h" defer></script>
</body>
</html>
+42 -15
View File
@@ -21,6 +21,7 @@
let searchPage = null;
let browsePage = null;
let catalogRows = [];
let rateRows = [];
let requestSeq = 0;
let detailSeq = 0;
let lastFamily = '';
@@ -28,6 +29,8 @@
let priceZones = [];
const compared = new Map();
const money = n => new Intl.NumberFormat('ru-RU', {minimumFractionDigits:2, maximumFractionDigits:2}).format(n) + ' ₽';
const amount = n => Number.isFinite(n) ? money(n).replace(' ₽', '') : '—';
const emptyTableCells = count => Array.from({length:count}, () => ['','']);
function node(tag, value, className) {
const el = document.createElement(tag);
@@ -134,7 +137,7 @@
return row;
}
function sectionHeading(label) {
return tableRow('norm-section-heading', [['',''],[label,''],['',''],['',''],['','']]);
return tableRow('norm-section-heading', [['',''],[label,''],...emptyTableCells(7)]);
}
function selectVariant(row) {
showRows([row]); browsePage = null; searchPage = null; $('more-results').hidden = true;
@@ -144,11 +147,15 @@
}
function renderSearchItem(item, familyName) {
const row = tableRow('norm-row', [['','norm-code-cell'],['','norm-name'],[item.unit || '—',''],['','num'],
[item.cost != null ? money(item.cost).replace(' ₽', '') : '—','num']]);
...[item.cost,item.salary,item.machines,item.salary_mach,item.materials]
.map(value => [amount(value),'num'])]);
row.dataset.key = key(item);
row.cells[4].title = item.cost != null
? 'Базисная стоимость, уровень ' + (item.price_level || 'не указан')
: 'Прямые затраты для этой нормы в индексе не указаны';
for (let index = 4; index < row.cells.length; index++) {
row.cells[index].title = item.cost != null
? 'Базисная стоимость ФЕР, уровень ' + (item.price_level || 'не указан')
: 'В этой норме нет готовой единичной цены';
}
row.cells[7].title += '. ОТм входит в ЭМ, к ПЗ повторно не прибавляется';
const codeCell = row.cells[0];
const workToggle = node('button', '▸', 'norm-toggle');
const resourceToggle = node('button', '▸', 'norm-toggle');
@@ -174,8 +181,8 @@
return detail;
}
function toolsRow() {
const toolRow = tableRow('norm-tools-row', [['',''],['',''],['',''],['',''],['','']]);
const cell = toolRow.cells[1]; cell.colSpan = 4;
const toolRow = tableRow('norm-tools-row', emptyTableCells(9));
const cell = toolRow.cells[1]; cell.colSpan = 8;
while (toolRow.cells.length > 2) toolRow.deleteCell(2);
const tools = node('div', null, 'norm-tools');
const compare = node('button', compared.has(key(item)) ? 'Убрать из сравнения' : 'Сравнить', 'secondary');
@@ -242,20 +249,28 @@
if (which === 'work' && !workRows.length) {
workRows = [sectionHeading('Состав работ')];
for (const [index, line] of (data.content || []).entries())
workRows.push(tableRow('norm-work-row', [[index + 1,'num'],[line,''],['',''],['',''],['','']]));
if (workRows.length === 1) workRows.push(tableRow('norm-work-row', [['',''],['Состав работ в индексе не указан',''],['',''],['',''],['','']]));
workRows.push(tableRow('norm-work-row', [[index + 1,'num'],[line,''],...emptyTableCells(7)]));
if (workRows.length === 1) workRows.push(tableRow('norm-work-row',
[['',''],['Состав работ в индексе не указан',''],...emptyTableCells(7)]));
}
if (which === 'resource' && !resourceRows.length) {
resourceRows = [sectionHeading('Состав норматива')];
for (const resource of data.resources || []) {
const quantity = resource.quantity_note || (resource.quantity ?? '—');
const price = !resource.quantity_note && Number.isFinite(resource.quantity)
&& Number.isFinite(resource.base_price?.cost)
? money(resource.quantity * resource.base_price.cost).replace(' ₽','') : '—';
const numeric = !resource.quantity_note && Number.isFinite(resource.quantity);
const price = numeric && Number.isFinite(resource.base_price?.cost)
? amount(resource.quantity * resource.base_price.cost) : '—';
const machinist = numeric && Number.isFinite(resource.base_price?.cost)
&& Number.isFinite(resource.base_price?.salary_mach)
? amount(resource.quantity * resource.base_price.salary_mach) : '—';
const machine = /^91\./.test(String(resource.code || ''));
const material = /^\d{2}\./.test(String(resource.code || '')) && !machine;
resourceRows.push(tableRow('norm-resource-row', [[resource.code || '—',''],
[resource.name || '—',''],[resource.unit || '—',''],[quantity,'num'],[price,'num']]));
[resource.name || '—',''],[resource.unit || '—',''],[quantity,'num'],[price,'num'],
['—','num'],[machine ? price : '—','num'],[machinist,'num'],[material ? price : '—','num']]));
}
if (resourceRows.length === 1) resourceRows.push(tableRow('norm-resource-row', [['',''],['Ресурсы в индексе не указаны',''],['',''],['',''],['','']]));
if (resourceRows.length === 1) resourceRows.push(tableRow('norm-resource-row',
[['',''],['Ресурсы в индексе не указаны',''],...emptyTableCells(7)]));
resourceRows.push(toolsRow());
}
} catch (error) { status(error.message, true); return; }
@@ -287,7 +302,7 @@
const title = familyTitle(groups.get(family));
if (family !== lastFamily) {
$('results').append(tableRow('norm-family-row', [[String(item.code || '').replace(/-\d+$/, ''),''],
[title,''],['',''],['',''],['','']]));
[title,''],...emptyTableCells(7)]));
lastFamily = family;
}
$('results').append(renderSearchItem(item, title));
@@ -683,6 +698,11 @@
'id', 'name', 'Выберите базу');
if (bases.length) $('base').selectedIndex = 1;
catalogRows = data.bases || [];
rateRows = data.rates || [];
fillSelect($('rate-type'), rateRows.map(row => ({id:row.id,
name:row.id + ' · ' + row.name})), 'id', 'name', 'Выберите вид работ');
$('rate-type').disabled = !rateRows.length;
if (!rateRows.length) $('rate-type').options[0].textContent = 'Справочник НР/СП недоступен';
fillBaseTypes();
subjects = data.subjects || [];
if (!publicMode) fillSelect($('subject'), subjects, 'id', 'name', 'Выберите регион');
@@ -696,6 +716,13 @@
? loadBrowse(browsePage.path, null, true) : search(event, true));
$('base').addEventListener('change', () => { fillBaseTypes(); loadBrowse(); });
$('base-type').addEventListener('change', () => loadBrowse());
$('rate-type').addEventListener('change', () => {
const selected = rateRows.find(row => row.id === $('rate-type').value);
const values = selected
? [selected.nr_code, selected.nr_pct + ' %', '—', '—', selected.sp_code, selected.sp_pct + ' %']
: ['—', '—', '—', '—', '—', '—'];
[...$('rate-values').cells].forEach((cell, index) => { cell.textContent = values[index]; });
});
$('catalog-mobile').addEventListener('click', () => {
const tree = $('catalog-tree');
tree.hidden = !tree.hidden;