import{ak as k,al as O,a as S,r as d,W as U,b as r,a7 as G,Z as V,c as f,j as B,h as a,f as o,u as E,m as M,e as P,i as Y,x as h,p as z,F as H,$ as W,l as X,am as Z}from"./index.4d061c66.js";import{r as J}from"./responseHandle.fe68d5aa.js";import{u as K}from"./useNav.5e73c372.js";import"./remote-select.36ee67a3.js";import{_ as Q}from"./Video.vue_vue_type_script_setup_true_lang.07ce870d.js";import{_ as ee}from"./ComCard.vue_vue_type_script_setup_true_lang.ad550102.js";const{VITE_PROXY_DOMAIN_REAL:x}=O();async function ae(p={}){return k.request("post",`${x}admin/videoGroupAdd`,{data:p})}async function ne(p={}){return k.request("post",`${x}admin/videoGroupList`,{data:p})}const re=S({__name:"edit-dialog",emits:["reload"],setup(p,{expose:D,emit:A}){const{logout:$}=K(),c=d(!1),g=d(""),C=d("create"),b=d(null),i=d(!1),v=d(""),N=d(""),y={group_id:"",video_ids:[]},u=d({...y}),q=U({group_id:[{required:!0,trigger:"change",message:"\u8BF7\u9009\u62E9\u516C\u53F8\u5361\u7C7B\u578B"}],video_ids:[{required:!0,type:"array",trigger:"change",message:"\u8BF7\u9009\u62E9\u76F4\u64AD\u89C6\u9891"}]});async function L(n,e,t){switch(N.value=e,g.value="",Object.keys(u.value).forEach(l=>{u.value[l]=y[l]}),C.value=t,C.value){case"create":v.value="\u65B0\u5EFA\u6279\u91CF\u8BBE\u7F6E\u89C6\u9891";break;case"edit":v.value="\u7F16\u8F91\u6279\u91CF\u8BBE\u7F6E\u89C6\u9891";break;case"view":v.value="\u6279\u91CF\u8BBE\u7F6E\u89C6\u9891\u8BE6\u60C5";break;default:v.value="\u65B0\u5EFA\u6279\u91CF\u8BBE\u7F6E\u89C6\u9891"}c.value=!0}function R(n){if(n){const{id:e,video_name:t}=n;u.value.video_ids.findIndex(_=>_.id+""==e+"")==-1&&u.value.video_ids.push({id:e,video_name:t})}}function T(){b.value.validate(async n=>{if(n){if(i.value)return;i.value=!0;const{group_id:e,video_ids:t}=u.value,l={group_id:e,video_ids:[]};t.forEach(F=>{l.video_ids.push(F.id)});const{message:_,code:m}=await ae(l);i.value=!1,J({code:m,message:_,logout:$,handler:()=>{c.value=!1,A("reload")}})}})}return D({show:L}),(n,e)=>{const t=r("el-form-item"),l=r("el-col"),_=r("el-tag"),m=r("el-button"),F=r("el-row"),j=r("el-dialog"),I=G("loading");return V((f(),B(j,{modelValue:c.value,"onUpdate:modelValue":e[3]||(e[3]=s=>c.value=s),"close-on-press-escape":!1,center:"","append-to-body":"","destroy-on-close":"",width:"650px",title:v.value},{default:a(()=>[o(E(Z),{ref_key:"formRef",ref:b,model:u.value,rules:q,"label-width":"100px",style:{"margin-top":"-10px"},class:"demo-ruleForm","status-icon":""},{default:a(()=>[o(F,null,{default:a(()=>[o(l,{span:24},{default:a(()=>[o(t,{label:"\u516C\u53F8\u5361\u7C7B\u578B",prop:"group_id"},{default:a(()=>[o(E(ee),{modelValue:u.value.group_id,"onUpdate:modelValue":e[0]||(e[0]=s=>u.value.group_id=s),showDisabled:!0,placeholder:"\u516C\u53F8\u5361\u7C7B\u578B"},null,8,["modelValue"])]),_:1})]),_:1}),o(l,{span:24},{default:a(()=>[o(t,{label:"\u89C6\u9891",prop:"video_ids"},{default:a(()=>[V(M("div",null,[(f(!0),P(H,null,Y(u.value.video_ids,(s,w)=>(f(),B(_,{key:s.id+w,class:"mx-1","disable-transitions":"",closable:"",size:"large",onClose:ue=>u.value.video_ids.splice(w,1)},{default:a(()=>[h(z(s.video_name),1)]),_:2},1032,["onClose"]))),128))],512),[[W,u.value.video_ids&&u.value.video_ids.length>0]])]),_:1})]),_:1}),o(l,{span:16},{default:a(()=>[o(t,{label:"",prop:"card_id"},{default:a(()=>[o(E(Q),{modelValue:g.value,"onUpdate:modelValue":e[1]||(e[1]=s=>g.value=s),placeholder:"\u8BF7\u9009\u62E9\u76F4\u64AD\u89C6\u9891",showDisabled:!0,onChange:R},null,8,["modelValue"])]),_:1})]),_:1}),o(l,{span:8,class:"flex justify-end"},{default:a(()=>[C.value!=="view"?(f(),B(m,{key:0,loading:i.value,disabled:i.value,type:"primary",onClick:T},{default:a(()=>[h("\u4FDD\u5B58")]),_:1},8,["loading","disabled"])):X("",!0),o(m,{onClick:e[2]||(e[2]=s=>c.value=!1)},{default:a(()=>[h("\u53D6\u6D88")]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])),[[I,i.value]])}}});export{re as _,ne as h};
