update User, User group, IO modules
Some checks failed
Test / test (push) Has been cancelled

This commit is contained in:
2026-06-23 11:06:26 +07:00
parent 523f98b74c
commit 50a2587cef
32 changed files with 4728 additions and 52 deletions

View File

@@ -146,6 +146,28 @@
plcMode: el("mapIoPlcMode"),
};
async function refreshMapIoModuleList() {
const listEl = document.getElementById("mapIoModuleList");
if (!listEl) return;
let modules = [];
try {
if (window.IoModulesCatalog?.refresh) {
modules = await window.IoModulesCatalog.refresh();
} else {
const res = await fetch("/api/io_modules", { credentials: "include" });
if (res.ok) {
const data = await res.json();
modules = Array.isArray(data.io_modules) ? data.io_modules : [];
}
}
} catch {
modules = [];
}
listEl.innerHTML = modules
.map((m) => `<option value="${String(m.name || "").replace(/"/g, "&quot;")}"></option>`)
.join("");
}
/** Off-screen base scan layer (map_base.png — eraser edits this). */
let baseCanvasEl = null;
function getBaseCanvas() {
@@ -1177,13 +1199,15 @@
}
if (zone.type === obj.TYPES.io) {
const s = adv.normalizeIoSettings(zone);
if (ioFields.module) ioFields.module.value = s.io_module || "";
if (ioFields.plcRegister) {
ioFields.plcRegister.value = s.plc_register == null ? "" : String(s.plc_register);
}
if (ioFields.plcValue) ioFields.plcValue.value = s.plc_value == null ? "" : String(s.plc_value);
if (ioFields.plcMode) ioFields.plcMode.value = s.plc_mode || "set";
ioDialogEl?.showModal();
void refreshMapIoModuleList().then(() => {
if (ioFields.module) ioFields.module.value = s.io_module || "";
if (ioFields.plcRegister) {
ioFields.plcRegister.value = s.plc_register == null ? "" : String(s.plc_register);
}
if (ioFields.plcValue) ioFields.plcValue.value = s.plc_value == null ? "" : String(s.plc_value);
if (ioFields.plcMode) ioFields.plcMode.value = s.plc_mode || "set";
ioDialogEl?.showModal();
});
}
}