PageSourceSearch

https://mbuk-kdk.ru/kubcms-front/v5/master/s/c-AddToCollectionDialog-BPPSBvfu.js

js mbuk-kdk.ru collected 2026-10-03 18:57:38 UTC 3,089 bytes, 1 lines download raw bytes

1import{F as T,m as _,n as k}from"./c-el-form-item-DpapBxAI.js";import{aR as $,ci as w,cL as F,cM as A,cl as B,cm as I,bm as N,a_ as c,bc as U,cn as y,cH as D,cd as L,ce as M,aV as b,b2 as E,b3 as a,bg as s,aW as R,bt as S,c1 as z,b1 as H,bR as C}from"./c-index-D0PNHfG-.js";const O=$({name:"AddToCollectionDialog",components:{ElDialog:I,ElForm:k,ElFormItem:_,ElInput:B,ElSelect:A,ElOption:F,ElButton:w,FormErrors:T},props:{modelValue:{type:Boolean,default:!1},sectionId:{type:Number,default:null}},emits:["update:modelValue","added"],setup(e,{emit:l}){const i=c(!1),d=c(null),p=c([]),n=c({title:"",tags:[]}),u=U({get:()=>e.modelValue,set:t=>l("update:modelValue",t)}),m=async()=>{try{const{data:t}=await y.get("admin/section-collection"),f=Array.isArray(t)?t:(t==null?void 0:t.data)??[],r=new Set;f.forEach(g=>(g.tags||[]).forEach(o=>r.add(o))),p.value=Array.from(r).sort()}catch{}};return N(()=>e.modelValue,t=>{t&&m()}),{visible:u,loading:i,errors:d,form:n,suggestedTags:p,reset:()=>{n.value={title:"",tags:[]},d.value=null},submit:async()=>{if(e.sectionId){i.value=!0,d.value=null;try{await y.post("admin/section-collection",{section_id:e.sectionId,title:n.value.title||void 0,tags:n.value.tags.length?n.value.tags:void 0}),D.success("Секция добавлена в коллекцию"),l("added",e.sectionId),u.value=!1}catch(t){d.value=t}finally{i.value=!1}}}}}});function W(e,l,i,d,p,n){const u=B,m=_,v=F,V=A,t=k,f=M("FormErrors"),r=w,g=I;return b(),E(g,{modelValue:e.visible,"onUpdate:modelValue":l[4]||(l[4]=o=>e.visible=o),title:"Добавить в коллекцию",width:"440px","close-on-click-modal":!1,onClose:e.reset},{footer:a(()=>[s(r,{onClick:l[3]||(l[3]=o=>e.visible=!1),disabled:e.loading},{default:a(()=>[...l[6]||(l[6]=[C("Отмена",-1)])]),_:1},8,["disabled"]),s(r,{type:"primary",loading:e.loading,onClick:e.submit},{default:a(()=>[...l[7]||(l[7]=[C(" Добавить в коллекцию ",-1)])]),_:1},8,["loading","onClick"])]),default:a(()=>[s(t,{"label-position":"top",disabled:e.loading},{default:a(()=>[s(m,{label:"Название секции"},{default:a(()=>[s(u,{modelValue:e.form.title,"onUpdate:modelValue":l[0]||(l[0]=o=>e.form.title=o),placeholder:"Введите название...",clearable:""},null,8,["modelValue"])]),_:1}),s(m,{label:"Теги"},{default:a(()=>[s(V,{modelValue:e.form.tags,"onUpdate:modelValue":l[1]||(l[1]=o=>e.form.tags=o),multiple:"",filterable:"","allow-create":"","default-first-option":"",placeholder:"Добавьте теги...",style:{width:"100%"}},{default:a(()=>[(b(!0),R(S,null,z(e.suggestedTags,o=>(b(),E(v,{key:o,label:o,value:o},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),l[5]||(l[5]=H("div",{style:{"font-size":"11px",color:"var(--el-text-color-secondary)","margin-top":"4px"}}," Введите тег и нажмите Enter чтобы создать новый ",-1))]),_:1})]),_:1},8,["disabled"]),s(f,{modelValue:e.errors,"onUpdate:modelValue":l[2]||(l[2]=o=>e.errors=o)},null,8,["modelValue"])]),_:1},8,["modelValue","onClose"])}const G=L(O,[["render",W]]);export{G as A};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.