feat: два режима ССР — заполнение существующего xlsx или генерация с нуля
Форма принимает: ZIP (обязательно) + xlsx (необязательно). Если xlsx указан → fill mode: заполняет РАСПРЕДЕЛЕНИЕ из GGE, остальные листы не трогает. Если только ZIP → generate mode: новый файл с нуля (9 листов). HTML-протокол с результатами заполнения. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+19
-5
@@ -43,12 +43,17 @@ button:disabled { background: var(--border); cursor: not-allowed; }
|
||||
|
||||
<!-- Step 1: Upload -->
|
||||
<div class="card" id="step-upload">
|
||||
<label>Архив с GGE-файлами (.zip)</label>
|
||||
<p class="hint">ZIP со всеми локальными сметами в формате GGE (до 2000 файлов, до 100 MB)</p>
|
||||
<label>1. Архив с GGE-файлами (.zip) <span style="color:var(--accent)">*</span></label>
|
||||
<p class="hint">ZIP со всеми локальными сметами в формате GGE (до 2000 файлов)</p>
|
||||
<input type="file" id="zip-file" accept=".zip">
|
||||
|
||||
<label>Параметры расчёта</label>
|
||||
<div class="params-row">
|
||||
<label>2. Сводный файл (.xlsx) — <em>необязательно</em></label>
|
||||
<p class="hint">Ваш существующий ССР/РАСПРЕДЕЛЕНИЕ. Скрипт заполнит GGE-данные в лист РАСПРЕДЕЛЕНИЕ, остальные листы не тронет.<br>
|
||||
Если не указан — будет сгенерирован новый файл с нуля (9 листов).</p>
|
||||
<input type="file" id="xlsx-file" accept=".xlsx,.xls">
|
||||
|
||||
<label>Параметры расчёта <span class="hint" style="display:inline">(для генерации с нуля)</span></label>
|
||||
<div class="params-row" id="params-row">
|
||||
<div class="param">
|
||||
<label>Зимнее, %</label>
|
||||
<input type="number" id="p-winter" value="3.2" step="0.1" min="0" max="20">
|
||||
@@ -67,7 +72,7 @@ button:disabled { background: var(--border); cursor: not-allowed; }
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="btn-upload" onclick="doUpload()">Генерировать ССР</button>
|
||||
<button id="btn-upload" onclick="doUpload()">Заполнить / Генерировать ССР</button>
|
||||
<div id="upload-error" class="error"></div>
|
||||
</div>
|
||||
|
||||
@@ -104,8 +109,17 @@ async function doUpload() {
|
||||
return;
|
||||
}
|
||||
|
||||
const xlsxInput = document.getElementById('xlsx-file');
|
||||
const hasXlsx = xlsxInput.files.length > 0;
|
||||
|
||||
const fd = new FormData();
|
||||
fd.append('zip_file', zipInput.files[0]);
|
||||
if (hasXlsx) {
|
||||
fd.append('xlsx_file', xlsxInput.files[0]);
|
||||
fd.append('mode', 'fill'); // fill existing file
|
||||
} else {
|
||||
fd.append('mode', 'generate'); // generate from scratch
|
||||
}
|
||||
fd.append('winter_pct', document.getElementById('p-winter').value);
|
||||
fd.append('control_pct', document.getElementById('p-control').value);
|
||||
fd.append('reserve_pct', document.getElementById('p-reserve').value);
|
||||
|
||||
Reference in New Issue
Block a user