import{u as D}from"./useInstance.233fbdde.js";import{_ as B}from"./ActivitySelect.vue_vue_type_script_setup_true_lang.5af17dcb.js";import{az as i,d as h,r as v,b as k,p as g,c as m,e as x,k as G,i as l,h as a,u as d,a2 as $,m as C,E}from"./index.0308b213.js";const T=e=>i.post("addon/vote.web.vote_group/list",e),N=e=>i.get(`addon/vote.web.vote_group/detail?id=${e}`),U=e=>i.post("addon/vote.web.vote_group/edit",e),L=e=>i.post("addon/vote.web.vote_group/add",e),j=e=>i.post(`addon/vote.web.vote_group/delete?id=${e}`),q=C("\u63D0\u4EA4"),z=C("\u53D6\u6D88"),H=h({props:{modelValue:{type:Boolean,default:!1},id:{default:0}},emits:["update:modelValue","onClose"],setup(e,{emit:c}){const _=e,{global:V}=D(),p=v(!1),b=v();let t=k({id:0,name:"",vote_activity_id:""});const y=u=>{N(u).then(o=>{t.id=o.data.id,t.name=o.data.name,t.vote_activity_id=o.data.vote_activity_id})};g(()=>_.modelValue,u=>{p.value=u});const F=()=>{t.id>0?U(t).then(()=>{E({message:"\u4FEE\u6539\u5206\u7EC4\u6570\u636E\u6210\u529F",type:"success"}),n()}):L(t).then(()=>{E({message:"\u65B0\u589E\u5206\u7EC4\u6570\u636E\u6210\u529F",type:"success"}),n()})};g(()=>_.id,u=>{Number(u)>0&&y(u)},{immediate:!0});const n=()=>{c("update:modelValue",!1),c("onClose"),V.$resetForm(b.value,t)};return(u,o)=>{const r=m("el-form-item"),w=m("el-input"),f=m("el-button"),A=m("el-dialog");return x(),G(A,{modelValue:p.value,"onUpdate:modelValue":o[2]||(o[2]=s=>p.value=s),title:e.id?"\u7F16\u8F91\u5206\u7EC4":"\u65B0\u589E\u5206\u7EC4",width:"50%",onClose:n},{default:l(()=>[a(d($),{model:d(t),"label-width":"120px"},{default:l(()=>[a(r,{label:"\u6295\u7968\u6D3B\u52A8"},{default:l(()=>[a(B,{modelValue:d(t).vote_activity_id,"onUpdate:modelValue":o[0]||(o[0]=s=>d(t).vote_activity_id=s)},null,8,["modelValue"])]),_:1}),a(r,{label:"\u5206\u7EC4\u540D\u79F0",prop:"name"},{default:l(()=>[a(w,{modelValue:d(t).name,"onUpdate:modelValue":o[1]||(o[1]=s=>d(t).name=s),placeholder:"\u8BF7\u8F93\u5165\u5206\u7EC4\u540D\u79F0"},null,8,["modelValue"])]),_:1}),a(r,null,{default:l(()=>[a(f,{type:"primary",onClick:F},{default:l(()=>[q]),_:1}),a(f,{onClick:n},{default:l(()=>[z]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{H as _,j as d,T as g};
