feat(ui/core): срез 6.2 — правка сметы → пересчёт ДВИЖКОМ (не JS)
Объёмы в панели редактируемы (input); «Пересчитать движком» → POST /api/recalc → estimate_contract.calc_estimate в threadpool (не блокирует сервер) → новая панель с детерминир. пересчётом. JS не считает — только движок. Браузер-verified (100→250 → итог пересчитан). APP_VERSION 2026-07-17r.
This commit is contained in:
@@ -81,6 +81,15 @@ window.fetch = async (url, opts={}) => {
|
||||
evs.push('event: done\ndata: {"result":"ok"}\n\n');
|
||||
return new Response(_sse(evs, opts.signal), {status:200, headers:{'Content-Type':'text/event-stream'}});
|
||||
}
|
||||
if (url.includes('/api/recalc')) {
|
||||
const b = JSON.parse(opts.body || '{}'); const pos = b.positions || [];
|
||||
// «движок»: total позиции = qty*1000; итог = сумма
|
||||
const positions = pos.map(p => ({code: p.code, name: 'Позиция ' + p.code, unit: p.unit || 'ед',
|
||||
qty: p.qty, total: p.qty * 1000}));
|
||||
const gt = positions.reduce((s, p) => s + p.total, 0);
|
||||
window._recalc = (window._recalc || 0) + 1;
|
||||
return _json({title: 'Смета (пересчёт)', positions, totals: {grand_total: gt}, ok: true, missing: []});
|
||||
}
|
||||
if (url.includes('/api/feedback')) { window._fb++; return _json({}); }
|
||||
if (url.includes('/api/history')) return _json([]);
|
||||
// /api/sessions/{tab}/title (POST)
|
||||
|
||||
Reference in New Issue
Block a user