v4: добавлена кнопка 'Проставить области' — автозаполнение по КАТО
This commit is contained in:
parent
5c2a822f2d
commit
951defe995
41
index.html
41
index.html
@ -136,6 +136,7 @@ tbody tr.marked:hover{background:var(--green-bg)}
|
|||||||
<div class="actions" id="batchActions" style="margin-bottom:16px">
|
<div class="actions" id="batchActions" style="margin-bottom:16px">
|
||||||
<button class="btn btn-sm" id="markAllBtn">✅ Отметить все в фильтре</button>
|
<button class="btn btn-sm" id="markAllBtn">✅ Отметить все в фильтре</button>
|
||||||
<button class="btn btn-sm btn-outline" id="unmarkAllBtn">✕ Снять все</button>
|
<button class="btn btn-sm btn-outline" id="unmarkAllBtn">✕ Снять все</button>
|
||||||
|
<button class="btn btn-sm btn-outline" id="fillOblastBtn">📋 Проставить области</button>
|
||||||
<span style="flex:1"></span>
|
<span style="flex:1"></span>
|
||||||
<button class="btn btn-sm btn-green" id="exportBtn">⬇ Скачать только отмеченные</button>
|
<button class="btn btn-sm btn-green" id="exportBtn">⬇ Скачать только отмеченные</button>
|
||||||
</div>
|
</div>
|
||||||
@ -383,6 +384,45 @@ function loadTemplate() {
|
|||||||
setTimeout(() => document.getElementById('templateStatus').textContent = '', 3000);
|
setTimeout(() => document.getElementById('templateStatus').textContent = '', 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const KATO_REGIONS = {
|
||||||
|
'01': 'Акмолинская область', '02': 'Актюбинская область',
|
||||||
|
'03': 'Алматинская область', '04': 'Атырауская область',
|
||||||
|
'05': 'Западно-Казахстанская область', '06': 'Жамбылская область',
|
||||||
|
'07': 'Карагандинская область', '08': 'Костанайская область',
|
||||||
|
'09': 'Кызылординская область', '10': 'Мангистауская область',
|
||||||
|
'11': 'Туркестанская область', '12': 'Павлодарская область',
|
||||||
|
'13': 'Северо-Казахстанская область', '14': 'Восточно-Казахстанская область',
|
||||||
|
'15': 'Г.Алматы', '16': 'Г.Астана', '17': 'Г.Шымкент',
|
||||||
|
'18': 'Улытауская область', '19': 'Абайская область',
|
||||||
|
'20': 'Жетысуйская область', '21': 'Кызылординская область'
|
||||||
|
};
|
||||||
|
|
||||||
|
function fillOblast() {
|
||||||
|
const katoIx = dataColumns.indexOf('kato');
|
||||||
|
const obIx = dataColumns.indexOf('oblast');
|
||||||
|
if (katoIx === -1) { alert('Не найдена колонка КАТО'); return; }
|
||||||
|
if (obIx === -1) { alert('Не найдена колонка области. Добавьте колонку "Область" в файл.'); return; }
|
||||||
|
|
||||||
|
let filled = 0;
|
||||||
|
allData.forEach(row => {
|
||||||
|
const kato = String(row[dataColumns[katoIx]] || '').trim();
|
||||||
|
const code = kato.length >= 2 ? kato.substring(0, 2) : '';
|
||||||
|
if (code && KATO_REGIONS[code] && !String(row[dataColumns[obIx]] || '').trim()) {
|
||||||
|
row[dataColumns[obIx]] = KATO_REGIONS[code];
|
||||||
|
filled++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (filled > 0) {
|
||||||
|
initHierarchy(allData);
|
||||||
|
renderFilters();
|
||||||
|
applyFilter();
|
||||||
|
alert(`✅ Области проставлены для ${filled} строк`);
|
||||||
|
} else {
|
||||||
|
alert('Области уже заполнены или нет строк с пустыми областями');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function autoProcess() {
|
function autoProcess() {
|
||||||
const raw = localStorage.getItem(TEMPLATE_KEY);
|
const raw = localStorage.getItem(TEMPLATE_KEY);
|
||||||
if (!raw) return;
|
if (!raw) return;
|
||||||
@ -464,6 +504,7 @@ dz.ondrop = e => { e.preventDefault(); dz.classList.remove('dragover'); if (e.da
|
|||||||
|
|
||||||
document.getElementById('saveTemplateBtn').onclick = saveTemplate;
|
document.getElementById('saveTemplateBtn').onclick = saveTemplate;
|
||||||
document.getElementById('loadTemplateBtn').onclick = loadTemplate;
|
document.getElementById('loadTemplateBtn').onclick = loadTemplate;
|
||||||
|
document.getElementById('fillOblastBtn').onclick = fillOblast;
|
||||||
updateTemplateStatus();
|
updateTemplateStatus();
|
||||||
|
|
||||||
document.getElementById('markAllBtn').onclick = () => {
|
document.getElementById('markAllBtn').onclick = () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user