feat: pv 값 파싱 헬퍼 parseEnumPv() 추가, 포인트빌더 테이블 적용
This commit is contained in:
@@ -630,7 +630,7 @@ function pbRender(points) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="mut">${esc(p?.id || '')}</td>
|
<td class="mut">${esc(p?.id || '')}</td>
|
||||||
<td style="font-weight:600">${esc((p?.tagName)?.toUpperCase() || '')}</td>
|
<td style="font-weight:600">${esc((p?.tagName)?.toUpperCase() || '')}</td>
|
||||||
<td class="val">${p?.liveValue != null ? esc(String(fmtVal(p.liveValue))) : '<span style="color:var(--t3)">—</span>'}</td>
|
<td class="val">${p?.liveValue != null ? esc(String(fmtVal(parseEnumPv(p.liveValue)))) : '<span style="color:var(--t3)">—</span>'}</td>
|
||||||
<td class="mut" style="font-size:11px">${p?.liveValue != null ? fmtTs(p.timestamp) : '—'}</td>
|
<td class="mut" style="font-size:11px">${p?.liveValue != null ? fmtTs(p.timestamp) : '—'}</td>
|
||||||
<td><button class="btn-sm btn-b" style="color:var(--red,#e55)" onclick="pbDelete(${p.id})">✕</button></td>
|
<td><button class="btn-sm btn-b" style="color:var(--red,#e55)" onclick="pbDelete(${p.id})">✕</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -2131,6 +2131,19 @@ function fmtVal(v) {
|
|||||||
return n.toFixed(2);
|
return n.toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OPC UA EnumValueType pv 값 파싱
|
||||||
|
* "{0 | L-STpv | }" → "L-STpv"
|
||||||
|
* "{0 | MID | }" → "MID"
|
||||||
|
* 일반 값은 그대로 반환
|
||||||
|
*/
|
||||||
|
function parseEnumPv(v) {
|
||||||
|
if (v == null) return v;
|
||||||
|
const s = String(v);
|
||||||
|
const m = s.match(/^\{\s*\d+\s*\|\s*([^|]+?)\s*\|\s*\}$/);
|
||||||
|
return m ? m[1].trim() : s;
|
||||||
|
}
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
// fastRecord — 변수 / 모달 헬퍼
|
// fastRecord — 변수 / 모달 헬퍼
|
||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
|
|||||||
Reference in New Issue
Block a user