[WORK] Форма авто-режима (что включить), крепления не дублируют комплект, обратный поиск по аксессуару, Roomcast больше не хост
This commit is contained in:
1 parent
f0260e9842
commit
2b00676119
4 files changed
+212
-21
No files matched your search
+78
-8
@@ -83,7 +83,16 @@ svg{width:100%;height:520px;background:#0a0e13;border:1px solid var(--line);bord
|
||||
<label>Мест</label>
|
||||
<div style="display:flex;align-items:center;gap:8px"><input type="range" id="seats" min="2" max="30" value="10"><b id="seatsv">10</b></div>
|
||||
<div class="muted" id="roomout" style="margin-top:4px"></div>
|
||||
<button class="btn" style="width:100%;margin-top:12px" onclick="doAutofill()">Собрать автоматически</button>
|
||||
<div id="af-form" style="margin-top:12px;border-top:1px solid #30363d;padding-top:10px">
|
||||
<div class="muted" style="margin-bottom:5px">авто-режим: что включить</div>
|
||||
<label style="display:flex;gap:6px;align-items:center"><input type="checkbox" id="inc-mic" checked> микрофоны</label>
|
||||
<label style="display:flex;gap:6px;align-items:center"><input type="checkbox" id="inc-camera" checked> камера</label>
|
||||
<label style="display:flex;gap:6px;align-items:center"><input type="checkbox" id="inc-panel" checked> панель</label>
|
||||
<label style="display:flex;gap:6px;align-items:center"><input type="checkbox" id="inc-sharing" checked> презентация</label>
|
||||
<label style="display:flex;gap:6px;align-items:center"><input type="checkbox" id="inc-display" checked> дисплей</label>
|
||||
<label style="display:flex;gap:6px;align-items:center"><input type="checkbox" id="inc-mount"> крепление</label>
|
||||
<button class="btn" style="width:100%;margin-top:10px" onclick="doAutofill()">Собрать автоматически</button>
|
||||
</div>
|
||||
<h3 style="margin-top:14px">Требования</h3>
|
||||
<div id="reqs"><span class="muted">загрузка…</span></div>
|
||||
</div>
|
||||
@@ -128,8 +137,17 @@ svg{width:100%;height:520px;background:#0a0e13;border:1px solid var(--line);bord
|
||||
<!-- МАТРИЦА -->
|
||||
<section id="sec-matrix" class="hidden">
|
||||
<div class="card"><h3>Матрица совместимости</h3>
|
||||
<input id="mq" placeholder="фильтр по модели…" style="max-width:260px;margin-bottom:10px" oninput="renderMatrix()">
|
||||
<div id="matrixbox" style="overflow:auto;max-height:68vh"><span class="muted">загрузка…</span></div>
|
||||
<div style="display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:10px">
|
||||
<input id="mq" placeholder="фильтр по модели…" style="max-width:220px" oninput="renderMatrix()">
|
||||
<span class="muted">проверить пару:</span>
|
||||
<select id="chk-host" style="max-width:220px"></select>
|
||||
<input id="chk-dev" placeholder="VCM36-W" list="acc-list" style="max-width:170px" onchange="accessoryHosts()">
|
||||
<datalist id="acc-list"></datalist>
|
||||
<button class="btn sm" onclick="checkPair()">Проверить</button>
|
||||
<span id="chkres"></span>
|
||||
</div>
|
||||
<div id="mxdetail"></div>
|
||||
<div id="matrixbox" style="overflow:auto;max-height:60vh"><span class="muted">загрузка…</span></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -235,12 +253,21 @@ async function renderChecklist(){
|
||||
}
|
||||
async function doAutofill(){
|
||||
const h=$('#host').value;
|
||||
const r=await J(`${SVC.engine}/autofill?host=${h}&seats=${$('#seats').value}`);
|
||||
const inc=['mic','camera','panel','sharing','display','mount']
|
||||
.filter(k=>$('#inc-'+k).checked);
|
||||
const need=[...NEED].map(n=>'need='+encodeURIComponent(n)).join('&');
|
||||
const incq=inc.map(k=>'include='+k).join('&');
|
||||
const r=await J(`${SVC.engine}/autofill?host=${h}&seats=${$('#seats').value}&${incq}&${need}`);
|
||||
if(r.error){alert(r.error);return;}
|
||||
SEL={};
|
||||
(r.items||[]).forEach(it=>{SEL[it.model]={qty:it.qty,limit:99,role:it.role};});
|
||||
(r.items||[]).forEach(it=>{
|
||||
if(it.role==='Хост')return;
|
||||
SEL[it.model]={qty:it.qty,limit:99,role:it.role};
|
||||
});
|
||||
renderSel();
|
||||
$('#projinfo').textContent='собрано автоматически: '+(r.items||[]).length+' позиций';
|
||||
const notes=(r.notes||[]);
|
||||
$('#projinfo').innerHTML='собрано: '+Object.keys(SEL).length+' позиций'
|
||||
+(notes.length?`<div class="muted">${notes.map(esc).join('; ')}</div>`:'');
|
||||
}
|
||||
async function renderCables(){
|
||||
const ks=Object.keys(SEL); if(!ks.length){$('#cablesbox').innerHTML='<span class="muted">соберите состав</span>';return;}
|
||||
@@ -294,12 +321,53 @@ async function loadProject(id){
|
||||
SEL={}; (p.items||[]).forEach(it=>{SEL[it.model]={qty:it.qty,limit:99,role:'из проекта'};});
|
||||
await reload(); renderSel(); $('#projinfo').textContent='загружен: '+(p.name||id);
|
||||
}
|
||||
async function hostDetail(key){
|
||||
const d=await J(`${SVC.catalog}/device?key=${key}`);
|
||||
if(d.error){return;}
|
||||
const accs=(d.attributes?[]:[]);
|
||||
const g=await J(`${SVC.engine}/groups?host=${key}`);
|
||||
const items=(g.groups||[]).filter(x=>x.items.length);
|
||||
const comp=g.completeness||{};
|
||||
$('#mxdetail').innerHTML=`<div class="card" style="margin-bottom:10px;border-color:#2f81f7">
|
||||
<h3 style="color:#79c0ff">${esc(d.name)} — совместимые аксессуары</h3>
|
||||
${comp.level!=='full'?`<div class="box">⚠ ${esc(comp.note||'')}</div>`:''}
|
||||
${items.map(x=>`<div style="margin-bottom:6px"><b>${esc(x.name)}</b> (${x.items.length}):
|
||||
${x.items.map(i=>`<span class="tag" onclick="checkOne('${key}','${esc(i.model)}')">${esc(i.model)}${i.max_qty?' до '+i.max_qty:''}</span>`).join('')}</div>`).join('')}
|
||||
<div id="onecheck" style="margin-top:8px"></div></div>`;
|
||||
window.scrollTo({top:0,behavior:'smooth'});
|
||||
}
|
||||
async function checkOne(host,model){
|
||||
const r=await J(`${SVC.engine}/check?host=${encodeURIComponent(host)}&device=${encodeURIComponent(model)}`);
|
||||
const ok=r.supported&&r.usable!==false;
|
||||
$('#onecheck').innerHTML=`<div class="box ${ok?'ok':'bad'}"><b>${esc(r.host||host)} + ${esc(r.device||model)}</b> — ${esc(r.verdict||'')}
|
||||
${r.condition?`<div class="muted">${esc(r.condition).slice(0,120)}</div>`:''}</div>`;
|
||||
}
|
||||
async function accessoryHosts(){
|
||||
const dev=$('#chk-dev').value.trim();
|
||||
if(!dev||!MATRIX)return;
|
||||
const r=await J(`${SVC.engine}/accessory?device=${encodeURIComponent(dev)}`);
|
||||
if(!r.count){$('#chkres').innerHTML='<span class="muted">ни один хост не поддерживает</span>';return;}
|
||||
$('#chkres').innerHTML=`<b>${esc(r.device)}</b>: ${r.hosts.map(h=>esc(h.host)).join(', ')}`;
|
||||
}
|
||||
async function checkPair(){
|
||||
const host=$('#chk-host').value, dev=$('#chk-dev').value.trim();
|
||||
if(!dev){return;}
|
||||
const r=await J(`${SVC.engine}/check?host=${encodeURIComponent(host)}&device=${encodeURIComponent(dev)}`);
|
||||
const ok=r.supported&&r.usable!==false;
|
||||
$('#chkres').innerHTML=`<b style="color:${ok?'#3fb950':'#f85149'}">${esc(r.verdict||'')}</b>`;
|
||||
}
|
||||
async function loadMatrix(){
|
||||
if(!MATRIX)MATRIX=await J(SVC.catalog+'/matrix');
|
||||
renderMatrix();
|
||||
}
|
||||
function renderMatrix(){
|
||||
if(!MATRIX)return;
|
||||
if($('#chk-host').options.length===0){
|
||||
$('#chk-host').innerHTML=(MATRIX.hosts||[]).map(x=>`<option>${esc(x)}</option>`).join('');
|
||||
}
|
||||
if($('#acc-list').children.length===0){
|
||||
$('#acc-list').innerHTML=(MATRIX.accessories||[]).map(a=>`<option>${esc(a)}</option>`).join('');
|
||||
}
|
||||
const f=($('#mq').value||'').toLowerCase();
|
||||
const accs=MATRIX.accessories.filter(a=>a.toLowerCase().includes(f));
|
||||
const rows=MATRIX.rows.filter(r=>r.host.toLowerCase().includes(f));
|
||||
@@ -307,10 +375,12 @@ function renderMatrix(){
|
||||
accs.forEach(a=>h+=`<th style="writing-mode:vertical-rl;transform:rotate(180deg);height:100px">${esc(a).slice(0,24)}</th>`);
|
||||
h+='</tr>';
|
||||
rows.forEach(r=>{
|
||||
h+=`<tr><td style="font-weight:600;white-space:nowrap">${esc(r.host)}</td>
|
||||
const rk=r.host.toLowerCase().replace(/[^a-z0-9]/g,'');
|
||||
h+=`<tr onclick="hostDetail('${rk}')" style="cursor:pointer">
|
||||
<td style="font-weight:600;white-space:nowrap;color:#79c0ff">${esc(r.host)}</td>
|
||||
<td class="muted">${(r.ports.in||[]).join(',')}</td><td class="muted">${(r.ports.out||[]).join(',')}</td>`;
|
||||
accs.forEach(a=>{const v=r.cells[a.toLowerCase().replace(/[^a-z0-9]/g,'')];
|
||||
h+=`<td style="text-align:center;color:${v?'#3fb950':'#30363d'}">${v?(v>1?v:'✓'):'·'}</td>`;});
|
||||
h+=`<td style="text-align:center;color:${v?'#3fb950':'#30363d'}" ${v?`onclick="event.stopPropagation();checkOne('${rk}','${esc(a)}')"`:''}>${v?(v>1?v:'✓'):'·'}</td>`;});
|
||||
h+='</tr>';
|
||||
});
|
||||
$('#matrixbox').innerHTML=h+'</table>';
|
||||
|
||||
Reference in new issue
Block a user