This commit is contained in:
1 parent
9e65abc475
commit
331ac9c2d2
1 file changed
+44
-1
@@ -52,6 +52,7 @@ main{max-width:1560px;margin:0 auto;padding:22px 26px 70px}.view{display:none}.v
|
||||
<button class="nav" data-v="vendors">Вендоры</button>
|
||||
<button class="nav" data-v="materials">Материалы</button>
|
||||
<button class="nav" data-v="quality">Качество</button>
|
||||
<button class="nav" data-v="heat">Покрытие</button>
|
||||
<button class="nav" data-v="inbox">Разбор</button>
|
||||
<button class="nav" data-v="archive">Архив</button>
|
||||
</nav>
|
||||
@@ -124,6 +125,16 @@ main{max-width:1560px;margin:0 auto;padding:22px 26px 70px}.view{display:none}.v
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="v-heat" class="view">
|
||||
<div class="card">
|
||||
<h3>Тепловая карта покрытия</h3>
|
||||
<div class="muted" style="margin-bottom:8px">Оценка по подтверждённым pickup/FOV. Без данных — честно «нет данных», без красивой картинки.</div>
|
||||
<div class="bar" style="margin-bottom:8px"><input id="heatw" type="number" min="2" max="30" value="6" style="width:80px" placeholder="Ш, м"> <span class="muted">×</span> <input id="heatd" type="number" min="2" max="30" value="5" style="width:80px" placeholder="Г, м"> <select id="heatdevice" style="min-width:240px"><option value="">— выберите модель —</option></select> <button class="btn sm" onclick="drawHeat()">Построить</button></div>
|
||||
<canvas id="heatcanvas" width="720" height="460" style="max-width:100%;border:1px solid var(--line);border-radius:10px;background:#0d1117"></canvas>
|
||||
<div id="heatnote" class="hint" style="margin-top:8px"></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="v-inbox" class="view">
|
||||
<div class="card">
|
||||
<h3>Разбор LLM-извлечения</h3>
|
||||
@@ -173,6 +184,7 @@ function setView(v){
|
||||
if(v==='telephony') loadTelephony();
|
||||
if(v==='materials') loadMaterials();
|
||||
if(v==='quality') loadCoverage();
|
||||
if(v==='heat') loadHeat();
|
||||
if(v==='inbox') loadInbox();
|
||||
if(v==='archive') loadArchive();
|
||||
if(v==='room') loadRoomOptions();
|
||||
@@ -195,6 +207,37 @@ async function loadMaterials(){
|
||||
const rows=ms.map(x=>`<tr><td><b>${esc(x.title||x.model||'')}</b></td><td>${esc(x.vendor||'')}</td><td>${esc(x.model||'')}</td><td>${esc(x.type||'')}</td><td>${esc(x.source_level||'')}</td><td>${x.url?`<a href="${esc(x.url)}" target="_blank" rel="noopener">открыть</a>`:'—'}</td></tr>`).join('');
|
||||
$('#materialsbox').innerHTML=`<table class="bom"><thead><tr><th>Материал</th><th>Вендор</th><th>Модель</th><th>Тип</th><th>L</th><th></th></tr></thead><tbody>${rows}</tbody></table>`;
|
||||
}
|
||||
function heatNum(v){ if(v===null||v===undefined||v==='') return null; if(typeof v==='number') return v; const m=String(v).replace(',', '.').match(/-?\d+(\.\d+)?/); return m?parseFloat(m[0]):null; }
|
||||
async function loadHeat(){
|
||||
const sel=$('#heatdevice');
|
||||
if(sel.options.length<=1){
|
||||
const r=await api('/api/search?q=&domain=vcs');
|
||||
S.heatItems=r.items||[];
|
||||
sel.innerHTML='<option value="">— выберите модель —</option>'+S.heatItems.map(x=>`<option value="${esc(x.name)}">${esc(x.vendor)} · ${esc(x.name)}</option>`).join('');
|
||||
if(S.product) sel.value=S.product.name;
|
||||
}
|
||||
drawHeat();
|
||||
}
|
||||
function showHeat(){ if(!S.product) return; setView('heat'); setTimeout(()=>{ const sel=$('#heatdevice'); if(sel) sel.value=S.product.name; drawHeat(); },50); }
|
||||
function drawHeat(){
|
||||
const c=$('#heatcanvas'); if(!c) return; const ctx=c.getContext('2d');
|
||||
const W=Math.max(2,parseFloat($('#heatw').value)||6), D=Math.max(2,parseFloat($('#heatd').value)||5);
|
||||
const name=$('#heatdevice').value; const p=(S.heatItems||[]).find(x=>x.name===name) || (S.product&&S.product.name===name?S.product:null);
|
||||
const pad=36, availW=c.width-pad*2, availH=c.height-pad*2;
|
||||
const scale=Math.min(availW/W, availH/D); const rw=W*scale, rh=D*scale, x0=(c.width-rw)/2, y0=(c.height-rh)/2;
|
||||
ctx.clearRect(0,0,c.width,c.height); ctx.fillStyle='#0d1117'; ctx.fillRect(0,0,c.width,c.height);
|
||||
ctx.strokeStyle='#30363d'; ctx.lineWidth=2; ctx.strokeRect(x0,y0,rw,rh);
|
||||
ctx.fillStyle='#8b949e'; ctx.font='12px system-ui'; ctx.fillText(W+' × '+D+' м',x0,y0-10);
|
||||
if(!p){ $('#heatnote').textContent='Выберите модель — без неё карта не строится.'; return; }
|
||||
const spec=p.specs||{}; const pickup=heatNum(spec.pickup_m); const fov=heatNum(spec.fov_h);
|
||||
if(pickup){ const r=Math.min(pickup*scale, rw*0.55); const cx=x0+rw/2, cy=y0+rh/2; const g=ctx.createRadialGradient(cx,cy,4,cx,cy,r); g.addColorStop(0,'rgba(88,166,255,.35)'); g.addColorStop(1,'rgba(88,166,255,0)'); ctx.fillStyle=g; ctx.beginPath(); ctx.arc(cx,cy,r,0,Math.PI*2); ctx.fill(); ctx.strokeStyle='rgba(88,166,255,.7)'; ctx.beginPath(); ctx.arc(cx,cy,r,0,Math.PI*2); ctx.stroke(); }
|
||||
if(fov){ const cx=x0+rw/2, cy=y0+6; const half=fov*Math.PI/360; const len=Math.min(rw,rh)*0.9; ctx.fillStyle='rgba(63,185,80,.16)'; ctx.beginPath(); ctx.moveTo(cx,cy); ctx.lineTo(cx+Math.sin(-half)*len,cy+Math.cos(-half)*len); ctx.arc(cx,cy,len,Math.PI/2-half,Math.PI/2+half); ctx.closePath(); ctx.fill(); }
|
||||
const notes=[]; notes.push(p.vendor+' · '+p.name);
|
||||
notes.push(pickup?'Микрофоны: ~'+pickup+' м':'Pickup: нет данных');
|
||||
notes.push(fov?'Камера: '+fov+'°':'FOV: нет данных');
|
||||
if(!pickup&&!fov) notes.push('Недостаточно подтверждённых specs — карта условная.');
|
||||
$('#heatnote').innerHTML=notes.map(esc).join(' · ');
|
||||
}
|
||||
async function loadInbox(){
|
||||
$('#inboxbox').innerHTML='<span class="muted">загрузка…</span>';
|
||||
const r=await api('/api/staging'); const xs=r.items||[]; const es=r.edges||[];
|
||||
@@ -303,7 +346,7 @@ async function openProduct(key){
|
||||
$('#detailbox').innerHTML = `<h2>${esc(p.name)}</h2><div class="tiny muted">${esc(p.vendor)} · ${esc(p.solution_class)}</div>
|
||||
<div class="kv">${kv.map(([k,v])=>`<span>${k}</span><span>${esc(v)}</span>`).join('')}</div>
|
||||
${p.components?.length?`<div class="tiny muted">Компоненты: ${esc(p.components.join(', '))}</div>`:''}
|
||||
<div class="bar" style="margin-top:10px"><button class="btn sm" onclick="showAnalogs()">Аналоги</button><button class="btn ghost sm" onclick="compareWith()">Сравнить с аналогами</button><button class="btn ghost sm" onclick="addToRoom()">В комнату</button>${p.archived?'<button class="btn ghost sm" onclick="archiveProduct(\'restore\')">Вернуть из архива</button>':'<button class="btn ghost sm" onclick="archiveProduct(\'archive\')">В архив</button>'}</div>
|
||||
<div class="bar" style="margin-top:10px"><button class="btn sm" onclick="showAnalogs()">Аналоги</button><button class="btn ghost sm" onclick="compareWith()">Сравнить с аналогами</button><button class="btn ghost sm" onclick="addToRoom()">В комнату</button><button class="btn ghost sm" onclick="showHeat()">Тепловая карта</button>${p.archived?'<button class="btn ghost sm" onclick="archiveProduct(\'restore\')">Вернуть из архива</button>':'<button class="btn ghost sm" onclick="archiveProduct(\'archive\')">В архив</button>'}</div>
|
||||
${p.archived?'<div class="warn" style="margin-top:8px">Снято с продажи · купить нельзя · в проекте можно как замену/существующий парк</div>':''}
|
||||
<div class="kv" style="margin-top:10px">${skv.map(([k,v])=>`<span>${k}</span><span>${esc(v)}</span>`).join('')}</div>
|
||||
${comp.length?`<h4 style="margin:14px 0 6px">Совместимость (${comp.length})</h4><table class="bom"><thead><tr><th>С устройством</th><th>Тип</th><th>Макс.</th><th>Условие</th></tr></thead><tbody>${comp.map(e=>`<tr><td>${e.supported===false?'×':'✓'} ${esc(e.to)}</td><td>${esc(e.kind||'')}</td><td>${esc(e.max_qty??'')}</td><td class="muted">${esc(e.condition||'')}</td></tr>`).join('')}</tbody></table>`:''}
|
||||
|
||||
Reference in new issue
Block a user