99
This commit is contained in:
1 parent
35d1102597
commit
c8f38d341d
49 files changed
+48
-48
No files matched your search
+1
@@ -0,0 +1 @@
|
||||
import{_ as N,l as P,r as u,s as c,t as V,v as e,x as t,K as r,L as z,A as C,y as n,B as f,C as M,$ as h,E as m,F as L,U as Y,M as i,f as F,R as j,T as B,S as I,D as T,Q as U,X as R,aP as q,z as K,b_ as J,bY as W}from"./index-edfacc9f.js";import{a as Z}from"./VVirtualScroll-302a72dc.js";import{V as $}from"./VCheckbox-5dac2d55.js";import{V as ee}from"./VForm-b2da0ad2.js";import"./VCheckboxBtn-daeeb7e0.js";import"./VSelectionControl-3f909ce8.js";import"./VInput-6f1d004c.js";const te={props:{type_fetch:{type:String,default:"best"},persons:{type:Array,default:()=>[]},myrealdep:{type:Object,default:()=>{}}},setup(d,{emit:_}){P();const p=u(!1);let l=u(),x=u(),y=u(),o=u();return d.type_fetch=="thanks"?x="api/vote/setthanks/":d.type_fetch=="best"&&(x="api/vote/setbest/"),{approveCandidate:()=>{l.value==="False"||l.value===""?y.value=!1:y.value=l.value,p.value=!0},voteSend:()=>{console.log(l.value),Y.post(x,{cand_name_id:l.value},{headers:{"Content-Type":"application/json"}}).then(g=>{p.value=!1,window.location.reload()})},vote:l,approve_name:y,aproveFalseMessage:o,dialog:p}}},le=i("p",null,"Выбранный кандидат",-1);function ae(d,_,p,l,x,y){return c(),V(ee,{onSubmit:l.voteSend},{default:e(()=>[t(r,{id:"scroll-window-chekbox",height:"300",elevation:"0"},{default:e(()=>[t(Z,{items:p.persons.filter(o=>o.id_dict_department!=1),"item-height":40},{default:e(({item:o})=>[t($,{modelValue:l.vote,"onUpdate:modelValue":_[0]||(_[0]=k=>l.vote=k),id:o.fio,value:o.fio,label:o.fio,required:""},null,8,["modelValue","id","value","label"])]),_:1},8,["items"])]),_:1}),t(L,{class:"justify-center vote-button-back"},{default:e(()=>[t(z,{"max-width":"500",modelValue:l.dialog,"onUpdate:modelValue":_[2]||(_[2]=o=>l.dialog=o)},{activator:e(()=>[t(C,{variant:"elevated",color:"teal-darken-1",onClick:l.approveCandidate},{default:e(()=>[n("Подтвердить выбор")]),_:1},8,["onClick"])]),default:e(()=>[t(r,{class:"justify-center align-center"},{default:e(()=>[t(f,null,{default:e(()=>[n("Вы подтверждаете выбор?")]),_:1}),t(M,null,{default:e(()=>[n("После подтверждения внесение измений станет невозможным.")]),_:1}),le,l.approve_name?(c(),V(f,{key:0},{default:e(()=>[n(h(l.approve_name),1)]),_:1})):(c(),V(f,{key:1},{default:e(()=>[n("Кандидат не выбран повторите голосование")]),_:1})),t(m,{class:"d-flex flex-rows justify-center align-center",cols:"12"},{default:e(()=>[t(m,{cols:"2"},{default:e(()=>[l.approve_name?(c(),V(C,{key:0,variant:"elevated",color:"green-darken-1",onClick:l.voteSend},{default:e(()=>[n("ДА")]),_:1},8,["onClick"])):(c(),V(C,{key:1,variant:"elevated",color:"green-darken-1",onClick:l.voteSend,disabled:""},{default:e(()=>[n("ДА")]),_:1},8,["onClick"]))]),_:1}),t(m,{cols:"2"},{default:e(()=>[t(C,{variant:"elevated",color:"red-darken-1",onClick:_[1]||(_[1]=o=>l.dialog=!1)},{default:e(()=>[n("НЕТ")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["onSubmit"])}const ne=N(te,[["render",ae]]);const se={components:{},props:{usersvotedbest:{type:Array,default:()=>[]},uservotedthanks:{type:Array,default:()=>[]},all_cod:{type:Array,default:()=>[]}},setup(d){P().user.login;let _=u([]),p=u([]);u([]),u([]),u();const l=F({get(){return Math.round(d.uservotedthanks.length*100/(d.all_cod.length+1))}}),x=F({get(){return Math.round(d.usersvotedbest.length*100/(d.all_cod.length+1))}}),y=F({get(){return w(d.usersvotedbest)}}),o=F({get(){let b=[];return d.uservotedthanks.forEach(s=>{let a=b.findIndex(v=>v.cand_name==s.cand_name);a==-1?b.push({...s,total:1}):b[a].total+=1}),b.sort((s,a)=>a.total-s.total)}}),k=b=>{let s={};for(let[a,v]of Object.entries(b))a in s||(s[a]=[]),v.forEach(D=>{let O=s[a].findIndex(G=>G.cand_name==D.cand_name);O>-1?s[a][O].total+=1:s[a].push(D)}),s[a]=s[a].sort((D,O)=>O.total-D.total);return s},w=b=>{let s=[];b.forEach(v=>{s.push({...v,total:1})});let a=Object.groupBy(s,({department_user:v})=>v);return k(a)};F({get(){return[]}});const g=F({get(){let b=d.usersvotedbest.reduce((a,v)=>[...a,v.voted_user],[]);console.log(d.usersvotedbest);let s=Object.groupBy(d.all_cod.filter(a=>b.includes(a.login)==!1),({department:a})=>a);return console.log(s),H(s)}}),A=F({get(){console.log(d.usersvotedbest);let b=d.uservotedthanks.reduce((a,v)=>[...a,v.voted_user],[]),s=Object.groupBy(d.all_cod.filter(a=>b.includes(a.login)==!1),({department:a})=>a);return H(s)}}),H=b=>{let s={};for(let[a,v]of Object.entries(b))a in s||(s[a]=[]),v.forEach(D=>{s[a].push(D)}),s[a]=s[a].sort((D,O)=>O.total-D.total);return s};return{max_thn:o,max_bst:y,perc_best:x,result_thn:_,result_bst:p,perc_thanks:l,notvotedthanks:A,notvotedbest:g}}};function oe(d,_,p,l,x,y){return c(),V(T,{justify:"center",align:"center",class:"pa-2"},{default:e(()=>[t(m,{justify:"center",align:"center",class:"flex-column"},{default:e(()=>[t(r,{width:"700",height:"820",class:"elevation-12"},{default:e(()=>[t(r,{class:"mb-2",color:"teLine truncated
|
||||
Reference in new issue
Block a user