From 7ba30210e86b3c6ff6120d93449433dcae89f7c4 Mon Sep 17 00:00:00 2001 From: Dauren777 Date: Tue, 9 Jun 2026 11:51:02 +0000 Subject: [PATCH] =?UTF-8?q?v56:=20AI-=D0=B0=D1=81=D1=81=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=20+=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20?= =?UTF-8?q?=D0=B2=20HTML-=D0=BE=D1=82=D1=87=D1=91=D1=82=D0=B5=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B8=D0=BA=D0=B0=D0=B1=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index b17007e..b7c6ac1 100644 --- a/index.html +++ b/index.html @@ -90,10 +90,12 @@ tr.warn td{background:#FFFDF5}tr.late td{background:#FFF5F5} +
+
@@ -128,7 +130,7 @@ function doLogin(){var e=document.getElementById("lem").value.trim().toLowerCase function doLogout(){localStorage.removeItem("su");cu=null;document.getElementById("login").style.display="flex";document.getElementById("app").style.display="none"} function show(){document.getElementById("login").style.display="none";document.getElementById("app").style.display="block";document.getElementById("ul").innerHTML=""+cu.n+" · "+(cu.r==="cur"?"Все":br[cu.b]);switchPg("ev")} -function switchPg(n){document.querySelectorAll(".tab").forEach(function(t){t.classList.remove("on")});document.querySelector('[data-pg="'+n+'"]').classList.add("on");document.querySelectorAll(".pg").forEach(function(p){p.classList.remove("on")});document.getElementById("pg-"+n).classList.add("on");if(n==="ev")re();else if(n==="an")ra();else if(n==="rp")rr()} +function switchPg(n){document.querySelectorAll(".tab").forEach(function(t){t.classList.remove("on")});document.querySelector('[data-pg="'+n+'"]').classList.add("on");document.querySelectorAll(".pg").forEach(function(p){p.classList.remove("on")});document.getElementById("pg-"+n).classList.add("on");if(n==="ev")re();else if(n==="an")ra();else if(n==="rp")rr();else if(n==="ai")rAI()} document.querySelectorAll(".tab").forEach(function(t){t.addEventListener("click",function(){switchPg(this.dataset.pg)})}); function dls(e){if(e.s==="late")return"late";if(e.s==="done")return"";var p=e.due.split(".");if(p.length===3){var d=new Date(parseInt(p[2]),parseInt(p[1])-1,parseInt(p[0]));if((d-new Date())/86400000<=30)return"warn"}return""} @@ -218,7 +220,7 @@ function rr(){var h='

Сводный отчёт

📥 Загрузить
'; document.getElementById("pg-rp").innerHTML=h} function dCSV(){var f=parseInt(document.getElementById("rf").value),t=parseInt(document.getElementById("rt").value);var csv="\uFEFF№;Филиал;Мероприятие;Регион;Статус;Срок\n";(ev||[]).forEach(function(e){reg.forEach(function(r,ri){var d=getMD(e.id,ri,-1),rep="";for(var i=f;i<=t;i++){var m=ms[i];if(d[m]&&d[m].report)rep+=M(i)+": "+d[m].report.replace(/"/g,'""')+"; "}csv+=e.id+';'+br[e.b]+';"'+e.t.replace(/"/g,'""')+'";'+r+';'+st[e.s]+';'+e.due+';"'+rep+'"\n'})});var a=document.createElement("a");a.href=URL.createObjectURL(new Blob([csv]));a.download="otchet.csv";a.click()} -function dHTML(){var f=parseInt(document.getElementById("rf").value),t=parseInt(document.getElementById("rt").value);var h='Отчёт

Сводный отчёт

';ev.forEach(function(e){var cl={done:"g",warn:"a",late:"r",wait:""}[e.s];h+='

'+e.id+'. '+esc(e.t)+'

'+br[e.b]+' | '+sec[e.sec]+' | Срок: '+e.due+' | '+st[e.s]+'

';reg.forEach(function(r,ri){var d=getMD(e.id,ri,-1);for(var i=f;i<=t;i++){var m=ms[i];if(d[m]&&d[m].report){h+='
'+M(i)+' — '+r+'

'+esc(d[m].report)+'

'}}});h+='
'});h+='';try{var a=document.createElement("a");a.href=URL.createObjectURL(new Blob(["\uFEFF"+h]));a.download="otchet.html";a.click()}catch(e){alert("Слишком большой")}} +function dHTML(){var f=parseInt(document.getElementById("rf").value),t=parseInt(document.getElementById("rt").value);var h='Отчёт

Сводный отчёт

';ev.forEach(function(e){var cl={done:"g",warn:"a",late:"r",wait:""}[e.s];h+='

'+e.id+'. '+esc(e.t)+'

'+br[e.b]+' | '+sec[e.sec]+' | Срок: '+e.due+' | '+st[e.s]+'

';reg.forEach(function(ri){var d=getMD(e.id,ri,-1);for(var i=f;i<=t;i++){var m=ms[i];if(d[m]&&(d[m].report||(d[m].files&&d[m].files.length))){h+='
'+M(i)+' — '+reg[ri]+'';if(d[m].report)h+='

'+esc(d[m].report)+'

';if(d[m].qty)h+='

Количество: '+d[m].qty+'

';if(d[m].files&&d[m].files.length)h+='

📎 Файлы: '+d[m].files.map(function(f2){return f2.data?'📄 '+esc(f2.name)+' ('+(f2.size/1024).toFixed(0)+' КБ)':'📄 '+esc(f2.name)}).join("; ")+'

';h+='
'}}});if(e.sub)e.sub.forEach(function(s,si){reg.forEach(function(ri){var sd=getMD(e.id,ri,si);for(var i=f;i<=t;i++){var m=ms[i];if(sd[m]&&(sd[m].report||(sd[m].files&&sd[m].files.length))){h+='
'+s.l+') '+esc(s.t.slice(0,50))+'... — '+reg[ri]+' | '+M(i)+'';if(sd[m].report)h+='

'+esc(sd[m].report)+'

';if(sd[m].qty)h+='

Количество: '+sd[m].qty+'

';if(sd[m].files&&sd[m].files.length)h+='

📎 Файлы: '+sd[m].files.map(function(f2){return f2.data?'📄 '+esc(f2.name)+' ('+(f2.size/1024).toFixed(0)+' КБ)':'📄 '+esc(f2.name)}).join("; ")+'

';h+='
'}}})});h+='
'});h+='';try{var a=document.createElement("a");a.href=URL.createObjectURL(new Blob(["\uFEFF"+h],{type:"text/html"}));a.download="otchet.html";a.click()}catch(e){alert("Отчёт слишком большой. Попробуйте меньший период.")}} function exp(){var d={events:ev,date:new Date().toISOString(),files:{},sc:{}};for(var i=0;i=0?"_s"+si:"",fi=document.getEl function dlF2(eid,mk,idx,ri,si){si=si||-1;mk=ms[mk];var ad=getMD(eid,ri,si),arr=ad[mk]?ad[mk].files:null;if(!arr||!arr[idx]||!arr[idx].data)return;var f=arr[idx],a=document.createElement("a");a.href=f.data;a.download=f.name;document.body.appendChild(a);a.click();document.body.removeChild(a)} function rmF2(eid,mk,idx,ri,si){si=si||-1;mk=ms[mk];var ad=getMD(eid,ri,si);if(!ad[mk]||!ad[mk].files)return;ad[mk].files.splice(idx,1);setMD(eid,ad,ri,si);closeM();oe(eid,cm,ri,si>=0?si:undefined)} +// ===== AI AGENT ===== +function rAI(){var all=ev||[],now=new Date(),late=all.filter(function(e){return e.s==="late"}),warn=all.filter(function(e){return e.s==="warn"}),done=all.filter(function(e){return e.s==="done"}),near=[],totalFiles=0,totalQty=0; + all.forEach(function(e){if(e.s==="warn"||e.s==="wait"){var p=e.due.split(".");if(p.length===3){var d=new Date(parseInt(p[2]),parseInt(p[1])-1,parseInt(p[0]));var days=Math.round((d-now)/86400000);if(days>0&&days<=30)near.push({e:e,days:days})}}reg.forEach(function(ri){var md=getMD(e.id,ri,-1);for(var k in md){if(md.hasOwnProperty(k)&&md[k]){totalFiles+=(md[k].files||[]).length;totalQty+=md[k].qty||0}if(e.sub)e.sub.forEach(function(si){var sd=getMD(e.id,ri,si);for(var sk in sd){if(sd.hasOwnProperty(sk)&&sd[sk]){totalFiles+=(sd[sk].files||[]).length;totalQty+=sd[sk].qty||0}}})}})});near.sort(function(a,b){return a.days-b.days});var dp=all.length?Math.round(done.length/all.length*100):0; + var h='

🤖 ИИ-ассистент

Автоматический анализ Плана мероприятий на 2026 год

'; + h+='

📊 Общий статус

План выполнен на '+dp+'% ('+done.length+' из '+all.length+').

';if(late.length)h+='

⚠️ Просрочено: '+late.length+'

';if(warn.length)h+='

🟡 На контроле: '+warn.length+'

';h+='
'; + if(late.length||near.length){h+='

🚨 Критические предупреждения

';if(late.length){h+='

Просрочено ('+late.length+'):

';late.slice(0,5).forEach(function(e){h+='
🔴 №'+e.id+' — '+esc(e.t.slice(0,70))+'... '+e.due+'
'});if(late.length>5)h+='

... и ещё '+(late.length-5)+'

'}if(near.length){h+='

Близкие сроки ('+near.length+'):

';near.slice(0,5).forEach(function(n){h+='
🟡 №'+n.e.id+' — '+esc(n.e.t.slice(0,60))+'... '+n.days+' дн.
'});if(near.length>5)h+='

... и ещё '+(near.length-5)+'

'}h+='
'} + h+='

💡 Рекомендации

    ';if(late.length)h+='
  1. Эскалировать просроченные мероприятия руководителям. Провести совещание с филиалами.
  2. ';if(near.length>3)h+='
  3. Усилить контроль за '+near.length+' мероприятиями с приближающимися сроками.
  4. ';if(dp<50)h+='
  5. Прогресс ниже 50%. Пересмотреть график Q3-Q4.
  6. ';if(totalFiles<5)h+='
  7. Низкая активность по загрузке документов ('+totalFiles+' файлов). Активизировать работу филиалов.
  8. ';if(totalQty===0)h+='
  9. Не указаны количественные показатели. Заполнить поля «Количество».
  10. ';if(dp>=70)h+='
  11. Положительная динамика. Поддерживать текущий темп.
  12. ';h+='
  13. Использовать фильтр по месяцам на вкладке «Отчёты» для контроля.
'; + document.getElementById("pg-ai").innerHTML=h} + // ===== INIT ===== document.getElementById("mo").addEventListener("click",function(e){if(e.target===this)closeM()}); document.addEventListener("keydown",function(e){if(e.key==="Escape")closeM()});