Page norm matches and finish finder release
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
[
|
||||
{
|
||||
"version": "2026-12-04b",
|
||||
"date": "2026-12-04",
|
||||
"changes": [
|
||||
"Подбор норм открыт без входа: поиск по работе и шифру, варианты таблиц и сравнение состава",
|
||||
"Несколько норм можно сохранить в подборку и пересчитать по зоне и кварталу; неполные цены отмечаются отдельно"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026-12-04a",
|
||||
"date": "2026-12-04",
|
||||
@@ -26,13 +34,5 @@
|
||||
"changes": [
|
||||
"После локальной сметы ассистент задаёт вопрос об отдельном расчёте дополнительных затрат, даже если исходных данных не хватило для полного итога"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2026-12-02b",
|
||||
"date": "2026-12-02",
|
||||
"changes": [
|
||||
"Локальная смета больше не начисляет зимние и временные затраты, резерв и НДС без отдельного расчёта",
|
||||
"Последние обновления нормативного корпуса на главной сгруппированы по источнику и дате"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -92,7 +92,8 @@
|
||||
<button type="button" data-query="10-08-002-02">10-08-002-02</button></div>
|
||||
</form>
|
||||
<div id="status" class="status" role="status" aria-live="polite"></div>
|
||||
<section id="results-section" class="section" hidden><h2>Подходящие нормы</h2><div id="results" class="results"></div></section>
|
||||
<section id="results-section" class="section" hidden><h2>Подходящие нормы</h2><div id="results" class="results"></div>
|
||||
<div class="actions" style="margin-top:16px"><button id="more-results" type="button" class="secondary" hidden>Показать ещё нормы</button></div></section>
|
||||
<section id="detail-section" class="section" hidden><div class="detail-grid">
|
||||
<div class="panel"><h2 id="detail-title">Состав нормы</h2><div id="detail"></div></div>
|
||||
<div class="panel" id="quote-panel"><h2>Предварительный расчёт</h2><p class="hint">Объём вводится в выбранной единице. Недостающие цены и затраты будут отмечены.</p>
|
||||
|
||||
+20
-7
@@ -18,6 +18,7 @@
|
||||
let active = null;
|
||||
let savedQuote = null;
|
||||
let draft = null;
|
||||
let searchPage = null;
|
||||
let subjects = [];
|
||||
let priceZones = [];
|
||||
const compared = new Map();
|
||||
@@ -151,23 +152,34 @@
|
||||
actions.append(open, compare, variants); card.append(actions, variantList);
|
||||
return card;
|
||||
}
|
||||
async function search(event) {
|
||||
async function search(event, nextPage=false) {
|
||||
event?.preventDefault();
|
||||
const q = $('query').value.trim(), base = $('base').value;
|
||||
const q = nextPage ? searchPage?.q : $('query').value.trim();
|
||||
const base = nextPage ? searchPage?.base : $('base').value;
|
||||
const offset = nextPage ? searchPage?.offset || 0 : 0;
|
||||
if (q.length < 2) { status('Введите хотя бы два символа', true); return; }
|
||||
status('Ищу нормы…');
|
||||
$('results-section').hidden = true; $('detail-section').hidden = true;
|
||||
if (!nextPage) {
|
||||
searchPage = null;
|
||||
$('results-section').hidden = true; $('detail-section').hidden = true;
|
||||
$('more-results').hidden = true;
|
||||
}
|
||||
$('more-results').disabled = true;
|
||||
try {
|
||||
const data = await api(readPath('search') + '?' +
|
||||
new URLSearchParams({q,base,limit:publicMode ? '8' : '12'}));
|
||||
new URLSearchParams({q,base,limit:publicMode ? '8' : '12',offset:String(offset)}));
|
||||
const items = data.items || [];
|
||||
$('results').replaceChildren(...items.map(renderSearchItem));
|
||||
$('results-section').hidden = !items.length;
|
||||
if (nextPage) $('results').append(...items.map(renderSearchItem));
|
||||
else $('results').replaceChildren(...items.map(renderSearchItem));
|
||||
$('results-section').hidden = !$('results').children.length;
|
||||
searchPage = {q, base, offset:offset + items.length};
|
||||
$('more-results').hidden = !data.has_more || !items.length;
|
||||
const correction = data.interpreted_query && data.interpreted_query !== q
|
||||
? 'Поиск по уточнённой формулировке: «' + data.interpreted_query + '». ' : '';
|
||||
status(items.length ? correction + 'Показано ' + items.length + ' подходящих норм. Проверьте состав работ перед расчётом.'
|
||||
status(items.length ? correction + 'Показано ' + searchPage.offset + ' подходящих норм. Проверьте состав работ перед расчётом.'
|
||||
: (data.message || 'Нормы не найдены. Уточните работу или шифр.'));
|
||||
} catch (e) { status(e.message, true); }
|
||||
finally { $('more-results').disabled = false; }
|
||||
}
|
||||
function renderDetail(item) {
|
||||
$('detail-title').textContent = item.code + ' — ' + (item.name || 'Норма');
|
||||
@@ -438,6 +450,7 @@
|
||||
} catch (e) { status(e.message, true); }
|
||||
}
|
||||
$('search-form').addEventListener('submit', search);
|
||||
$('more-results').addEventListener('click', event => search(event, true));
|
||||
document.querySelectorAll('[data-query]').forEach(button => button.addEventListener('click', () => {
|
||||
$('query').value = button.dataset.query; $('search-form').requestSubmit();
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user